jcelaya / hdrmerge

HDR exposure merging
http://jcelaya.github.io/hdrmerge/
Other
355 stars 78 forks source link

raw ca correction #162

Open heckflosse opened 5 years ago

heckflosse commented 5 years ago

I just want to mention that there is some work by @CarVac and me in project https://github.com/CarVac/librtprocess This work will also lead to allow usage of raw ca correction before merging the files in hdmerge....

Stay tuned...

heckflosse commented 5 years ago

First version is available for test in cacorrect branch. At the moment there is no checkbox for ca correction. It's just called. Gui control will follow later.

You also need to install librtprocess

heckflosse commented 5 years ago

I just added a checkbox for ca correction.

Beep6581 commented 5 years ago

The results can be fantastic! screenshot_20180903_224202 screenshot_20180903_224210

Beep6581 commented 5 years ago

@heckflosse I noticed in the library set that CA correction can introduce artifacts where it looks like data is taken from the wrong image, hard to describe in words. Here is a set where this problem is very clear: https://filebin.net/nxpkpqjlkv3mynw5

heckflosse commented 5 years ago

@Beep6581 Please show a screenshot of the region in the image where the artifacts appear

Beep6581 commented 5 years ago

screenshot_20180905_110502

Beep6581 commented 5 years ago

The same problem in the library shots around the light bulb: imgur-2018_09_05-11 08 48

https://filebin.net/il7pzq83ly4miuru/karin_library_2_1-4_noca_crop.jpg?t=031xtx6b https://filebin.net/il7pzq83ly4miuru/karin_library_2_1-4_autocaall_crop.jpg?t=031xtx6b

heckflosse commented 5 years ago

@Beep6581 I found the reason for the artifacts. Looking for a fix now...

Floessie commented 5 years ago

@heckflosse @Beep6581 Any news on this? Looking forward to CA correction in master. :+1:

heckflosse commented 5 years ago

@Floessie I will continue after holidays

gaaned92 commented 5 years ago

W10 errors when compiling cacorrect branch with gcc 8.2.0

D:/PROGRAMMES/HDRsource/hdr/src/Image.cpp: In member function 'void hdrmerge::Image::caCorrect(hdrmerge::RawParameters&, CaFitParams&, bool)':
D:/PROGRAMMES/HDRsource/hdr/src/Image.cpp:279:5: error: 'array2D' was not declared in this scope
     array2D<float> temp(width, height);
     ^~~~~~~
D:/PROGRAMMES/HDRsource/hdr/src/Image.cpp:279:5: note: suggested alternative: 'Array2D'
     array2D<float> temp(width, height);
     ^~~~~~~
     Array2D
D:/PROGRAMMES/HDRsource/hdr/src/Image.cpp:279:13: error: expected primary-expression before 'float'
     array2D<float> temp(width, height);
             ^~~~~
D:/PROGRAMMES/HDRsource/hdr/src/Image.cpp:282:13: error: 'temp' was not declared in this scope
             temp[i][j] = (*this)(j, i) * scale[FCX(i,j)];
             ^~~~
D:/PROGRAMMES/HDRsource/hdr/src/Image.cpp:282:13: note: suggested alternative: 'time'
             temp[i][j] = (*this)(j, i) * scale[FCX(i,j)];
             ^~~~
             time
D:/PROGRAMMES/HDRsource/hdr/src/Image.cpp:291:51: error: 'temp' was not declared in this scope
     if (CA_correct(width, height, true, 0.0, 0.0, temp, {{{FCX(0,0), FCX(0,1)},{FCX(1,0),FCX(1,1)}}}, setProgCancel, fitParams, fitParamsIn)) {
                                                   ^~~~
D:/PROGRAMMES/HDRsource/hdr/src/Image.cpp:291:51: note: suggested alternative: 'time'
     if (CA_correct(width, height, true, 0.0, 0.0, temp, {{{FCX(0,0), FCX(0,1)},{FCX(1,0),FCX(1,1)}}}, setProgCancel, fitParams, fitParamsIn)) {
                                                   ^~~~
                                                   time
D:/PROGRAMMES/HDRsource/hdr/src/Image.cpp:291:9: error: 'CA_correct' was not declared in this scope
     if (CA_correct(width, height, true, 0.0, 0.0, temp, {{{FCX(0,0), FCX(0,1)},{FCX(1,0),FCX(1,1)}}}, setProgCancel, fitParams, fitParamsIn)) {
         ^~~~~~~~~~
D:/PROGRAMMES/HDRsource/hdr/src/Image.cpp:291:9: note: suggested alternative:
In file included from D:/PROGRAMMES/HDRsource/hdr/src/Image.hpp:31,
                 from D:/PROGRAMMES/HDRsource/hdr/src/Image.cpp:23:
C:/msys64/mingw64/include/rtprocess/librtprocess.h:34:10: note:   'librtprocess::CA_correct'
     bool CA_correct(int winx, int winy, int winw, int winh, const bool autoCA,size_t autoIterations, const double cared, const double cablue, bool avoidColourshift, const float * const *rawDataIn, float **rawDataOut, const ColorFilterArray &cfarray, const std::function<bool(double)> &setProgCancel, CaFitParams &fitParams, bool fitParamsIn, float inputScale = 65535.f, float outputScale = 65535.f);
          ^~~~~~~~~~

and a lot of warnings if you are interested

heckflosse commented 5 years ago

I will fix that after holidays

gaaned92 commented 5 years ago

@heckflosse could you have a look please?

olokobayusuf commented 5 years ago

This looks pretty amazing. Any word on it?

fanckush commented 5 years ago

@Beep6581 I found the reason for the artifacts. Looking for a fix now...

@heckflosse could you direct me to what you think the reason behind the artefacts is? I want to help and would love a hint :)

heckflosse commented 5 years ago

@fanckush I think the reason is, that the raw data is not white balanced. In RawTherapee we apply an auto whitebalance to the raw data before raw ca correction and demosaic and revert this scale after demosaic. Iirc this gave better raw ca correction and demosaic results and afaik that's the only difference atm between raw ca correction in RawTherapee and this hdrmerge branch.