Я работаю на стерео задачи видения и пытаюсь запустить этот алгоритм:стереозрение на Matlab (ошибка ректификации)
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
Запуска это приводит к выходу:
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);
В этом случае были обнаружены все углы всех изображений, что означает, что калибровка, по-видимому, работает нормально и составляет 11 сантиметров d между двумя камерами.
Спасибо за помощь Дима! Теперь я использую 22 калибровочных изображения и возникла новая ошибка. Я размещаю его в своем вопросе выше, после слова «EDIT», потому что его размер очень большой ... –
Извините за задержку –
Что происходит, когда вы делаете '[J1, J2] = rectifyStereoImages (I1, I2, stereoParams, ' OutputView ',' full '); '? Кроме того, если вы делаете 'showReprojectionErrors (stereoParams)', что вы видите? Вы хотите, чтобы средняя ошибка перепечатки была меньше пикселя. – Dima