Velocity Reviews

Velocity Reviews (
-   Java (
-   -   Fast Image Construction (

Aaron Birenboim 01-27-2006 03:32 PM

Fast Image Construction
I'm looking for a FAST way to create a java.awt.Image from a (2D) array
of unsigned char data from C.
It would be nice if I could supply a 256 element pseudo-color table.

I'm having a heck of a time finding a reasonable way to do this.
Everything seems to want to work from .JPG or .PNG files, etc...
not a raw data buffer derived from a C app.

Is the easiest way to do this to make some sort of DataBuffer in
memory containing a BMP description of the image.
(I think BMP has a indexed image mode)

I will probobally (eventually) want some sort of WritableRaster
sub-class of Image. At first, just displaying the image will be
sufficient. Eventually, I may want to draw some "overlays" on
the image. (Like plot an X over the computed centroid point...)

I would think that looping through, and setting pixels ONE AT A TIME
on a WritableRaster would be innefficient.

Right now, C is quantizing the 2D array into unsigned char.
I could move the interface down a level and let Java
quatize and colorize from the original float 2D array.
(We often have non-linear mappings like histogram equalization)

JAI may be the answer, but I fear that it is a bit high-level for me.
I'm not looking for convolutions, etc. Just display the pixels!


All times are GMT. The time now is 04:23 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.