フィルターのクリア

DetectCheckerboardPoints problem - finds wrong corner positions

3 ビュー (過去 30 日間)
Brian
Brian 2016 年 6 月 28 日
コメント済み: Image Analyst 2016 年 7 月 12 日
Hi
I am trying to calibrate a camera. I have used the approach described in this example: openExample('vision/CorrectAnImageForLensDistortionExample')
In order to evaluate how good it is for finding the points I have drawn some images where I have defined the different kinds of distortion (e.g. radial, rotation and tangental) myself such that I can test how good it is. My problem is that it does not recognize the corner points in the checkerboard pattern when I do simple examples such as the following.
%%Reference geometry (chess pattern)
I = (checkerboard(100,4,3)<0.5);
I = I(1:700,:);
image = ones(2000)*0.3;
image(300:999,300:899) = I;
figure;
imshow(image)
set(gca,'color','blue')
axis off
axis image
F = getframe(gcf);
[specimen,~] = frame2im(F);
saveas(gcf,'dataImage.png')
%%Detect the calibration pattern.
[imagePoints, boardSize] = detectCheckerboardPoints('dataImage.png');
figure,imshow(image); hold on; plot(imagePoints(:,1), imagePoints(:,2), 'ro');
Does anyone know what cause the problem?
Best regards Brian

採用された回答

Vidya Viswanathan
Vidya Viswanathan 2016 年 7 月 12 日
Hi Brian,
I went over the code that you posted in your question. I notice that you are first saving the current figure as an image ("dataImage.png"). This captures the gray background of the figure window also as a part of the image. This is different from the variable "image". You can see the difference between the two from the figures shown below. The one on the left is the variable "image" and the one on the right is "imshow(imread("dataImage.png")). You can see that there is an additional white portion in the image on the right. Additionally, the sizes of both "image" and imread("dataImage.png") are different.
In the code that you shared, you are basically finding the corners of imread("dataImage.png") but plotting it on the image represented by the variable "image". To get the right output, modify the code to one of the following:
[imagePoints, boardSize] = detectCheckerboardPoints('dataImage.png');
I1=imread('dataImage.png');
figure,imshow(I1); hold on; plot(imagePoints(:,1), imagePoints(:,2), 'ro');
OR
[imagePoints, boardSize] = detectCheckerboardPoints(image);
figure,imshow(image); hold on; plot(imagePoints(:,1), imagePoints(:,2), 'ro');
I hope this helps.
Regards,
Vidya Viswanathan
  1 件のコメント
Image Analyst
Image Analyst 2016 年 7 月 12 日
And of course even using the word "image" as the name of your variable is a bad idea because image is already a built-in function. Call it something else, like myImage, to avoid confusion.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Support Package for USB Webcams についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by