Calculate GLCM feature vector for each pixel of an image
1 view (last 30 days)
Show older comments
Dear all,
I used graycomatrix and graycoprops functions to obtain texture feature which are single values of each feature. Now I want to calculate the feature vector of each pixel in the image based on the feature values obtained. Could anyone provide me any solution for that ?
4 Comments
Image Analyst
on 16 Dec 2017
I agree with Rik. Since you'll have only 8 entries in the GLCM, it's very doubtful it will be useful to you. Perhaps if you give us your image and existing segmentation algorithm we can suggest ways to "enhance the quality of the segmentation and eliminate if exists irrelevant features".
Answers (1)
Image Analyst
on 16 Dec 2017
I doubt glcm stats on a per pixel basis will be a useful feature for you. Attached is an example of GLCM on the entire image. Basically you'd have to do that inside a nested for loop where you scan over every pixel. I really think it's literally a waste of time. Why don't you just post your image and tell us what you want to find, and why you think this algorithm will work for that?
3 Comments
Image Analyst
on 16 Dec 2017
kmeans is lousy for color segmentation. I'm attaching my kmeans demo for segmenting color images so you can try it for yourself and see that it's not great.
One problem with it is that you have to specify how many clusters there are in advance, and for an arbitrary photo, that's not known. So if you wanted to find grass, sky, and horses, and you say there are 3 color classes, that's fine (well actually not) if there are horses there, but what if the scene doesn't have any horses? Don't you want to know that no horses are in the scene? But you won't be able to because you're saying 3 colors and it will have to take the remaining colors and make 3 clusters out of them. So you will have some area for color class #3, but it's NOT a horse that was found!
Better is to use something else, like DEM: https://www.mathworks.com/matlabcentral/fileexchange/37197-dem--diffused-expectation-maximisation-for-image-segmentation
Or an example-based approach like discriminant analysis, done by the classify() function in the other attached demo.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!