http://gen-img-dec.svn.sf.net/viewvc/gen-img-dec/gid.ads?view=markup&pathrev=2
I've discovered the possibility of an Inline pragma to a procedure
listed in a generic formal part. At least GNAT and ObjectAda don't
protest on that, so probably it makes some sense...
G.
The first question which comes up in mind is: where do you want to use
it for?
Is it an initial step for your Ada based browser?
The 2nd question is more basic, are you write the load image functions
in Ada or use bindings to existing libraries (like the JPEG one)?
Basically all pixel based images are a block of memory. The one which
are 8 bit based use normally a Palette (like GIF and 8-bit BMP). The
full color versions (JPEG, 24-bit BMP) use 3 or 4 byte per pixel (4th
one is in general the alpha channel) in a memory map. So that can easily
be modeled.
If it is for a browser, you can forget about the 1-, 2- and 4-bit images.
So how will be your real image data be modeled?
Do you plan to just use a 24-bit with alpha channel format and convert
lower grade images (like GIF) into this format?
Or do you want to represent the different image types also in you data
model?
just some feedback,
Andr�
If it helps plan, I have an almost complete thin OpenCV binding at
projectlets.sourceforge.net
IMHO if the intent is to support Image Processing algorithms, then
OpenCV or itk would be the libraries to model after and possibly
support to leverage.
Cheers, srini
Have you thought about supporting the FITS (http://
fits.gsfc.nasa.gov/) format?
-Brian
> The first question which comes up in mind is: where do you want to use
> it for?
> Is it an initial step for your Ada based browser?
Many things, from image manipulation without display, loading of
textures for GL (there it would replace the "input" part of the GL.IO
provided with GLOBE_3D), display into a rectangle of a GUI system and
an in-memory cache (good guess: for a browser :-) ),...
> The 2nd question is more basic, are you write the load image functions
> in Ada or use bindings to existing libraries (like the JPEG one)?
The whole would be in Ada. The code already exists for GIF, BMP, TGA,
in different places. The decompression for PNG can be taken from
UnZip.Decompress. JPEG is a bit trickier.
There are "Pascal" sources that could be used, perhaps.
> Basically all pixel based images are a block of memory. The one which
> are 8 bit based use normally a Palette (like GIF and 8-bit BMP). The
> full color versions (JPEG, 24-bit BMP) use 3 or 4 byte per pixel (4th
> one is in general the alpha channel) in a memory map. So that can easily
> be modeled.
> If it is for a browser, you can forget about the 1-, 2- and 4-bit images.
>
> So how will be your real image data be modeled?
> Do you plan to just use a 24-bit with alpha channel format and convert
> lower grade images (like GIF) into this format?
> Or do you want to represent the different image types also in you data
> model?
The color model is 24-bit. Palettes will be decoded.
The transparent pixels in GIF will have alpha=Opacity_range'First and
the others will have Opacity_range'Last.
All the rest (basically, the choice of the memory model, and what to
do with transparency) is left to the user.
For instance GL.IO will keep its model: a data buffer, which is sent
to GL via Insert_into_GL.
But decoded pixels might be even directly sent to a "screen" or a GUI
object if it makes sense (e.g when decoding an interlaced PNG to a
visible image on a Web page), without any Ada storage of the image.
> just some feedback,
> André
Thanks for it!
Gautier
> Have you thought about supporting the FITS (http://fits.gsfc.nasa.gov/) format?
Until now, not, but I've of course added it to the [wish] list of
formats.
Thanks!
Gautier
> On May 2, 11:19�am, Andre <avsa...@hotmail.com> wrote:
>
>> The first question which comes up in mind is: where do you want to use
>> it for? Is it an initial step for your Ada based browser?
>
> Many things, from image manipulation without display, loading of
> textures for GL (there it would replace the "input" part of the GL.IO
> provided with GLOBE_3D), display into a rectangle of a GUI system and
> an in-memory cache (good guess: for a browser :-) ),...
Do you plan image processing stuff? I have somewhere half-written pyramid
and region-growing segmenting in Ada.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
> Do you plan image processing stuff?
Not yet - maybe one day...
> I have somewhere half-written pyramid and region-growing segmenting in Ada.
Sounds good!
G.
> Have you thought about supporting the FITS (http://fits.gsfc.nasa.gov/) format?
Do you know what maximum color depth there is with FITS ?
I guess it might be more than 255 per fundamental color, but I got
lost in the docs.
Perhaps I should let this 255 boundary as a generic parameter as well.
Gautier
If it's not just for viewers, but also for photography and graphic arts,
it would be well worth supporting 16-bit per channel colour depths.
(Some scanners are 12-bit but that is often padded to 16 anyway.)
- Brian
Generic handling at the pixel level will surely be slower than direct
coding that knows what it's operating on, and that will be an issue
if there's any significant pixel level processing. CLAW uses tags to
distinguish images with different memory layouts, so image processing
dispatches to the correct code for the image at hand.
Picture : Claw.Bitmaps.Root_DIBitmap_Type'Class
:= Claw.Bitmaps.Root_DIBitmap_Type'Class'Input(Stream);
The different images have arrays of, e.g.,
for RGB555_Color_Type use record
Blue at 0 range 0 .. 4;
Green at 0 range 5 .. 9;
Red at 0 range 10 .. 14;
Alpha at 0 range 15 .. 15;
end record;
for Triple_Color_Type use record
Blue at 0 range 0 .. 7;
Green at 1 range 0 .. 7;
Red at 2 range 0 .. 7;
end record;
But is your package aimed more at processing images, or at doing IO on
the myriad file formats of images? And how about video?
> Generic handling at the pixel level will surely be slower than direct
> coding that knows what it's operating on, and that will be an issue
> if there's any significant pixel level processing.
Not necessarily if the generics are properly inlined (perhaps you are
thinking of shared generics).
The range of primary colors is now a generic parameter too. So there
will be tests like "if Color_Range'Last=255 then..." which will be
resolved at compile-time by smart compilers.
[...]
> But is your package aimed more at processing images, or at doing IO on
> the myriad file formats of images?
Only decoding images of various formats, that's all!
> And how about video?
This is not excluded. Probably I'll add an out parameter,
time_of_next_frame, to the Load_image_contents procedure.
_________________________________________________________
Gautier's Ada programming -- http://sf.net/users/gdemont/
Interesting idea. What you are proposing looks to me like a sort
of binding to various image libraries, in that you provide basic
image reading/writing to a variety of formats. Of course, you
can't handle all the special features of each image format, but
for an application that just needs to read or write the pixels
and a few other basics like palettes, alpha etc, the approach
would be useful. I can speak from experience of developing PNG_IO
to say that handling any non-trivial format is not a small task.
BMP is pretty easy - TIFF is probably the hardest to handle. In
both PNG and TIFF the pixel data is stored in disparate pieces
within the file - not as a single block of pixel data. In the
case of PNG the compression runs across these blocks, not within
each block. What this means is that code for handling the pixel
data can't easily be common to different types of image file.
You have available an Ada package for PNG already in PNG_IO.
I've thought about GIF as a student project now that the
compression is no longer subject to patent protection, but no
work has been done on it yet.
Steve Sangwine
You can have a look via a svn checkout:
svn co https://gen-img-dec.svn.sf.net/svnroot/gen-img-dec gid
and with gnatmake -P gid.gpr
It builds ./test/to_bmp on your platform.
Note: there is a "Fast" mode in the gid.gpr project file!
Gautier