Hi,can you give how i can correct my error
this is my code:
boxPoints = imread('C:\images\ima1.bmp');
figure;
imshow(boxPoints);
title('Image of a Box');
sceneImage = imread('C:\images\im1.jpg');
figure;
imshow(sceneImage);
title('Image of a Cluttered Scene');
boxPoints =detectSURFFeatures(boxPoints);
scenePoints = detectSURFFeatures(sceneImage);
figure;
imshow(boxImage);
title('100 Strongest Feature Points from Box Image');
hold on;
plot(selectStrongest(boxPoints, 100));
figure;
imshow(sceneImage);
title('300 Strongest Feature Points from Scene Image');
hold on;
plot(selectStrongest(scenePoints, 300));
[boxFeatures, boxPoints] = extractFeatures(boxImage, boxPoints);
[sceneFeatures, scenePoints] = extractFeatures(sceneImage, scenePoints);
boxPairs = matchFeatures(boxFeatures, sceneFeatures);
matchedBoxPoints = boxPoints(boxPairs(:, 1), :);
matchedScenePoints = scenePoints(boxPairs(:, 2), :);
figure;
showMatchedFeatures(boxImage, sceneImage, matchedBoxPoints, ...
matchedScenePoints, 'montage');
title('Putatively Matched Points (Including Outliers)');
[tform, inlierBoxPoints, inlierScenePoints] = ...
estimateGeometricTransform(matchedBoxPoints, matchedScenePoints, 'affine');
figure;
showMatchedFeatures(boxImage, sceneImage, inlierBoxPoints, ...
inlierScenePoints, 'montage');
title('Matched Points (Inliers Only)');
boxPolygon = [1, 1;... % top-left
size(boxImage, 2), 1;... % top-right
size(boxImage, 2), size(boxImage, 1);... % bottom-right
1, size(boxImage, 1);... % bottom-left
1, 1]; % top-left again to close the polygon
newBoxPolygon = transformPointsForward(tform, boxPolygon);
figure;
imshow(sceneImage);
hold on;
line(newBoxPolygon(:, 1), newBoxPolygon(:, 2), 'Color', 'y');
title('Detected Box');
And this is the error:
Error in detectSURFFeatures (line 81)
checkImage(I);
Error in Untitled2 (line 1)
boxPoints = detectSURFFeatures(boxImage);

댓글 수: 3

Ced
Ced 2016년 3월 15일
편집: Ced 2016년 3월 15일
Hi
First things first:
There is a little "{} Code" symbol when you write posts to make code readable. Oh, and it's usually good practice to start a new line for each command. From your error, I gather that you have most of them on a single line. That defeats the point of line information when debugging.
But as the error says, there is a problem in function "detectSURFFeatures", which you call with "boxPoints". In this function, you call another function called "checkImage" in line 81. That's all we can say for now.
ahmed abdelbakey
ahmed abdelbakey 2017년 12월 1일
편집: Walter Roberson 2018년 2월 10일
boxImage = imread('C:\Users\ahmed abdel bakey\Desktop\New folder\8.jpg');
boxImage=rgb2gray(boxImage);
figure;
imshow(boxImage);
title('Image of a Box');
sceneImage = imread('C:\Users\ahmed abdel bakey\Desktop\New folder\9.jpg');
sceneImage=rgb2gray(sceneImage);
figure;
imshow(sceneImage);
title('Image of a Cluttered Scene');
boxPoints = detectSURFFeatures(boxImage);
scenePoints = detectSURFFeatures(sceneImage);
figure;
imshow(boxImage);
title('100 Strongest Feature Points from Box Image');
hold on;
plot(selectStrongest(boxPoints, 100));
figure;
imshow(sceneImage);
title('300 Strongest Feature Points from Scene Image');
hold on;
plot(selectStrongest(scenePoints, 300));
[boxFeatures, boxPoints] = extractFeatures(boxImage, boxPoints);
[sceneFeatures, scenePoints] = extractFeatures(sceneImage, scenePoints);
boxPairs = matchFeatures(boxFeatures, sceneFeatures);
matchedBoxPoints = boxPoints(boxPairs(:, 1), :);
matchedScenePoints = scenePoints(boxPairs(:, 2), :);
figure;
showMatchedFeatures(boxImage, sceneImage, matchedBoxPoints, ...
matchedScenePoints, 'montage');
[tform, inlierBoxPoints, inlierScenePoints] =...
    EstimateGeometricTransform(matchedBoxPoints,matchedScenePoints,'affine');
