فهرست منبع

i.segment: fix writing out goodness of fit

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@73512 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 6 سال پیش
والد
کامیت
95a22d81ae
3فایلهای تغییر یافته به همراه4 افزوده شده و 12 حذف شده
  1. 1 11
      imagery/i.segment/create_isegs.c
  2. 1 0
      imagery/i.segment/iseg.h
  3. 2 1
      imagery/i.segment/write_output.c

+ 1 - 11
imagery/i.segment/create_isegs.c

@@ -113,17 +113,7 @@ int create_isegs(struct globals *globals)
 	globals->max_rid = max_id;
 	G_debug(1, "Largest renumbered ID: %d", globals->max_rid);
 	
-	for (row = 0; row < globals->nrows; row++) {
-	    for (col = 0; col < globals->ncols; col++) {
-		Segment_get(&globals->rid_seg, &rid, row, col);
-		if (!Rast_is_c_null_value(&rid)) {
-		    rid = new_id[rid];
-		    Segment_put(&globals->rid_seg, &rid, row, col);
-		}
-	    }
-	}
-
-	G_free(new_id);
+	globals->new_id = new_id;
     }
 
     return successflag;

+ 1 - 0
imagery/i.segment/iseg.h

@@ -80,6 +80,7 @@ struct globals
 
     /* region growing */
     int min_segment_size;	/* smallest number of pixels/cells allowed in a final segment */
+    int *new_id;
 
     /* inactive options for region growing */
     double radio_weight;	/* weighing factor radiometric - shape */

+ 2 - 1
imagery/i.segment/write_output.c

@@ -34,7 +34,8 @@ int write_ids(struct globals *globals)
 		Segment_get(&globals->rid_seg, (void *) &rid, row, col);
 
 		if (rid > 0) {
-		    outbuf[col] = rid;
+		    if (globals->method == ORM_RG)
+			rid = globals->new_id[rid];
 		    if (maxid < rid)
 			maxid = rid;
 		}