Recent comments

Reply to: Support of monochromatic DNG in LibRAW   5 years 2 weeks ago

Exactly same problem present in our mem_image_sample: channel count assumed to be also 3 :)

We usually do not close threads (unless lot of spam come to specific thread).

Reply to: Support of monochromatic DNG in LibRAW   5 years 2 weeks ago

Thanks for your fast reply.

I've found what I'm doing wrong. I always assume that resulting image is 3-channel when copying it into my internal RGB buffer for further processing, but this one is obviously 1-channel. Very stupid and obvious error, and I've found it in half of an hour after submitting my first post. Now I check value of rawImage->colors and for 1-channel images I copy value of first channel into the other two. I'll do some performance tests, maybe your solution with setting proper color space will be faster.

Interesting that digiKam gives similar triple-image result when processing my file. digiKam uses LibRaw for the processing of DNG files, and it's behaviour led my thoughts wrong way. Possibly I should report an issue into digiKam bugtracker.

Anyway, thanks again! The problem is solved. Should I somehow close this forum thread?

Reply to: Support of monochromatic DNG in LibRAW   5 years 2 weeks ago

Thank you for the sample and for detailed explanation.
Tested with current LibRaw 0.20(beta):
dcraw_emu produces correct pgm file
dcraw_emu -T makes correct tiff file.
So, LibRaw::dcraw_process() and all previous steps are OK.

mem_image_sample.c fails to produce correct results, the problem not in LibRaw::dcraw_make_mem_image() (it is also correct, see below), but in sample source code:

1) write_ppm() do not handle img->colors != 3 case and just returns. This is expected, but need to be fixed.

2) write_jpeg() do not check for colors count, but assumes that 3-color data passed that is wrong.
Quick fixes:
A. replace
cinfo.in_color_space = JCS_RGB; /* colorspace of input image */
with
cinfo.in_color_space = img->colors==3?JCS_RGB:JCS_GRAYSCALE; /* colorspace of input image */

B. replace:
row_stride = img->width * 3; /* JSAMPLEs per row in image_buffer */
with:
row_stride = img->width * img->colors; /* JSAMPLEs per row in image_buffer */

Fixed version will be uploaded to github soon (likely tomorrow, we want to fix write_ppm sample code too).

Here are processing results (pgm file from dcraw_emu and .jpg from fixed mem_image_sample): https://www.dropbox.com/sh/a6aksx5opyzeeyv/AACG3f9GCZ703UksKjc5H5Rta?dl=0

Reply to: Requesting to submit a patch for direct raw access?   5 years 2 weeks ago

The C-api call you proposed may fit your specific needs, sure. It is not enough if someone want to create generic raw processing tool, that handle non-bayer data (or even if row pitch is not raw_width*2).

Current C-API is limited for single (but most frequently requested) task: create rendered RGB image from RAW. In general, it is possible to create C-wrappers for each LibRaw class data field, but this is out of our goal and scope, sorry. LibRaw is C++ library, no plans to make it fully functional when called from C.

Reply to: libraw_set_exifparser_handler - what is the void *datap parameter   5 years 2 weeks ago

Yes - except that there are significant differences between it and MSVC that would probably lead to a lot of pain trying to even get it compile... I did try, but concluded the work involved would be too great, especially if I want to keep it up to date...

For example, its library does not have the _BitScanReverse function and there's nothing I can find on Google that shows someone has implemented it... I could have a go, but there will be other functions as well...

Reply to: Requesting to submit a patch for direct raw access?   5 years 2 weeks ago

Thanks for the quick response!

For this project, I need three things from the raw data: image height, image width, and the bitmap. There's already C calls for get_raw_height and get_raw_width -- all I need past that is the raw bitmap.

Black/white level, bayer pattern, color data, and white balance data are all needed if you need to reconstruct a full color original image-- and for that, yes, dcraw_process() is absolutely the right thing to call, because it manipulates the bitmap to reconstruct the image. This app don't need that level of processing. I also tried using raw2image, and even that appears to do some light debayering work and modifying the base bitmap.

This project needs the raw, unmodified bitmap straight off the camera sensor. It doesn't need any of the white balance data or color information, nor is it trying to recreate the full color picture. However, what's critical is the turnaround time between shutter snaps- in between shutter snaps, the app needs to extract the raw image data, review it for just a couple things, make decisions, and get back to the business of taking pictures as quickly as it can.

The first pass at implementing libraw invoked the unprocessed_raw utility (using the -T switch) to convert the bitstream to a TIFF, and it does exactly what was needed. However, it also adds the overhead of writing to/reading from the disk twice, as well as wrapping the bitmap in a TIFF wrapper.

Ideally the app should get the image from the camera, extract the things it needs from the raw data in memory, and pass everything around in memory buffers. Adding that one routine to the API would streamline the entire process, and make that capability available for anyone else as well.

Reply to: libraw_set_exifparser_handler - what is the void *datap parameter   5 years 2 weeks ago

