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
 LibRaw question
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

MikeyC

USA
11 Posts

Posted - May 16 2018 :  16:09:35  Show Profile  Reply
In my software, I need the ability to load a raw photo with no color matrix manipulation using LibRaw. In DCRAW, you could do that by specifying the -o 0 parameter. I believe in LibRaw, the equivalent would be output_color set to zero.

Is there a way to do that? I've tried specifying a number of things in the raw_extraparams string but they don't seem to do anything (with LibRaw enabled anyway).

In addition, the parameters raw_red_bias and raw_blue_bias don't seem to do anything (they are always 1.0). I would expect them to change the white balance if set <> 1.0 before the load and also indicate the camera values if UseCameraWB is true (after the load).

Regards,
Mike

Mike Chaney

xequte

39053 Posts

Posted - May 17 2018 :  19:14:34  Show Profile  Reply
Hi Mike

In 8.0.0 (ready in a couple of weeks) you can use the new property RAW_OutputColorSpace. If you set:

ImageEnView.IOParams.RAW_OutputColorSpace := iercsRAW;

This is the same as using "-o" parameter.

Regarding "raw_red_bias" and "raw_blue_bias", do you mean the RAW_RedScale and RAW_BlueScale properties? They work correctly in our testing:

ImageEnView.IOParams.RAW_RedScale := 0.2;



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

MikeyC

USA
11 Posts

Posted - May 22 2018 :  12:58:58  Show Profile  Reply
OK. Thanks. I did mean RAW_RedScale and RAW_BlueScale but those don't do what I would expect. They seem to actually scale the size of the image rather than scaling the WB multipliers so you end up with the red and blue planes not aligned with the green. Maybe I was expecting them to do something they weren't designed to do?

The other thing I've found is that TIOParams.read seems to be very slow. I think it might be because all of the EXIF data is being read instead of what I was using in DCraw that only read the essentials such as make, model, shutter, and a few others. It doesn't really show up until you are processing a folder of a few dozen raws, but is there a way to tell the read command to load fewer parameters? Or any way to spead up the read?

Thanks again,
Mike

Mike Chaney
Go to Top of Page

xequte

39053 Posts

Posted - May 23 2018 :  17:29:18  Show Profile  Reply
Hi Mike


Regarding the RAW_RedScale and RAW_BlueScale query, can you please supply your test image and advise what you are trying to achieve.

In our testing EXIF processing has a negligible effect on speed, can you show me the code you are using to test.




Nigel
Xequte Software
www.imageen.com
Go to Top of Page

MikeyC

USA
11 Posts

Posted - May 24 2018 :  12:18:08  Show Profile  Reply
Thanks Nigel,

I've solved the red and blue scaling by doing the scaling myself but I'm still having issues with the EXIF reading being slow. The code that I'm using is simple:

iop:=TIOParams.create(nil);
if iop.read(filename) then
<code to process params>

The single statement iop.read(filename) takes about 200ms on a decently equipped 3.8 Ghz octocore AMD machine. 200ms might not seem that bad but if you are reading EXIF info for say 100 raw photos while processing thumbs in order to sort by EXIF date, that's 20 seconds just to read the EXIF info for 100 raws. The speed issue only seems to be a problem with raw photos.

All raw photos seem to take the same ~200ms but here's one I've been working with if you need one to test:

https://www.imaging-resource.com/PRODS/sony-a7/AA7hVFAI00100.ARW.HTM

Regards,
Mike

Mike Chaney
Go to Top of Page

xequte

39053 Posts

Posted - May 24 2018 :  23:24:54  Show Profile  Reply
Hi Mike

In v8.0.0 you will be able to disable meta-data loading. It makes it approx twice as fast when getting file info for RAW images in my testing

var
  io: TImageEnIO;
begin
  IEGlobalSettings().UseLibRaw := True;
  io := TImageEnIO.create(nil);
  io.Params.GetMetaData := False;
  io.ParamsFromFile( 'C:\image.arw' );
  ... Do something with params ...
  io.free;
end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

MikeyC

USA
11 Posts

