Skip to content
This repository has been archived by the owner on Jul 22, 2018. It is now read-only.

Add thumbnail and whitebalance extraction #42

Open
pedrocr opened this issue Aug 16, 2014 · 11 comments
Open

Add thumbnail and whitebalance extraction #42

pedrocr opened this issue Aug 16, 2014 · 11 comments

Comments

@pedrocr
Copy link
Contributor

pedrocr commented Aug 16, 2014

For rawspeed to be able to completely replace libraw in apps at least two things seem to be needed:

  • Extracting white balance: should be relatively easy, it's just extra metadata that needs to be extracted in each format and added to mRaw
  • Extracting the embedded thumbnail: this should be easy as well but not very high performance as rawspeed reads in the whole file at once. The only option I see here is to mmap the file instead of actually reading it. Should actually be better in the general case if the OS is smart enough.

Comments?

@LibRaw
Copy link

LibRaw commented Aug 16, 2014

Also, you need color data extraction from files which provides color data (DNG, digital backs, several other formats).

BTW, LibRaw may use RawSpeed as (faster) decoder for about two years. We use this way to use RawSpeed in our apps (RawDigger, FastRawViewer) without problems (although, sometimes RawSpeed's output differs from LibRaw's, in this case I file a bug to Klaus).

@pedrocr
Copy link
Contributor Author

pedrocr commented Aug 16, 2014

you need color data extraction from files which provides color data

Isn't that already done? At least darktable doesn't seem to use libraw to get that.

@LibRaw
Copy link

LibRaw commented Aug 16, 2014

As I can see, darktable uses own built-in color data (src/external/adobe_coeff.c) copypasted from dcraw

@pedrocr
Copy link
Contributor Author

pedrocr commented Aug 16, 2014

That's one source, originally from dcraw now generated from the Adobe DNG converter directly. It also has custom colors for some cameras.

Do you mean that besides fixed values for some formats you also need to extract them from the file itself? And that rawspeed isn't doing that already?

@LibRaw
Copy link

LibRaw commented Aug 16, 2014

yes, for some cameras it is better to extract it from file.
I do not see some generic interface for it in RawSpeed.

@LibRaw
Copy link

LibRaw commented Aug 16, 2014

BTW, you say 'generated from the Adobe DNG converter directly'.
Is there any script or something? I'm interested to extract Adobe's BaselineExposure values for all cameras....

@pedrocr
Copy link
Contributor Author

pedrocr commented Aug 16, 2014

https://github.com/darktable-org/darktable/blob/master/tools/dngmeta.sh

I'm afraid that probably doesn't do what you want. It extracts the values from a .DNG file but you'd probably want to extract them from the app data itself.

@LibRaw
Copy link

LibRaw commented Aug 16, 2014

Thanks, but this script extracts data from DNG file, not from DNG convertor.
I use Exiftool, not exiv2 for it, but it is nearly the same.

The problem is there is no enough samples to extract BaselineExposure from, because this parameter may vary with ISO change (and, worse, with other camera settings, such as 'highlight preservation')

@pedrocr
Copy link
Contributor Author

pedrocr commented Aug 24, 2014

After looking at this in more detail my plan would be to extend rawspeed to extract both whitebalance and color data but not thumbnails. For thumbnails something like exiv2 should work instead. For the color data my plan would be to take the matrices currently in darktable's adobe_coeff and migrate them to rawspeed's cameras.xml. That way we would have a complete sensor definition with black/white points and color matrix all in one place.

Klaus, does this make sense to you, or would you rather keep this info out of cameras.xml?

@klauspost
Copy link
Owner

I think all color convertion should be separate.

I have however thought about adding the "UniqueCameraModelRestriction" camera name from Adobes DCP to cameras.xml - that way it would be trivial to match a DCP profile with data from RawSpeed. I think these could be added automatically with a little coding efford.

If time had been more on my side, I have thought about making a simple, but separate converter frontend for RawSpeed, that used (Adobe) DCP profiles for conversion. These contain, at very least the same matrix as D.C. has extracted and included. However, there can be two matrices with different illuminants, and based on the whitebalance an intermediate can be calculated.

Here you can see the "simple" profiles, which only contain matrices:

http://rawstudio.org/svn/rawstudio/trunk/profiles/simple-src/

These xml files are "compiled" into DCP files (using a tool called dcptool), which are basically slightly modified DNG/TIFF files that only contain profile information:

http://rawstudio.org/svn/rawstudio/trunk/profiles/

More advanced profiles can contain 3d HSV-lookup tables to correct color casts and imperfections in the matrix.

@LibRaw
Copy link

LibRaw commented Aug 26, 2014

Color conversion, surely, should be separate.
But raw decoding library should unpack color data from raw files (it these raw data contains color data) and pass it to calling application.
This is very useful for
a) generic DNG support (from unknown camera)
b) generic format support (from new camera from known manufacturer; for example, Sony or Olympus raws contains matrix color profile)
c) cameras with per-camera calibration (digital backs)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants