Azzera filtri
Azzera filtri

The function rectifyStereoImages can't return reprojectionMatrix.with an error "Error using rectifyStereoImages Too many output arguments."

3 visualizzazioni (ultimi 30 giorni)
Input data:
to_reg e rif contain 2 images converted in grey level, I tried to attach but mages are bigger than 5 Mb
ptsreg = detectSURFFeatures(to_reg);
ptsrif = detectSURFFeatures(rif);
[featreg,validPtsreg] = extractFeatures(to_reg,ptsreg);
[featrif,validPtsrif] = extractFeatures(rif,ptsrif);
index_pairs = matchFeatures(featrif,featreg,'MatchThreshold',sogliaMatch);
matchedPtsrif = validPtsrif(index_pairs(:,1));
matchedPtsreg = validPtsreg(index_pairs(:,2));
[fund,inlierF] = estimateFundamentalMatrix(matchedPtsrif, matchedPtsreg,Method=tipostimaF);
figure;
showMatchedFeatures(rif,to_reg,matchedPtsrif(inlierF,:),matchedPtsreg(inlierF,:),"montage",PlotOptions=["ro","go","y--"]);
title("Point Matches After Outliers Are Removed");
This is the figure
[t1, t2] = estimateUncalibratedRectification(fund,matchedPtsrif(inlierF,:),matchedPtsreg(inlierF,:),size(to_reg));
Now, the problem is in next command line. If I run this
[rifRect,to_regRect] = rectifyStereoImages(rif,to_reg,t1,t2, OutputView='full');
figure;
imshow(stereoAnaglyph(rifRect,to_regRect));
the program correctly run.
If I run this
[rifRect,to_regRect,reprojectionMatrix] = rectifyStereoImages(rif,to_reg,t1,t2, OutputView='full');
the program gives me the error:
Error using rectifyStereoImages
Too many output arguments.
Error in ObjectExtraction_v0 (line 75)
[rifRect,to_regRect,reprojectionMatrix] = rectifyStereoImages(rif,to_reg,t1,t2, OutputView='full');
I need the reprojectionMatrix because I want to generate apply the function reconstructScene

Risposte (1)

Varun
Varun il 21 Feb 2023
Modificato: Varun il 21 Feb 2023
Hello!
I believe the error is due to improper syntax while calling the rectifyStereoImages function. When using the syntax for getting a reprojectionMatrix, the function call must be in the format:
[rifRect,to_regRect,reprojectionMatrix] = rectifyStereoImages(rif,to_reg,stereoParams);
To know more, please refer to https://www.mathworks.com/help/vision/ref/rectifystereoimages.html#d124e243545 for documentation on rectifyStereoImages and https://www.mathworks.com/help/releases/R2022b/vision/ref/reconstructscene.html#d124e242860 for documentation and examples on reconstructScene.
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by