Feature request - textural measures for each segment.

72 views
Skip to first unread message

Osian Dafydd Roberts

unread,
Oct 11, 2016, 9:52:45 AM10/11/16
to RSGISLib Support

Hi everyone,

I was wondering if anyone else would like to see support added for generating textural measures (such as GLCM) in RSGISLib? It would be nice if these could be calculated for each segment to enable textural measures to be used in image classification.

I don't know if RSGISLib has functions for this, but I particularly like the way that these measures are calculated in eCognition.

Any thoughts/suggestions are welcome.

Thanks, Osian.

Nathan Thomas

unread,
Oct 19, 2016, 8:46:04 PM10/19/16
to RSGISLib Support
Ive thought about something similar too. As calculating texture values uses a window of some size, I assume you had it in mind that the segment would be the window? I suppose a limitation to this would be the window size. I assume the window size always has to be odd? Also it raises questions over the validity of the texture analyses if it is composed of lots of different window (segment) sizes. This would hold especially true if your segmentation was based on optical data but you were populating the RAT with texture derived from radar imagery. Alternatively, you could create the textural parameters yourself (using bandmath), but then populating it into the RAT using the mean may not be statistically accurate? For instance, generating a mean filter and then populating a RAT using the mean would not necessarily be correct.

Maybe an option to calculate a user defined calculation would be more beneficial? For instance the 'populateImageStats' command has no option for range, but you could write this easily yourself using 'max(pixelsWithinSegs) - min(pixelsWithinSegs)'. This could be based on the mu parser library or just python/numpy.

Its definitely an interesting idea.

Nathan

Osian Dafydd Roberts

unread,
Oct 20, 2016, 3:22:13 AM10/20/16
to RSGISLib Support
Hi Nathan,

Thanks for the reply. In the past I have used ENVI or imagemath/bandmath to generate the rasters and then populate the segmentation with the mean values. Like you said, this has the advantage that textural data from optical & radar imagery can be used within one segmentation. It's just very laborious, and I was thinking that a function for doing this in RSGISLib would be useful for textural classification.

I'm not 100% certain how eCognition generates the textural measures for each segment. Perhaps it generates them using a conventional 3x3 window, or perhaps the segment is the window? If the latter approach is used, I suppose that the textural values would be invalid for very small segments with only one or two pixels. I'd also guess that its much easier to implement the first approach in RSGISLib.

I hope you're enjoying things in the States. All the best, Osian.

Dan Clewley

unread,
Oct 20, 2016, 3:53:27 AM10/20/16
to RSGISLib Support
Hi Osain and Nathan,

It might be a good idea to open an issue on Bitbucket with this request to keep all the discussion in one place.

If you just want to apply filters to a raster and then populate each object with the mean you could write your own function using RIOS. This example shows how to apply a filter using RIOS: http://rioshome.org/en/latest/applierexamples.html#filters-and-overlap

There are lots of filters available in scipy see, https://docs.scipy.org/doc/scipy/reference/ndimage.html. Some of these are also available in RSGISLib.

There are also filters in scikit-image, including GLCM see, http://scikit-image.org/docs/dev/auto_examples/plot_glcm.html

If you can't find an existing function that does what you want you could always write your own. Performance might be a problem but using a combination of clever NumPy syntax or Numba (http://numba.pydata.org/) you should be able to get close to what would be achievable in RSGISLib using C++.

Thanks,

Dan

Osian Dafydd Roberts

unread,
Oct 20, 2016, 4:23:36 AM10/20/16
to RSGISLib Support
Thanks Dan. Those are excellent links/suggestions.

Osian.

Nathan Thomas

unread,
Oct 20, 2016, 1:13:06 PM10/20/16
to RSGISLib Support
Thanks both,

I think it is definitely an interesting discussion. I may have need for this in the near future so I can let you know what I do. I wasn't aware you could apply a function with RIOS - that would seem to me to be the easiest method, provided that the filter you want exists. 

Otherwise, a bumpy or numba approach looks interesting too, although there is probably a steeper learning curve behind this. 

Nathan

Nathan Thomas

unread,
Apr 6, 2017, 3:13:13 PM4/6/17
to Osian Dafydd Roberts, RSGISLib Support, Daniel Clewley
Hi Osian,

Just wondering if you progressed any further with this? I have tried implementing a GLCM using RIOS/Sci-kit image as Dan suggested but am getting some strange results. I can get it running but the outputs are completely wrong with mostly 0 values and the occasional grey pixel. Ultimately, I am unsure about the parameters that are needed - Im experimenting but Im blind. I put the question on stack exchange if you wanted to take a look: http://gis.stackexchange.com/questions/234990/glcm-texture-parameters

Just wondering if you got this working and if you had any advice?

Dan - any of your knowledge on this is always appreciated.


Cheers, Nathan

Nathan M Thomas
CalTech Postdoc at JPL
Radar Science and Engineering
4800 Oak Grove Dr.
300-356A
Pasadena, CA 91109



--
You received this message because you are subscribed to a topic in the Google Groups "RSGISLib Support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rsgislib-support/fQEPtnY9cwE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rsgislib-suppo...@googlegroups.com.
To post to this group, send email to rsgislib...@googlegroups.com.
Visit this group at https://groups.google.com/group/rsgislib-support.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages