Feature extraction of texture, irregularity

Is there any opinion about how can calculate these kind of texture's regularity metric. You see there is difference because of directionality,particle shape, size, placement etc. Is there any code for this. regards

 Accepted Answer

Try functions like stdfilt(), graycomatrix(), graycoprops(), regionprops(), etc. There are a lot of things you could potentially measure so the algorithm depends on exactly what you're interested in characterizing.

3 Comments

Actullay i thought these something like that std/mean. First i thought score characterizing the spread of the primitives. For examples peaks points then. There should be distance measure for closing neighbor like min(i-j) for N fixation points. And then all these distance points can combine, after my suggestion should be take into. But how can i first calculate these distances for all image(n point), is there a simple way :)
If you use regionprops() you can get the centroid of all the blobs. Then you can use pdist2() in the stats toolbox to find the distance of every centroid to every other centroid. Sometimes people look at the mean distance of the 5 or 10 closest blobs.
How can we use GLCM features to obtain fractal dimension?

Sign in to comment.

More Answers (4)

4 Comments

thanks. I will analyze the link.
newy5 = y3(1:1460, 1:2080); imshow(newy5); yn=im2bw(newy5,0.5); %threshold level define 0.7 5 icin 0.5 7 ler icin figure;imshow(yn); tst=imcomplement(yn);figure;imshow(tst);
BW2 = bwareaopen(tst,7000); %remove small dipserse objects figure;imshow(BW2);
s = regionprops(BW2,'centroid'); % calculate the remaining objects centers. centroids = cat(1, s.Centroid); % combine all them
D = pdist2(centroids(:,1),centroids(:,2),'euclidean'); %calculate the distance between them
value=std(D)/mean(D) %irregularity
value1=mean2(D)
is this true or not what is your suggestion
You're calling pdist2() incorrectly. You have to pass it two arrays of x,y coordinates. In your case they will be the same array. So you should do
distances = pdist2(centroids, centroids, 'euclidean');

Sign in to comment.

ali
ali on 5 May 2016
Edited: ali on 5 May 2016
s = regionprops(newBW2,'centroid'); % calculate the remaining objects centers. centroids = cat(1, s.Centroid);
D = pdist2(centroids(:,1),centroids(:,2),'euclidean');
the result just Centroid: [949.2040 788.5083], why i cant take all distances if blobs big then calculate but for this figure the particles small then just one centroid. What is wrong? So the value i use for irregularity always zero because std(D)=0 and mean(D)=0 because of the D is just one value. How can i solve this

8 Comments

"why i cant take " <== You can. No one is stopping you.
D should not be just one value unless you have only one centroid. What does length(s) tell you? That's how many regions you have.
ali
ali on 8 May 2016
Edited: ali on 8 May 2016
Actually I dont understand, I remove bigger ones from binary image. But like you see from untitled, When ı use the s = regionprops(newBW2,'centroid','Area'); it calculates all white areas but centroid just one values why I cant take all pairwise distances from second image.
You're calling pdist2() incorrectly. You have to pass it two arrays of x,y coordinates. In your case they will be the same array. So you should do
distances = pdist2(centroids, centroids, 'euclidean');
ali
ali on 9 May 2016
Edited: ali on 9 May 2016
like this usage distance found 0. More than 5000 objects found on binary image. Soit has to be found distances but no?
What is the size of centroids?
size(centroids)
%% ifeatures=zeros(1,5);%/to take features close all; for i=1:30%/for take one by one image close all;
%preprocessing step for images readimage=tum{1,i}; new_image = readimage(1:1460, 1:2080); %//%% imshow(new_image);
%convert to gray image binary level %suggested threshold for 3 and 5 level about 0.7 %7 level ıs 0.5 thresh_image=im2bw(new_image,0.7); %threshold level define 0.7 5 icin, 0.5 7 ler icin % figure;imshow(thresh_image);
%complement stage thresh_image_conv=imcomplement(thresh_image);figure;imshow(thresh_image_conv);
%removing dispersed areas from image %level is determined by expert and found empirically BW2 = bwareaopen(thresh_image_conv,5000); %remove small dipserse objects % figure;imshow(BW2); newBW2=imsubtract(thresh_image_conv,BW2);figure;imshow(newBW2); %substract image to remove non-dispersed areas %
%this part use for extract features from images(binary) if(mean2(newBW2)~=0) % calculate the remaining objects centers. s = regionprops(newBW2,'centroid','Area'); area = extractfield(s,'Area'); centroids = cat(1, s.Centroid); % combine all them [labeledImage, numberOfObject] = bwlabel(newBW2);
%calculate the distance between them
D = pdist2(centroids,centroids,'euclidean');
value=std(D)/mean(D) %irregularity
value1=mean2(D) % average value of all distances
value2=std(D); %std for all areas
elseif(mean2(newBW2)==0)
value=0;
value1=0;
value2=0;
end
temp_new=horzcat(value,value1,numberOfObject,mean2(area),max(value2));
ifeatures=vertcat(ifeatures,temp_new);
end
ali
ali on 9 May 2016
Edited: ali on 9 May 2016
size(centroids)
answer 1 2
waiting for this suggestion you ImageAnalyst

Sign in to comment.

ali
ali on 9 May 2016
Edited: ali on 9 May 2016
Actually I want to look at for this images dispersion level. The white cells dispersion is high(regular) or not on the surface image that is the reason why i want to measure this. Like homogeneus dispersion but GLCM not give significant so i want to design new feature. Like your suggestion i cant take dimension what is wrong my code? Fractal analysis can be use or not?

2 Comments

This is not an answer to the original question. Was it a comment to me, or a comment on your other "answer"?
This is an another idea that comes my mind. I m waiting for your suggestion another centroid question

Sign in to comment.

ali
ali on 10 May 2016
And image analyst do you have any suggestion for calculation distance for this D = pdist2(centroids,centroids,'euclidean'); for mathematical formula and other suggestions from you for centroid question

Asked:

ali
on 3 May 2016

Edited:

on 10 Aug 2018

Community Treasure Hunt

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

Start Hunting!