Calculating Halarick/GLCM features for just an image segment.

조회 수: 8 (최근 30일)
Jake
Jake 2015년 4월 28일
편집: Jake 2015년 4월 28일
Hello, I have an image mask that I would like to apply to an image. I then want to calculate the Halarick texture features (GLCM features) for just this region. Is this possible? If so, what would the code look like?
I currently have a segmented image that contain my area of interest, but then has a large black region on the outside (see below). I'm worried this large black outside region will give me incorrect texture measurements if I input just this image into a graycomatrix.
I tried using code like:
GLCM = graycomatrix(I(I~=0));
but this doesn't keep the right orientation of the image.
Is there an easy solution? Thanks in advance!

답변 (1개)

Image Analyst
Image Analyst 2015년 4월 28일
Just use the whole image. Then to get rid of the effect that the zero gray level has, just zero out the first row and first column of the GLCM.
  댓글 수: 1
Jake
Jake 2015년 4월 28일
편집: Jake 2015년 4월 28일
The current code I am using is:
gray = rgb2gray(imageSegment);
offsets = [0 1; 0 2; 0 3; ...
-1 1; -2 2; -3 3; ...
-1 0; -2 0; -3 0; ...
-1 -1; -2 -2; -3 -3; ...
0 -1; 0 -2; 0 -3; ...
1 1; 2 2; 3 3; ...
1 0; 2 0; 3 0; ...
1 -1; 2 -2; 3 -3];
GLCM2 = graycomatrix(gray,'Offset',offsets);
Would this implementation be correct? :
GLCM2(1,:) = 0;
GLCM2(:,1) = 0;
My goal is to compare across multiple segmented images. So I don't want to calculate any features based on the background black of these images.
Thanks again.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by