Perspective correction implemented
This commit is contained in:
@@ -76,19 +76,34 @@ bool ImProcFunctions::transCoord (int W, int H, std::vector<Coord2D> &src, std::
|
||||
|
||||
double oW = W*params->resize.scale;
|
||||
double oH = H*params->resize.scale;
|
||||
double w2 = (double) oW / 2.0 - 0.5;
|
||||
double h2 = (double) oH / 2.0 - 0.5;
|
||||
double w2 = (double) oW / 2.0 - 0.5;
|
||||
double h2 = (double) oH / 2.0 - 0.5;
|
||||
double a = params->distortion.amount;
|
||||
double cost = cos(params->rotate.degree * 3.14/180.0);
|
||||
double sint = sin(params->rotate.degree * 3.14/180.0);
|
||||
double maxRadius = sqrt( (double)( oW*oW + oH*oH ) ) / 2;
|
||||
double ascale = ascaleDef>0 ? ascaleDef : (params->rotate.fill ? getTransformAutoFill (oW, oH) : 1.0);
|
||||
double vpdeg = params->perspective.vertical / 100.0 * 45.0;
|
||||
double vpalpha = (90.0 - vpdeg) / 180.0 * 3.14;
|
||||
double vpteta = fabs(vpalpha-3.14/2)<1e-3 ? 0.0 : acos ((vpdeg>0 ? 1.0 : -1.0) * sqrt((-oW*oW*tan(vpalpha)*tan(vpalpha) + (vpdeg>0 ? 1.0 : -1.0) * oW*tan(vpalpha)*sqrt(16*maxRadius*maxRadius+oW*oW*tan(vpalpha)*tan(vpalpha)))/(maxRadius*maxRadius*8)));
|
||||
double vpcospt = (vpdeg>=0 ? 1.0 : -1.0) * cos (vpteta), vptanpt = tan (vpteta);
|
||||
double hpdeg = params->perspective.horizontal / 100.0 * 45.0;
|
||||
double hpalpha = (90.0 - hpdeg) / 180.0 * 3.14;
|
||||
double hpteta = fabs(hpalpha-3.14/2)<1e-3 ? 0.0 : acos ((hpdeg>0 ? 1.0 : -1.0) * sqrt((-oH*oH*tan(hpalpha)*tan(hpalpha) + (hpdeg>0 ? 1.0 : -1.0) * oH*tan(hpalpha)*sqrt(16*maxRadius*maxRadius+oH*oH*tan(hpalpha)*tan(hpalpha)))/(maxRadius*maxRadius*8)));
|
||||
double hpcospt = (hpdeg>=0 ? 1.0 : -1.0) * cos (hpteta), hptanpt = tan (hpteta);
|
||||
|
||||
double ascale = ascaleDef>0 ? ascaleDef : (params->commonTrans.autofill ? getTransformAutoFill (oW, oH) : 1.0);
|
||||
|
||||
for (int i=0; i<src.size(); i++) {
|
||||
|
||||
double y_d = ascale * (src[i].y - h2);
|
||||
double x_d = ascale * (src[i].x - w2);
|
||||
|
||||
y_d = y_d * maxRadius / (maxRadius + x_d*hptanpt);
|
||||
x_d = x_d * maxRadius * hpcospt / (maxRadius + x_d*hptanpt);
|
||||
|
||||
x_d = x_d * maxRadius / (maxRadius - y_d*vptanpt);
|
||||
y_d = y_d * maxRadius * vpcospt / (maxRadius - y_d*vptanpt);
|
||||
|
||||
double Dx = x_d * cost - y_d * sint;
|
||||
double Dy = x_d * sint + y_d * cost;
|
||||
|
||||
@@ -197,14 +212,10 @@ void ImProcFunctions::transform (Image16* original, Image16* transformed, int cx
|
||||
if (!(needsCA() || needsDistortion() || needsRotation() || needsPerspective()) && needsVignetting())
|
||||
vignetting (original, transformed, cx, cy, oW, oH);
|
||||
else if (!needsCA()) {
|
||||
MyTime t1,t2;
|
||||
t1.set ();
|
||||
if (scale==1)
|
||||
transformNonSep (original, transformed, cx, cy, sx, sy, oW, oH);
|
||||
else
|
||||
simpltransform (original, transformed, cx, cy, sx, sy, oW, oH);
|
||||
t2.set ();
|
||||
printf ("transform time=%d\n", t2.etime(t1));
|
||||
}
|
||||
else
|
||||
transformSep (original, transformed, cx, cy, sx, sy, oW, oH);
|
||||
@@ -260,14 +271,34 @@ void ImProcFunctions::transformNonSep (Image16* original, Image16* transformed,
|
||||
double mul = (1.0-v) / tanh(b);
|
||||
bool dovign = params->vignetting.amount != 0;
|
||||
|
||||
double ascale = params->rotate.fill ? getTransformAutoFill (oW, oH) : 1.0;
|
||||
// auxiliary variables for vertical perspective correction
|
||||
double vpdeg = params->perspective.vertical / 100.0 * 45.0;
|
||||
double vpalpha = (90.0 - vpdeg) / 180.0 * 3.14;
|
||||
double vpteta = fabs(vpalpha-3.14/2)<1e-3 ? 0.0 : acos ((vpdeg>0 ? 1.0 : -1.0) * sqrt((-oW*oW*tan(vpalpha)*tan(vpalpha) + (vpdeg>0 ? 1.0 : -1.0) * oW*tan(vpalpha)*sqrt(16*maxRadius*maxRadius+oW*oW*tan(vpalpha)*tan(vpalpha)))/(maxRadius*maxRadius*8)));
|
||||
double vpcospt = (vpdeg>=0 ? 1.0 : -1.0) * cos (vpteta), vptanpt = tan (vpteta);
|
||||
|
||||
// auxiliary variables for horizontal perspective correction
|
||||
double hpdeg = params->perspective.horizontal / 100.0 * 45.0;
|
||||
double hpalpha = (90.0 - hpdeg) / 180.0 * 3.14;
|
||||
double hpteta = fabs(hpalpha-3.14/2)<1e-3 ? 0.0 : acos ((hpdeg>0 ? 1.0 : -1.0) * sqrt((-oH*oH*tan(hpalpha)*tan(hpalpha) + (hpdeg>0 ? 1.0 : -1.0) * oH*tan(hpalpha)*sqrt(16*maxRadius*maxRadius+oH*oH*tan(hpalpha)*tan(hpalpha)))/(maxRadius*maxRadius*8)));
|
||||
double hpcospt = (hpdeg>=0 ? 1.0 : -1.0) * cos (hpteta), hptanpt = tan (hpteta);
|
||||
|
||||
double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH) : 1.0;
|
||||
|
||||
// main cycle
|
||||
#pragma omp parallel for if (multiThread)
|
||||
for (int y=0; y<transformed->height; y++) {
|
||||
double y_d = ascale * (y + cy - h2); // centering y coord & scale
|
||||
for (int x=0; x<transformed->width; x++) {
|
||||
double x_d = ascale * (x + cx - w2); // centering x coord & scale
|
||||
double y_d = ascale * (y + cy - h2); // centering y coord & scale
|
||||
|
||||
// horizontal perspective transformation
|
||||
y_d = y_d * maxRadius / (maxRadius + x_d*hptanpt);
|
||||
x_d = x_d * maxRadius * hpcospt / (maxRadius + x_d*hptanpt);
|
||||
|
||||
// vertical perspective transformation
|
||||
x_d = x_d * maxRadius / (maxRadius - y_d*vptanpt);
|
||||
y_d = y_d * maxRadius * vpcospt / (maxRadius - y_d*vptanpt);
|
||||
|
||||
// rotate
|
||||
double Dx = x_d * cost - y_d * sint;
|
||||
@@ -354,16 +385,36 @@ void ImProcFunctions::transformSep (Image16* original, Image16* transformed, int
|
||||
double mul = (1.0-v) / tanh(b);
|
||||
bool dovign = params->vignetting.amount != 0;
|
||||
|
||||
double ascale = params->rotate.fill ? getTransformAutoFill (oW, oH) : 1.0;
|
||||
// auxiliary variables for vertical perspective correction
|
||||
double vpdeg = params->perspective.vertical / 100.0 * 45.0;
|
||||
double vpalpha = (90.0 - vpdeg) / 180.0 * 3.14;
|
||||
double vpteta = fabs(vpalpha-3.14/2)<1e-3 ? 0.0 : acos ((vpdeg>0 ? 1.0 : -1.0) * sqrt((-oW*oW*tan(vpalpha)*tan(vpalpha) + (vpdeg>0 ? 1.0 : -1.0) * oW*tan(vpalpha)*sqrt(16*maxRadius*maxRadius+oW*oW*tan(vpalpha)*tan(vpalpha)))/(maxRadius*maxRadius*8)));
|
||||
double vpcospt = (vpdeg>=0 ? 1.0 : -1.0) * cos (vpteta), vptanpt = tan (vpteta);
|
||||
|
||||
// auxiliary variables for horizontal perspective correction
|
||||
double hpdeg = params->perspective.horizontal / 100.0 * 45.0;
|
||||
double hpalpha = (90.0 - hpdeg) / 180.0 * 3.14;
|
||||
double hpteta = fabs(hpalpha-3.14/2)<1e-3 ? 0.0 : acos ((hpdeg>0 ? 1.0 : -1.0) * sqrt((-oH*oH*tan(hpalpha)*tan(hpalpha) + (hpdeg>0 ? 1.0 : -1.0) * oH*tan(hpalpha)*sqrt(16*maxRadius*maxRadius+oH*oH*tan(hpalpha)*tan(hpalpha)))/(maxRadius*maxRadius*8)));
|
||||
double hpcospt = (hpdeg>=0 ? 1.0 : -1.0) * cos (hpteta), hptanpt = tan (hpteta);
|
||||
|
||||
double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH) : 1.0;
|
||||
|
||||
// main cycle
|
||||
#pragma omp parallel for if (multiThread)
|
||||
for (int y=0; y<transformed->height; y++) {
|
||||
double y_d = ascale * (y + cy - h2); // centering y coord & scale
|
||||
for (int x=0; x<transformed->width; x++) {
|
||||
double x_d = ascale * (x + cx - w2); // centering x coord & scale
|
||||
double y_d = ascale * (y + cy - h2); // centering y coord & scale
|
||||
|
||||
// rotate
|
||||
// horizontal perspective transformation
|
||||
y_d = y_d * maxRadius / (maxRadius + x_d*hptanpt);
|
||||
x_d = x_d * maxRadius * hpcospt / (maxRadius + x_d*hptanpt);
|
||||
|
||||
// vertical perspective transformation
|
||||
x_d = x_d * maxRadius / (maxRadius - y_d*vptanpt);
|
||||
y_d = y_d * maxRadius * vpcospt / (maxRadius - y_d*vptanpt);
|
||||
|
||||
// rotate
|
||||
double Dxc = x_d * cost - y_d * sint;
|
||||
double Dyc = x_d * sint + y_d * cost;
|
||||
|
||||
@@ -430,15 +481,35 @@ void ImProcFunctions::simpltransform (Image16* original, Image16* transformed, i
|
||||
double mul = (1.0-v) / tanh(b);
|
||||
bool dovign = params->vignetting.amount != 0;
|
||||
|
||||
double ascale = params->rotate.fill ? getTransformAutoFill (oW, oH) : 1.0;
|
||||
// auxiliary variables for vertical perspective correction
|
||||
double vpdeg = params->perspective.vertical / 100.0 * 45.0;
|
||||
double vpalpha = (90 - vpdeg) / 180.0 * 3.14;
|
||||
double vpteta = fabs(vpalpha-3.14/2)<1e-3 ? 0.0 : acos ((vpdeg>0 ? 1.0 : -1.0) * sqrt((-oW*oW*tan(vpalpha)*tan(vpalpha) + (vpdeg>0 ? 1.0 : -1.0) * oW*tan(vpalpha)*sqrt(16*maxRadius*maxRadius+oW*oW*tan(vpalpha)*tan(vpalpha)))/(maxRadius*maxRadius*8)));
|
||||
double vpcospt = (vpdeg>=0 ? 1.0 : -1.0) * cos (vpteta), vptanpt = tan (vpteta);
|
||||
|
||||
// auxiliary variables for horizontal perspective correction
|
||||
double hpdeg = params->perspective.horizontal / 100.0 * 45.0;
|
||||
double hpalpha = (90 - hpdeg) / 180.0 * 3.14;
|
||||
double hpteta = fabs(hpalpha-3.14/2)<1e-3 ? 0.0 : acos ((hpdeg>0 ? 1.0 : -1.0) * sqrt((-oH*oH*tan(hpalpha)*tan(hpalpha) + (hpdeg>0 ? 1.0 : -1.0) * oH*tan(hpalpha)*sqrt(16*maxRadius*maxRadius+oH*oH*tan(hpalpha)*tan(hpalpha)))/(maxRadius*maxRadius*8)));
|
||||
double hpcospt = (hpdeg>=0 ? 1.0 : -1.0) * cos (hpteta), hptanpt = tan (hpteta);
|
||||
|
||||
double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH) : 1.0;
|
||||
|
||||
// main cycle
|
||||
#pragma omp parallel for if (multiThread)
|
||||
for (int y=0; y<transformed->height; y++) {
|
||||
double y_d = ascale * (y + cy - h2); // centering y coord & scale
|
||||
for (int x=0; x<transformed->width; x++) {
|
||||
double y_d = ascale * (y + cy - h2); // centering y coord & scale
|
||||
double x_d = ascale * (x + cx - w2); // centering x coord & scale
|
||||
|
||||
// horizontal perspective transformation
|
||||
y_d = y_d * maxRadius / (maxRadius + x_d*hptanpt);
|
||||
x_d = x_d * maxRadius * hpcospt / (maxRadius + x_d*hptanpt);
|
||||
|
||||
// vertical perspective transformation
|
||||
x_d = x_d * maxRadius / (maxRadius - y_d*vptanpt);
|
||||
y_d = y_d * maxRadius * vpcospt / (maxRadius - y_d*vptanpt);
|
||||
|
||||
// rotate
|
||||
double Dx = x_d * cost - y_d * sint;
|
||||
double Dy = x_d * sint + y_d * cost;
|
||||
@@ -498,8 +569,6 @@ void ImProcFunctions::simpltransform (Image16* original, Image16* transformed, i
|
||||
|
||||
double ImProcFunctions::getTransformAutoFill (int oW, int oH) {
|
||||
|
||||
MyTime t1,t2;
|
||||
t1.set ();
|
||||
double scaleU = 1.0;
|
||||
double scaleL = 0.001;
|
||||
while (scaleU - scaleL > 0.001) {
|
||||
@@ -513,8 +582,6 @@ double ImProcFunctions::getTransformAutoFill (int oW, int oH) {
|
||||
else
|
||||
scaleL = scale;
|
||||
}
|
||||
t2.set ();
|
||||
printf ("autofill time=%d\n", t2.etime(t1));
|
||||
return scaleL;
|
||||
}
|
||||
|
||||
@@ -532,11 +599,11 @@ bool ImProcFunctions::needsRotation () {
|
||||
}
|
||||
bool ImProcFunctions::needsPerspective () {
|
||||
|
||||
return false;
|
||||
return params->perspective.horizontal || params->perspective.vertical;
|
||||
}
|
||||
bool ImProcFunctions::needsVignetting () {
|
||||
|
||||
return params->vignetting.amount != 0;
|
||||
return params->vignetting.amount;
|
||||
}
|
||||
bool ImProcFunctions::needsTransform () {
|
||||
|
||||
|
||||
@@ -1,114 +1,115 @@
|
||||
/*
|
||||
* This file is part of RawTherapee.
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
*
|
||||
* RawTherapee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* RawTherapee is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __PROCEVENT__
|
||||
#define __PROCEVENT__
|
||||
|
||||
#include <rtengine.h>
|
||||
|
||||
#define NUMOFEVENTS 83
|
||||
|
||||
namespace rtengine {
|
||||
|
||||
enum ProcEvent {
|
||||
EvPhotoLoaded=0,
|
||||
EvProfileLoaded=1,
|
||||
EvProfileChanged=2,
|
||||
EvHistoryBrowsed=3,
|
||||
EvBrightness=4,
|
||||
EvContrast=5,
|
||||
EvBlack=6,
|
||||
EvExpComp=7,
|
||||
EvHLCompr=8,
|
||||
EvSHCompr=9,
|
||||
EvToneCurve=10,
|
||||
EvAutoExp=11,
|
||||
EvClip=12,
|
||||
EvLBrightness=13,
|
||||
EvLContrast=14,
|
||||
EvLBlack=15,
|
||||
EvLHLCompr=16,
|
||||
EvLSHCompr=17,
|
||||
EvLCurve=18,
|
||||
EvShrEnabled=19,
|
||||
EvShrRadius=20,
|
||||
EvShrAmount=21,
|
||||
EvShrThresh=22,
|
||||
EvShrEdgeOnly=23,
|
||||
EvShrEdgeRadius=24,
|
||||
EvShrEdgeTolerance=25,
|
||||
EvShrHaloControl=26,
|
||||
EvShrHaloAmount=27,
|
||||
EvShrMethod=28,
|
||||
EvShrDRadius=29,
|
||||
EvShrDAmount=30,
|
||||
EvShrDDamping=31,
|
||||
EvShrDIterations=32,
|
||||
EvCBAvoidClip=33,
|
||||
EvCBSatLimiter=34,
|
||||
EvCBSatLimit=35,
|
||||
EvCBBoost=36,
|
||||
EvWBMethod=37,
|
||||
EvWBTemp=38,
|
||||
EvWBGreen=39,
|
||||
EvCShiftA=40,
|
||||
EvCShiftB=41,
|
||||
EvLDNEnabled=42,
|
||||
EvLDNRadius=43,
|
||||
EvLDNEdgeTolerance=44,
|
||||
EvCDNEnabled=45,
|
||||
EvCDNRadius=46,
|
||||
EvCDNEdgeTolerance=47,
|
||||
EvCDNEdgeSensitive=48,
|
||||
EvSHEnabled=49,
|
||||
EvSHHighlights=50,
|
||||
EvSHShadows=51,
|
||||
EvSHHLTonalW=52,
|
||||
EvSHSHTonalW=53,
|
||||
EvSHLContrast=54,
|
||||
EvSHRadius=55,
|
||||
EvCTRotate=56,
|
||||
EvCTHFlip=57,
|
||||
EvCTVFlip=58,
|
||||
EvROTDegree=59,
|
||||
EvROTFill=60,
|
||||
EvDISTAmount=61,
|
||||
EvBookmarkSelected=62,
|
||||
EvCrop=63,
|
||||
EvCACorr=64,
|
||||
EvHREnabled=65,
|
||||
EvHRAmount=66,
|
||||
EvHRMethod=67,
|
||||
EvWProfile=68,
|
||||
EvOProfile=69,
|
||||
EvIProfile=70,
|
||||
EvVignetting=71,
|
||||
EvChMixer=72,
|
||||
EvResizeScale=73,
|
||||
EvResizeMethod=74,
|
||||
EvExif=75,
|
||||
EvIPTC=76,
|
||||
EvResizeSpec=77,
|
||||
EvResizeWidth=78,
|
||||
EvResizeHeight=79,
|
||||
EvResizeEnabled=80,
|
||||
EvProfileChangeNotification=81,
|
||||
EvSHHighQuality=82
|
||||
};
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* This file is part of RawTherapee.
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
*
|
||||
* RawTherapee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* RawTherapee is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __PROCEVENT__
|
||||
#define __PROCEVENT__
|
||||
|
||||
#include <rtengine.h>
|
||||
|
||||
#define NUMOFEVENTS 84
|
||||
|
||||
namespace rtengine {
|
||||
|
||||
enum ProcEvent {
|
||||
EvPhotoLoaded=0,
|
||||
EvProfileLoaded=1,
|
||||
EvProfileChanged=2,
|
||||
EvHistoryBrowsed=3,
|
||||
EvBrightness=4,
|
||||
EvContrast=5,
|
||||
EvBlack=6,
|
||||
EvExpComp=7,
|
||||
EvHLCompr=8,
|
||||
EvSHCompr=9,
|
||||
EvToneCurve=10,
|
||||
EvAutoExp=11,
|
||||
EvClip=12,
|
||||
EvLBrightness=13,
|
||||
EvLContrast=14,
|
||||
EvLBlack=15,
|
||||
EvLHLCompr=16,
|
||||
EvLSHCompr=17,
|
||||
EvLCurve=18,
|
||||
EvShrEnabled=19,
|
||||
EvShrRadius=20,
|
||||
EvShrAmount=21,
|
||||
EvShrThresh=22,
|
||||
EvShrEdgeOnly=23,
|
||||
EvShrEdgeRadius=24,
|
||||
EvShrEdgeTolerance=25,
|
||||
EvShrHaloControl=26,
|
||||
EvShrHaloAmount=27,
|
||||
EvShrMethod=28,
|
||||
EvShrDRadius=29,
|
||||
EvShrDAmount=30,
|
||||
EvShrDDamping=31,
|
||||
EvShrDIterations=32,
|
||||
EvCBAvoidClip=33,
|
||||
EvCBSatLimiter=34,
|
||||
EvCBSatLimit=35,
|
||||
EvCBBoost=36,
|
||||
EvWBMethod=37,
|
||||
EvWBTemp=38,
|
||||
EvWBGreen=39,
|
||||
EvCShiftA=40,
|
||||
EvCShiftB=41,
|
||||
EvLDNEnabled=42,
|
||||
EvLDNRadius=43,
|
||||
EvLDNEdgeTolerance=44,
|
||||
EvCDNEnabled=45,
|
||||
EvCDNRadius=46,
|
||||
EvCDNEdgeTolerance=47,
|
||||
EvCDNEdgeSensitive=48,
|
||||
EvSHEnabled=49,
|
||||
EvSHHighlights=50,
|
||||
EvSHShadows=51,
|
||||
EvSHHLTonalW=52,
|
||||
EvSHSHTonalW=53,
|
||||
EvSHLContrast=54,
|
||||
EvSHRadius=55,
|
||||
EvCTRotate=56,
|
||||
EvCTHFlip=57,
|
||||
EvCTVFlip=58,
|
||||
EvROTDegree=59,
|
||||
EvTransAutoFill=60,
|
||||
EvDISTAmount=61,
|
||||
EvBookmarkSelected=62,
|
||||
EvCrop=63,
|
||||
EvCACorr=64,
|
||||
EvHREnabled=65,
|
||||
EvHRAmount=66,
|
||||
EvHRMethod=67,
|
||||
EvWProfile=68,
|
||||
EvOProfile=69,
|
||||
EvIProfile=70,
|
||||
EvVignetting=71,
|
||||
EvChMixer=72,
|
||||
EvResizeScale=73,
|
||||
EvResizeMethod=74,
|
||||
EvExif=75,
|
||||
EvIPTC=76,
|
||||
EvResizeSpec=77,
|
||||
EvResizeWidth=78,
|
||||
EvResizeHeight=79,
|
||||
EvResizeEnabled=80,
|
||||
EvProfileChangeNotification=81,
|
||||
EvSHHighQuality=82,
|
||||
EvPerspCorr=83
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -117,10 +117,16 @@ void ProcParams::setDefaults () {
|
||||
coarse.hflip = false;
|
||||
coarse.vflip = false;
|
||||
|
||||
commonTrans.autofill = true;
|
||||
|
||||
rotate.degree = 0;
|
||||
rotate.fill = true;
|
||||
distortion.amount = 0;
|
||||
|
||||
distortion.amount = 0;
|
||||
distortion.uselensfun = false;
|
||||
|
||||
perspective.horizontal = 0;
|
||||
perspective.vertical = 0;
|
||||
|
||||
cacorrection.red = 0;
|
||||
cacorrection.blue = 0;
|
||||
|
||||
@@ -259,12 +265,19 @@ int ProcParams::save (Glib::ustring fname) const {
|
||||
keyFile.set_boolean ("Coarse Transformation", "HorizontalFlip", coarse.hflip);
|
||||
keyFile.set_boolean ("Coarse Transformation", "VerticalFlip", coarse.vflip);
|
||||
|
||||
// save commonTrans
|
||||
keyFile.set_boolean ("Common Properties for Transformations", "AutoFill", commonTrans.autofill);
|
||||
|
||||
// save rotate
|
||||
keyFile.set_double ("Rotation", "Degree", rotate.degree);
|
||||
keyFile.set_double ("Rotation", "Fill", rotate.fill);
|
||||
|
||||
// save distortion
|
||||
keyFile.set_double ("Distortion", "Amount", distortion.amount);
|
||||
keyFile.set_boolean ("Distortion", "UseLensFun", distortion.uselensfun);
|
||||
|
||||
// save perspective correction
|
||||
keyFile.set_integer ("Perspective", "Horizontal", perspective.horizontal);
|
||||
keyFile.set_integer ("Perspective", "Vertical", perspective.vertical);
|
||||
|
||||
// save C/A correction
|
||||
keyFile.set_double ("CACorrection", "Red", cacorrection.red);
|
||||
@@ -464,15 +477,25 @@ if (keyFile.has_group ("Coarse Transformation")) {
|
||||
// load rotate
|
||||
if (keyFile.has_group ("Rotation")) {
|
||||
if (keyFile.has_key ("Rotation", "Degree")) rotate.degree = keyFile.get_double ("Rotation", "Degree");
|
||||
if (keyFile.has_key ("Rotation", "Fill")) rotate.fill = keyFile.get_double ("Rotation", "Fill");
|
||||
}
|
||||
// load commonTrans
|
||||
if (keyFile.has_group ("Common Properties for Transformations")) {
|
||||
if (keyFile.has_key ("Common Properties for Transformations", "AutoFill")) commonTrans.autofill = keyFile.get_boolean ("Common Properties for Transformations", "AutoFill");
|
||||
}
|
||||
|
||||
// load distortion
|
||||
if (keyFile.has_group ("Distortion")) {
|
||||
if (keyFile.has_key ("Distortion", "Amount")) distortion.amount = keyFile.get_double ("Distortion", "Amount");
|
||||
if (keyFile.has_key ("Distortion", "Amount")) distortion.amount = keyFile.get_double ("Distortion", "Amount");
|
||||
if (keyFile.has_key ("Distortion", "UseLensFun")) distortion.uselensfun = keyFile.get_boolean ("Distortion", "UseLensFun");
|
||||
}
|
||||
|
||||
// load c/a correction
|
||||
// load perspective correction
|
||||
if (keyFile.has_group ("Perspective")) {
|
||||
if (keyFile.has_key ("Perspective", "Horizontal")) perspective.horizontal = keyFile.get_integer ("Perspective", "Horizontal");
|
||||
if (keyFile.has_key ("Perspective", "Vertical")) perspective.vertical = keyFile.get_integer ("Perspective", "Vertical");
|
||||
}
|
||||
|
||||
// load c/a correction
|
||||
if (keyFile.has_group ("CACorrection")) {
|
||||
if (keyFile.has_key ("CACorrection", "Red")) cacorrection.red = keyFile.get_double ("CACorrection", "Red");
|
||||
if (keyFile.has_key ("CACorrection", "Blue")) cacorrection.blue = keyFile.get_double ("CACorrection", "Blue");
|
||||
@@ -534,7 +557,7 @@ if (keyFile.has_group ("IPTC")) {
|
||||
printf ("-->%s\n", e.what().c_str());
|
||||
}
|
||||
catch (...) {
|
||||
printf ("-->ismeretlen exception!\n");
|
||||
printf ("-->unknown exception!\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -614,8 +637,11 @@ bool ProcParams::operator== (const ProcParams& other) {
|
||||
&& coarse.hflip == other.coarse.hflip
|
||||
&& coarse.vflip == other.coarse.vflip
|
||||
&& rotate.degree == other.rotate.degree
|
||||
&& rotate.fill == other.rotate.fill
|
||||
&& commonTrans.autofill == other.commonTrans.autofill
|
||||
&& distortion.uselensfun == other.distortion.uselensfun
|
||||
&& distortion.amount == other.distortion.amount
|
||||
&& perspective.horizontal == other.perspective.horizontal
|
||||
&& perspective.vertical == other.perspective.vertical
|
||||
&& cacorrection.red == other.cacorrection.red
|
||||
&& cacorrection.blue == other.cacorrection.blue
|
||||
&& vignetting.amount == other.vignetting.amount
|
||||
|
||||
@@ -177,6 +177,15 @@ class CoarseTransformParams {
|
||||
bool vflip;
|
||||
};
|
||||
|
||||
/**
|
||||
* Common transformation parameters
|
||||
*/
|
||||
class CommonTransformParams {
|
||||
|
||||
public:
|
||||
bool autofill;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parameters of the rotation
|
||||
*/
|
||||
@@ -184,7 +193,6 @@ class RotateParams {
|
||||
|
||||
public:
|
||||
double degree;
|
||||
bool fill;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -193,8 +201,19 @@ class RotateParams {
|
||||
class DistortionParams {
|
||||
|
||||
public:
|
||||
bool uselensfun;
|
||||
double amount;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parameters of the perspective correction
|
||||
*/
|
||||
class PerspectiveParams {
|
||||
|
||||
public:
|
||||
int horizontal;
|
||||
int vertical;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parameters of the vignetting correction
|
||||
@@ -300,8 +319,10 @@ class ProcParams {
|
||||
SHParams sh; ///< Shadow/highlight enhancement parameters
|
||||
CropParams crop; ///< Crop parameters
|
||||
CoarseTransformParams coarse; ///< Coarse transformation (90, 180, 270 deg rotation, h/v flipping) parameters
|
||||
CommonTransformParams commonTrans; ///< Common transformation parameters (autofill)
|
||||
RotateParams rotate; ///< Rotation parameters
|
||||
DistortionParams distortion; ///< Lens distortion correction parameters
|
||||
DistortionParams distortion; ///< Lens distortion correction parameters
|
||||
PerspectiveParams perspective; ///< Perspective correction parameters
|
||||
CACorrParams cacorrection; ///< Lens c/a correction parameters
|
||||
VignettingParams vignetting; ///< Lens vignetting correction parameters
|
||||
ChannelMixerParams chmixer; ///< Channel mixer parameters
|
||||
|
||||
@@ -19,88 +19,89 @@
|
||||
#include <refreshmap.h>
|
||||
|
||||
int refreshmap[] = {
|
||||
ALL, // EvPhotoLoaded,
|
||||
ALL, // EvProfileLoaded,
|
||||
ALL, // EvProfileChanged,
|
||||
ALL, // EvHistoryBrowsed,
|
||||
RGBCURVE, // EvBrightness,
|
||||
RGBCURVE, // EvContrast,
|
||||
RGBCURVE, // EvBlack,
|
||||
RGBCURVE, // EvExpComp,
|
||||
RGBCURVE, // EvHLCompr,
|
||||
RGBCURVE, // EvSHCompr,
|
||||
RGBCURVE, // EvToneCurve,
|
||||
AUTOEXP, // EvAutoExp,
|
||||
AUTOEXP, // EvClip,
|
||||
LUMINANCECURVE, // EvLBrightness,
|
||||
LUMINANCECURVE, // EvLContrast,
|
||||
LUMINANCECURVE, // EvLBlack,
|
||||
LUMINANCECURVE, // EvLHLCompr,
|
||||
LUMINANCECURVE, // EvLSHCompr,
|
||||
LUMINANCECURVE, // EvLCurve,
|
||||
SHARPENING, // EvShrEnabled,
|
||||
SHARPENING, // EvShrRadius,
|
||||
SHARPENING, // EvShrAmount,
|
||||
SHARPENING, // EvShrThresh,
|
||||
SHARPENING, // EvShrEdgeOnly,
|
||||
SHARPENING, // EvShrEdgeRadius,
|
||||
SHARPENING, // EvShrEdgeTolerance,
|
||||
SHARPENING, // EvShrHaloControl,
|
||||
SHARPENING, // EvShrHaloAmount,
|
||||
SHARPENING, // EvShrMethod,
|
||||
SHARPENING, // EvShrDRadius,
|
||||
SHARPENING, // EvShrDAmount,
|
||||
SHARPENING, // EvShrDDamping,
|
||||
SHARPENING, // EvShrDIterations,
|
||||
COLORBOOST, // EvCBAvoidClip,
|
||||
COLORBOOST, // EvCBSatLimiter,
|
||||
COLORBOOST, // EvCBSatLimit,
|
||||
COLORBOOST, // EvCBBoost,
|
||||
WHITEBALANCE, // EvWBMethod,
|
||||
WHITEBALANCE, // EvWBTemp,
|
||||
WHITEBALANCE, // EvWBGreen,
|
||||
COLORBOOST, // EvCShiftA,
|
||||
COLORBOOST, // EvCShiftB,
|
||||
LUMADENOISE, // EvLDNEnabled,
|
||||
LUMADENOISE, // EvLDNRadius,
|
||||
LUMADENOISE, // EvLDNEdgeTolerance,
|
||||
COLORDENOISE, // EvCDNEnabled,
|
||||
COLORDENOISE, // EvCDNRadius,
|
||||
COLORDENOISE, // EvCDNEdgeTolerance,
|
||||
COLORDENOISE, // EvCDNEdgeSensitive,
|
||||
RETINEX, // EvSHEnabled,
|
||||
RGBCURVE, // EvSHHighlights,
|
||||
RGBCURVE, // EvSHShadows,
|
||||
RGBCURVE, // EvSHHLTonalW,
|
||||
RGBCURVE, // EvSHSHTonalW,
|
||||
RGBCURVE, // EvSHLContrast,
|
||||
RETINEX, // EvSHRadius,
|
||||
ALL, // EvCTRotate,
|
||||
ALL, // EvCTHFlip,
|
||||
ALL, // EvCTVFlip,
|
||||
TRANSFORM, // EvROTDegree,
|
||||
TRANSFORM, // EvROTFill,
|
||||
TRANSFORM, // EvDISTAmount,
|
||||
ALL, // EvBookmarkSelected,
|
||||
CROP, // EvCrop,
|
||||
TRANSFORM, // EvCACorr,
|
||||
ALL, // EvHREnabled,
|
||||
ALL, // EvHRAmount,
|
||||
ALL, // EvHRMethod,
|
||||
ALL, // EvWProfile,
|
||||
ALL, // EvOProfile,
|
||||
ALL, // EvIProfile,
|
||||
TRANSFORM, // EvVignetting,
|
||||
RGBCURVE, // EvChMixer,
|
||||
ALL, // EvResizeScale,
|
||||
ALL, // EvResizeMethod,
|
||||
EXIF, // EvExif,
|
||||
IPTC, // EvIPTC
|
||||
ALL, // EvResizeSpec,
|
||||
ALL, // EvResizeWidth
|
||||
ALL, // EvResizeHeight
|
||||
ALL, // EvResizeEnabled
|
||||
ALL, // EvProfileChangeNotification
|
||||
RETINEX // EvShrHighQuality
|
||||
};
|
||||
ALL, // EvPhotoLoaded,
|
||||
ALL, // EvProfileLoaded,
|
||||
ALL, // EvProfileChanged,
|
||||
ALL, // EvHistoryBrowsed,
|
||||
RGBCURVE, // EvBrightness,
|
||||
RGBCURVE, // EvContrast,
|
||||
RGBCURVE, // EvBlack,
|
||||
RGBCURVE, // EvExpComp,
|
||||
RGBCURVE, // EvHLCompr,
|
||||
RGBCURVE, // EvSHCompr,
|
||||
RGBCURVE, // EvToneCurve,
|
||||
AUTOEXP, // EvAutoExp,
|
||||
AUTOEXP, // EvClip,
|
||||
LUMINANCECURVE, // EvLBrightness,
|
||||
LUMINANCECURVE, // EvLContrast,
|
||||
LUMINANCECURVE, // EvLBlack,
|
||||
LUMINANCECURVE, // EvLHLCompr,
|
||||
LUMINANCECURVE, // EvLSHCompr,
|
||||
LUMINANCECURVE, // EvLCurve,
|
||||
SHARPENING, // EvShrEnabled,
|
||||
SHARPENING, // EvShrRadius,
|
||||
SHARPENING, // EvShrAmount,
|
||||
SHARPENING, // EvShrThresh,
|
||||
SHARPENING, // EvShrEdgeOnly,
|
||||
SHARPENING, // EvShrEdgeRadius,
|
||||
SHARPENING, // EvShrEdgeTolerance,
|
||||
SHARPENING, // EvShrHaloControl,
|
||||
SHARPENING, // EvShrHaloAmount,
|
||||
SHARPENING, // EvShrMethod,
|
||||
SHARPENING, // EvShrDRadius,
|
||||
SHARPENING, // EvShrDAmount,
|
||||
SHARPENING, // EvShrDDamping,
|
||||
SHARPENING, // EvShrDIterations,
|
||||
COLORBOOST, // EvCBAvoidClip,
|
||||
COLORBOOST, // EvCBSatLimiter,
|
||||
COLORBOOST, // EvCBSatLimit,
|
||||
COLORBOOST, // EvCBBoost,
|
||||
WHITEBALANCE, // EvWBMethod,
|
||||
WHITEBALANCE, // EvWBTemp,
|
||||
WHITEBALANCE, // EvWBGreen,
|
||||
COLORBOOST, // EvCShiftA,
|
||||
COLORBOOST, // EvCShiftB,
|
||||
LUMADENOISE, // EvLDNEnabled,
|
||||
LUMADENOISE, // EvLDNRadius,
|
||||
LUMADENOISE, // EvLDNEdgeTolerance,
|
||||
COLORDENOISE, // EvCDNEnabled,
|
||||
COLORDENOISE, // EvCDNRadius,
|
||||
COLORDENOISE, // EvCDNEdgeTolerance,
|
||||
COLORDENOISE, // EvCDNEdgeSensitive,
|
||||
RETINEX, // EvSHEnabled,
|
||||
RGBCURVE, // EvSHHighlights,
|
||||
RGBCURVE, // EvSHShadows,
|
||||
RGBCURVE, // EvSHHLTonalW,
|
||||
RGBCURVE, // EvSHSHTonalW,
|
||||
RGBCURVE, // EvSHLContrast,
|
||||
RETINEX, // EvSHRadius,
|
||||
ALL, // EvCTRotate,
|
||||
ALL, // EvCTHFlip,
|
||||
ALL, // EvCTVFlip,
|
||||
TRANSFORM, // EvROTDegree,
|
||||
TRANSFORM, // EvTransAutoFill,
|
||||
TRANSFORM, // EvDISTAmount,
|
||||
ALL, // EvBookmarkSelected,
|
||||
CROP, // EvCrop,
|
||||
TRANSFORM, // EvCACorr,
|
||||
ALL, // EvHREnabled,
|
||||
ALL, // EvHRAmount,
|
||||
ALL, // EvHRMethod,
|
||||
ALL, // EvWProfile,
|
||||
ALL, // EvOProfile,
|
||||
ALL, // EvIProfile,
|
||||
TRANSFORM, // EvVignetting,
|
||||
RGBCURVE, // EvChMixer,
|
||||
ALL, // EvResizeScale,
|
||||
ALL, // EvResizeMethod,
|
||||
EXIF, // EvExif,
|
||||
IPTC, // EvIPTC
|
||||
ALL, // EvResizeSpec,
|
||||
ALL, // EvResizeWidth
|
||||
ALL, // EvResizeHeight
|
||||
ALL, // EvResizeEnabled
|
||||
ALL, // EvProfileChangeNotification
|
||||
RETINEX, // EvShrHighQuality
|
||||
TRANSFORM // EvPerspCorr
|
||||
};
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
#define NUMOFEVENTS 83
|
||||
|
||||
#define FIRST 65535
|
||||
#define ALL 65535
|
||||
#define TRANSFORM 127
|
||||
|
||||
Reference in New Issue
Block a user