.sid/.jp2 image to XImage

For discussion of LizardTech's free Decode SDK for MrSID and JPEG 2000.

Moderator: jskiffington

.sid/.jp2 image to XImage

Postby BrianP » Thu Jan 14, 2010 1:42 pm

Looking for a little advice. I have a collection of .sid and .jp2 images (both are the same, I have them in both formats). I was hoping to use the .sid images since they are lossless.

Anyway, in the end I need the images as a XImage so I can display them in my motif application. I was doing something like (this is kind of combination of v4 and v7 code, I haven't ported completely).

J2KImageReader *reader = J2KImageReader::create();
reader->initialize(fileSpec, false);
const LTIScene scene(x, y, w, h, 1.0);
LTISceneBuffer bufData(reader->getPixelProps(), w, h, bufs);
reader->read(scene, bufData);

Then convert the image to RGB pixel to pixel
red = static_cast<lt_uint8*>(bufs[0])[count];
green = static_cast<lt_uint8*>(bufs[1])[count];
blue = static_cast<lt_uint8*>(bufs[2])[count];
rgb[pixelX][pixelY] = adt::RGB((unsigned char)red, (unsigned char)green, (unsigned char)blue);

Then using XPutPixel() to create my XImage.

This is terribly slow (at least the v4 SDK was. I haven't finished the port to v7 yet). Especially in the size image files I am using.

I am just now starting to look at the v7 SDK. And it sounds like I might be able to do something with LTIViewerImageFilter but I am not completely sure.

Any random thoughts here for a good way to make the connection?

- Brian
BrianP
 
Posts: 10
Joined: Thu Jan 14, 2010 8:27 am

Postby gat » Thu Jan 14, 2010 2:33 pm

Our support for ximage is very limited(in fact we don't provide support for other products in general) but someone mentioned the following:

The key is to convert the BSQ sceneBuffer to BIP and then pass the BIP buffer the to the XCreateImage call.

I hope that helps. Pixel by pixel is certainly going to be slow.

Update - you can use:
LTISceneBuffer::exportDataBIP()
to do the BSQ->BIP
gat
 
Posts: 28
Joined: Mon Jan 12, 2009 12:41 pm


Return to SDKs

Who is online

Users browsing this forum: No registered users and 1 guest