Harnessing the Perl Goodness of The Gimp in the Name of Biologyby Arguile (Hermit)
|on Jun 09, 2003 at 06:23 UTC||Need Help??|
As requested in CB, some clarification...
From what you’ve said you’ll be hand drawing outlines of what you believe to be the extent of each species boundry; even if another species happens to be overgrowing that boundry to some extent. In this case you’ll be guessing the exact extent and copying that whole area into a new image.
What I propose is creating a layer or channel** for each species in the image. So for each species:
This will essentially give you a one bit mask that represents the living area of each species. The layers can all overlap without interfering with each other. In addition all the data is stored in one file, easy to keep track of or change.
This could also work very well for quick visual surveys if you wanted to get fancy. Assign each species-layer a colour and then turn the ones of interest on with a high transparency. You’ll see a montage of interacting colour representative of that species living areas and their overlaps.
Anyways, enough talk. On to some code!
Adding a zillion layers (one for each specie) to each image would be boring manual work (colouring will be boring enough), so in the above partial snippet we let a Gimp script do that for us. In production you’d probably pull this from a file or database. Anything else you'd normally do to preprocess the image could be done here as well, for example autolevels or auto contrast.
It’s late, so I think I’ll stop here. For now I’ll leave you with some reference material to look over.
** Layers and channels are different, which you use will depend on exactly what you want to do with it. If all you need is a one bit mask then channels would be your best choice. For simplicity sake I’ll refer to the choice as layers throughout the post.
*** Spiffy title eh? :)