Filtering Image by using GLCM feature properties as filter

4 vues (au cours des 30 derniers jours)
Dimitris M
Dimitris M le 15 Mai 2012
Hello
I relatively new to Image processing and I do not know if my question is concrete but I was wondering if it is possible to use an 'imfilter' function and a GLCM feature-property such as correlation or constrast in form of a window filter to be able to extract texture information from the images.
If this is possible how can I give input to the GLCM (graycomatrix) from a sliding window and then introduce the output to the imfilter ???
Thanks in advance
  1 commentaire
Dimitris M
Dimitris M le 15 Mai 2012
In the problem occurring is that I want to process the image using this function (graycoprops). To be able to do this I need first to create the GLCM (graycomatrix).
To do this for the whole image is easy but how can i do it for a small region (eg. 3x3) like a filter.
I was thinking something like 'colfilt' could work but I no idea how can i take each time the block values and feed them to the 'graycomatrix' and 'graycoprops'.
Any help would be much appreciated as I am many hours stack here !!!

Connectez-vous pour commenter.

Réponses (2)

Image Analyst
Image Analyst le 16 Mai 2012
I don't know why you want the graycomatrix for a small area, like a 3x3 window or 9x9 window. It's just not statistically very valid. If you did want to do that you might have to use blockproc() and then inside the function, call graycomatrix and graycoprops on the submatrix. Search Answers for a blockproc demo I've posted before for an example of how to do that.
  1 commentaire
Dimitris M
Dimitris M le 16 Mai 2012
Hello
I just want to do it not for statistical reasons but for creating a texture image like the one implemented in ENVI(IDL) software.
Thank you for the hint about blockproc() I am going to look know into it.

Connectez-vous pour commenter.


Dimitris M
Dimitris M le 16 Mai 2012
Ok I have written the code but it works partially and I was wondering if you can help me understand some gaps I got
So the first part of the code (Computation of GLCM) works with my image but not with a default Matlab image (cameraman.tif). Can you tell me why ???
Also the second half of the code (graycoprops) do not work at all and it gives me the following error message:
_??? Error using ==> blockproc at 219 Invalid output class. The user function, FUN, returned an invalid result. The class of the result was struct.
Error in ==> TETE at 31 Con=blockproc(I_GLCM,[3 3],myFun2); _
My code:
I=imread('189b.tif');
I=I(:,:,3);
% GLCM Parameters
p1= 'offset';
v1= [0 1];
p2= 'Symmetric';
v2= true;
% Create functon to handle what we will apply to each block
myFun1= @(block_struct) graycomatrix(block_struct.data,p1,v1,p2,v2);
% Calculationg GLCM as a filter for the image
I_GLCM= blockproc(I,[3 3],myFun1);
% GLCM-Features Parameters
k1='contrast';
% Create GLCM-Features 'Contrast'
myFun2= @(block_struct) graycoprops(block_struct.data,{k1});
%Calculation of GLCM-Contrast
Con=blockproc(I_GLCM,[3 3],myFun2);
imshow(Con)

Community Treasure Hunt

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

Start Hunting!

Translated by