[GRASS-dev] i.superpixels.slic ( was: #3142 Implementing SLIC image segmentation)

Markus Metz markus.metz.giswork at gmail.com
Wed Dec 21 15:01:55 PST 2016


On Wed, Dec 21, 2016 at 7:53 AM, Moritz Lennert <
mlennert at club.worldonline.be> wrote:
>
>
>
> Le 20 décembre 2016 23:39:09 GMT+01:00, Markus Metz <
markus.metz.giswork at gmail.com> a écrit :
> >On Tue, Dec 20, 2016 at 11:09 PM, Martin Landa <landa.martin at gmail.com>
> >wrote:
> >>
> >> Hi,
> >>
> >> 2016-12-20 22:17 GMT+01:00 Markus Metz
> ><markus.metz.giswork at gmail.com>:
> >> > I think the module is automatically compiled only if it is added to
> >> > grass-addons/grass7/imagery/Makefile which it is not yet.
> >>
> >> no it's compiled automatically, see [1].
> >
> >OK. Then what is the reason for the existence of
> >grass-addons/grass7/imagery/Makefile?
> >
> >> There is an compilation error. Ma
> >>
> >> [1]
> >
https://wingrass.fsv.cvut.cz/grass73/x86_64/addons/grass-7.3.svn/logs/i.superpixels.slic.log
> >
> >fmin needs to be replaced with a macro MIN as used by many other
> >modules,
> >maybe with a test for nan.
>
> Simply using fmin (from math.h IIRC), does the job for me. Any reason not
to use it ?

Because it requires -std=c99 or higher whereas most of GRASS C code tries
to comply with c89, because custom MIN and MAX macros are used frequently
within the GRASS code base, because the usage of fmin as e.g. "fmin(double
(g_width-1), seedx);" is wrong. The main argument is to avoid C standard 99
because not all compilers have the same idea of C standards other than c89:
incomplete and different support for c99 (or higher) features in different
compilers and different versions of the same compiler.

Adding

#undef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))

as in other GRASS modules is a nice solution to keep things simple and
portable.

Markus M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20161222/743f07e3/attachment.html>


More information about the grass-dev mailing list