[GRASS-user] v.class.mlR Error

Moritz Lennert mlennert at club.worldonline.be
Thu May 31 01:59:38 PDT 2018


On 31/05/18 09:52, Helmut Kudrnovsky wrote:
>> My hunch is that the problem is some PATH issues making it >difficult to
>> call R.
> 
>> Maybe some of the Windows gurus out there could help with this ?
> 
> Is there a working example available for this addon?

Here's a complete working example of the entire OBIA chain in the NC 
dataset (warning: this is a demo example, not necessarily one of best 
practice ;-)) :

g.extension r.object.geometry
g.extension i.segment.stats
g.extension v.class.mlR

g.region rast=lsat7_2002_10 -p
i.group lsat7_2002_ms 
in=lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40,lsat7_2002_50,lsat7_2002_70
i.segment lsat7_2002_ms threshold=0.05 out=lsat7_segs_005 minsize=10
i.segment.stats lsat7_segs_005 
rasters=lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40,lsat7_2002_50,lsat7_2002_70 
vectormap=lsat7_segs_stats
v.random n=1000 out=points
v.db.addtable points
v.db.addcolumn points col="class int"
v.what.rast map=points raster=landclass96 column=class
v.db.addcolumn points col="segid int"
v.what.rast map=points raster=lsat7_segs_005 column=segid
v.db.join lsat7_segs_stats column=cat otable=points ocolumn=segid 
subset_col=class
v.extract lsat7_segs_stats where="class>0" output=training
v.class.mlR segments_map=lsat7_segs_stats training_map=training 
train_class_colum=class
r.colors.out landclass96  rules=landclass96.colors
v.colors lsat7_segs_stats use=attr column=vote_smv rules=landclass96.colors
d.vect lsat7_segs_stats

Not sure if this should go into the man pages of the different tools, or 
whether it might be better to integrate it into image classification 
wiki page's section on OBIA [1] and link to that from the different man 
pages.

Moritz

[1] 
https://grasswiki.osgeo.org/wiki/Image_classification#Object-based_classification_and_image_segmentation


More information about the grass-user mailing list