How to use calibration parameters from KITTI? - matlab

I'm working on stereo vision and I am using data from The KITTI Vision Benchmark Suite, The calibration parameters they use are very different from the parameters that the stereo camera calibrator toolbox produce and I couldn't find a way to use their data in MATLAB.
I also tried to use their calibration images in stereo camera calibrator toolbox which looks like this:
Calibration Toolbox MATLAB
But when I run the calibration it fails saying
Calibration fails:
unable to estimate camera parameters. images may contain severe less
distortion or the 3-D orientations of the calibration pattern are too
similar across images, if calibration pattern orientations are too
similar, try removing very similar images or adding additional images
with pattern in invalid orientations
Please help me if you have any idea on how to solve this

Related

Problems with single camera calibration using MATLAB Camera Calibrator

I'm doing a project that requires acquiring real world coordination from a camera. The first thing that I need to do is calibrate my camera. I use Camera Calibrator from MATLAB Toolbox, and about 40 samples for calibrating. All the samples was taken by Logitech C922. But after calibrate, the result seems so wrong, as you can see in the image below.
It is more distortion than the original image. I have also tried to calibrate using OpenCV but the result is the same. Anyone know what wrong and why does this happen ?
I am sorry if those questions are really beginner level, camera calibration is very new to me and I was not able to find my answers.
Thank you in advance!
Firstly, you really need to figure out what does 'calibration' means.
it's clear that the picture is showing the undistorted picture,since the lines on the chessboard and those on the background are quite straight. Without undistortion the chessboard in the center would look like squeezed in radial directions. Check the button 'show original' on the bottom-left corner of your picture, click it, and find the difference between these two pics.
What this calibrator does is that it calculates the intrinsic/extrinsic parameters, distortion coefficients and, if you wish, undistort the pictures you gave to her. She already did the job.

Wrong rectification in MATLAB

The rectification function in Matlab seems to be responding wrong. Can anyone let me know if I am getting the right output?
Left Image
Right Image
Anaglyph of unrectified images
Anaglyph of rectified images
Here is my code:
leftImageSnapshot = getsnapshot(handles.vidL);
imshow(leftImageSnapshot);
rightImageSnapshot = getsnapshot(handles.vidR);
imshow(rightImageSnapshot);
[I1Rect,I2Rect]=rectifyStereoImages(I1,I2,stereoParams,'OutputView','valid');
imshowpair(I1Rect,I2Rect,'falsecolor','ColorChannels','red-cyan');
I was following this link for image rectification. After rectification, the images are supposed to look like the cameras are parallel. But in my case, the vertical disparity still exists in the image.
I am trying to obtain a disparity map for which the vertical disparity should be removed.
My best guess would be that your cameras were moved after you did the calibration. Once you calibrate, the position and orientation of the cameras relative to each other cannot change. If it does, your stereoParams are no longer valid.
To see what went wrong, do the calibration again using the Stereo Camera Calibrator app, and then click "Show Rectified" button at the lower left corner of the main image pane. I will show you a rectified pair of calibration images. If those look ok, then your cameras have moved and you have to take the calibration images again and recalibrate. If the rectified calibration images look bad, then something is wrong with your calibration.
By the way, there is a stereoAnaglyph function, which you can use to create a red-cyan anaglyph.

What image file type is expected by Matlab Stereo Camera Calibrator app?

The Matlab Calibration Workflow documention just says "capture images."
But it doesn't say how, or what file format is required.
My Matlab script has the line:
load('handshakeStereoParams.mat');
...and this .mat file I believe is generated by Matlab's Stereo Camera Calibrator app.
The Mathworks documentation on the Stereo Camera Calibration app does give specific advice on image formats:
Use uncompressed images or lossless compression formats such as PNG.
There's also a great deal more information on the details of what sort of images you need, under the "Image, Camera, and Pattern Preparation" subheading, in the expandable sections.
"Capture images" means take images of the checkerboard pattern with the cameras that you are trying to calibrate. Generally, you can load images of any format that imread can read into the Stereo Camera Calibrator app. However, it is much better not to use a format with lossy compression, like JPEG, because the calibration artifacts affect the calibration accuracy. So if you can configure your camera to save the images as PNG or BMP, you should do that. And if your camera only lets you use JPEG, then turn the image quality up to 100%.

Opencv open 3d stereo video file and output to display

is there anyone working on extracting the data from a 3d stereo video by using opencv? (e.g. 3d blu-ray). From some documentation, it stated .avi is the only supporting video file format on opencv. If there you are or you know, would you mind to give me a tutorial how to do that. (e.g.A frame of a 3d stereo video should be an image of 2 views plus one depth map? or A frame of a 3d stereo video is 2 images of 2 views and some depth maps?) How to read the information?
An other question is, is there any API in opencv can control the output from the graphic cards ports? I mean if I have a graphic card with two DVI ports, would it be possible for the monitor connected to A-DVI display the left-sided image of the 3d-stereo video while B-DVI display the right-sided image.

MATLAB video capture & image processing without the Image Acquisition Toolbox

I would like to capture a live video in MATLAB and take picture frames from it, upon which image processing will be done to identify certain colours in the environment
I do not have the Image Acquisition Toolbox, I only have Image Processing Toolbox. The methods I know use the Image Acquisition toolbox functions.
Try these fex options:
Simple Video Camera Frame Grabber Toolkit
VCAPG2
Video Adaptor device (webcam) setup for MATLAB