MATLAB: How to find seed point and regions of interest in an image

image processingimage segmentationregion growing

In the seed.jpg image : first i need to find regions of interest on the basis of the brightest pixels having the maximal values because they represent the most significant regions in the image. Once the regions of interest are determined, the centroid of each region need to found. The resulting centroid pixel are the seeds for region growing algorithm.
The algorithm for region growing scans seed image S(x, y) to find a seed. When a seed is found, the region growing is performed from this point over the originalimage.jpg f(x, y). Region growing stops when a significant difference between the seed and the neighbour pixel is found.
I also see this code in a book but it don't accept my class of image. It needs to read an image with format such as .bmp, but I just have .fig (I cant save it with another format because of its bad quality). .fig image is better.
function [g,NR,SI,TI] = regiongrow( f,S,T )
%REGIONGROW Perform segmentation by region growing .
% [G,NR,SI,Tl)=REGIONGROW(F,s,T) .f is an image to be segmented.
%s can be an array(the same size as F )with a 1 at the coordinates of every seed point
% and Os elsewhere . S can also be a single seed value . Similarly ,
% T can be an array (the same size as F ) containing a threshold
% value for each pixel in F . T can also be a scalar , in which case
% it becomes a global threshold . All values in S and T must be in
% the range ( 0 , 1 )
%
% G is the result of region growing , with each region labeled by a
% different integer , NR is the number of regions , SI is the final
% seed image used by the algorithm , and TI is the image consisting
% of the pixels in F that satisfied the threshold test , but before
% they were processed for connectivity
f=tofloat(f) ;
% If s is a scalar , obtain the seed image .
if numel(S)==1
SI f==S ;
S1 = S ;
else
end
% S is an array . Eliminate duplicate , connected seed locations
% to reduce the number of loop executions in the following
% sections of code .
SI=bwmorph( S ,'shrink' ,Inf) ;
S1 = f(SI) ; % Array of seed value s .
TI=false(size(f)) ;
for K = 1 : length(S1)
seedvalue=S1(K);
end
S = abs(f-seedvalue)<=T; % Re - use variable S .
TI = TIIS;
% Use function imreconstruct with SI as the marker image to
% obtain the regions corresponding to each seed in S . Function
% bwlabel as signs a different integer to each connected region .
[ g , NR ] = bwlabel( imreconstruct(SI,TI)) ;
end

Best Answer

Theshhold your image, then regionprops() and request Centroids. bwdist() to find the closest pixel that is actually in the image. Caution: a centroid is not necessarily in an object, so you might even want to proceed region by region to be sure you are getting a point inside the region.
If you get too many regions then threshold again with a higher threshold.