Posted - May 25 2018 :  12:51:04  Show Profile  Reply
Sounds good! Thanks for the help. I did notice one more anomaly in my testing. When you set params.RAW_Interpolation:=ieRAWInterpolationDCB for loading a raw via LibRaw, it seems to use about 5x more memory than I would expect. That's the best interpolation method and I'd like to use it but it uses 840MB of memory just to open the raw file on a 24 megapixel raw. For a 24 megapixel raw, I'd expect it to use maybe 150MB max if you are using NativePixelFormat. The other methods seem to use around that value but params.RAW_Interpolation:=ieRAWInterpolationDCB uses many times that. Don't know if that's something that can be addressed.

Regards,
Mike

Mike Chaney
Go to Top of Page

MikeyC

USA
11 Posts

Posted - May 26 2018 :  09:54:17  Show Profile  Reply
In 8.0.0, do you think it would be possible to implement LibRaw's user WB parameter?

float user_mul[4];
dcraw keys: -r mul0 mul1 mul2 mul3
4 multipliers (r,g,b,g) of the user's white balance.

This would allow you to set mul0, mul1, mul2, mul3 to 1.0 to get a raw photo as shot (with no white balance), allow the user to click on a spot to white balance, and calculate your own mul0, mul1, mul2, mul3 to set for the next load.

Thanks,
Mike

Mike Chaney
Go to Top of Page

MikeyC

USA
11 Posts

Posted - May 27 2018 :  10:16:36  Show Profile  Reply
One more thing that would be nice to have in the next release is the ability to extract the camera generated JPG. DCraw could do that: it's typically an embedded JPEG that is 1/4 the size of the raw. I typically use that function when generating thumbnails because it loads almost as fast and it isn't the tiny size of a thumbnail which are typically 160x120 or 320x240, etc.

Mike

Mike Chaney
Go to Top of Page

xequte

39053 Posts

Posted - May 29 2018 :  02:58:27  Show Profile  Reply
> Would it be possible to implement LibRaw's user WB parameter?

We've added RAW_UserWhiteBalance to 8.0.0.


> When you set params.RAW_Interpolation:=ieRAWInterpolationDCB for loading a raw via LibRaw,
> it seems to use about 5x more memory than I would expect.

Interpolation is performed by LibRaw so we cannot do anything about that.


> Add the ability to extract the camera generated JPG.

This is already supported. When you enable GetThumbnail it actually gets the embedded JPEG (not the thumbnail) from dcraw and libraw, which will be something like a 700x500 image.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

MikeyC

USA
11 Posts

Posted - May 29 2018 :  10:31:21  Show Profile  Reply
Thanks for the great support! On the topic of getting the camera JPEG, I must be doing something wrong. I can set GetThumbnail to true and load the raw either via TImageEnIO.loadfromfile or TIOParams.read and the image I get is always the EXIF thumbnail (160x120). I'm not getting the camera JPEG like I do from DCraw. Maybe I'm not using the proper function(s)?

Thanks again

Mike Chaney
Go to Top of Page

xequte

39053 Posts

Posted - May 29 2018 :  18:53:24  Show Profile  Reply
Hi Mike

In my testing today, I could not find many images that included a higher resolution preview. Do you have some test images that include a preview, but you are not seeing that with ImageEn?


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PixAndMore

Germany
7 Posts

Posted - May 30 2018 :  03:20:18  Show Profile  Reply
Hi Nigel,

I have the problem that no image is loaded when I set:
GetThumbnail := True;
UseLibRaw := True;

Example Image:
https://cloud.xatosch.de/index.php/s/FENFqbJMgtow5WL

Setting UseLibRaw := False loads "something"...

Regards, Kai
Go to Top of Page

MikeyC

USA
11 Posts

Posted - May 30 2018 :  11:28:36  Show Profile  Reply
Hi Nigel,

Most raws that I've seen from Canons have something like a 1/4 size JPEG. This image has a 1616 x 1080 resolution image embedded: I'm able to get it using my old DCraw code:

https://www.imaging-resource.com/PRODS/sony-a7/AA7hVFAI00100.ARW.HTM

No matter how I try to load a thumb using LibRaw in ImageEn, I get a 160x120. It seems like there are two "thumbnails" in most raws: the EXIF thumbnail which is the tiny 160x120 and then the raw itself has an embedded JPEG in the raw data. Looks like the LibRaw implementation in ImageEn is only accessing the EXIF thumb.

Hope this helps, and my continued thanks!

Mike Chaney
Go to Top of Page

xequte

39053 Posts

Posted - Jun 01 2018 :  03:25:13  Show Profile  Reply
Hi Mike

We'll have a new "Get Embedded JPEG" property in v8.


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