Finding corners in grayscale images and plotting them

1 次查看(过去 30 天)
Hi everyone, I have a satellite grayscale image (double) from an urban area which I'm trying to find the corners in it using the function corner. I'm doing this according to matlab help for this function which says:
I = checkerboard(50,2,2);
C = corner(I);
imshow(I);
hold on
plot(C(:,1), C(:,2), 'r*');
but I have two problems with this:
1) in matching the plot function with size of my image which is 1593*2765! How should I change the numbers in plot function?
2) I've tried using this:
plot(C(:,:),'r.');
but I know it's wrong, cause it shows me a completely red picture (a page full of red dots). In this case C is a 200*2 double matrix with large numbers. What do these numbers mean? What should I do if I wanted every pixel which is a corner to be saved as 1 and every pixel which is not a corner to be saved as 0 in a matrix the same size as my original image?!
Thanks a lot

采纳的回答

Image Analyst
Image Analyst 2013-9-10
Why don't you just use the plot function the way the help told you to? Why do you change it when you know that gives you incorrect display? plot() takes x as the first argument and y as the second argument so it's obvious that C(:,1) is the x coordinates and C(:,2) is the y coordinates. What happens if you just do it the way the example did it? Anything wrong with doing that?
In your case you should have 200 corners and each row in C is the (x,y) coordinate of one of the corners.
Did you try doing
out = zeros(size(I));
for row = 1 : size(I, 1)
out(C(row,1), C(row,2)) = 1;
end
  1 个评论
Mithra
Mithra 2013-9-11
编辑:Mithra 2013-9-11
Thanks for the explanation, now I understand what do they mean.
and the code works great, thnx again :)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Visual Exploration 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by