Merge pull request #4593 from Beep6581/green-eq-camconst

Move green equilibration info to camconst.json
This commit is contained in:
Alberto Griggio
2018-06-12 08:46:24 +02:00
committed by GitHub
4 changed files with 80 additions and 22 deletions

View File

@@ -35,6 +35,7 @@
#include "improcfun.h"
#include "rtlensfun.h"
#include "pdaflinesfilter.h"
#include "camconst.h"
#ifdef _OPENMP
#include <omp.h>
#endif
@@ -1945,8 +1946,19 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le
}
}
// check if it is an olympus E camera or green equilibration is enabled. If yes, compute G channel pre-compensation factors
if ( ri->getSensorType() == ST_BAYER && (raw.bayersensor.greenthresh || (((idata->getMake().size() >= 7 && idata->getMake().substr(0, 7) == "OLYMPUS" && idata->getModel()[0] == 'E') || (idata->getMake().size() >= 9 && idata->getMake().substr(0, 9) == "Panasonic")) && raw.bayersensor.method != RAWParams::BayerSensor::getMethodString( RAWParams::BayerSensor::Method::VNG4))) ) {
// check if green equilibration is needed. If yes, compute G channel pre-compensation factors
const auto globalGreenEq =
[&]() -> bool
{
CameraConstantsStore *ccs = CameraConstantsStore::getInstance();
CameraConst *cc = ccs->get(ri->get_maker().c_str(), ri->get_model().c_str());
return cc && cc->get_globalGreenEquilibration();
};
if ( ri->getSensorType() == ST_BAYER && (raw.bayersensor.greenthresh || (globalGreenEq() && raw.bayersensor.method != RAWParams::BayerSensor::getMethodString( RAWParams::BayerSensor::Method::VNG4))) ) {
if (settings->verbose) {
printf("Performing global green equilibration...\n");
}
// global correction
if(numFrames == 4) {
for(int i = 0; i < 4; ++i) {