I want to apply a GLCM texture filter to some aerial photographs that I have. I am using the skimage package to compute the GLCM and a package called rios to handle the i/o.
Rios - raster input output simplification - reads imagery in as a 400 x 400 x nbands numpy array and handles the creation of the output dataset paramaters. It is designed to handle very large datasets in a memory efficient way and also enables the user to set a moving window. I understand that I need to use caution when reading an image in in blocks and applying a moving window but I am not at the stage where I am implementing a window yet.
I can get my code to run but the result is an output made up of zeros with the occasional grey pixel. Ultimately I don't understand what the parameters I am using do. I consulted the documentation but it doesn't give any more than a brief description or examples of what different parameter values will achieve.
Thus far, I have:
# Set up input and output filenames. infiles = applier.FilenameAssociations() infiles.image1 = "infile.tif" outfiles = applier.FilenameAssociations() outfiles.outimage = "outfile.tif" controls = applier.ApplierControls() controls.progress = cuiprogress.CUIProgressBar() # Apply a moving window if required # 3x3 the overlap is 1, 5x5 overlap is 2 etc # I have yet to try this as i'm trying to get something basic working first #controls.setOverlap(4) # Apply Texture def doFilter(info, infiles, outfiles, controls=controls): g = greycomatrix(infiles.image1, , , 256, normed=True, symmetric=True) filtered = greycoprops(g, 'contrast') # create 3d image from 2d array outfiles.outimage = numpy.expand_dims(filtered, axis=0) applier.apply(doFilter, infiles, outfiles, controls=controls)
Could someone help explain what the parameters within the greycomatrix mean and how I would expect the GLCM to behave under different parameter values? They are referred to in the documentation as:
greycomatrix(input array, distances, angles, levels, normed=True, symmetric=True)
The parameters distances, angles and levels are the ones I understand the least.