Connected Neighbourhood / Regional Maxima - Image Processing

4 views (last 30 days)
Hi there,
I am not able to understand how imregionalmax works for finding the regional maxima. Can anybody brief me.!! Mainly not clear about the connected neighbourhood.
Thanks for the time.

Answers (5)

Harshit
Harshit on 7 Nov 2012
Hi Sriram, 8-Connected neighborhood means the pixels in left,right,up,down,left up, left down,up right and down right. It works by finding all the connected component of same intensity say the 3x3 matrix of 22. And then checking if these components have a connectivity with intensity value higher. Connectivity now means connectivity by a single element of the components.

Sriram
Sriram on 7 Nov 2012
Check out for this.
Let the below matrix be the input
10 10 10 10 10
10 10 10 30 30
10 13 13 10 30
10 13 10 10 10
10 10 10 10 10
output from the matlab command - imregional max is
0 0 0 0 0
0 0 0 1 1
0 0 0 0 1
0 0 0 0 0
0 0 0 0 0
whereas according to MY theoretical understanding the output would be
0 0 0 0 0 since when element (3,2) which is 13 it will have neighb
0 0 0 1 1 10 10 10
0 1 0 0 1 10 <13> 13 which will be replace by 1
0 1 0 0 0 10 13 10
0 0 0 0 0 whereas for element (3,3)
10 10 30
13 <13> 10 which will be 0 since 30 at(1,3)
13 10 10
what went wrong on my understanding?

Andrei Bobrov
Andrei Bobrov on 7 Nov 2012
x=[ 10 10 10 10 10
10 10 10 30 30
10 13 13 10 30
10 13 10 10 10
10 10 10 10 10]
imregionalmax(x,4)

Harshit
Harshit on 7 Nov 2012
Hi Sriram, It won't be. You have to see the entire connected component. Look at 3rd column and 3rd row 13 it is connected to 2nd row and 4th column 30 in a 8-neighbor way. So 13 is connected to 30 and so it will become zero.
  4 Comments
Harshit
Harshit on 8 Nov 2012
You can look at the source of matlab function itself. It is the most optimized code. Else the logic will be for every pixel check its 8 neighbor. If any of them is bigger store it in a lut such that a(13,10)=1 which means intensity 13 and 10 are connected. In the second iteration just traverse the matrix and delete elements on the basis of lut.
Image Analyst
Image Analyst on 8 Nov 2012
In this case, as with most m-files, the m-file for the function in the toolbox is merely a wrapper for a mex file that does the actual heavy lifting. So you can't see what it does internally. And for this case, it doesn't give a citation to a published article.

Sign in to comment.


Image Analyst
Image Analyst on 7 Nov 2012
Regarding your example: No, the 13's won't be a local max. There's a trail of pixels (equal or higher in values) that connect the 13's to a higher number (30), so none of the 13's will be a regional max. With 8 connected the trail can go up, down, left, right, or diagonally.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!