Converting 12bit Tiff from Photron Highspeed camera.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Ludvig Friberg
Posts: 5
Joined: 2012-02-23T07:56:57-07:00
Authentication code: 8675308

Converting 12bit Tiff from Photron Highspeed camera.

Post by Ludvig Friberg »

Hi!

I have been searching for a solution to display this series of tiff images correctly. The user has pushed some wrong buttons in the software that converted the files from raw bayer. The original bayer raw is gone. All we have left is these strange tiff files. They appear to be RGB 12 bit tiff. All software I have tried so far displays them wrong.

www.sementbetong.no/temp/12bit.tif

Perhaps ImageMagick can save the day!

Best Regards

Ludvig Friberg
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting 12bit Tiff from Photron Highspeed camera.

Post by fmw42 »

try this

convert 12bit.tif -depth 16 -auto-level 12bit_al16b.tif

or

convert 12bit.tif -depth 8 -auto-level 12bit_al8.tif
Ludvig Friberg
Posts: 5
Joined: 2012-02-23T07:56:57-07:00
Authentication code: 8675308

Re: Converting 12bit Tiff from Photron Highspeed camera.

Post by Ludvig Friberg »

I tried it but it looks the same. Perhaps the file is just written in this corrupt way?

anyway here is the result
Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting 12bit Tiff from Photron Highspeed camera.

Post by fmw42 »

Yes, that is the results that I got also.
Ludvig Friberg
Posts: 5
Joined: 2012-02-23T07:56:57-07:00
Authentication code: 8675308

Re: Converting 12bit Tiff from Photron Highspeed camera.

Post by Ludvig Friberg »

Is there anything that can be explored with how the 4096 values are stored in the 16 bit space? Is there some standard ways of restoring this data that I could try?

Best regards

Ludvig
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting 12bit Tiff from Photron Highspeed camera.

Post by fmw42 »

Ludvig Friberg wrote:Is there anything that can be explored with how the 4096 values are stored in the 16 bit space? Is there some standard ways of restoring this data that I could try?

Best regards

Ludvig

Someone more knowledgeable about tif than me would have to answer that.
Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: Converting 12bit Tiff from Photron Highspeed camera.

Post by Jason S »

I examined the file, but I'm having trouble making sense of it. It does not seem to be a simple byte/nibble ordering problem.

If you could provide samples of a single image saved in both the 12-bit format, and in a portable format, that might help.
Ludvig Friberg
Posts: 5
Joined: 2012-02-23T07:56:57-07:00
Authentication code: 8675308

Re: Converting 12bit Tiff from Photron Highspeed camera.

Post by Ludvig Friberg »

well the problem is I dont have the raw file anymore. I could try to replicate the problem with a different file though. What do you mean by portable?
Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: Converting 12bit Tiff from Photron Highspeed camera.

Post by Jason S »

Portable = something that ImageMagick can read.
Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: Converting 12bit Tiff from Photron Highspeed camera.

Post by Jason S »

Unfortunately, I think the image is damaged, and probably cannot be recovered in an automated way.

For example, here's a binary representation of a run of blue samples near the start of the image:

Code: Select all

 ...
 010001111001
 010001110011
 010000111111
 010000011001
 011111111100
 011111101110
 010000011010
 010000111010
 ...
The sudden jump from 010000011001 (1049) to 011111111100 (2044) is surely wrong. The 2nd-most significant bit has erroneously been turned on, or maybe the value has been left-shifted by one bit.

This same problem with the 2nd-most significant bit happens many times, for all colors. But it doesn't always happen. Maybe a program could be written to guess which samples are wrong, based on the sudden jumps, and try to correct them. But it would not be perfect, and I don't know whether that's the only problem.
Ludvig Friberg
Posts: 5
Joined: 2012-02-23T07:56:57-07:00
Authentication code: 8675308

Re: Converting 12bit Tiff from Photron Highspeed camera.

Post by Ludvig Friberg »

Wow...

Thank you so much, this has got to be the most helpful forum ever!

I would never have found this out myself, these things can really haunt me and finally I can put this to rest.

Best Regards

Ludvig Friberg
Post Reply