From: Digistar You on
Dear all,

I had divided an image into different regions and label each region. For each region, I want to find which regions are neighboring to it, i.e. a region shares the same boundary with the target region, and how many pixels on the shared boundary. I tried to write a program, which can give me the answer, however, it run very very slowly. Because I calculated the distance between any two pixels in two regions. Is there any MATLAB toolbox function that can do this job? Or could you please tell me a fast approach to find out the neighboring regions? Thank you very much.

Best regards,

Jason
From: ImageAnalyst on
On Apr 8, 4:11 pm, "Digistar You" <digistar2...(a)163.com> wrote:
> Dear all,
>
> I had divided an image into different regions and label each region. For each region, I want to find which regions are neighboring to it, i.e. a region shares the same boundary with the target region, and how many pixels on the shared boundary. I tried to write a program, which can give me the answer, however, it run very very slowly. Because I calculated the distance between any two pixels in two regions. Is there any MATLAB toolbox function that can do this job? Or could you please tell me a fast approach to find out the neighboring regions? Thank you very much.
>
> Best regards,
>
> Jason

----------------------------------------------------------------------------------
Yes, run graycomatrix() on the labeled image.
From: Do on
Hi everybody. You may know about graycomatrix function. Could you please tell me why this small test does not work:

A = [1 1 5 6 8; 2 3 5 7 1; 4 5 7 1 2; 8 5 1 2 5];
glcm = graycomatrix(A);

It gives me the result:
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 16

which is wrong.
Thank you.