ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Why are both raw and jpg are ie24RGB?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

tedfine

10 Posts

Posted - Oct 28 2017 :  10:03:31  Show Profile  Reply
I need some help understanding camera raw formats.

TIEBitmap.Read opens both CR2 and jpg images as ie24RGB. That means 8 bits for each R, G, and B.

IrfranView agrees that both images are 24 bits/pixel.

8 bits for each color means that the range for each color is 0..255.

I thought that raw images had a maximum pixel depth (on the camera) far greater than 255.

How are camera raw images any better than plain jpgs if the R, G, and B values on both are limited to 255 maximum?

Why do I ask? I'm trying to create tool for photographers in dim lighting conditions to determine how over-exposed (and thus losing data to pixel wells on the sensor being full) or under-exposed (and thus bad SNR) their image is. This would be just like the histogram demo program.



Uwe

284 Posts

Posted - Oct 28 2017 :  15:43:15  Show Profile  Reply
Check out TImageEnIO -> NativePixelFormat in the online documentation.

"By default, ImageEn converts all paletted images to 24 bit (true color). Only black/white images are stored in the original format with 1 bit per pixel. Setting NativePixelFormat to True disables the conversion and uses the image's native format."


Uwe
Go to Top of Page

tedfine

10 Posts

Posted - Oct 28 2017 :  21:05:34  Show Profile  Reply
Hi, Uwe, Thanks for the helpful answer. Glad to hear I wasn't totally confused, just partially confused! :-)

Questions about my code below:

1. Where can I find LegacyBitMap since I'm not using ImageEndView (or must I use it?)
2. Should PF be ie24RGB after loading?

Thanks again for your help!

Ted

var
  bmp: TIEBitmap;
  ImageEnIO: TImageEnIO;
  PF: TIEPixelFOrmat;
begin
  Screen.Cursor := crHourGlass;
  bmp := TIEBitmap.Create;
  bmp.ParamsEnabled := TRUE;
  bmp.Params.RAW_QuickInterpolate := TRUE;  // <--- Is this necessary?

  ImageEnIO := TImageEnIO.CreateFromBitMap(bmp);
  ImageEnIO.NativePixelFormat := TRUE;
  ImageEnIO.LoadFromFile('C:\testfiles\i.cr2');
  PF := ImageEnIO.IEBitmap.PixelFormat;


Go to Top of Page

Uwe

284 Posts

Posted - Oct 29 2017 :  15:07:54  Show Profile  Reply
Ted, why don't you use something along these lines?


procedure WorkOnImage(View: TImageEnVect);
begin
  {...}
  with View.IO do
  begin
    NativePixelFormat := True;
    {...}


If you set NativePixelFormat to True then it makes no sense to use ie24RGB after loading. The format is set automatically depending on the image's native pixel format. For obvious reasons, using NativePixelFormat will often result in very dark images depending on their color depth.

In case you only want to read out the color depth of the image, use GetImageDetails.

https://www.imageen.com/help/GetImageDetails.html


You will only need RAW_QuickInterpolate if you want a fast, low-quality color interpolation.


Hope this helps
Uwe
Go to Top of Page

xequte

39053 Posts

Posted - Oct 29 2017 :  20:31:47  Show Profile  Reply
Hi

Using ImageEnIO.NativePixelFormat (or with IEBitmap.ParamsEnabled = true, setting IEBitmap.IsNativePixelFormat to true) will load the Raw images as 48 bpp (16 bits per sample).

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: