[IPOL discuss] computing and displaying contours
Pascal Getreuer
getreuer at gmail.com
Tue Mar 15 18:04:06 CET 2011
> d) I google'd for a bit to find any clean C implementation of the
> marching squares algorithm but without luck. do you know/have any
> piece of C code to compute contours? I know implementations in ITK and
> VTK, but that's out of the question. I find sad that there is no
> reference implementation of such well-know and established algorithms.
I was recently looking into the topic of visualizing contours. It
seems the standard approach is
Cottafava and Moli, "Automatic Contour Map," Communications of the
ACM, vol 12, no 7, July 1969.
http://portal.acm.org/citation.cfm?id=363172
MATLAB uses a very similar contouring method, which they describe in detail at
http://www.mathworks.com/help/techdoc/creating_plots/f10-2524.html#f10-2614
It is indeed sad that such a standard thing does not have a free
simple reference implementation. Come to think of it, contouring
would make a good IPOL article.
> b) Ask the user to draw in a vectorial format like eps or svg. As far
> as I know, svg support varies too much across browsers. (correct me
> please if I'm wrong)
I agree with you that visualizing the contour map on the web is a
problem, since SVG would be the right format if browser support were
better established. I suggest following what was done in the Line
Segment Detector demo. Create the contour map as an EPS file, then
call Ghostscript to convert the EPS to a raster PNG image for display
on the webpage. Additionally, the demo can provide a link to allow
users to download the EPS.
Best,
Pascal
On Tue, Mar 15, 2011 at 17:38, Juan Cardelino <juan.cardelino at gmail.com> wrote:
> Dear all,
> I remember that we discussed the topic of visualization in
> the september meeting. I'm not sure if you have advanced in that
> direction in January, if that's the case, please update me.
> So far I contributed in demos for me and for people that were also in
> IPOL. I'm facing the first case of helping a non-member of the crew,
> and I have some doubts about were to draw the line of what's
> responsibility of the author and what's the task of the editor.
>
> The case is the following: the author is Mauricio Delbracio and his
> algorithm that estimates a PSF, so the output are regular samples of a
> 2D function. When thinking about visualization, the wanted to display
> the level lines of that function. This involves a couple of tasks:
>
> 1) actually computing the contours:
> a) I think this should be done by the author
> b) however, it won't hurt to have a handful of simple functions at
> hand, to provide the authors. Maybe we can just reuse the code done by
> the first autor interested in doing the task.
> c) I think about many cases in which we could be interested in
> computing/showing level lines, so maybe the definition of an interface
> (how to specify the points of the contour) could be useful.
> d) I google'd for a bit to find any clean C implementation of the
> marching squares algorithm but without luck. do you know/have any
> piece of C code to compute contours? I know implementations in ITK and
> VTK, but that's out of the question. I find sad that there is no
> reference implementation of such well-know and established algorithms.
>
> 2) drawing the contours on the web page:
> a) the first ugly way to do this is to just ask the author for an
> image with white pixels over a black background. I think this is
> efortless but poses many problems (low resolution, no scaling, etc).
> b) Ask the user to draw in a vectorial format like eps or svg. As far
> as I know, svg support varies too much across browsers. (correct me
> please if I'm wrong)
> c) ask the author for a description of the curve as in 1c) and render
> it using javascript of whatever we like. Here we need a precise
> definition of the curve, as I guess we don't want to recode that part
> for each new demo.
> d) I think in general this should be our concern, not the authors.
>
> Personally, I would go for the svg, but sadly technology is not on our side yet.
> What do you think? Is there any hack to make an svg look the same in
> different browsers?
>
> Thanks in advance.
> Best regards,
> Juan
> _______________________________________________
> discuss mailing list
> discuss at list.ipol.im
> http://tools.ipol.im/mailman/listinfo/discuss
>
More information about the discuss
mailing list