Image.read decoder selection
"Robert H. Olsen" <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.help |
|---|---|
| Message-ID | <[email protected]> |
I am using GraphicsMagick to manipulate images captured from a GigE camera.
The data is raw pixel intensities. Either 8 bits of intensity data
stored in a single byte,
of 12 bits of data stored in 16 bits, LSBEndian.
Once the data is captured I have it in a Blob.
Here is some code:
Image gmimage;
try {
// grayscale image
printf("GRAYSCALE\n");
gmimage.depth(bpp); // bpp is either 8 or 12...
gmimage.endian(LSBEndian);
gmimage.read(blob,Geometry(width, height),"GRAY");
.....
catch( Exception &gmerror_ ) {
printf("copyThread caught exception: %s\n", gmerror_.what());
pAdo->UnlockAfterCopy();
pthread_exit(&retval);
// return;
}
This works most of the time, but occasionally I get messages like these,
apparently triggered by the read():
copyThread caught exception: Magick: Image column or row size is not supported () reported by coders/viff.c:428 (ReadVIFFImage)
copyThread caught exception: Magick: Improper image header () reported by coders/dib.c:512 (ReadDIBImage)
copyThread caught exception: Magick: Improper image header () reported by coders/pcx.c:429 (ReadPCXImage)
I couldn't find where different coders might be selected by the read().
Is "GRAY" the wrong choice for this type of raw data? Is the code maybe
looking at the first few bytes for a clue to the format and occasionally
finding a coincidental match for a known type? Is there some way I can
force it to not do that? I was thinking I might force the first few
bytes to zero or something like that, but it might take a while before I
could confidently say that such a changed fix things -- the error
doesn't happen consistently. And I would rather do things the 'right'
way, if there is a better way than what I am doing now.
Thanks in advance for any suggestions.
Rob
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot