logoalt Hacker News

throwaway219450 • today at 4:31 AM • 2 replies • view on HN

SAD runs in better than real time on a typical desktop CPU, even on a Pi. The author glossed over basically all of the calibration involved with stereo. It’s not quite as simple as taking two cameras and running a matcher.

Because stereo disparity (parallax) scales inversely with distance, conveniently you don’t need to search huge ranges. A point at infinity should have zero disparity in a calibrated stereo system. So normally you pick a depth range and search the corresponding pixels. Also if the cameras are calibrated, you only need to search horizontally so it works out to say 64 operations per pixel, which can be vectorized if the CPU supports it. Other approaches use more stable comparisons like census (is each pixel in the match window brighter than the central one) and hamming distance which is also very efficient.

And yes, stereo is sensitive to repeating texture but absence of texture like a blank wall is usually worse.


Replies

hex4def6 • today at 5:29 AM

I'm not convinced he's done the calibration, at least in his demo video. It's pretty bad, imo.

I think he's just running it on the raw unrectified images.

For anyone wanting to play with this, OpenCV has a number of tutorials on this using stuff like stereoBM (which also uses SAD if I'm remembering my algos).

The first step is calibration -- intrinsics (basically figuring out the equations that can cancel out the lens distortion) and extrinsics (how far apart are the two cameras in XYZ, tilt, etc).

➕ show 1 reply
a_t48 • today at 5:00 AM

Can also help if you can remove IR filter + add an IR noise projector