[GRASS-SVN] r70458 - grass-addons/grass7/imagery/i.superpixels.slic
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jan 30 01:22:52 PST 2017
Author: mmetz
Date: 2017-01-30 01:22:52 -0800 (Mon, 30 Jan 2017)
New Revision: 70458
Modified:
grass-addons/grass7/imagery/i.superpixels.slic/main.c
grass-addons/grass7/imagery/i.superpixels.slic/minsize.c
Log:
i.superpixels.slic: +history, +random colors
Modified: grass-addons/grass7/imagery/i.superpixels.slic/main.c
===================================================================
--- grass-addons/grass7/imagery/i.superpixels.slic/main.c 2017-01-30 09:03:57 UTC (rev 70457)
+++ grass-addons/grass7/imagery/i.superpixels.slic/main.c 2017-01-30 09:22:52 UTC (rev 70458)
@@ -60,6 +60,8 @@
char *outname;
int outfd;
CELL *obuf;
+ struct Colors colors;
+ struct History hist;
int n_iterations, n_super_pixels, numk, numlabels, slic0;
int nrows, ncols, row, col, b, k;
@@ -580,8 +582,8 @@
G_free(nlabels);
if (minsize > 1)
- merge_small_clumps(pdata, nbands, klabels, numlabels, 0,
- minsize);
+ numlabels = merge_small_clumps(pdata, nbands, klabels,
+ numlabels, 0, minsize);
outfd = Rast_open_new(outname, CELL_TYPE);
obuf = Rast_allocate_c_buf();
@@ -598,8 +600,14 @@
Rast_close(outfd);
/* history */
+ Rast_short_history(outname, "raster", &hist);
+ Rast_command_history(&hist);
+ Rast_write_history(outname, &hist);
/* random colors */
+ Rast_init_colors(&colors);
+ Rast_make_random_colors(&colors, 1, numlabels);
+ Rast_write_colors(outname, G_mapset(), &colors);
exit(EXIT_SUCCESS);
}
Modified: grass-addons/grass7/imagery/i.superpixels.slic/minsize.c
===================================================================
--- grass-addons/grass7/imagery/i.superpixels.slic/minsize.c 2017-01-30 09:03:57 UTC (rev 70457)
+++ grass-addons/grass7/imagery/i.superpixels.slic/minsize.c 2017-01-30 09:22:52 UTC (rev 70458)
@@ -403,5 +403,5 @@
G_free(clumpbsum);
G_free(clumpsize);
- return 1;
+ return n_clumps_new;
}
More information about the grass-commit
mailing list