[GRASS-dev] i.segment: invalid region id 0

Moritz Lennert mlennert at club.worldonline.be
Wed Jul 31 04:18:23 PDT 2013


On 31/07/13 05:35, Pierre Roudier wrote:
> Any of you guys have code around to do hierarchical segmentation?
> Tried to do it in Python a few months ago, but failed (I'm not exactly
> a great Python coder it seems!).

It should just be a question of creating a loop. Something like this 
(untested):

seeds = ''

for thresh in [0.01, 0.05, 0.1, 0.2, 0.5]:

     outname = mapname + '_' + str(thresh)

     if seeds:
        grass.run_command('i.segment', [all your parameters], 
threshold=thresh, seeds=seeds)
     else:
        grass.run_command('i.segment', [all your parameters], 
threshold=thresh)

     seeds = outname

Moritz


More information about the grass-dev mailing list