>> % Create a checkerboard image. >> I = checkerboard(40,2,2); >> % Find the corners in the image. >> C = corner(I); >> % Display the corners when the maximum number of desired corners is the default setting of 200. >> subplot(1,2,1); >> imshow(I); >> hold on >> plot(C(:,1), C(:,2), '*', 'Color', 'c') >> title('Maximum Corners = 200') >> hold off
Maximum Corners = 200
>> % Display the corners when the maximum number of desired corners is 3.
>> corners_max_specified = corner(I,3);
>> subplot(1,2,2);
>> imshow(I);
>> hold on
>> plot(corners_max_specified(:,1), corners_max_specified(:,2), ...
'*','Color','m')
>> title('Maximum Corner = 3')
>> hold off
>> clear
>> close all
>> clc
>> % Second Example
>> I = imread('Heart.bmp');
>> figure, imshow(I);
>> I = imdilate(I,strel('disk',2));
>> g = rgb2gray(I);
>> bw = im2bw(g);
>> bw = ~bw;
>> figure, imshow(bw);
>> C = corner(bw);
>> hold on
>> plot(C(:,1), C(:,2), 'r*');
Original
>> clear
>> close all
>> clc
>> % Third Example
>>I = imread('Football.bmp');
>> figure, imshow(I);
>> g = rgb2gray(I);
>> figure, imshow(g);
>> C = corner(g);
>> hold on
>> plot(C(:,1), C(:,2), 'go');
>> bw = im2bw(g);
>> figure, imshow(bw);
>> D = corner(bw);
>> hold on
>> plot(D(:,1), D(:,2), 'yo');
Original
Points of Corner in Grayscale
Points of Corner in Binary
ไม่มีความคิดเห็น:
แสดงความคิดเห็น