Stereo Rectification Issue

1.Which seller did you purchase the product(s) from?
2.The Model number of the product(s) you have purchased?
SKU B016601
3.Which Platform are you using the product(s) on?
Raspberry Pi 3B+
4.Which instruction are you following?
5.Has your product ever worked properly?
6.What problems are you experiencing?
Hello Arducam team, I am having trouble calibrating with my stereo camera adapter, with my code being adapted from the code provided here:


The cameras and the adapter work well, but I am unable to obtain good rectification results, which result in excessive rotation/skewing of the re-mapped images.

“StereoCameraCalibration” is used to calibrate the cameras (executed using these parameters: “./StereoCameraCalibration 20 640 480”), which generates a “camera.bin” file that should be transferred to the build directory of “StereoCameraCalibrationTest”, which then opens the file to extract the relevant undistortion and rectification matrices for remapping.


The zipped project is linked below:


Ideally, I would like to see a working example demonstrating how to perform stereo matching using the uc444 module, but none are provided. I created my code by cross-referencing other codes provided by Arducam for stereo matching purposes, specifically from here:


Please advise.
7.What attempts at troubleshooting have you already made?

8.How would you like us to help you?

Additionally, here is the “main.cpp” of “StereoCameraCalibration” by itself hosted on Gist, so the calibration process can be visualized more easily. I have written it as verbosely as possible to make it easier to understand.

It is worth noting that “stereoCalibrate” yields an error of 14.3365, which is very high.

Perhaps I have identified the reason, when I capture the stereo images I get artifacts in my image. Please advise how to mend such errors. Board connections are good, the demo video stream works fine, but when I begin calibrating this happens:

Further experimentation has determined that the individual cameras (OV5642) are not the issue (I have multiple and have changed them); it seems to be a race condition of the uc444 multi camera adapter board itself. As you can see in the image in my previous post part of the right camera image has embedded itself within the left camera image.

I realize I failed to share the Gist of “StereoCamera.cpp”, so here it is as well:

The issue has been wholly identified. Upon calling “findChessboardCorners” things break. I have tried cloning the data (deep copy) to separate matrices but the issue is still present.


The main.cpp demonstrating this is shown below:


Without “findChessboardCorners”:


With “findChessboardCorners”:

It appears that introducing any substantial amount of computation induces errors in imaging, for example adding a simple for loop that spins for a significant amount of cycles:

for (int i = 0; i < 1000000; ++i);
At this point artifacts begin to accumulate in the image for unknown reasons; they occupy separate memory addresses yet interfere with one-another.

How can I reliably extract data from the uc444 to be used without this happening?