View previous topic :: View next topic |
Author |
Message |
Adam
Joined: 01 Dec 2006 Posts: 61 Location: Sequim, WA
|
Posted: Mon Dec 04, 2006 8:53 pm Post subject: support for 32 bit images |
|
|
I interact with some imagery people who have to use weirdly inflexible software, and sometimes produce >16 bit images. Preview can read some of them, surprisingly, so I just saved one from Preview as 8 bit TIFF. DT can't read that one, either, so we're trying to figure out another workaround. |
|
Back to top |
|
 |
David Site Admin
Joined: 25 Nov 2006 Posts: 1971 Location: Chapel Hill, NC
|
Posted: Mon Dec 04, 2006 9:51 pm Post subject: |
|
|
Can you send me a sample image? I can read 16 bit images, and it is easy to implement a 32bit per channel "2D Bitmap" object. I would then also add this to DTBitmap2D so you can hand them to external programs. Are these floats or 32 bit integers?
David |
|
Back to top |
|
 |
Adam
Joined: 01 Dec 2006 Posts: 61 Location: Sequim, WA
|
Posted: Mon Dec 04, 2006 10:29 pm Post subject: |
|
|
David wrote: | Can you send me a sample image? I can read 16 bit images, and it is easy to implement a 32bit per channel "2D Bitmap" object. I would then also add this to DTBitmap2D so you can hand them to external programs. Are these floats or 32 bit integers?
David |
The file is supposed to have floats; I'll post something to our file transfer service and send you the link. We finally used an ESRI ASCII grid file, which works fine. |
|
Back to top |
|
 |
Adam
Joined: 01 Dec 2006 Posts: 61 Location: Sequim, WA
|
Posted: Mon Jan 15, 2007 1:53 pm Post subject: |
|
|
I thought I'd take a look at this myself. I can read in the 32 bit float tiff using ImageIO, create a CGImageRef in a CIContext, and write that back out to disk with no apparent loss. Hence, I'm convinced that I'm reading the image OK.
My problem now is in converting that image to either a 2D Mesh (as grayscale), or a 2D Bitmap. I tried creating an NSBitmapImageRep and using -[NSBitmapImageRep getPixel:atX:y], but I seem to end up with an 8 bit image.
I'm not used to working with raw pixel data, but presumably I need to get the actual buffer that I passed to CGBitmapContextCreate and then stuff those pixel values into a DTMutableFloatArray (for the grayscale route). Does that sound right? Or am I making this way too hard? |
|
Back to top |
|
 |
Adam
Joined: 01 Dec 2006 Posts: 61 Location: Sequim, WA
|
Posted: Tue May 29, 2007 3:55 pm Post subject: |
|
|
I finally had to get this working for a couple of projects, and it turned out to be pretty easy for 32 bit grayscale images; extending it to multichannel images should be easy enough.
I'm passing a GeoTIFF as filename to an external program, creating an NSBitmapImageRep from it, and returning a DTMesh2D. By linking with libtiff/libgeotiff, I'm also able to read the origin and pixel size directly, so the returned mesh is properly georeferenced. If anyone's interested, I can post code snippets. -[NSBitmapImageRep getPixel:atX:y:] was /not/ a good way to do this. |
|
Back to top |
|
 |
|