pixelshift: optional red/blue check
This commit is contained in:
parent
9bcb347a3b
commit
ac5bad2de1
@ -1655,6 +1655,7 @@ TP_RAW_LABEL;Demosaicing
|
||||
TP_RAW_LMMSEITERATIONS;LMMSE enhancement steps
|
||||
TP_RAW_LMMSE_TOOLTIP;Adds gamma (step 1), median (steps 2-4) and refinement (steps 5-6) to reduce artifacts and improve the signal-to-noise ratio.
|
||||
TP_RAW_PIXELSHIFTADAPTIVE;Adaptive detection
|
||||
TP_RAW_PIXELSHIFTNONGREENHORIZONTAL;Check red/blue horizontal
|
||||
TP_RAW_PIXELSHIFTMOTION;Pixelshift motion detection
|
||||
TP_RAW_PIXELSHIFTMOTION_TOOLTIP;0 means no motion detection\n1 - 99 means motion will be detected according to this value. Increase value to increase detection rate\n100 means the Amaze demosaiced frame will be used
|
||||
TP_RAW_PIXELSHIFTMOTIONCORRECTION;Pixelshift motion correction
|
||||
|
@ -144,7 +144,7 @@ void dfInfo::updateRawImage()
|
||||
} else {
|
||||
int H = ri->get_height();
|
||||
int W = ri->get_width();
|
||||
ri->compress_image();
|
||||
ri->compress_image(0);
|
||||
int rSize = W * ((ri->getSensorType() == ST_BAYER || ri->getSensorType() == ST_FUJI_XTRANS) ? 1 : 3);
|
||||
acc_t **acc = new acc_t*[H];
|
||||
|
||||
@ -164,7 +164,7 @@ void dfInfo::updateRawImage()
|
||||
RawImage* temp = new RawImage(*iName);
|
||||
|
||||
if( !temp->loadRaw(true)) {
|
||||
temp->compress_image(); //\ TODO would be better working on original, because is temporary
|
||||
temp->compress_image(0); //\ TODO would be better working on original, because is temporary
|
||||
nFiles++;
|
||||
|
||||
if( ri->getSensorType() == ST_BAYER || ri->getSensorType() == ST_FUJI_XTRANS ) {
|
||||
@ -204,7 +204,7 @@ void dfInfo::updateRawImage()
|
||||
delete ri;
|
||||
ri = nullptr;
|
||||
} else {
|
||||
ri->compress_image();
|
||||
ri->compress_image(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ void ffInfo::updateRawImage()
|
||||
} else {
|
||||
int H = ri->get_height();
|
||||
int W = ri->get_width();
|
||||
ri->compress_image();
|
||||
ri->compress_image(0);
|
||||
int rSize = W * ((ri->getSensorType() == ST_BAYER || ri->getSensorType() == ST_FUJI_XTRANS) ? 1 : 3);
|
||||
acc_t **acc = new acc_t*[H];
|
||||
|
||||
@ -156,7 +156,7 @@ void ffInfo::updateRawImage()
|
||||
RawImage* temp = new RawImage(*iName);
|
||||
|
||||
if( !temp->loadRaw(true)) {
|
||||
temp->compress_image(); //\ TODO would be better working on original, because is temporary
|
||||
temp->compress_image(0); //\ TODO would be better working on original, because is temporary
|
||||
nFiles++;
|
||||
|
||||
if( ri->getSensorType() == ST_BAYER || ri->getSensorType() == ST_FUJI_XTRANS ) {
|
||||
@ -195,7 +195,7 @@ void ffInfo::updateRawImage()
|
||||
delete ri;
|
||||
ri = nullptr;
|
||||
} else {
|
||||
ri->compress_image();
|
||||
ri->compress_image(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
float greenDiff(float a, float b, bool adaptive, float stddevFactor, float eperIso, float nreadIso, float prnu, bool showMotion)
|
||||
float colourDiff(float a, float b, bool adaptive, float stddevFactor, float eperIso, float nreadIso, float prnu, bool showMotion)
|
||||
{
|
||||
// calculate the difference between to green samples
|
||||
if(adaptive) {
|
||||
@ -68,7 +68,7 @@ float greenDiff(float a, float b, bool adaptive, float stddevFactor, float eperI
|
||||
using namespace std;
|
||||
using namespace rtengine;
|
||||
|
||||
void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool detectMotion, int motion, bool showMotion, bool showOnlyMask, unsigned int frame, unsigned int gridSize, bool adaptive, float stddevFactor, float eperIso, float nreadIso, float prnu)
|
||||
void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool detectMotion, int motion, bool showMotion, bool showOnlyMask, unsigned int frame, unsigned int gridSize, bool adaptive, float stddevFactor, float eperIso, float nreadIso, float prnu, bool checkNonGreenHorizontal)
|
||||
{
|
||||
|
||||
BENCHFUN
|
||||
@ -93,7 +93,8 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool det
|
||||
const float scaleGreen = 1.f / scale_mul[1];
|
||||
|
||||
eperIso *= (100.f / idata->getISOSpeed());
|
||||
eperIso *= scaleGreen;
|
||||
|
||||
float eperIsoGreen = eperIso * scaleGreen;
|
||||
|
||||
prnu /= 100.f;
|
||||
stddevFactor *= stddevFactor;
|
||||
@ -104,9 +105,7 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool det
|
||||
// For shades of green motion indicators
|
||||
const float blendFactor = (motion == 0.f ? 1.f : 1.f / (1.f - motionThreshold));
|
||||
|
||||
// bool showOnlyMask = showMotion;
|
||||
// bool checkRedBlue = (gridSize == 5);
|
||||
// bool checkRedBlue = false;
|
||||
bool checkNonGreen = true;
|
||||
unsigned int offsX = 0, offsY = 0;
|
||||
// We have to adjust the offsets for the selected subframe we use for areas with motion
|
||||
switch (frame) {
|
||||
@ -128,6 +127,8 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool det
|
||||
offsY = 0;
|
||||
}
|
||||
|
||||
const float thresh = adaptive ? 0.f : motionThreshold;
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,16)
|
||||
#endif
|
||||
@ -138,10 +139,16 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool det
|
||||
float *nonGreenDest1 = blue[i + offsY];
|
||||
int j = winx + border - offsX;
|
||||
int c = FC(i, j);
|
||||
float scaleNonGreen0 = 1.f / scale_mul[0];
|
||||
float scaleNonGreen2 = 1.f / scale_mul[2];
|
||||
float eperIsoNonGreen0 = eperIso / scale_mul[0];
|
||||
float eperIsoNonGreen2 = eperIso / scale_mul[2];
|
||||
|
||||
if (c == 2 || ((c & 1) && FC(i, j + 1) == 2)) {
|
||||
// row with blue pixels => swap destination pointers for non green pixels
|
||||
std::swap(nonGreenDest0, nonGreenDest1);
|
||||
std::swap(scaleNonGreen0, scaleNonGreen2);
|
||||
std::swap(eperIsoNonGreen0, eperIsoNonGreen2);
|
||||
}
|
||||
|
||||
// offset to keep the code short. It changes its value between 0 and 1 for each iteration of the loop
|
||||
@ -152,39 +159,39 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool det
|
||||
if(detectMotion || adaptive) {
|
||||
if(gridSize == 3) {
|
||||
// compute maximum of differences for first two columns of 3x3 grid
|
||||
greenDifMax[0] = max(greenDiff(riFrames[0 + offset]->data[i + offset][j - 1], riFrames[2 + offset]->data[i - offset + 1][j], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset][j - 1], riFrames[3 - offset]->data[i + offset - 1][j], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset + 2][j - 1], riFrames[3 - offset]->data[i + offset + 1][j], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion)
|
||||
greenDifMax[0] = max(colourDiff(riFrames[0 + offset]->data[i + offset][j - 1], riFrames[2 + offset]->data[i - offset + 1][j], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset][j - 1], riFrames[3 - offset]->data[i + offset - 1][j], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset + 2][j - 1], riFrames[3 - offset]->data[i + offset + 1][j], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion)
|
||||
);
|
||||
greenDifMax[1] = max(greenDiff(riFrames[1 - offset]->data[i - offset + 1][j], riFrames[3 - offset]->data[i + offset][j + 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[0 + offset]->data[i + offset - 1][j], riFrames[2 + offset]->data[i - offset][j + 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[0 + offset]->data[i + offset + 1][j], riFrames[2 + offset]->data[i - offset + 2][j + 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion)
|
||||
greenDifMax[1] = max(colourDiff(riFrames[1 - offset]->data[i - offset + 1][j], riFrames[3 - offset]->data[i + offset][j + 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[0 + offset]->data[i + offset - 1][j], riFrames[2 + offset]->data[i - offset][j + 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[0 + offset]->data[i + offset + 1][j], riFrames[2 + offset]->data[i - offset + 2][j + 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion)
|
||||
);
|
||||
} else if(gridSize == 5) {
|
||||
// compute maximum of differences for first four columns of 5x5 grid
|
||||
greenDifMax[0] = max(greenDiff(riFrames[1 - offset]->data[i - offset - 1][j-2], riFrames[3 - offset]->data[i + offset -2][j - 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset + 1][j-2], riFrames[3 - offset]->data[i + offset][j - 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset + 3][j-2], riFrames[3 - offset]->data[i + offset +2][j - 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[0 + offset]->data[i + offset - 1][j-2], riFrames[2 + offset]->data[i - offset][j - 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[0 + offset]->data[i + offset + 1][j-2], riFrames[2 + offset]->data[i - offset + 2][j - 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion)
|
||||
greenDifMax[0] = max(colourDiff(riFrames[1 - offset]->data[i - offset - 1][j-2], riFrames[3 - offset]->data[i + offset -2][j - 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset + 1][j-2], riFrames[3 - offset]->data[i + offset][j - 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset + 3][j-2], riFrames[3 - offset]->data[i + offset +2][j - 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[0 + offset]->data[i + offset - 1][j-2], riFrames[2 + offset]->data[i - offset][j - 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[0 + offset]->data[i + offset + 1][j-2], riFrames[2 + offset]->data[i - offset + 2][j - 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion)
|
||||
);
|
||||
greenDifMax[1] = max(greenDiff(riFrames[0 + offset]->data[i + offset-2][j - 1], riFrames[2 + offset]->data[i - offset - 1][j], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[0 + offset]->data[i + offset][j - 1], riFrames[2 + offset]->data[i - offset + 1][j], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[0 + offset]->data[i + offset+2][j - 1], riFrames[2 + offset]->data[i - offset + 3][j], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset][j - 1], riFrames[3 - offset]->data[i + offset - 1][j], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset + 2][j - 1], riFrames[3 - offset]->data[i + offset + 1][j], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion)
|
||||
greenDifMax[1] = max(colourDiff(riFrames[0 + offset]->data[i + offset-2][j - 1], riFrames[2 + offset]->data[i - offset - 1][j], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[0 + offset]->data[i + offset][j - 1], riFrames[2 + offset]->data[i - offset + 1][j], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[0 + offset]->data[i + offset+2][j - 1], riFrames[2 + offset]->data[i - offset + 3][j], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset][j - 1], riFrames[3 - offset]->data[i + offset - 1][j], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset + 2][j - 1], riFrames[3 - offset]->data[i + offset + 1][j], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion)
|
||||
);
|
||||
greenDifMax[2] = max(greenDiff(riFrames[1 - offset]->data[i - offset - 1][j], riFrames[3 - offset]->data[i + offset -2][j + 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset + 1][j], riFrames[3 - offset]->data[i + offset][j + 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset + 3][j], riFrames[3 - offset]->data[i + offset +2][j + 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[0 + offset]->data[i + offset - 1][j], riFrames[2 + offset]->data[i - offset][j + 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[0 + offset]->data[i + offset + 1][j], riFrames[2 + offset]->data[i - offset + 2][j + 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion)
|
||||
greenDifMax[2] = max(colourDiff(riFrames[1 - offset]->data[i - offset - 1][j], riFrames[3 - offset]->data[i + offset -2][j + 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset + 1][j], riFrames[3 - offset]->data[i + offset][j + 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset + 3][j], riFrames[3 - offset]->data[i + offset +2][j + 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[0 + offset]->data[i + offset - 1][j], riFrames[2 + offset]->data[i - offset][j + 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[0 + offset]->data[i + offset + 1][j], riFrames[2 + offset]->data[i - offset + 2][j + 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion)
|
||||
);
|
||||
greenDifMax[3] = max(greenDiff(riFrames[0 + offset]->data[i + offset-2][j + 1], riFrames[2 + offset]->data[i - offset - 1][j+2], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[0 + offset]->data[i + offset][j + 1], riFrames[2 + offset]->data[i - offset + 1][j+2], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[0 + offset]->data[i + offset+2][j + 1], riFrames[2 + offset]->data[i - offset + 3][j+2], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset][j + 1], riFrames[3 - offset]->data[i + offset - 1][j+2], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset + 2][j +- 1], riFrames[3 - offset]->data[i + offset + 1][j+2], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion)
|
||||
greenDifMax[3] = max(colourDiff(riFrames[0 + offset]->data[i + offset-2][j + 1], riFrames[2 + offset]->data[i - offset - 1][j+2], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[0 + offset]->data[i + offset][j + 1], riFrames[2 + offset]->data[i - offset + 1][j+2], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[0 + offset]->data[i + offset+2][j + 1], riFrames[2 + offset]->data[i - offset + 3][j+2], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset][j + 1], riFrames[3 - offset]->data[i + offset - 1][j+2], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset + 2][j +- 1], riFrames[3 - offset]->data[i + offset + 1][j+2], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -193,6 +200,7 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool det
|
||||
|
||||
// this is the index for the last column of the grid. Obviously we have to start with gridSize - 1
|
||||
int lastIndex = gridSize - 1;
|
||||
float korr = 0.f;
|
||||
|
||||
for(; j < winw - (border + offsX); ++j) {
|
||||
offset ^= 1; // 0 => 1 or 1 => 0
|
||||
@ -202,22 +210,22 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool det
|
||||
float gridMax;
|
||||
if(gridSize == 1) {
|
||||
// compute difference for current pixel and skip next pixel, that's the method from dcrawps
|
||||
gridMax = greenDiff(riFrames[1 - offset]->data[i - offset + 1][j], riFrames[3 - offset]->data[i + offset][j + 1], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion);
|
||||
gridMax = colourDiff(riFrames[1 - offset]->data[i - offset + 1][j], riFrames[3 - offset]->data[i + offset][j + 1], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion);
|
||||
skipNext = !showMotion;
|
||||
} else if(gridSize == 3) {
|
||||
// compute maximum of differences for third column of 3x3 grid and save at position lastIndex
|
||||
greenDifMax[lastIndex] = max(greenDiff(riFrames[0 + offset]->data[i + offset][j + 1], riFrames[2 + offset]->data[i - offset + 1][j + 2], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset][j + 1], riFrames[3 - offset]->data[i + offset - 1][j + 2], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset + 2][j + 1], riFrames[3 - offset]->data[i + offset + 1][j + 2], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion)
|
||||
greenDifMax[lastIndex] = max(colourDiff(riFrames[0 + offset]->data[i + offset][j + 1], riFrames[2 + offset]->data[i - offset + 1][j + 2], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset][j + 1], riFrames[3 - offset]->data[i + offset - 1][j + 2], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset + 2][j + 1], riFrames[3 - offset]->data[i + offset + 1][j + 2], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion)
|
||||
);
|
||||
gridMax = max(greenDifMax[0],greenDifMax[1],greenDifMax[2]);
|
||||
} else if(gridSize == 5) {
|
||||
// compute maximum of differences for fifth column of 5x5 grid and save at position lastIndex
|
||||
greenDifMax[lastIndex] = max(greenDiff(riFrames[1 - offset]->data[i - offset - 1][j+2], riFrames[3 - offset]->data[i + offset -2][j + 3], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset + 1][j+2], riFrames[3 - offset]->data[i + offset][j + 3], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[1 - offset]->data[i - offset + 3][j+2], riFrames[3 - offset]->data[i + offset +2][j + 3], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[0 + offset]->data[i + offset - 1][j+2], riFrames[2 + offset]->data[i - offset][j + 3], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion),
|
||||
greenDiff(riFrames[0 + offset]->data[i + offset + 1][j+2], riFrames[2 + offset]->data[i - offset + 2][j + 3], adaptive, stddevFactor, eperIso, nreadIso, prnu, showMotion)
|
||||
greenDifMax[lastIndex] = max(colourDiff(riFrames[1 - offset]->data[i - offset - 1][j+2], riFrames[3 - offset]->data[i + offset -2][j + 3], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset + 1][j+2], riFrames[3 - offset]->data[i + offset][j + 3], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[1 - offset]->data[i - offset + 3][j+2], riFrames[3 - offset]->data[i + offset +2][j + 3], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[0 + offset]->data[i + offset - 1][j+2], riFrames[2 + offset]->data[i - offset][j + 3], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion),
|
||||
colourDiff(riFrames[0 + offset]->data[i + offset + 1][j+2], riFrames[2 + offset]->data[i - offset + 2][j + 3], adaptive, stddevFactor, eperIsoGreen, nreadIso, prnu, showMotion)
|
||||
);
|
||||
gridMax = max(greenDifMax[0],greenDifMax[1],greenDifMax[2],greenDifMax[3],greenDifMax[4]);
|
||||
}
|
||||
@ -226,14 +234,8 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool det
|
||||
lastIndex = lastIndex == gridSize ? 0 : lastIndex;
|
||||
|
||||
// increase motion detection dependent on brightness
|
||||
float korr;
|
||||
float thresh;
|
||||
if(adaptive) {
|
||||
korr = 0.f;
|
||||
thresh = 0;
|
||||
} else {
|
||||
if(!adaptive) {
|
||||
korr = log2Lut[((int)(riFrames[1 - offset]->data[i - offset + 1][j] * scaleGreen))>>1];
|
||||
thresh = motionThreshold;
|
||||
}
|
||||
|
||||
if (gridMax > thresh - korr) {
|
||||
@ -260,6 +262,86 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool det
|
||||
greenDest[j + offsX] = nonGreenDest0[j + offsX] = nonGreenDest1[j + offsX] = 0.f;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(adaptive && checkNonGreenHorizontal) {
|
||||
float ng1 = riFrames[(offset << 1) + offset]->data[i][j + offset];
|
||||
float ng0 = riFrames[((offset^1) << 1) + (offset^1)]->data[i][j + (offset^1)+1];
|
||||
float ng2 = riFrames[((offset^1) << 1) + (offset^1)]->data[i][j + (offset^1)-1];
|
||||
float diff0 = ng0 - ng1;
|
||||
float diff2 = ng2 - ng1;
|
||||
if(diff0 * diff2 >= 0.f) {
|
||||
// float val = std::abs(diff0) > std::abs(diff2) ? ng0 : ng2;
|
||||
float val = (ng0 + ng2) / 2.f;
|
||||
float gridMax = colourDiff(ng1, val, true, stddevFactor, eperIsoNonGreen0, nreadIso, prnu, showMotion);
|
||||
if(gridMax > 0.f) {
|
||||
if(showMotion) {
|
||||
float blend = gridMax * blendFactor;
|
||||
if(!showOnlyMask) {
|
||||
// if showMotion is enabled make the pixel green
|
||||
nonGreenDest0[j + offsX] = 1000.f + 25000.f;
|
||||
nonGreenDest1[j + offsX] = greenDest[j + offsX] = 0.f;
|
||||
} else {
|
||||
greenDest[j + offsX] = nonGreenDest0[j + offsX] = nonGreenDest1[j + offsX] = 1000.f + 25000.f;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ng1 = riFrames[2 - offset]->data[i + 1][j - offset + 1];
|
||||
ng0 = riFrames[2 - (offset^1)]->data[i + 1][j - (offset^1) + 2];
|
||||
ng2 = riFrames[2 - (offset^1)]->data[i + 1][j - (offset^1)];
|
||||
diff0 = ng0 - ng1;
|
||||
diff2 = ng2 - ng1;
|
||||
if(diff0 * diff2 >= 0.f) {
|
||||
// float val = std::abs(diff0) > std::abs(diff2) ? ng0 : ng2;
|
||||
float val = (ng0 + ng2) / 2.f;
|
||||
float gridMax = colourDiff(ng1, val, true, stddevFactor, eperIsoNonGreen2, nreadIso, prnu, showMotion);
|
||||
if(gridMax > 0.f) {
|
||||
if(showMotion) {
|
||||
float blend = gridMax * blendFactor;
|
||||
if(!showOnlyMask) {
|
||||
nonGreenDest1[j + offsX] = 1000.f + 25000.f;
|
||||
nonGreenDest0[j + offsX] = greenDest[j + offsX] = 0.f;
|
||||
} else {
|
||||
greenDest[j + offsX] = nonGreenDest0[j + offsX] = nonGreenDest1[j + offsX] = 1000.f + 25000.f;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// float ngDiff = nonGreenDiff(ng0,ng1,ng2);
|
||||
// float korr = log2Lut[((int)(riFrames[(offset << 1) + offset]->data[i][j + offset] * scaleNonGreen0))>>1];
|
||||
// if(ngDiff > 0.5f - korr) {
|
||||
// if(showMotion) {
|
||||
// if(!showOnlyMask) {
|
||||
// // if showMotion is enabled make the pixel green
|
||||
// nonGreenDest0[j + offsX] = 1000.f + 25000.f;
|
||||
// nonGreenDest1[j + offsX] = greenDest[j + offsX] = 0.f;
|
||||
// } else {
|
||||
// greenDest[j + offsX] = nonGreenDest0[j + offsX] = nonGreenDest1[j + offsX] = 1000.f + 25000.f;
|
||||
// }
|
||||
// }
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// ng1 = riFrames[2 - offset]->data[i + 1][j - offset + 1];
|
||||
// ng0 = riFrames[2 - (offset^1)]->data[i + 1][j - (offset^1) + 2];
|
||||
// ng2 = riFrames[2 - (offset^1)]->data[i + 1][j - (offset^1)];
|
||||
// ngDiff = nonGreenDiff(ng0,ng1,ng2);
|
||||
// korr = log2Lut[((int)(riFrames[2 - offset]->data[i + 1][j - offset + 1] * scaleNonGreen2))>>1];
|
||||
// if(ngDiff > 0.5f - korr) {
|
||||
// if(showMotion) {
|
||||
// if(!showOnlyMask) {
|
||||
// // if showMotion is enabled make the pixel green
|
||||
// nonGreenDest0[j + offsX] = 1000.f + 25000.f;
|
||||
// nonGreenDest1[j + offsX] = greenDest[j + offsX] = 0.f;
|
||||
// } else {
|
||||
// greenDest[j + offsX] = nonGreenDest0[j + offsX] = nonGreenDest1[j + offsX] = 1000.f + 25000.f;
|
||||
// }
|
||||
// }
|
||||
// continue;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// if(false && detectMotion && checkRedBlue) {
|
||||
@ -270,9 +352,9 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool det
|
||||
// float diff2 = ng1 - ng2;
|
||||
// float gridMax;
|
||||
// if(diff0 * diff2 > 0.f) {
|
||||
//// if(greenDiff(ng1, fabsf(diff0) < fabsf(diff2) ? ng0 : ng2) > motionThreshold ) {
|
||||
// gridMax = greenDiff(ng1, std::max(ng0, ng2));
|
||||
//// gridMax = greenDiff(ng1, ((ng0 + ng2) / 2.f));
|
||||
//// if(colourDiff(ng1, fabsf(diff0) < fabsf(diff2) ? ng0 : ng2) > motionThreshold ) {
|
||||
// gridMax = colourDiff(ng1, std::max(ng0, ng2));
|
||||
//// gridMax = colourDiff(ng1, ((ng0 + ng2) / 2.f));
|
||||
// if(gridMax > motionThreshold ) {
|
||||
// float factor = 1.f / (1.f - motionThreshold);
|
||||
// float blend = (gridMax - motionThreshold) * factor;
|
||||
@ -309,9 +391,9 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, bool det
|
||||
// diff0 = ng1 - ng0;
|
||||
// diff2 = ng1 - ng2;
|
||||
// if(signbit(diff0) == signbit(diff2)) {
|
||||
//// if(greenDiff(ng1, fabsf(diff0) < fabsf(diff2) ? ng0 : ng2) > motionThreshold ) {
|
||||
// gridMax = greenDiff(ng1, std::max(ng0, ng2));
|
||||
//// gridMax = greenDiff(ng1, ((ng0 + ng2) / 2.f));
|
||||
//// if(colourDiff(ng1, fabsf(diff0) < fabsf(diff2) ? ng0 : ng2) > motionThreshold ) {
|
||||
// gridMax = colourDiff(ng1, std::max(ng0, ng2));
|
||||
//// gridMax = colourDiff(ng1, ((ng0 + ng2) / 2.f));
|
||||
// if(gridMax > motionThreshold ) {
|
||||
// float factor = 1.f / (1.f - motionThreshold);
|
||||
// float blend = (gridMax - motionThreshold) * factor;
|
||||
|
@ -885,7 +885,7 @@ void RAWParams::setDefaults()
|
||||
bayersensor.dcb_enhance = true;
|
||||
//bayersensor.all_enhance = false;
|
||||
bayersensor.lmmse_iterations = 2;
|
||||
bayersensor.pixelshiftMotion = 70;
|
||||
bayersensor.pixelshiftMotion = 0;
|
||||
bayersensor.pixelshiftMotionCorrection = 3;
|
||||
bayersensor.pixelShiftStddevFactor = 5.0;
|
||||
bayersensor.pixelShiftEperIso = 0.75;
|
||||
@ -894,6 +894,7 @@ void RAWParams::setDefaults()
|
||||
bayersensor.pixelshiftShowMotion = false;
|
||||
bayersensor.pixelshiftShowMotionMaskOnly = false;
|
||||
bayersensor.pixelShiftAutomatic = true;
|
||||
bayersensor.pixelShiftNonGreenHorizontal = false;
|
||||
bayersensor.black0 = 0.0;
|
||||
bayersensor.black1 = 0.0;
|
||||
bayersensor.black2 = 0.0;
|
||||
@ -3409,6 +3410,10 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b
|
||||
keyFile.set_boolean ("RAW Bayer", "pixelShiftAutomatic", raw.bayersensor.pixelShiftAutomatic );
|
||||
}
|
||||
|
||||
if (!pedited || pedited->raw.bayersensor.pixelShiftNonGreenHorizontal) {
|
||||
keyFile.set_boolean ("RAW Bayer", "pixelShiftNonGreenHorizontal", raw.bayersensor.pixelShiftNonGreenHorizontal );
|
||||
}
|
||||
|
||||
//if (!pedited || pedited->raw.bayersensor.allEnhance) keyFile.set_boolean ("RAW Bayer", "ALLEnhance", raw.bayersensor.all_enhance );
|
||||
|
||||
if (!pedited || pedited->raw.xtranssensor.method) {
|
||||
@ -7539,6 +7544,13 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited)
|
||||
}
|
||||
}
|
||||
|
||||
if (keyFile.has_key ("RAW Bayer", "pixelShiftNonGreenHorizontal")) {
|
||||
raw.bayersensor.pixelShiftNonGreenHorizontal = keyFile.get_boolean("RAW Bayer", "pixelShiftNonGreenHorizontal");
|
||||
|
||||
if (pedited) {
|
||||
pedited->raw.bayersensor.pixelShiftNonGreenHorizontal = true;
|
||||
}
|
||||
}
|
||||
//if (keyFile.has_key ("RAW Bayer", "ALLEnhance")) { raw.bayersensor.all_enhance = keyFile.get_boolean("RAW Bayer", "ALLEnhance"); if (pedited) pedited->raw.bayersensor.allEnhance = true; }
|
||||
}
|
||||
|
||||
|
@ -1191,6 +1191,7 @@ public:
|
||||
bool pixelshiftShowMotion;
|
||||
bool pixelshiftShowMotionMaskOnly;
|
||||
bool pixelShiftAutomatic;
|
||||
bool pixelShiftNonGreenHorizontal;
|
||||
bool dcb_enhance;
|
||||
//bool all_enhance;
|
||||
};
|
||||
|
@ -659,7 +659,7 @@ int RawImage::loadRaw (bool loadData, unsigned int imageNum, bool closeFile, Pro
|
||||
return 0;
|
||||
}
|
||||
|
||||
float** RawImage::compress_image()
|
||||
float** RawImage::compress_image(int frameNum)
|
||||
{
|
||||
if( !image ) {
|
||||
return nullptr;
|
||||
@ -667,11 +667,12 @@ float** RawImage::compress_image()
|
||||
|
||||
if (isBayer() || isXtrans()) {
|
||||
if (!allocation) {
|
||||
allocation = new float[height * width];
|
||||
// shift the beginning of all frames but the first by 32 floats to avoid cache miss conflicts on CPUs which have <= 4-way associative L1-Cache
|
||||
allocation = new float[height * width + frameNum * 32];
|
||||
data = new float*[height];
|
||||
|
||||
for (int i = 0; i < height; i++) {
|
||||
data[i] = allocation + i * width;
|
||||
data[i] = allocation + i * width + frameNum * 32;
|
||||
}
|
||||
}
|
||||
} else if (colors == 1) {
|
||||
|
@ -119,7 +119,7 @@ public:
|
||||
{
|
||||
return image;
|
||||
}
|
||||
float** compress_image(); // revert to compressed pixels format and release image data
|
||||
float** compress_image(int frameNum); // revert to compressed pixels format and release image data
|
||||
float** data; // holds pixel values, data[i][j] corresponds to the ith row and jth column
|
||||
unsigned prefilters; // original filters saved ( used for 4 color processing )
|
||||
unsigned int getFrameCount() const { return is_raw; }
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <omp.h>
|
||||
#endif
|
||||
#include "opthelper.h"
|
||||
//#define BENCHMARK
|
||||
#define BENCHMARK
|
||||
#include "StopWatch.h"
|
||||
#define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val )
|
||||
#undef CLIPD
|
||||
@ -1521,7 +1521,7 @@ StopWatch Stop1("decode");
|
||||
{
|
||||
int errCodeThr = 0;
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for
|
||||
#pragma omp for nowait
|
||||
#endif
|
||||
for(unsigned int i = 0; i < numFrames; ++i) {
|
||||
if(i == 0) {
|
||||
@ -1531,7 +1531,7 @@ StopWatch Stop1("decode");
|
||||
riFrames[i] = new RawImage(fname);
|
||||
errCodeThr = riFrames[i]->loadRaw (true, i);
|
||||
}
|
||||
riFrames[i]->compress_image();
|
||||
riFrames[i]->compress_image(i);
|
||||
}
|
||||
#ifdef _OPENMP
|
||||
#pragma omp critical
|
||||
@ -1966,7 +1966,7 @@ void RawImageSource::demosaic(const RAWParams &raw)
|
||||
amaze_demosaic_RT (0, 0, W, H); // for non pixelshift files use amaze if pixelshift is selected. We need it also for motion correction
|
||||
}
|
||||
if(numFrames == 4) {
|
||||
pixelshift(0, 0, W, H, raw.bayersensor.pixelshiftMotion > 0, raw.bayersensor.pixelshiftMotion, raw.bayersensor.pixelshiftShowMotion, raw.bayersensor.pixelshiftShowMotionMaskOnly, currFrame, raw.bayersensor.pixelshiftMotionCorrection, raw.bayersensor.pixelShiftAutomatic, raw.bayersensor.pixelShiftStddevFactor, raw.bayersensor.pixelShiftEperIso, raw.bayersensor.pixelShiftNreadIso, raw.bayersensor.pixelShiftPrnu);
|
||||
pixelshift(0, 0, W, H, raw.bayersensor.pixelshiftMotion > 0, raw.bayersensor.pixelshiftMotion, raw.bayersensor.pixelshiftShowMotion, raw.bayersensor.pixelshiftShowMotionMaskOnly, currFrame, raw.bayersensor.pixelshiftMotionCorrection, raw.bayersensor.pixelShiftAutomatic, raw.bayersensor.pixelShiftStddevFactor, raw.bayersensor.pixelShiftEperIso, raw.bayersensor.pixelShiftNreadIso, raw.bayersensor.pixelShiftPrnu, raw.bayersensor.pixelShiftNonGreenHorizontal);
|
||||
}
|
||||
} else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::dcb] ) {
|
||||
dcb_demosaic(raw.bayersensor.dcb_iterations, raw.bayersensor.dcb_enhance);
|
||||
@ -3520,64 +3520,24 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R
|
||||
|
||||
void RawImageSource::scaleColors_pixelshift(int winx, int winy, int winw, int winh, const RAWParams &raw)
|
||||
{
|
||||
chmax[0] = chmax[1] = chmax[2] = chmax[3] = 0; //channel maxima
|
||||
float black_lev[4] = {0.f};//black level
|
||||
|
||||
//adjust black level (eg Canon)
|
||||
bool isMono = false;
|
||||
|
||||
black_lev[0] = raw.bayersensor.black1; //R
|
||||
black_lev[1] = raw.bayersensor.black0; //G1
|
||||
black_lev[2] = raw.bayersensor.black2; //B
|
||||
black_lev[3] = raw.bayersensor.black3; //G2
|
||||
|
||||
for(int i = 0; i < 4 ; i++) {
|
||||
cblacksom[i] = max( c_black[i] + black_lev[i], 0.0f ); // adjust black level
|
||||
}
|
||||
|
||||
initialGain = calculate_scale_mul(scale_mul, ref_pre_mul, c_white, cblacksom, isMono, ri->get_colors()); // recalculate scale colors with adjusted levels
|
||||
|
||||
//fprintf(stderr, "recalc: %f [%f %f %f %f]\n", initialGain, scale_mul[0], scale_mul[1], scale_mul[2], scale_mul[3]);
|
||||
for(int i = 0; i < 4 ; i++) {
|
||||
clmax[i] = (c_white[i] - cblacksom[i]) * scale_mul[i]; // raw clip level
|
||||
}
|
||||
|
||||
// this seems strange, but it works
|
||||
BENCHFUN
|
||||
|
||||
// scale image colors
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for schedule(dynamic,64) collapse(2)
|
||||
#endif
|
||||
for(int frame = 0; frame < 4; ++frame) {
|
||||
for (int row = winy; row < winy + winh; row ++)
|
||||
{
|
||||
float tmpchmax[3];
|
||||
tmpchmax[0] = tmpchmax[1] = tmpchmax[2] = 0.0f;
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for nowait
|
||||
#endif
|
||||
|
||||
for (int row = winy; row < winy + winh; row ++)
|
||||
{
|
||||
for (int col = winx; col < winx + winw; col++) {
|
||||
int c = FC(row,col);
|
||||
for(int frame = 0; frame < 4; ++frame) {
|
||||
float val = (riFrames[frame]->data[row][col] - cblacksom[c]) * scale_mul[c];
|
||||
tmpchmax[c] = max(tmpchmax[c], val);
|
||||
riFrames[frame]->data[row][col] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp critical
|
||||
#endif
|
||||
{
|
||||
chmax[0] = max(tmpchmax[0], chmax[0]);
|
||||
chmax[1] = max(tmpchmax[1], chmax[1]);
|
||||
chmax[2] = max(tmpchmax[2], chmax[2]);
|
||||
for (int col = winx; col < winx + winw; col++) {
|
||||
int c = FC(row,col);
|
||||
float val = (riFrames[frame]->data[row][col] - cblacksom[c]) * scale_mul[c];
|
||||
riFrames[frame]->data[row][col] = val;
|
||||
}
|
||||
}
|
||||
pixelShiftColoursScaled = true;
|
||||
}
|
||||
pixelShiftColoursScaled = true;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -263,7 +263,7 @@ protected:
|
||||
void xtransborder_interpolate (int border);
|
||||
void xtrans_interpolate (const int passes, const bool useCieLab);
|
||||
void fast_xtrans_interpolate ();
|
||||
void pixelshift(int winx, int winy, int winw, int winh, bool detectMotion, int motion, bool showMotion, bool showOnlyMask, unsigned int frame, unsigned int gridSize, bool adaptive, float stddevFactor, float eperIso, float nreadIso, float prnu);
|
||||
void pixelshift(int winx, int winy, int winw, int winh, bool detectMotion, int motion, bool showMotion, bool showOnlyMask, unsigned int frame, unsigned int gridSize, bool adaptive, float stddevFactor, float eperIso, float nreadIso, float prnu, bool checkNonGreenHorizontal);
|
||||
void hflip (Imagefloat* im);
|
||||
void vflip (Imagefloat* im);
|
||||
|
||||
|
@ -92,6 +92,9 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
|
||||
pixelShiftAutomatic = Gtk::manage (new Gtk::CheckButton(M("TP_RAW_PIXELSHIFTADAPTIVE")));
|
||||
pixelShiftOptions->pack_start(*pixelShiftAutomatic);
|
||||
|
||||
pixelShiftNonGreenHorizontal = Gtk::manage (new Gtk::CheckButton(M("TP_RAW_PIXELSHIFTNONGREENHORIZONTAL")));
|
||||
pixelShiftOptions->pack_start(*pixelShiftNonGreenHorizontal);
|
||||
|
||||
pixelShiftMotion = Gtk::manage (new Adjuster (M("TP_RAW_PIXELSHIFTMOTION"), 0, 100, 1, 70));
|
||||
pixelShiftMotion->setAdjusterListener (this);
|
||||
pixelShiftMotion->set_tooltip_markup (M("TP_RAW_PIXELSHIFTMOTION_TOOLTIP"));
|
||||
@ -185,6 +188,7 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
|
||||
pixelShiftShowMotionconn = pixelShiftShowMotion->signal_toggled().connect ( sigc::mem_fun(*this, &BayerProcess::pixelShiftShowMotionChanged), true);
|
||||
pixelShiftShowMotionMaskOnlyconn = pixelShiftShowMotionMaskOnly->signal_toggled().connect ( sigc::mem_fun(*this, &BayerProcess::pixelShiftShowMotionMaskOnlyChanged), true);
|
||||
pixelShiftAutomaticconn = pixelShiftAutomatic->signal_toggled().connect ( sigc::mem_fun(*this, &BayerProcess::pixelShiftAutomaticChanged), true);
|
||||
pixelShiftNonGreenHorizontalconn = pixelShiftNonGreenHorizontal->signal_toggled().connect ( sigc::mem_fun(*this, &BayerProcess::pixelShiftNonGreenHorizontalChanged), true);
|
||||
//allEnhconn = allEnhance->signal_toggled().connect ( sigc::mem_fun(*this, &BayerProcess::allEnhanceChanged), true);
|
||||
}
|
||||
|
||||
@ -215,6 +219,7 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params
|
||||
pixelShiftShowMotion->set_inconsistent(!pedited->raw.bayersensor.pixelshiftShowMotion);
|
||||
pixelShiftShowMotionMaskOnly->set_inconsistent(!pedited->raw.bayersensor.pixelshiftShowMotionMaskOnly);
|
||||
pixelShiftAutomatic->set_inconsistent(!pedited->raw.bayersensor.pixelShiftAutomatic);
|
||||
pixelShiftNonGreenHorizontal->set_inconsistent(!pedited->raw.bayersensor.pixelShiftNonGreenHorizontal);
|
||||
//allEnhance->set_inconsistent(!pedited->raw.bayersensor.allEnhance);
|
||||
lmmseIterations->setEditedState ( pedited->raw.bayersensor.lmmseIterations ? Edited : UnEdited);
|
||||
pixelShiftMotion->setEditedState ( pedited->raw.bayersensor.pixelshiftMotion ? Edited : UnEdited);
|
||||
@ -239,6 +244,7 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params
|
||||
pixelShiftShowMotion->set_active(pp->raw.bayersensor.pixelshiftShowMotion);
|
||||
pixelShiftShowMotionMaskOnly->set_active(pp->raw.bayersensor.pixelshiftShowMotionMaskOnly);
|
||||
pixelShiftAutomatic->set_active(pp->raw.bayersensor.pixelShiftAutomatic);
|
||||
pixelShiftNonGreenHorizontal->set_active(pp->raw.bayersensor.pixelShiftNonGreenHorizontal);
|
||||
ccSteps->setValue (pp->raw.bayersensor.ccSteps);
|
||||
lmmseIterations->setValue (pp->raw.bayersensor.lmmse_iterations);
|
||||
pixelShiftMotion->setValue (pp->raw.bayersensor.pixelshiftMotion);
|
||||
@ -304,6 +310,7 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe
|
||||
pp->raw.bayersensor.pixelshiftShowMotion = pixelShiftShowMotion->get_active();
|
||||
pp->raw.bayersensor.pixelshiftShowMotionMaskOnly = pixelShiftShowMotionMaskOnly->get_active();
|
||||
pp->raw.bayersensor.pixelShiftAutomatic = pixelShiftAutomatic->get_active();
|
||||
pp->raw.bayersensor.pixelShiftNonGreenHorizontal = pixelShiftNonGreenHorizontal->get_active();
|
||||
|
||||
int currentRow = method->get_active_row_number();
|
||||
if( currentRow >= 0 && currentRow < procparams::RAWParams::BayerSensor::numMethods) {
|
||||
@ -333,6 +340,7 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe
|
||||
pedited->raw.bayersensor.pixelshiftShowMotion = !pixelShiftShowMotion->get_inconsistent();
|
||||
pedited->raw.bayersensor.pixelshiftShowMotionMaskOnly = !pixelShiftShowMotionMaskOnly->get_inconsistent();
|
||||
pedited->raw.bayersensor.pixelShiftAutomatic = !pixelShiftAutomatic->get_inconsistent();
|
||||
pedited->raw.bayersensor.pixelShiftNonGreenHorizontal = !pixelShiftNonGreenHorizontal->get_inconsistent();
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,6 +551,7 @@ void BayerProcess::pixelShiftAutomaticChanged ()
|
||||
pixelShiftNreadIso->set_sensitive(pixelShiftAutomatic->get_active ());
|
||||
pixelShiftPrnu->set_sensitive(pixelShiftAutomatic->get_active ());
|
||||
pixelShiftStddevFactor->set_sensitive(pixelShiftAutomatic->get_active ());
|
||||
pixelShiftNonGreenHorizontal->set_sensitive(pixelShiftAutomatic->get_active ());
|
||||
|
||||
if (listener) {
|
||||
listener->panelChanged (EvDemosaicPixelshiftMotion, pixelShiftAutomatic->get_active() ? M("GENERAL_ENABLED") : M("GENERAL_DISABLED"));
|
||||
@ -550,6 +559,27 @@ void BayerProcess::pixelShiftAutomaticChanged ()
|
||||
}
|
||||
|
||||
|
||||
void BayerProcess::pixelShiftNonGreenHorizontalChanged ()
|
||||
{
|
||||
if (batchMode) {
|
||||
if (pixelShiftNonGreenHorizontal->get_inconsistent()) {
|
||||
pixelShiftNonGreenHorizontal->set_inconsistent (false);
|
||||
pixelShiftNonGreenHorizontalconn.block (true);
|
||||
pixelShiftNonGreenHorizontal->set_active (false);
|
||||
pixelShiftNonGreenHorizontalconn.block (false);
|
||||
} else if (lastDCBen) {
|
||||
pixelShiftNonGreenHorizontal->set_inconsistent (true);
|
||||
}
|
||||
|
||||
lastDCBen = pixelShiftNonGreenHorizontal->get_active ();
|
||||
}
|
||||
|
||||
if (listener) {
|
||||
listener->panelChanged (EvDemosaicPixelshiftMotion, pixelShiftNonGreenHorizontal->get_active() ? M("GENERAL_ENABLED") : M("GENERAL_DISABLED"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*void BayerProcess::allEnhanceChanged ()
|
||||
{
|
||||
if (batchMode) {
|
||||
|
@ -47,6 +47,7 @@ protected:
|
||||
Gtk::CheckButton* pixelShiftShowMotion;
|
||||
Gtk::CheckButton* pixelShiftShowMotionMaskOnly;
|
||||
Gtk::CheckButton* pixelShiftAutomatic;
|
||||
Gtk::CheckButton* pixelShiftNonGreenHorizontal;
|
||||
Adjuster* pixelShiftStddevFactor;
|
||||
Adjuster* pixelShiftEperIso;
|
||||
Adjuster* pixelShiftNreadIso;
|
||||
@ -54,7 +55,7 @@ protected:
|
||||
bool lastDCBen;
|
||||
int oldMethod;
|
||||
//bool lastALLen;
|
||||
sigc::connection methodconn, imagenumberconn, dcbEnhconn, pixelShiftShowMotionconn, pixelShiftShowMotionMaskOnlyconn, pixelShiftAutomaticconn; //,allEnhconn;
|
||||
sigc::connection methodconn, imagenumberconn, dcbEnhconn, pixelShiftShowMotionconn, pixelShiftShowMotionMaskOnlyconn, pixelShiftAutomaticconn, pixelShiftNonGreenHorizontalconn; //,allEnhconn;
|
||||
public:
|
||||
|
||||
BayerProcess ();
|
||||
@ -71,6 +72,7 @@ public:
|
||||
void pixelShiftShowMotionChanged();
|
||||
void pixelShiftShowMotionMaskOnlyChanged();
|
||||
void pixelShiftAutomaticChanged();
|
||||
void pixelShiftNonGreenHorizontalChanged();
|
||||
//void allEnhanceChanged();
|
||||
};
|
||||
|
||||
|
@ -379,6 +379,7 @@ void ParamsEdited::set (bool v)
|
||||
raw.bayersensor.pixelshiftShowMotion = v;
|
||||
raw.bayersensor.pixelshiftShowMotionMaskOnly = v;
|
||||
raw.bayersensor.pixelShiftAutomatic = v;
|
||||
raw.bayersensor.pixelShiftNonGreenHorizontal = v;
|
||||
raw.bayersensor.greenEq = v;
|
||||
raw.bayersensor.linenoise = v;
|
||||
raw.xtranssensor.method = v;
|
||||
@ -884,6 +885,7 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
|
||||
raw.bayersensor.pixelshiftShowMotion = raw.bayersensor.pixelshiftShowMotion && p.raw.bayersensor.pixelshiftShowMotion == other.raw.bayersensor.pixelshiftShowMotion;
|
||||
raw.bayersensor.pixelshiftShowMotionMaskOnly = raw.bayersensor.pixelshiftShowMotionMaskOnly && p.raw.bayersensor.pixelshiftShowMotionMaskOnly == other.raw.bayersensor.pixelshiftShowMotionMaskOnly;
|
||||
raw.bayersensor.pixelShiftAutomatic = raw.bayersensor.pixelShiftAutomatic && p.raw.bayersensor.pixelShiftAutomatic == other.raw.bayersensor.pixelShiftAutomatic;
|
||||
raw.bayersensor.pixelShiftNonGreenHorizontal = raw.bayersensor.pixelShiftNonGreenHorizontal && p.raw.bayersensor.pixelShiftNonGreenHorizontal == other.raw.bayersensor.pixelShiftNonGreenHorizontal;
|
||||
raw.bayersensor.greenEq = raw.bayersensor.greenEq && p.raw.bayersensor.greenthresh == other.raw.bayersensor.greenthresh;
|
||||
raw.bayersensor.linenoise = raw.bayersensor.linenoise && p.raw.bayersensor.linenoise == other.raw.bayersensor.linenoise;
|
||||
raw.xtranssensor.method = raw.xtranssensor.method && p.raw.xtranssensor.method == other.raw.xtranssensor.method;
|
||||
@ -2332,6 +2334,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
|
||||
toEdit.raw.bayersensor.pixelShiftAutomatic = mods.raw.bayersensor.pixelShiftAutomatic;
|
||||
}
|
||||
|
||||
if (raw.bayersensor.pixelShiftNonGreenHorizontal) {
|
||||
toEdit.raw.bayersensor.pixelShiftNonGreenHorizontal = mods.raw.bayersensor.pixelShiftNonGreenHorizontal;
|
||||
}
|
||||
|
||||
//if (raw.bayersensor.allEnhance) toEdit.raw.bayersensor.all_enhance = mods.raw.bayersensor.all_enhance;
|
||||
if (raw.bayersensor.greenEq) {
|
||||
toEdit.raw.bayersensor.greenthresh = dontforceSet && options.baBehav[ADDSET_PREPROCESS_GREENEQUIL] ? toEdit.raw.bayersensor.greenthresh + mods.raw.bayersensor.greenthresh : mods.raw.bayersensor.greenthresh;
|
||||
|
@ -701,6 +701,8 @@ public:
|
||||
bool pixelshiftShowMotion;
|
||||
bool pixelshiftShowMotionMaskOnly;
|
||||
bool pixelShiftAutomatic;
|
||||
bool pixelShiftNonGreenHorizontal;
|
||||
|
||||
//bool allEnhance;
|
||||
bool greenEq;
|
||||
bool linenoise;
|
||||
|
Loading…
x
Reference in New Issue
Block a user