Chethan
Chethan

Reputation: 213

shape based image retrieval MATLAB

I've encountered with new terms while writing code for CBIR, in my reference algorithm it is given that some varaible say

z(i) is the set of  euclidian distance between centroid and all N boundary pixels of   digitized shape.

There is a function to find out centroid

I = imread('coins.png');
bw = im2bw(I, graythresh(getimage));
bw2 = imfill(bw,'holes');
s  = regionprops(bw2, 'centroid');
centroids = cat(1, s.Centroid);
imtool(I)
plot(imgca,centroids(:,1), centroids(:,2), 'r*')

what is N boundary pixels of digitized shapes and How to find it? any appropriate answers are appreciable.

Upvotes: 0

Views: 635

Answers (1)

nhowe
nhowe

Reputation: 929

You can use bwboundaries to find the boundary point coordinates of connected components. If you fill holes as in the sample code, then you should get a cell array of boundary point coordinates that corresponds in order to the centroids you have computed. If any of your components have holes, then it will return additional boundary segments corresponding to those.

Upvotes: 1

Related Questions