i.segment: invalid region id 0

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: i.segment: invalid region id 0

Pietro Zambelli
Hi,

On Wed, Jul 31, 2013 at 12:39 PM, Moritz Lennert
<[hidden email]> wrote:
>> ok, I can do it... which name should I use for the hierarchical module?
>
> i.segment.hierarchical ?

I change my mind...

Do we really need to make a module only to avoid the user to define a cycle?
From my point of view we should avoid to bloat the GRASS' code with
this kind of codes

the code to do this operation is:

{{{
from __future__ import print_function
import time
from grass.pygrass.modules import Module


def segment(thresholds, output='seg__%.2f', **opts):
    iseg = Module('i.segment')
    seeds = None
    for thr in thresholds:
        opts['threshold'] = thr
        opts['seeds'] = seeds
        opts['output'] = output % thr
        st = time.time()
        iseg(**opts)
        print("%s, required: %.2fs" % (opts['output'], time.time() - st))
        seeds = opts['output']

# use the function
segment([0.02, 0.05, 0.1],
        group='rgb', method='region_growing', similarity='euclidean',
        minsize=2, iterations=20, overwrite=True)
}}}

and the output will be something like:
{{{
 100%
seg__0.02, required: 15.02s
 100%
seg__0.05, required: 7.82s
 100%
seg__0.10, required: 9.99s
}}}

Best regards

Pietro
_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Object-based classification [was: Re: i.segment: invalid region id 0]

Moritz Lennert
In reply to this post by Pietro Zambelli
Pietro,

On 31/07/13 10:01, Pietro wrote:
> I'm working to develop a module that use several machine learning
> technique to classify the segments results...
> the part concerning the hierarchical segmentation is working quite well...

Out of curiosity: which variables are you planning on using for this
classification ?

FYI, here's a list of variables that colleagues established here as
being the ones they use most in objet-based classification:

- mean band values
- brightness (combination of several band values)
- standard deviation of a certain band within an object
- length/width ratio of an object
- GLCM Homogeneity (Haralick)

All of these are implemented in GRASS, except for the length/width ratio.

And of the Haralick indicator, r.texture is pixel-based, evaluating
texture in a given neighborhood. Don't know how difficult it would be to
add the option to calculate the same indicators within the polygons
defined in a cover map.

Moritz
_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: Object-based classification [was: Re: i.segment: invalid region id 0]

Pietro Zambelli
Hi Moritz,

On Thu, Aug 1, 2013 at 12:40 PM, Moritz Lennert
<[hidden email]> wrote:

> Pietro,
>
> On 31/07/13 10:01, Pietro wrote:
>>
>> I'm working to develop a module that use several machine learning
>> technique to classify the segments results...
>> the part concerning the hierarchical segmentation is working quite well...
>
>
> Out of curiosity: which variables are you planning on using for this
> classification ?

At the moment I'm using only the results of r.univar for each raster
in the group (RGB) combined with the ratio between (R/G, R/B, G/B) of
the mean.
and it is working quite well...
Add other variables like brightness, length/width ratio, GLCM
Homogeneity, skewness, etc. it will consist only to add new columns to
a csv file.
Or would be nice to add this variables to r.univar... :-)

To classify the segments I'm using three different machine learning
techniques: Tree, KNN, and SVM. I tested also Parzen but the results
were not so good.

Best regards.

Pietro
_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: Object-based classification [was: Re: i.segment: invalid region id 0]

NikosAlexandris
In reply to this post by Moritz Lennert
Moritz Lennert wrote:
> FYI, here's a list of variables that colleagues established here as
> being the ones they use most in objet-based classification:
>
> - mean band values
> - brightness (combination of several band values)
> - standard deviation of a certain band within an object
> - length/width ratio of an object
> - GLCM Homogeneity (Haralick)

Being an "old" e-cognition user (I think it's almost 6-7 years ago) I remember
using Vegetation Indices as well, wherever applicable. Weighting some bands,
e.g. the NIR band, when the final classification-objective was related to
related, was also not uncommon.

Nikos
_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
12