working with raw image files

Dave Angel davea at ieee.org
Tue Jun 14 22:13:33 EDT 2011


On 01/-10/-28163 02:59 PM, kafooster wrote:
> On 15 Cze, 01:25, Dave Angel<da... at ieee.org>  wrote:
>> On 01/-10/-28163 02:59 PM, kafooster wrote:
>>
>>> On 14 Cze, 22:26, MRAB<pyt... at mrabarnett.plus.com>    wrote:
>>
>>>> Multiply the numpy array by a scaling factor, which is
>>>> float(max_8bit_value) / float(max_16bit_value).
>>
>>> could you please explain it a little? I dont understand it. like
>>> multiplying each element?
>>
>> You said in an earlier message to ignore the RAW format.  However, if
>> your file matches a typical camera's raw file, there are several problems:
>>
>> 1) the data is typically 12 to 14 bits per pixel, only rarely 16 (very
>> expensive cameras)
>> 2) the data does not have R, G and B values for each pixel, but only one
>> of these.  The others are generated by Bayer interpolation.
>> 3) the data is linear (which is what the hardware produces), and
>> traditional image data wants to be in some non-linear color space.  For
>> example, most jpegs are sRGB 8*3 bits per pixel.
>>
>> The first would mean that you'd need to do a lot of shifting and
>> masking.  The second would mean a pretty complex interpolation
>> algorithm.  And the third would require an exponential function at the
>> very least.
>>
>> DaveA
>
> well, I am only working with grayscale MRI medical images(mainly 8 or
> 16bits), saved as .raw. I do not need to worry about rgb.
>

Well, since you've already gotten results you like (per another msg from 
you), the gamma adjustment must already be made.  So they're an entirely 
different meaning of raw than used by DSLR's, for example.

Glad it's working for you.

DaveA



More information about the Python-list mailing list