[GIL] GIL and FreeImage interaction sample code suggestions ?
Hi, FWIW I'm considering boost GIL to implement the few image algorithms I need, and I need proper image I/O on top of that. As I'm using FreeImage in my current codebase, I thought about exposing FreeImage image memory layout to GIL. You can find the, quite simplistic, source code here : http://code.google.com/p/rotoglup-scratchpad/source/browse/trunk/rtgu/image_... http://code.google.com/p/rotoglup-scratchpad/source/browse/trunk/rtgu/image_... http://code.google.com/p/rotoglup-scratchpad/source/browse/trunk/rtgu/image_... I created a 'borrowed_image' class that mimics the behaviour of gil::image : it is not allocating memory itself, it takes an existing memory buffer and a 'deleter' (under the form of a boost::shared_ptr<void>) as input. This allows to use directly the memory allocated by FreeImage, avoiding extra copy, in case of file input. Feel free to use the code as a starting point, if you have similar needs, and I'd be glad to have comments about the concept of 'borrowed_image' class, and about its interface, as I feel I'm missing something. Cheers, Nicolas.
Nicolas, glad you like using boost::gil. Did you notice that gil comes
with an io extension? Also, what image formats can your extension read
and write?
Regards,
Christian
On Wed, Sep 2, 2009 at 11:16 AM, Nicolas Lelong
Hi,
FWIW I'm considering boost GIL to implement the few image algorithms I need, and I need proper image I/O on top of that.
As I'm using FreeImage in my current codebase, I thought about exposing FreeImage image memory layout to GIL. You can find the, quite simplistic, source code here :
http://code.google.com/p/rotoglup-scratchpad/source/browse/trunk/rtgu/image_... http://code.google.com/p/rotoglup-scratchpad/source/browse/trunk/rtgu/image_...
http://code.google.com/p/rotoglup-scratchpad/source/browse/trunk/rtgu/image_...
I created a 'borrowed_image' class that mimics the behaviour of gil::image : it is not allocating memory itself, it takes an existing memory buffer and a 'deleter' (under the form of a boost::shared_ptr<void>) as input. This allows to use directly the memory allocated by FreeImage, avoiding extra copy, in case of file input.
Feel free to use the code as a starting point, if you have similar needs, and I'd be glad to have comments about the concept of 'borrowed_image' class, and about its interface, as I feel I'm missing something.
Cheers,
Nicolas.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
From my point of view, it lacks of documentation and of supported file
Christian,
yes I noticed the gil::io extension, even if I do not follow it closely.
formats.
My intent is not really to provide a GIL extension, but some bindings to the
FreeImage library, which has been around for many years now. You can find
its feature list (and supported formats) here :
http://freeimage.sourceforge.net/features.html
Cheers,
Nicolas.
On Wed, Sep 2, 2009 at 5:35 PM, Christian Henning
Nicolas, glad you like using boost::gil. Did you notice that gil comes with an io extension? Also, what image formats can your extension read and write?
Regards, Christian
Freeimage has a lot of nice features which are missing in GIL. I, myself, have written some extensions for GIL. For instance, for OpenCV or SDL. You can have a look right here. http://gil-contributions.googlecode.com/svn/trunk/gil_2/ In case you want to supply a Freeimage extension for gil I would like to ask you to prepare similar structure I did. Let me know if you have any questions. Regards, Christian
participants (2)
-
Christian Henning
-
Nicolas Lelong