timothybrooks / hdr-plus

HDR+ Implementation
MIT License
594 stars 201 forks source link

Add support of arbitrary CCM and CFA in finishing. #54

Closed brotherofken closed 4 years ago

brotherofken commented 4 years ago

Solves #39 and maybe #48.

CCM stands for the color correction matrix, which is used in srgb function in finishing. CCM depends on the sensor model and shouldn't be hardcoded. Wrong CCM results in incorrect output color. Now color should be Okay on most of input RAWs.

CFA stands for Color Filter Array or Bayer Filter. Most of the sensors use the RGGB pattern, but it may be shifted by one pixel in horizontal and/or vertical direction. I added shift_bayer_to_rggb function on the start of finish, which shifts input raw image depending on the RAW CFA pattern.

It also fixes black level for DNGs input from the hdrplus dataset - I reused black level calculation function from LibRaw2DngConverter.

Tested on hdrplus data and Timothy's RAWs.

brotherofken commented 4 years ago

@Titaniumtown look at this, please. It will be better if you merge #55 first.

Titaniumtown commented 4 years ago

Ok, I will merge #55 first!