alheka asked . 2022-01-10

Mapping RGB and depth (Kinect v2)

Hi everyone, for my project, I'm working with the Kinect v2 and I have to map the depth information onto the RGB images to process them: in particular, I need to know which pixels in the RGB images are in a certain range of distance (depth) along the Z axis; I'm acquiring all the data with a C# program and saving them as images.
 
 
I had a look on the internet and I found some equations to map depth and RGB info here. I am actually able to get the intrinsic parameters for the single camera calibration using a checkerboard recorded from both the RGB camera (1920x1080) and the IR sensor (512x424) and processing them with MatLab Camera Calibrator app, but I'm stuck doing the stereo calibration (to find the rotation and translation matrices), because MatLab Stereo Camera Calibrator doesn't accept pair of images with different resolution.
 
 
I've also tried some other method with no results; It would be great if anyone could help me figuring out what I have to do in order to solve my problem. Thanks very much!

kinect v2 , stereo calibration , mapping rgb/depth

Expert Answer

Kshitij Singh answered . 2024-12-21 01:48:25

Hi alheka,
I used to have the same problem. It's a pity that Matlab still hasn't solved this issue. But there's a solution to that. It took me quite a while to figure it out. Here you have the steps you need:
 
1. Stereo Calibration:
 
a) Find checkerboard points:
    [pointsRGB, boardSizeRGB, imagesRGBused] =detectCheckerboardPoints(imagesRGB);
    [pointsIR, boardSizeIR, imagesIRused] = detectCheckerboardPoints(imagesIR);
b) Remove the pairs where in one of the sets the points were not detected. Matlab does that automatically for the stereo calibration. But you need to write your code. I did make such code, but it's too unreadable to share here !
 
 
c) Now you need to manually combine the two sets.
    imagePoints = cat(4, poitnsRGB, pointsIR);

d) Now the word points: where squaresize is the width of each of the squares in your calibration target (unit is mm).

    worldPoints = generateCheckerboardPoints(boardSizeRGB, squaresize);

e) Calibration:

    [stereoParams,pairsUsed,estimationErrors] = estimateCameraParameters(imagePoints,...
    worldPoints,'EstimateSkew', false, 'EstimateTangentialDistortion', false, ...
    'NumRadialDistortionCoefficients', 2, 'WorldUnits', 'mm');
figure; showReprojectionErrors(stereoParams);
figure; showExtrinsics(stereoParams);
f) If needed, remove pairs of images with high error and re-calibrate until you're satisfied with the error.
 
2) Map the images: Actually the link you have is correct for this part. Just follow those instructions.
 
3) Remember that some artifacts (repeated pixels) can be caused in the mapped image due to parallax and the fact that some pixels are visible in one camera and not in the other. There are ways to fix that.


Not satisfied with the answer ?? ASK NOW

Frequently Asked Questions

MATLAB offers tools for real-time AI applications, including Simulink for modeling and simulation. It can be used for developing algorithms and control systems for autonomous vehicles, robots, and other real-time AI systems.

MATLAB Online™ provides access to MATLAB® from your web browser. With MATLAB Online, your files are stored on MATLAB Drive™ and are available wherever you go. MATLAB Drive Connector synchronizes your files between your computers and MATLAB Online, providing offline access and eliminating the need to manually upload or download files. You can also run your files from the convenience of your smartphone or tablet by connecting to MathWorks® Cloud through the MATLAB Mobile™ app.

Yes, MATLAB provides tools and frameworks for deep learning, including the Deep Learning Toolbox. You can use MATLAB for tasks like building and training neural networks, image classification, and natural language processing.

MATLAB and Python are both popular choices for AI development. MATLAB is known for its ease of use in mathematical computations and its extensive toolbox for AI and machine learning. Python, on the other hand, has a vast ecosystem of libraries like TensorFlow and PyTorch. The choice depends on your preferences and project requirements.

You can find support, discussion forums, and a community of MATLAB users on the MATLAB website, Matlansolutions forums, and other AI-related online communities. Remember that MATLAB's capabilities in AI and machine learning continue to evolve, so staying updated with the latest features and resources is essential for effective AI development using MATLAB.

Without any hesitation the answer to this question is NO. The service we offer is 100% legal, legitimate and won't make you a cheater. Read and discover exactly what an essay writing service is and how when used correctly, is a valuable teaching aid and no more akin to cheating than a tutor's 'model essay' or the many published essay guides available from your local book shop. You should use the work as a reference and should not hand over the exact copy of it.

Matlabsolutions.com provides guaranteed satisfaction with a commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been empanelled after extensive research and quality check.

Matlabsolutions.com provides undivided attention to each Matlab assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work done at the best price in industry.