Dear all,
I have two corner points (I marked them in red so you can see it) in black and white image. I want to find coordinates of the points automatically without using 'ginput'.
I have tried to use bwmorph(), but it gives too many endpoints as show bellow:
Code:
clear all; clc; close all; workspace; format long g; format compact;im = imread('LA.jpg'); figure; imshow(im,[]);LA= im2bw(im, graythresh(im));% Filtering from noize by measuring blow
[Clab num] = bwlabel(LA);props = regionprops(Clab); % [maxValue,index] = max([props.Area]);
CC = bwconncomp(LA);[~,idx] = max(cellfun(@numel,CC.PixelIdxList));L=labelmatrix(CC);LA=L==idx;figure; imshow(LA);skelImage = bwmorph(LA, 'skel', inf); %
endPoints = bwmorph(skelImage, 'Endpoints'); %
[rows, columns] = find(endPoints); % Find coordinates of the End Points
figure; imshow(LA); hold on;plot(columns,rows,'g*');
Thank you very much for any guidance or advice you could give me.
Regards,
Ivan
Best Answer