Je travaille sur la tâche de vision stéréo et d'essayer d'exécuter cet algorithme:Vision Stereo sur Matlab (erreur de Redressement)
numImagePairs = 11;
imageFiles1 = cell(1,numImagePairs);
imageFiles2 = cell(1,numImagePairs);
imagemDir = fullfile('C:','Users','carlo','Documents','Iniciacao','Matlab','Principal');
for i = 1:numImagePairs
imageFiles1{i} = fullfile(imagemDir, sprintf('left%02d.jpg',i));
imageFiles2{i} = fullfile(imagemDir, sprintf('right%02d.jpg',i));
end
%Detect the checkerboard
[imagePoints,boardSize,pairsUsed] = detectCheckerboardPoints(imageFiles1,imageFiles2);
%Generate world coordinates of the checkerboard points
squareSize=29; %millimeters
worldPoints= generateCheckerboardPoints(boardSize, squareSize);
%Compute the stereo camera parameters
stereoParams= estimateCameraParameters(imagePoints,worldPoints);
%Evaluate calibration accuracy
figure;
showReprojectionErrors(stereoParams);
%Read in the stereo pair of images
I1 = imread('left.jpg');
I2 = imread('right.jpg');
%Rectify the images
[J1,J2]=rectifyStereoImages(I1,I2,stereoParams);
%Display the images before rectification
figure;
imshow(stereoAnaglyph(I1,I2));
title('Before rectification');
%Display the images after rectification
figure;
imshow(stereoAnaglyph(J1,J2));
title('After rectification');
%Generate the disparity map
disparityMap = disparity(J1,J2);
figure;
imshow(disparityMap, [0,64]);
colormap('jet');
colorbar;
title('Disparity Map');
EDIT
L'exécution de ce conduit à la sortie:
Operands to the || and && operators must be convertible to logical scalar values.
Error in vision.internal.calibration.CameraParametersImpl/getValidBounds (line 883)
if isempty(coder.target) && (left > right || top > bot)
Error in vision.internal.calibration.CameraParametersImpl/computeUndistortBounds (line 785)
[xBounds, yBounds] = getValidBounds(this, undistortedMask, ...
Error in vision.internal.calibration.StereoParametersImpl/computeOutputBounds (line 371)
[xBoundsUndistort1, yBoundsUndistort1] = ...
Error in vision.internal.calibration.StereoParametersImpl/computeRectificationParameters (line 271)
[xBounds, yBounds] = computeOutputBounds(this, imageSize, ...
Error in vision.internal.calibration.StereoParametersImpl/rectifyStereoImagesImpl (line 190)
[H1, H2, Q, xBounds, yBounds] = ...
Error in rectifyStereoImages (line 99)
[rectifiedImage1, rectifiedImage2] = rectifyStereoImagesImpl(stereoParams, ...
Error in new_project (line 55)
[J1, J2] = rectifyStereoImages(I1, I2, stereoParams);
Dans ce cas, tous les coins de toutes les images ont été détectés, ce qui signifie que le calibrage semble fonctionner correctement et 11 centimètres de d istance entre les deux caméras.
Merci pour votre aide Dima! Maintenant, j'utilise 22 images d'étalonnage et une nouvelle erreur a été générée. Je l'affiche dans ma question ci-dessus après le mot 'EDIT' parce que sa taille est très grande ... –
Désolé pour le retard –
Que se passe-t-il quand vous faites '[J1, J2] = rectifyStereoImages (I1, I2, stereoParams, ' OutputView ',' full '); '? De plus, si vous faites 'showReprojectionErrors (stereoParams)', que voyez-vous? Vous voulez que l'erreur moyenne de reprojection soit inférieure à un pixel. – Dima