Azzera filtri
Azzera filtri

Finding corners in grayscale images and plotting them

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Image Analyst
Image Analyst il 10 Set 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 Commento
Mithra
Mithra il 11 Set 2013
Modificato: Mithra il 11 Set 2013
Thanks for the explanation, now I understand what do they mean.
and the code works great, thnx again :)

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Visual Exploration in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by