Wouldn't it be easier to recompile LibRaw using your compiler?

Reply to: libraw_set_exifparser_handler - what is the void *datap parameter   5 years 2 weeks ago

Thanks Alex

Unfortunately C++ Builder's C++ name mangling is not compatible with MSVC's. There are nasty ways to get an MSVC class in a DLL to be accessible, but I took the simple way out and extended the LibRaw C API to include the LibRaw_abstract_datastream gets() function, which seems to be all I need.

Andy

Reply to: Requesting to submit a patch for direct raw access?   5 years 2 weeks ago

Pointer to raw data itself is useless without access to metadata (black/white level, bayer pattern, color data, white balance data, image size, etc, etc, etc).

So you'll need to access all internals anyway.

Reply to: libraw_set_exifparser_handler - what is the void *datap parameter   5 years 2 weeks ago

datap is pointer to your datablock (context), for example data table to be filled w/ exif callback.
It is passed to callback as 1st parameter (void *, you'll need to explicitly convert type before use).

Input datastream is passed as last parameter to callback as (void*). You'll need it (so, your callback should be C++ function in that case) if you plan to read tag values. If you want to only collect tags/tag types, you may ignore this last parameter.

Know nothing about CodeGear C++, so could not help with it.

Reply to: Questions about black-level and white-levels in colordata   5 years 2 weeks ago

As mentioned above:
> linear_max is 'specular white' read from metadata (if present in file)

Hope this helps.

Reply to: Questions about black-level and white-levels in colordata   5 years 2 weeks ago

Alex,
I am trying to implement my own version of subtract_black. Following which I am trying to rescale the image to the range (0,1). For this, I need to know the black-level and white-level. Given, there are two properties that contain white-level information, I was curious to know which one to use if both maximum and linear_max are both populated.

Dinesh

Reply to: Questions about black-level and white-levels in colordata   5 years 2 weeks ago

I don’t know what exactly you are doing and what you mean by normalization.
Therefore, do as you think is right.

Reply to: Questions about black-level and white-levels in colordata   5 years 2 weeks ago

Alex,
I am trying to apply my own black-level subtraction and image normalization. So, I just wanted to clarify on what image range I should apply the black-level subtraction. Also, I am not sure if I should use maximum or linear_max for normalization.

Dinesh

Dinesh

Reply to: Questions about black-level and white-levels in colordata   5 years 2 weeks ago

I do not know what you want to achieve, so I could not answer (both) your questions.

Reply to: Questions about black-level and white-levels in colordata   5 years 2 weeks ago

Alex,
For the black-levels that are specified in cblack[0]->cblack[3], do those also need to be applied starting at the visible region. I am assuming this is the case because the subtract_black_internal operates on imgdata.image which only operates on the visible image.

Also, for the white-levels, if linear_max is all zeros, then do I just assume maximum applies to all the channels.

Also, if both maximum and linear_max value is present, which value should I use?

Regards,
Dinesh

Reply to: LibRaw 0.20.2 Release   5 years 2 weeks ago

This depends on beta feedback. Hope to finish Beta-RC-Release cycle in May.

Reply to: LibRaw 0.20.2 Release   5 years 2 weeks ago

Is there any schedule / target / roadmap currently for when the final release will drop?

Reply to: Questions about black-level and white-levels in colordata   5 years 2 weeks ago

Followup, 6 is intended value for non-bayer:

int COLOR(int row, int col)
  {
    if (!imgdata.idata.filters)
      return 6; /* Special value 0+1+2+3 */
  ...
Reply to: Questions about black-level and white-levels in colordata   5 years 2 weeks ago

COLOR() for non-bayer(x-trans) data is useless, check filters too before use.

Reply to: Questions about black-level and white-levels in colordata   5 years 2 weeks ago

Alex,
Thanks for this clarification. So it looks like my best bet would be to call raw2image() and subtract_black() to leverage libraw to do the black-level correction for me. I still would like to return the CFA data as a rows x columns matrix instead of the output of raw2image. I guess I have to add some custom logic to do the copying.

Also, it appears that raw2image() only returns the visible portion of the image. It typically has only 1 out of the 4 channels as non-zero. I am assuming this does not hold true for Fovean sensors or DNG files that are created from Sigma cameras?

Can I use the COLOR function for non-Bayer sensors? I have a DNG file that appears to be created from a Sigma camera. The output of COLOR(0, 0), COLOR(0, 1) returned 6.

Dinesh

Reply to: Paswword needing to be reset.   5 years 2 weeks ago

Yes, you're the only person affected.

We do not log authentication data on our sites, so no way to recover the problem source. If you have your HTTP sessions dump it may help.

Reply to: Paswword needing to be reset.   5 years 2 weeks ago

Hmmm.... That's what you said last time I reported this (about two years ago).

Oh well.

Reply to: LibRaw 0.20.2 Release   5 years 2 weeks ago

No plans for publishing binaries or source tarballs for beta.

Binaries and tarballs will be updated on 'release' status.

Pages