필터 지우기
필터 지우기

Finding corners in grayscale images and plotting them

조회 수: 1 (최근 30일)
Mithra
Mithra 2013년 9월 10일
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