How can I determine the place of local maxima (minima) on an intensive
image? Is there any function in Matlab that can do this for me? Any paper or
documentation that can help me on this?
Where can I read more about the theory behind 'imhmax'? I don't have access
to the book that comes as reference to this function.
Regards
[I,J]=find(im==max(im(:))); should do the work
Regards
"Pinpress" <sb...@yahoo.com> wrote in message
news:ef3a...@webcrossing.raydaftYaTP...
If you decide to do the convolutions (conv2), the image is convolved
with a 3-3 matrix that has 0s everywhere except the center, which is
-1, and one of the neighbors, which is 1. You vary the neighbor
covering each of the 4 or 8 neighbors. Threshold each convolution to
find values > 0; these are pixels that have values less than a
neighbor in a specific position. By ORing (ie, multiplying) the
thresholded convolution results together, you'll be setting equal to
1 only those pixel that are local minima.
It's not pretty, but it gets around the pixel loop. I'd be surprised
if there weren't a better way, but I think you're not going to find a
one-line function.
% image - your image
% seedImage - binary output image with all local maxima = 1
% x,y - size of the images
% wSize - size of the subimage(size of your local area)
% wStep - size of the step (should be <= wSize)
for cntX = 1:wStep:x
%Define x range of the subimage
begX = max((cntX-wSize), 1);
endX = min((cntX+wSize), x);
for cntY = 1:wStep:y
%Define y range of the subimage
begY = max((cntY-wSize), 1);
endY = min((cntY+wSize), y);
%Extract matrix in which to look for local max
tempMatrix = image(begX:endX,begY:endY);
%Find max value in the tempMatrix
[maxVal, maxInd] = maxn(tempMatrix);
%Convert linear indice to subscripts, get real coordinates
[maxSubX, maxSubY] = ind2sub(size(tempMatrix),maxInd);
maxSubX = maxSubX + begX-1; maxSubY = maxSubY + begY-1;
seedImage(maxSubX(1), maxSubY(1), maxSubZ(1)) = 1;
end
end
I use here the maxn function (from the File Exchange) which returns x
and y coordinates of the max value.
Hope this helps,
Versath