Effacer les filtres
Effacer les filtres

Finding corners in grayscale images and plotting them

1 vue (au cours des 30 derniers jours)
Mithra
Mithra le 10 Sep 2013
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

Réponse acceptée

Image Analyst
Image Analyst le 10 Sep 2013
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 commentaire
Mithra
Mithra le 11 Sep 2013
Modifié(e) : Mithra le 11 Sep 2013
Thanks for the explanation, now I understand what do they mean.
and the code works great, thnx again :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Visual Exploration dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by