[Gimp-developer] Script-fu primitive wishlist: islands, integrals/sums, and data files
David Gowers
00ai99 at gmail.com
Fri Oct 31 07:32:14 PDT 2008
Hi Adam,
On Fri, Oct 31, 2008 at 9:51 PM, Adam C Powell IV <hazelsct at debian.org> wrote:
> Greetings,
>
> I am working on an image processing plug-in (which I'll offer for
> upstream contribution BSD-licensed), and would really like to have a
> couple of primitives that I can't find.
>
> One is finding "islands" in an image: take a channel and create new
> layers each with one contiguous region in the channel. So if the
> channel has ten islands, create ten new layers, each with one of the
> islands. Since this could be unwieldy (too many new layers), one new
> layer with one island would suffice; one could then process that island
> layer, subtract it from the original, and move on.
>
> Another is integrals: zero, first and second moments, or alternatively,
> integrals/sums of channel intensity, x- and y-weighted intensity, and
> x^2, y^2 and xy-weighted intensity. This lets me fit an ellipse to an
> island, and then display major and minor axes.
>
> Finally, opening and storing data files. I'd like to be able to create
> a CSV file with statistics of the islands: size, centroid, aspect ratio
> (major/minor axis ratio), major axis orientation. One could then
> further process these statistics in a spreadsheet or other program.
>
> I can do the first two in scheme, though it would be slow, but tolerable
> for my needs. I don't see a script-fu primitive which would let me do
> the last.
>
> If there are other packages which can do this, that would be helpful.
> But having it in the same program/UI as GIMP, with all of its other
> image manipulation tools, and with its presence across platforms, would
> be even better. I'd love to have your ideas.
It sounds like you might find working with the combination of
Gimp-Python, NumPy and SciPy more effective.
integration,definitely. Islands, possibly (a browse through
http://scipy.org/scipy/scipy/browser/trunk might help you to find out.
And Python has a CSV module as standard.
I had the impression that writing external files was not supported by
Script-Fu; I'm sure Kevin Cozens could tell you.
Hope that helps,
David
More information about the Gimp-developer
mailing list