showMatchedFeatures(boxImage, sceneImage, inlierBoxPoints, ...
inlierScenePoints, 'montage');
title('Matched Points (Inliers Only)');
boxPolygon = [1, 1;... % top-left
size(boxImage, 2), 1;... % top-right
size(boxImage, 2), size(boxImage, 1);... % bottom-right
1, size(boxImage, 1);... % bottom-left
1, 1]; % top-left again to close the polygon
newBoxPolygon = transformPointsForward(tform, boxPolygon);
figure;
imshow(sceneImage);
hold on;
line(newBoxPolygon(:, 1), newBoxPolygon(:, 2), 'Color', 'y');
title('Detected Box');

error EstimateGeometricTransform(matchedBoxPoints,matchedScenePoints,'affine');

how can solve it

Image Analyst
Image Analyst 2017년 12월 2일
Start your own question and attach your code and images(s) with the paper clip icon.

댓글을 달려면 로그인하십시오.

답변 (3개)

Image Analyst
Image Analyst 2016년 3월 16일

0 개 추천

boxImage is supposed to be gray scale or binary. You just read it in from a BMP image so it's probably color. Try this and see if it fixes it:
% Get the dimensions of the image.
% numberOfColorBands should be = 1.
[rows, columns, numberOfColorChannels] = size(boxImage);
if numberOfColorChannels > 1
% It's not really gray scale like we expected - it's color.
% Convert it to gray scale by taking only the green channel.
boxImage= boxImage(:, :, 2); % Take green channel.
end

댓글 수: 3

chaala chibani
chaala chibani 2016년 3월 17일
thanks but there are other error can you help me: Error in extractFeatures (line 162) [blockSize, SURFSize, descriptor,upright] ...
Error in cherche (line 20) [boxFeatures, boxPoints] = extractFeatures(boxImage, boxPoints);
Image Analyst
Image Analyst 2016년 3월 17일
Sorry, I don't have the Computer Vision System Toolbox.
Ced
Ced 2016년 3월 17일
편집: Ced 2016년 3월 17일
hm... it looks like your input is correct. But what kind of image are you reading? These are the accepted input classes for
extractFeatures(I, points)
as you are calling it:
% Class Support
% -------------
% The input image I can be logical, uint8, uint16, int16, single, or
% double, and it must be real and nonsparse. POINTS can be a SURFPoints,
% MSERRegions, cornerPoints, or BRISKPoints object, or int16, uint16,
% int32, uint32, single or double.
Also, which points are you using? The output of detectSURFFeatures as you are using it above should be fine, but maybe you changed something?

댓글을 달려면 로그인하십시오.

Dima Lisin
Dima Lisin 2016년 3월 18일

0 개 추천

I am guessing that your image is M-by-N-by-3 (RGB). detectSURFFeatures only takes M-by-N grayscale images. Convert your images to grayscale using rgb2gray.
Mystery Devil
Mystery Devil 2018년 2월 10일

0 개 추천

Can you please explain it to me what does this two lines mean?
matchedBoxPoints = boxPoints(boxPairs(:, 1), :);
matchedScenePoints = scenePoints(boxPairs(:, 2), :);
Thank you very much. It's kind of urgent.

태그

질문:

2016년 3월 15일

편집:

2018년 2월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by