Perspective correction implemented
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
file (GLOB IMAGEFILES "images/*.png")
|
||||
file (GLOB PROFILEFILES "profiles/*.pp2")
|
||||
file (GLOB PROFILEFILES "profiles/*.pp3")
|
||||
file (GLOB LANGUAGEFILES "languages/*")
|
||||
# THEMEDIR includes subfolders for image resources for some themes; doing the normal glob won't work.
|
||||
set (THEMEDIR "themes")
|
||||
|
@@ -180,7 +180,7 @@ HISTORY_MSG_58;Horizontal Flipping
|
||||
HISTORY_MSG_59;Vertical Flipping
|
||||
HISTORY_MSG_5;Brightness
|
||||
HISTORY_MSG_60;Rotation
|
||||
HISTORY_MSG_61;Rotation
|
||||
HISTORY_MSG_61;Auto Fill
|
||||
HISTORY_MSG_62;Lens Distortion Correction
|
||||
HISTORY_MSG_63;Snapshot Selected
|
||||
HISTORY_MSG_64;Crop Photo
|
||||
@@ -203,6 +203,9 @@ HISTORY_MSG_79;Resize width
|
||||
HISTORY_MSG_7;Black
|
||||
HISTORY_MSG_80;Resize height
|
||||
HISTORY_MSG_81;Resize enabled
|
||||
HISTORY_MSG_82;Profile Changed
|
||||
HISTORY_MSG_83;High quality shadows/highlights
|
||||
HISTORY_MSG_84;Perspective correction
|
||||
HISTORY_MSG_8;Exposure Compensation
|
||||
HISTORY_MSG_9;Highlight Compression
|
||||
HISTORY_NEWSNAPSHOT;Add
|
||||
@@ -543,6 +546,9 @@ TP_ICM_OUTPUTDLGLABEL;Select Output ICC Profile...
|
||||
TP_ICM_OUTPUTPROFILE;Output Profile
|
||||
TP_ICM_SAVEREFERENCE;Save reference image for profiling
|
||||
TP_ICM_WORKINGPROFILE;Working Profile
|
||||
TP_LENSGEOM_AUTOCROP;Auto Crop
|
||||
TP_LENSGEOM_FILL;Auto Fill
|
||||
TP_LENSGEOM_LABEL;Lens / Geometry
|
||||
TP_LUMACURVE_BLACKLEVEL;Black
|
||||
TP_LUMACURVE_BRIGHTNESS;Brightness
|
||||
TP_LUMACURVE_COMPRHIGHLIGHTS;Highlight compression
|
||||
@@ -553,6 +559,9 @@ TP_LUMACURVE_LABEL;Luminance Curve
|
||||
TP_LUMADENOISE_EDGETOLERANCE;Edge Tolerance
|
||||
TP_LUMADENOISE_LABEL;Luminance Noise Reduction
|
||||
TP_LUMADENOISE_RADIUS;Radius
|
||||
TP_PERSPECTIVE_LABEL;Perspective
|
||||
TP_PERSPECTIVE_HORIZONTAL;Horizontal
|
||||
TP_PERSPECTIVE_VERTICAL;Vertical
|
||||
TP_RESIZE_BICUBIC;Bicubic
|
||||
TP_RESIZE_BICUBICSF;Bicubic (Softer)
|
||||
TP_RESIZE_BICUBICSH;Bicubic (Sharper)
|
||||
@@ -564,9 +573,7 @@ TP_RESIZE_METHOD;Method:
|
||||
TP_RESIZE_NEAREST;Nearest
|
||||
TP_RESIZE_SCALE;Scale
|
||||
TP_RESIZE_W;W:
|
||||
TP_ROTATE_AUTOCROP;Auto Crop
|
||||
TP_ROTATE_DEGREE;Degree
|
||||
TP_ROTATE_FILL;Fill
|
||||
TP_ROTATE_LABEL;Rotate
|
||||
TP_ROTATE_SELECTLINE; Select Straight Line
|
||||
TP_SHADOWSHLIGHTS_HIGHLIGHTS;Highlights
|
||||
|
@@ -180,7 +180,7 @@ HISTORY_MSG_58;Horizontal Flipping
|
||||
HISTORY_MSG_59;Vertical Flipping
|
||||
HISTORY_MSG_5;Brightness
|
||||
HISTORY_MSG_60;Rotation
|
||||
HISTORY_MSG_61;Rotation
|
||||
HISTORY_MSG_61;Auto Fill
|
||||
HISTORY_MSG_62;Lens Distortion Correction
|
||||
HISTORY_MSG_63;Snapshot Selected
|
||||
HISTORY_MSG_64;Crop Photo
|
||||
@@ -203,6 +203,9 @@ HISTORY_MSG_79;Resize width
|
||||
HISTORY_MSG_7;Black
|
||||
HISTORY_MSG_80;Resize height
|
||||
HISTORY_MSG_81;Resize enabled
|
||||
HISTORY_MSG_82;Profile Changed
|
||||
HISTORY_MSG_83;High quality shadows/highlights
|
||||
HISTORY_MSG_84;Perspective correction
|
||||
HISTORY_MSG_8;Exposure Compensation
|
||||
HISTORY_MSG_9;Highlight Compression
|
||||
HISTORY_NEWSNAPSHOT;Add
|
||||
@@ -545,6 +548,9 @@ TP_ICM_OUTPUTDLGLABEL;Select Output ICC Profile...
|
||||
TP_ICM_OUTPUTPROFILE;Output Profile
|
||||
TP_ICM_SAVEREFERENCE;Save reference image for profiling
|
||||
TP_ICM_WORKINGPROFILE;Working Profile
|
||||
TP_LENSGEOM_AUTOCROP;Auto Crop
|
||||
TP_LENSGEOM_FILL;Auto Fill
|
||||
TP_LENSGEOM_LABEL;Lens / Geometry
|
||||
TP_LUMACURVE_BLACKLEVEL;Black
|
||||
TP_LUMACURVE_BRIGHTNESS;Brightness
|
||||
TP_LUMACURVE_COMPRHIGHLIGHTS;Highlight compression
|
||||
@@ -555,6 +561,9 @@ TP_LUMACURVE_LABEL;Luminance Curve
|
||||
TP_LUMADENOISE_EDGETOLERANCE;Edge Tolerance
|
||||
TP_LUMADENOISE_LABEL;Luminance Noise Reduction
|
||||
TP_LUMADENOISE_RADIUS;Radius
|
||||
TP_PERSPECTIVE_LABEL;Perspective
|
||||
TP_PERSPECTIVE_HORIZONTAL;Horizontal
|
||||
TP_PERSPECTIVE_VERTICAL;Vertical
|
||||
TP_RESIZE_BICUBIC;Bicubic
|
||||
TP_RESIZE_BICUBICSF;Bicubic (Softer)
|
||||
TP_RESIZE_BICUBICSH;Bicubic (Sharper)
|
||||
@@ -568,9 +577,7 @@ TP_RESIZE_METHOD;Method:
|
||||
TP_RESIZE_NEAREST;Nearest
|
||||
TP_RESIZE_SCALE;Scale
|
||||
TP_RESIZE_W;W:
|
||||
TP_ROTATE_AUTOCROP;Auto Crop
|
||||
TP_ROTATE_DEGREE;Degree
|
||||
TP_ROTATE_FILL;Fill
|
||||
TP_ROTATE_LABEL;Rotate
|
||||
TP_ROTATE_SELECTLINE; Select Straight Line
|
||||
TP_SHADOWSHLIGHTS_HIGHLIGHTS;Highlights
|
||||
|
@@ -82,13 +82,28 @@ bool ImProcFunctions::transCoord (int W, int H, std::vector<Coord2D> &src, std::
|
||||
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,14 +385,34 @@ 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
|
||||
|
||||
// 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;
|
||||
@@ -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 () {
|
||||
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <rtengine.h>
|
||||
|
||||
#define NUMOFEVENTS 83
|
||||
#define NUMOFEVENTS 84
|
||||
|
||||
namespace rtengine {
|
||||
|
||||
@@ -86,7 +86,7 @@ enum ProcEvent {
|
||||
EvCTHFlip=57,
|
||||
EvCTVFlip=58,
|
||||
EvROTDegree=59,
|
||||
EvROTFill=60,
|
||||
EvTransAutoFill=60,
|
||||
EvDISTAmount=61,
|
||||
EvBookmarkSelected=62,
|
||||
EvCrop=63,
|
||||
@@ -108,7 +108,8 @@ enum ProcEvent {
|
||||
EvResizeHeight=79,
|
||||
EvResizeEnabled=80,
|
||||
EvProfileChangeNotification=81,
|
||||
EvSHHighQuality=82
|
||||
EvSHHighQuality=82,
|
||||
EvPerspCorr=83
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@@ -117,9 +117,15 @@ void ProcParams::setDefaults () {
|
||||
coarse.hflip = false;
|
||||
coarse.vflip = false;
|
||||
|
||||
commonTrans.autofill = true;
|
||||
|
||||
rotate.degree = 0;
|
||||
rotate.fill = true;
|
||||
|
||||
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", "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,9 +201,20 @@ 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
|
||||
PerspectiveParams perspective; ///< Perspective correction parameters
|
||||
CACorrParams cacorrection; ///< Lens c/a correction parameters
|
||||
VignettingParams vignetting; ///< Lens vignetting correction parameters
|
||||
ChannelMixerParams chmixer; ///< Channel mixer parameters
|
||||
|
@@ -79,7 +79,7 @@ ALL, // EvCTRotate,
|
||||
ALL, // EvCTHFlip,
|
||||
ALL, // EvCTVFlip,
|
||||
TRANSFORM, // EvROTDegree,
|
||||
TRANSFORM, // EvROTFill,
|
||||
TRANSFORM, // EvTransAutoFill,
|
||||
TRANSFORM, // EvDISTAmount,
|
||||
ALL, // EvBookmarkSelected,
|
||||
CROP, // EvCrop,
|
||||
@@ -101,6 +101,7 @@ ALL, // EvResizeWidth
|
||||
ALL, // EvResizeHeight
|
||||
ALL, // EvResizeEnabled
|
||||
ALL, // EvProfileChangeNotification
|
||||
RETINEX // EvShrHighQuality
|
||||
};
|
||||
RETINEX, // EvShrHighQuality
|
||||
TRANSFORM // EvPerspCorr
|
||||
};
|
||||
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
#define NUMOFEVENTS 83
|
||||
|
||||
#define FIRST 65535
|
||||
#define ALL 65535
|
||||
#define TRANSFORM 127
|
||||
|
@@ -3,8 +3,8 @@ set (BASESOURCEFILES
|
||||
batchtoolpanelcoord.cc paramsedited.cc cropwindow.cc previewhandler.cc previewwindow.cc navigator.cc indclippedpanel.cc filterpanel.cc
|
||||
cursormanager.cc rtwindow.cc renamedlg.cc recentbrowser.cc placesbrowser.cc filepanel.cc editorpanel.cc batchqueuepanel.cc
|
||||
ilabel.cc thumbbrowserbase.cc adjuster.cc filebrowserentry.cc filebrowser.cc filethumbnailbuttonset.cc
|
||||
cachemanager.cc cacheimagedata.cc shcselector.cc
|
||||
clipboard.cc thumbimageupdater.cc bqentryupdater.cc
|
||||
cachemanager.cc cacheimagedata.cc shcselector.cc perspective.cc
|
||||
clipboard.cc thumbimageupdater.cc bqentryupdater.cc lensgeom.cc
|
||||
coarsepanel.cc cacorrection.cc colorshift.cc hlrec.cc chmixer.cc
|
||||
colorboost.cc resize.cc icmpanel.cc crop.cc shadowshighlights.cc
|
||||
colordenoise.cc
|
||||
|
@@ -19,8 +19,8 @@
|
||||
#define ADDSET_CS_GREENMAGENTA 15
|
||||
#define ADDSET_ROTATE_DEGREE 16
|
||||
#define ADDSET_DIST_AMOUNT 17
|
||||
#define ADDSET_CA_BLUE 18
|
||||
#define ADDSET_CA_RED 19
|
||||
#define ADDSET_PERSPECTIVE 18
|
||||
#define ADDSET_CA 19
|
||||
#define ADDSET_VIGN_AMOUNT 20
|
||||
|
||||
#define ADDSET_PARAM_NUM 21
|
||||
|
@@ -126,7 +126,8 @@ void BatchToolPanelCoordinator::initSession () {
|
||||
vignetting->setAdjusterBehavior (options.baBehav[ADDSET_VIGN_AMOUNT]);
|
||||
rotate->setAdjusterBehavior (options.baBehav[ADDSET_ROTATE_DEGREE]);
|
||||
distortion->setAdjusterBehavior (options.baBehav[ADDSET_DIST_AMOUNT]);
|
||||
cacorrection->setAdjusterBehavior (options.baBehav[ADDSET_CA_RED], options.baBehav[ADDSET_CA_BLUE]);
|
||||
perspective->setAdjusterBehavior (options.baBehav[ADDSET_PERSPECTIVE]);
|
||||
cacorrection->setAdjusterBehavior (options.baBehav[ADDSET_CA]);
|
||||
colorshift->setAdjusterBehavior (options.baBehav[ADDSET_CS_BLUEYELLOW], options.baBehav[ADDSET_CS_GREENMAGENTA]);
|
||||
colorboost->setAdjusterBehavior (options.baBehav[ADDSET_CBOOST_AMOUNT]);
|
||||
lumadenoise->setAdjusterBehavior (options.baBehav[ADDSET_LD_EDGETOLERANCE]);
|
||||
@@ -158,8 +159,9 @@ void BatchToolPanelCoordinator::initSession () {
|
||||
|
||||
if (options.baBehav[ADDSET_ROTATE_DEGREE]) pparams.rotate.degree = 0;
|
||||
if (options.baBehav[ADDSET_DIST_AMOUNT]) pparams.distortion.amount = 0;
|
||||
if (options.baBehav[ADDSET_CA_RED]) pparams.cacorrection.red = 0;
|
||||
if (options.baBehav[ADDSET_CA_BLUE]) pparams.cacorrection.blue = 0;
|
||||
if (options.baBehav[ADDSET_PERSPECTIVE]) pparams.perspective.horizontal = pparams.perspective.vertical = 0;
|
||||
if (options.baBehav[ADDSET_CA]) pparams.cacorrection.red = 0;
|
||||
if (options.baBehav[ADDSET_CA]) pparams.cacorrection.blue = 0;
|
||||
if (options.baBehav[ADDSET_VIGN_AMOUNT]) pparams.vignetting.amount = 0;
|
||||
|
||||
for (int i=0; i<toolPanels.size(); i++) {
|
||||
|
@@ -22,7 +22,7 @@
|
||||
using namespace rtengine;
|
||||
using namespace rtengine::procparams;
|
||||
|
||||
CACorrection::CACorrection () : valaAdd(false), valbAdd(false) {
|
||||
CACorrection::CACorrection () : vAdd(false) {
|
||||
|
||||
red = Gtk::manage (new Adjuster (M("TP_CACORRECTION_RED"), -0.005, 0.005, 0.0001, 0));
|
||||
red->setAdjusterListener (this);
|
||||
@@ -83,16 +83,14 @@ void CACorrection::adjusterChanged (Adjuster* a, double newval) {
|
||||
listener->panelChanged (EvCACorr, Glib::ustring::compose ("%1=%3\n%2=%4", M("TP_CACORRECTION_RED"), M("TP_CACORRECTION_BLUE"), Glib::ustring::format (std::setw(5), std::fixed, std::setprecision(4), red->getValue()), Glib::ustring::format (std::setw(5), std::fixed, std::setprecision(4), blue->getValue())));
|
||||
}
|
||||
|
||||
void CACorrection::setAdjusterBehavior (bool baadd, bool bbadd) {
|
||||
void CACorrection::setAdjusterBehavior (bool badd) {
|
||||
|
||||
if (!valaAdd && baadd || valaAdd && !baadd)
|
||||
if (!vAdd && badd || vAdd && !badd) {
|
||||
red->setLimits (-0.005, 0.005, 0.0001, 0);
|
||||
|
||||
if (!valbAdd && bbadd || valbAdd && !bbadd)
|
||||
blue->setLimits (-0.005, 0.005, 0.0001, 0);
|
||||
}
|
||||
|
||||
valaAdd = baadd;
|
||||
valbAdd = bbadd;
|
||||
vAdd = badd;
|
||||
}
|
||||
|
||||
void CACorrection::setBatchMode (bool batchMode) {
|
||||
|
@@ -28,7 +28,7 @@ class CACorrection : public Gtk::VBox, public AdjusterListener, public ToolPanel
|
||||
protected:
|
||||
Adjuster* red;
|
||||
Adjuster* blue;
|
||||
bool valaAdd, valbAdd;
|
||||
bool vAdd;
|
||||
|
||||
public:
|
||||
|
||||
@@ -40,7 +40,7 @@ class CACorrection : public Gtk::VBox, public AdjusterListener, public ToolPanel
|
||||
void setBatchMode (bool batchMode);
|
||||
|
||||
void adjusterChanged (Adjuster* a, double newval);
|
||||
void setAdjusterBehavior (bool baadd, bool bbadd);
|
||||
void setAdjusterBehavior (bool badd);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
104
rtgui/lensgeom.cc
Normal file
104
rtgui/lensgeom.cc
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
#include <lensgeom.h>
|
||||
#include <guiutils.h>
|
||||
|
||||
extern Glib::ustring argv0;
|
||||
|
||||
using namespace rtengine;
|
||||
using namespace rtengine::procparams;
|
||||
|
||||
LensGeometry::LensGeometry () : ToolPanel(), rlistener(NULL) {
|
||||
|
||||
fill = Gtk::manage (new Gtk::CheckButton (M("TP_LENSGEOM_FILL")));
|
||||
pack_start (*fill);
|
||||
|
||||
autoCrop = Gtk::manage (new Gtk::Button (M("TP_LENSGEOM_AUTOCROP")));
|
||||
pack_start (*autoCrop, Gtk::PACK_SHRINK, 2);
|
||||
|
||||
packBox = Gtk::manage (new Gtk::VBox ());
|
||||
pack_start (*packBox);
|
||||
|
||||
autoCrop->signal_pressed().connect( sigc::mem_fun(*this, &LensGeometry::autoCropPressed) );
|
||||
fillConn = fill->signal_toggled().connect( sigc::mem_fun(*this, &LensGeometry::fillPressed) );
|
||||
|
||||
fill->set_active (true);
|
||||
show_all ();
|
||||
}
|
||||
|
||||
void LensGeometry::read (const ProcParams* pp, const ParamsEdited* pedited) {
|
||||
|
||||
disableListener ();
|
||||
|
||||
if (pedited)
|
||||
fill->set_inconsistent (!pedited->commonTrans.autofill);
|
||||
|
||||
fillConn.block (true);
|
||||
fill->set_active (pp->commonTrans.autofill);
|
||||
fillConn.block (false);
|
||||
|
||||
lastFill = pp->commonTrans.autofill;
|
||||
|
||||
enableListener ();
|
||||
}
|
||||
|
||||
void LensGeometry::write (ProcParams* pp, ParamsEdited* pedited) {
|
||||
|
||||
pp->commonTrans.autofill = fill->get_active ();
|
||||
|
||||
if (pedited)
|
||||
pedited->commonTrans.autofill = !fill->get_inconsistent();
|
||||
}
|
||||
|
||||
void LensGeometry::autoCropPressed () {
|
||||
|
||||
if (rlistener)
|
||||
rlistener->autoCropRequested ();
|
||||
}
|
||||
|
||||
void LensGeometry::fillPressed () {
|
||||
|
||||
if (batchMode) {
|
||||
if (fill->get_inconsistent()) {
|
||||
fill->set_inconsistent (false);
|
||||
fillConn.block (true);
|
||||
fill->set_active (false);
|
||||
fillConn.block (false);
|
||||
}
|
||||
else if (lastFill)
|
||||
fill->set_inconsistent (true);
|
||||
|
||||
lastFill = fill->get_active ();
|
||||
}
|
||||
else
|
||||
autoCrop->set_sensitive (!fill->get_active());
|
||||
|
||||
if (listener) {
|
||||
if (fill->get_active ())
|
||||
listener->panelChanged (EvTransAutoFill, M("TP_LENSGEOM_AUTOFILL")+' '+M("GENERAL_ENABLED"));
|
||||
else
|
||||
listener->panelChanged (EvTransAutoFill, M("TP_LENSGEOM_AUTOFILL")+' '+M("GENERAL_DISABLED"));
|
||||
}
|
||||
}
|
||||
|
||||
void LensGeometry::setBatchMode (bool batchMode) {
|
||||
|
||||
ToolPanel::setBatchMode (batchMode);
|
||||
removeIfThere (this, autoCrop);
|
||||
}
|
51
rtgui/lensgeom.h
Normal file
51
rtgui/lensgeom.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 _LENSGEOM_H_
|
||||
#define _LENSGEOM_H_
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include <toolpanel.h>
|
||||
#include <lensgeomlistener.h>
|
||||
|
||||
class LensGeometry : public Gtk::VBox, public ToolPanel {
|
||||
|
||||
protected:
|
||||
Gtk::Button* autoCrop;
|
||||
LensGeomListener* rlistener;
|
||||
Gtk::CheckButton* fill;
|
||||
bool lastFill;
|
||||
sigc::connection fillConn;
|
||||
Gtk::VBox* packBox;
|
||||
|
||||
public:
|
||||
|
||||
LensGeometry ();
|
||||
|
||||
Gtk::Box* getPackBox () { return packBox; }
|
||||
|
||||
void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL);
|
||||
void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL);
|
||||
void setBatchMode (bool batchMode);
|
||||
|
||||
void fillPressed ();
|
||||
void autoCropPressed ();
|
||||
void setLensGeomListener (LensGeomListener* l) { rlistener = l; }
|
||||
};
|
||||
|
||||
#endif
|
29
rtgui/lensgeomlistener.h
Normal file
29
rtgui/lensgeomlistener.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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 _LENSGEOMLISTENER_H_
|
||||
#define _LENSGEOMLISTENER_H_
|
||||
|
||||
class LensGeomListener {
|
||||
|
||||
public:
|
||||
virtual void straightenRequested ()=0;
|
||||
virtual void autoCropRequested ()=0;
|
||||
};
|
||||
|
||||
#endif
|
@@ -27,7 +27,7 @@
|
||||
|
||||
Options options;
|
||||
Glib::ustring versionString = "v3.0 alpha 1";
|
||||
Glib::ustring paramFileExtension = ".pp2";
|
||||
Glib::ustring paramFileExtension = ".pp3";
|
||||
|
||||
Options::Options () {
|
||||
|
||||
|
@@ -88,9 +88,12 @@ void ParamsEdited::set (bool v) {
|
||||
coarse.rotate = v;
|
||||
coarse.hflip = v;
|
||||
coarse.vflip = v;
|
||||
commonTrans.autofill = v;
|
||||
rotate.degree = v;
|
||||
rotate.fill = v;
|
||||
distortion.uselensfun = v;
|
||||
distortion.amount = v;
|
||||
perspective.horizontal = v;
|
||||
perspective.vertical = v;
|
||||
cacorrection.red = v;
|
||||
cacorrection.blue = v;
|
||||
vignetting.amount = v;
|
||||
@@ -192,9 +195,12 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
|
||||
coarse.rotate = coarse.rotate && p.coarse.rotate == other.coarse.rotate;
|
||||
coarse.hflip = coarse.hflip && p.coarse.hflip == other.coarse.hflip;
|
||||
coarse.vflip = coarse.vflip && p.coarse.vflip == other.coarse.vflip;
|
||||
commonTrans.autofill = commonTrans.autofill && p.commonTrans.autofill == other.commonTrans.autofill;
|
||||
rotate.degree = rotate.degree && p.rotate.degree == other.rotate.degree;
|
||||
rotate.fill = rotate.fill && p.rotate.fill == other.rotate.fill;
|
||||
distortion.uselensfun = distortion.uselensfun && p.distortion.uselensfun == other.distortion.uselensfun;
|
||||
distortion.amount = distortion.amount && p.distortion.amount == other.distortion.amount;
|
||||
perspective.horizontal = perspective.horizontal && p.perspective.horizontal == other.perspective.horizontal;
|
||||
perspective.vertical = perspective.vertical && p.perspective.vertical == other.perspective.vertical;
|
||||
cacorrection.red = cacorrection.red && p.cacorrection.red == other.cacorrection.red;
|
||||
cacorrection.blue = cacorrection.blue && p.cacorrection.blue == other.cacorrection.blue;
|
||||
vignetting.amount = vignetting.amount && p.vignetting.amount == other.vignetting.amount;
|
||||
@@ -287,11 +293,14 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
|
||||
if (coarse.rotate) toEdit.coarse.rotate = (toEdit.coarse.rotate + mods.coarse.rotate) % 360;
|
||||
if (coarse.hflip) toEdit.coarse.hflip = mods.coarse.hflip ? !toEdit.coarse.hflip : toEdit.coarse.hflip;
|
||||
if (coarse.vflip) toEdit.coarse.vflip = mods.coarse.vflip ? !toEdit.coarse.vflip : toEdit.coarse.vflip;
|
||||
if (commonTrans.autofill) toEdit.commonTrans.autofill = mods.commonTrans.autofill;
|
||||
if (rotate.degree) toEdit.rotate.degree = options.baBehav[17] ? toEdit.rotate.degree + mods.rotate.degree : mods.rotate.degree;
|
||||
if (rotate.fill) toEdit.rotate.fill = mods.rotate.fill;
|
||||
if (distortion.uselensfun) toEdit.distortion.uselensfun = mods.distortion.uselensfun;
|
||||
if (distortion.amount) toEdit.distortion.amount = options.baBehav[ADDSET_DIST_AMOUNT] ? toEdit.distortion.amount + mods.distortion.amount : mods.distortion.amount;
|
||||
if (cacorrection.red) toEdit.cacorrection.red = options.baBehav[ADDSET_CA_RED] ? toEdit.cacorrection.red + mods.cacorrection.red : mods.cacorrection.red;
|
||||
if (cacorrection.blue) toEdit.cacorrection.blue = options.baBehav[ADDSET_CA_BLUE] ? toEdit.cacorrection.blue + mods.cacorrection.blue : mods.cacorrection.blue;
|
||||
if (perspective.horizontal) toEdit.perspective.horizontal = options.baBehav[ADDSET_PERSPECTIVE] ? toEdit.perspective.horizontal + mods.perspective.horizontal : mods.perspective.horizontal;
|
||||
if (perspective.vertical) toEdit.perspective.vertical = options.baBehav[ADDSET_PERSPECTIVE] ? toEdit.perspective.vertical + mods.perspective.vertical : mods.perspective.vertical;
|
||||
if (cacorrection.red) toEdit.cacorrection.red = options.baBehav[ADDSET_CA] ? toEdit.cacorrection.red + mods.cacorrection.red : mods.cacorrection.red;
|
||||
if (cacorrection.blue) toEdit.cacorrection.blue = options.baBehav[ADDSET_CA] ? toEdit.cacorrection.blue + mods.cacorrection.blue : mods.cacorrection.blue;
|
||||
if (vignetting.amount) toEdit.vignetting.amount = options.baBehav[ADDSET_VIGN_AMOUNT] ? toEdit.vignetting.amount + mods.vignetting.amount : mods.vignetting.amount;
|
||||
if (vignetting.radius) toEdit.vignetting.radius = mods.vignetting.radius;
|
||||
if (chmixer.red[0]) toEdit.chmixer.red[0] = mods.chmixer.red[0];
|
||||
|
@@ -140,19 +140,32 @@ class CoarseTransformParamsEdited {
|
||||
bool vflip;
|
||||
};
|
||||
|
||||
class CommonTransformParamsEdited {
|
||||
|
||||
public:
|
||||
bool autofill;
|
||||
};
|
||||
|
||||
class RotateParamsEdited {
|
||||
|
||||
public:
|
||||
bool degree;
|
||||
bool fill;
|
||||
};
|
||||
|
||||
class DistortionParamsEdited {
|
||||
|
||||
public:
|
||||
bool uselensfun;
|
||||
bool amount;
|
||||
};
|
||||
|
||||
class PerspectiveParamsEdited {
|
||||
|
||||
public:
|
||||
bool horizontal;
|
||||
bool vertical;
|
||||
};
|
||||
|
||||
class VignettingParamsEdited {
|
||||
|
||||
public:
|
||||
@@ -230,8 +243,10 @@ class ParamsEdited {
|
||||
SHParamsEdited sh;
|
||||
CropParamsEdited crop;
|
||||
CoarseTransformParamsEdited coarse;
|
||||
CommonTransformParamsEdited commonTrans;
|
||||
RotateParamsEdited rotate;
|
||||
DistortionParamsEdited distortion;
|
||||
PerspectiveParamsEdited perspective;
|
||||
CACorrParamsEdited cacorrection;
|
||||
VignettingParamsEdited vignetting;
|
||||
ChannelMixerParamsEdited chmixer;
|
||||
|
100
rtgui/perspective.cc
Normal file
100
rtgui/perspective.cc
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
#include <perspective.h>
|
||||
|
||||
using namespace rtengine;
|
||||
using namespace rtengine::procparams;
|
||||
|
||||
PerspCorrection::PerspCorrection () : vAdd(false) {
|
||||
|
||||
horiz = Gtk::manage (new Adjuster (M("TP_PERSPECTIVE_HORIZONTAL"), -100, 100, 1, 0));
|
||||
horiz->setAdjusterListener (this);
|
||||
|
||||
vert = Gtk::manage (new Adjuster (M("TP_PERSPECTIVE_VERTICAL"), -100, 100, 1, 0));
|
||||
vert->setAdjusterListener (this);
|
||||
|
||||
pack_start (*horiz);
|
||||
pack_start (*vert);
|
||||
|
||||
show_all();
|
||||
}
|
||||
|
||||
void PerspCorrection::read (const ProcParams* pp, const ParamsEdited* pedited) {
|
||||
|
||||
disableListener ();
|
||||
|
||||
if (pedited) {
|
||||
horiz->setEditedState (pedited->perspective.horizontal ? Edited : UnEdited);
|
||||
vert->setEditedState (pedited->perspective.vertical ? Edited : UnEdited);
|
||||
}
|
||||
|
||||
horiz->setValue (pp->perspective.horizontal);
|
||||
vert->setValue (pp->perspective.vertical);
|
||||
|
||||
enableListener ();
|
||||
}
|
||||
|
||||
void PerspCorrection::write (ProcParams* pp, ParamsEdited* pedited) {
|
||||
|
||||
pp->perspective.horizontal = horiz->getValue ();
|
||||
pp->perspective.vertical = vert->getValue ();
|
||||
|
||||
if (pedited) {
|
||||
pedited->perspective.horizontal = horiz->getEditedState ();
|
||||
pedited->perspective.vertical = vert->getEditedState ();
|
||||
}
|
||||
}
|
||||
|
||||
void PerspCorrection::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) {
|
||||
|
||||
horiz->setDefault (defParams->perspective.horizontal);
|
||||
vert->setDefault (defParams->perspective.vertical);
|
||||
|
||||
if (pedited) {
|
||||
horiz->setDefaultEditedState (pedited->perspective.horizontal ? Edited : UnEdited);
|
||||
vert->setDefaultEditedState (pedited->perspective.vertical ? Edited : UnEdited);
|
||||
}
|
||||
else {
|
||||
horiz->setDefaultEditedState (Irrelevant);
|
||||
vert->setDefaultEditedState (Irrelevant);
|
||||
}
|
||||
}
|
||||
|
||||
void PerspCorrection::adjusterChanged (Adjuster* a, double newval) {
|
||||
|
||||
if (listener)
|
||||
listener->panelChanged (EvPerspCorr, Glib::ustring::compose ("%1=%3\n%2=%4", M("TP_PERSPECTIVE_HORIZONTAL"), M("TP_PERSPECTIVE_VERTICAL"), horiz->getValue(), vert->getValue()));
|
||||
}
|
||||
|
||||
void PerspCorrection::setAdjusterBehavior (bool badd) {
|
||||
|
||||
if (!vAdd && badd || vAdd && !badd) {
|
||||
// horiz->setLimits (-0.005, 0.005, 0.0001, 0);
|
||||
// vert->setLimits (-0.005, 0.005, 0.0001, 0);
|
||||
}
|
||||
|
||||
vAdd = badd;
|
||||
}
|
||||
|
||||
void PerspCorrection::setBatchMode (bool batchMode) {
|
||||
|
||||
ToolPanel::setBatchMode (batchMode);
|
||||
horiz->showEditedCB ();
|
||||
vert->showEditedCB ();
|
||||
}
|
46
rtgui/perspective.h
Normal file
46
rtgui/perspective.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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 _PERSPECTIVE_PANEL_H_
|
||||
#define _PERSPECTIVE_PANEL_H_
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include <adjuster.h>
|
||||
#include <toolpanel.h>
|
||||
|
||||
class PerspCorrection : public Gtk::VBox, public AdjusterListener, public ToolPanel {
|
||||
|
||||
protected:
|
||||
Adjuster* horiz;
|
||||
Adjuster* vert;
|
||||
bool vAdd;
|
||||
|
||||
public:
|
||||
|
||||
PerspCorrection ();
|
||||
|
||||
void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL);
|
||||
void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL);
|
||||
void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL);
|
||||
void setBatchMode (bool batchMode);
|
||||
|
||||
void adjusterChanged (Adjuster* a, double newval);
|
||||
void setAdjusterBehavior (bool badd);
|
||||
};
|
||||
|
||||
#endif
|
@@ -173,10 +173,13 @@ Gtk::Widget* Preferences::getBatchProcPanel () {
|
||||
mi->set_value (behavColumns.label, M("TP_DISTORTION_LABEL"));
|
||||
appendBehavList (mi, M("TP_DISTORTION_AMOUNT"), ADDSET_DIST_AMOUNT, false);
|
||||
|
||||
mi = behModel->append ();
|
||||
mi->set_value (behavColumns.label, M("TP_PERSPECTIVE_LABEL"));
|
||||
appendBehavList (mi, M("TP_PERSPECTIVE_HORIZONTAL")+", "+M("TP_PERSPECTIVE_VERTICAL"), ADDSET_PERSPECTIVE, false);
|
||||
|
||||
mi = behModel->append ();
|
||||
mi->set_value (behavColumns.label, M("TP_CACORRECTION_LABEL"));
|
||||
appendBehavList (mi, M("TP_CACORRECTION_BLUE"), ADDSET_CA_BLUE, true);
|
||||
appendBehavList (mi, M("TP_CACORRECTION_RED"), ADDSET_CA_RED, true);
|
||||
appendBehavList (mi, M("TP_CACORRECTION_BLUE")+", "+M("TP_CACORRECTION_RED"), ADDSET_CA, true);
|
||||
|
||||
mi = behModel->append ();
|
||||
mi->set_value (behavColumns.label, M("TP_VIGNETTING_LABEL"));
|
||||
|
@@ -33,22 +33,13 @@ Rotate::Rotate () : ToolPanel (), degAdd(false) {
|
||||
degree->setAdjusterListener (this);
|
||||
pack_start (*degree);
|
||||
|
||||
fill = Gtk::manage (new Gtk::CheckButton (M("TP_ROTATE_FILL")));
|
||||
pack_start (*fill);
|
||||
|
||||
selectStraight = Gtk::manage (new Gtk::Button (M("TP_ROTATE_SELECTLINE")));
|
||||
Gtk::Image* selimg = Gtk::manage (new Gtk::Image (argv0+"/images/straighten16.png"));
|
||||
selectStraight->set_image (*selimg);
|
||||
pack_start (*selectStraight, Gtk::PACK_SHRINK, 2);
|
||||
|
||||
autoCrop = Gtk::manage (new Gtk::Button (M("TP_ROTATE_AUTOCROP")));
|
||||
pack_start (*autoCrop, Gtk::PACK_SHRINK, 2);
|
||||
|
||||
selectStraight->signal_pressed().connect( sigc::mem_fun(*this, &Rotate::selectStraightPressed) );
|
||||
autoCrop->signal_pressed().connect( sigc::mem_fun(*this, &Rotate::autoCropPressed) );
|
||||
fillConn = fill->signal_toggled().connect( sigc::mem_fun(*this, &Rotate::fillPressed) );
|
||||
|
||||
fill->set_active (true);
|
||||
show_all ();
|
||||
}
|
||||
|
||||
@@ -56,17 +47,10 @@ void Rotate::read (const ProcParams* pp, const ParamsEdited* pedited) {
|
||||
|
||||
disableListener ();
|
||||
|
||||
if (pedited) {
|
||||
if (pedited)
|
||||
degree->setEditedState (pedited->rotate.degree ? Edited : UnEdited);
|
||||
fill->set_inconsistent (!pedited->rotate.fill);
|
||||
}
|
||||
|
||||
degree->setValue (pp->rotate.degree);
|
||||
fillConn.block (true);
|
||||
fill->set_active (pp->rotate.fill);
|
||||
fillConn.block (false);
|
||||
|
||||
lastFill = pp->rotate.fill;
|
||||
|
||||
enableListener ();
|
||||
}
|
||||
@@ -74,12 +58,9 @@ void Rotate::read (const ProcParams* pp, const ParamsEdited* pedited) {
|
||||
void Rotate::write (ProcParams* pp, ParamsEdited* pedited) {
|
||||
|
||||
pp->rotate.degree = degree->getValue ();
|
||||
pp->rotate.fill = fill->get_active ();
|
||||
|
||||
if (pedited) {
|
||||
if (pedited)
|
||||
pedited->rotate.degree = degree->getEditedState ();
|
||||
pedited->rotate.fill = !fill->get_inconsistent();
|
||||
}
|
||||
}
|
||||
|
||||
void Rotate::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) {
|
||||
@@ -112,40 +93,10 @@ void Rotate::selectStraightPressed () {
|
||||
rlistener->straightenRequested ();
|
||||
}
|
||||
|
||||
void Rotate::autoCropPressed () {
|
||||
|
||||
if (rlistener)
|
||||
rlistener->autoCropRequested ();
|
||||
}
|
||||
|
||||
void Rotate::fillPressed () {
|
||||
|
||||
if (batchMode) {
|
||||
if (fill->get_inconsistent()) {
|
||||
fill->set_inconsistent (false);
|
||||
fillConn.block (true);
|
||||
fill->set_active (false);
|
||||
fillConn.block (false);
|
||||
}
|
||||
else if (lastFill)
|
||||
fill->set_inconsistent (true);
|
||||
|
||||
lastFill = fill->get_active ();
|
||||
}
|
||||
|
||||
if (listener) {
|
||||
if (fill->get_active())
|
||||
listener->panelChanged (EvROTDegree, M("TP_ROTATE_FILL")+' '+M("GENERAL_ENABLED"));
|
||||
else
|
||||
listener->panelChanged (EvROTFill, M("TP_ROTATE_FILL")+' '+M("GENERAL_DISABLED"));
|
||||
}
|
||||
}
|
||||
|
||||
void Rotate::setBatchMode (bool batchMode) {
|
||||
|
||||
ToolPanel::setBatchMode (batchMode);
|
||||
degree->showEditedCB ();
|
||||
removeIfThere (this, autoCrop);
|
||||
}
|
||||
|
||||
void Rotate::setAdjusterBehavior (bool brotadd) {
|
||||
|
@@ -22,25 +22,15 @@
|
||||
#include <gtkmm.h>
|
||||
#include <adjuster.h>
|
||||
#include <toolpanel.h>
|
||||
|
||||
class RotateListener {
|
||||
|
||||
public:
|
||||
virtual void straightenRequested () {}
|
||||
virtual void autoCropRequested () {}
|
||||
};
|
||||
#include <lensgeomlistener.h>
|
||||
|
||||
class Rotate : public Gtk::VBox, public AdjusterListener, public ToolPanel {
|
||||
|
||||
protected:
|
||||
Adjuster* degree;
|
||||
Gtk::Button* selectStraight;
|
||||
Gtk::Button* autoCrop;
|
||||
RotateListener* rlistener;
|
||||
Gtk::CheckButton* fill;
|
||||
LensGeomListener* rlistener;
|
||||
bool degAdd;
|
||||
bool lastFill;
|
||||
sigc::connection fillConn;
|
||||
|
||||
public:
|
||||
|
||||
@@ -56,9 +46,7 @@ class Rotate : public Gtk::VBox, public AdjusterListener, public ToolPanel {
|
||||
void adjusterChanged (Adjuster* a, double newval);
|
||||
void setAdjusterBehavior (bool brotadd);
|
||||
void selectStraightPressed ();
|
||||
void fillPressed ();
|
||||
void autoCropPressed ();
|
||||
void setRotateListener (RotateListener* l) { rlistener = l; }
|
||||
void setLensGeomListener (LensGeomListener* l) { rlistener = l; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -39,10 +39,12 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
|
||||
lcurve = Gtk::manage (new LCurve ());
|
||||
colorboost = Gtk::manage (new ColorBoost ());
|
||||
colorshift = Gtk::manage (new ColorShift ());
|
||||
lensgeom = Gtk::manage (new LensGeometry ());
|
||||
distortion = Gtk::manage (new Distortion ());
|
||||
rotate = Gtk::manage (new Rotate ());
|
||||
whitebalance = Gtk::manage (new WhiteBalance ());
|
||||
vignetting = Gtk::manage (new Vignetting ());
|
||||
perspective = Gtk::manage (new PerspCorrection ());
|
||||
cacorrection = Gtk::manage (new CACorrection ());
|
||||
hlrecovery = Gtk::manage (new HLRecovery ());
|
||||
chmixer = Gtk::manage (new ChMixer ());
|
||||
@@ -64,11 +66,13 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
|
||||
addPanel (detailsPanel, lumadenoise, M("TP_LUMADENOISE_LABEL")); toolPanels.push_back (lumadenoise);
|
||||
addPanel (detailsPanel, colordenoise, M("TP_COLORDENOISE_LABEL")); toolPanels.push_back (colordenoise);
|
||||
addPanel (transformPanel, crop, M("TP_CROP_LABEL")); toolPanels.push_back (crop);
|
||||
addPanel (transformPanel, rotate, M("TP_ROTATE_LABEL")); toolPanels.push_back (rotate);
|
||||
addPanel (transformPanel, distortion, M("TP_DISTORTION_LABEL")); toolPanels.push_back (distortion);
|
||||
addPanel (transformPanel, cacorrection, M("TP_CACORRECTION_LABEL")); toolPanels.push_back (cacorrection);
|
||||
addPanel (transformPanel, vignetting, M("TP_VIGNETTING_LABEL")); toolPanels.push_back (vignetting);
|
||||
addPanel (transformPanel, resize, M("TP_RESIZE_LABEL")); toolPanels.push_back (resize);
|
||||
addPanel (transformPanel, lensgeom, M("TP_LENSGEOM_LABEL")); toolPanels.push_back (lensgeom);
|
||||
addPanel (lensgeom->getPackBox(), rotate, M("TP_ROTATE_LABEL")); toolPanels.push_back (rotate);
|
||||
addPanel (lensgeom->getPackBox(), perspective, M("TP_PERSPECTIVE_LABEL")); toolPanels.push_back (perspective);
|
||||
addPanel (lensgeom->getPackBox(), distortion, M("TP_DISTORTION_LABEL")); toolPanels.push_back (distortion);
|
||||
addPanel (lensgeom->getPackBox(), cacorrection, M("TP_CACORRECTION_LABEL")); toolPanels.push_back (cacorrection);
|
||||
addPanel (lensgeom->getPackBox(), vignetting, M("TP_VIGNETTING_LABEL")); toolPanels.push_back (vignetting);
|
||||
addPanel (colorPanel, icm, M("TP_ICM_LABEL")); toolPanels.push_back (icm);
|
||||
|
||||
toolPanels.push_back (coarse);
|
||||
@@ -110,7 +114,8 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
|
||||
|
||||
whitebalance->setWBProvider (this);
|
||||
whitebalance->setSpotWBListener (this);
|
||||
rotate->setRotateListener (this);
|
||||
lensgeom->setLensGeomListener (this);
|
||||
rotate->setLensGeomListener (this);
|
||||
crop->setCropPanelListener (this);
|
||||
icm->setICMPanelListener (this);
|
||||
|
||||
|
@@ -45,16 +45,20 @@
|
||||
#include <colorshift.h>
|
||||
#include <cacorrection.h>
|
||||
#include <distortion.h>
|
||||
#include <perspective.h>
|
||||
#include <rotate.h>
|
||||
#include <vignetting.h>
|
||||
#include <toolbar.h>
|
||||
#include <lensgeom.h>
|
||||
#include <lensgeomlistener.h>
|
||||
|
||||
|
||||
class ImageEditorCoordinator;
|
||||
|
||||
class ToolPanelCoordinator : public ToolPanelListener,
|
||||
public ProfileChangeListener,
|
||||
public WBProvider,
|
||||
public RotateListener,
|
||||
public LensGeomListener,
|
||||
public SpotWBListener,
|
||||
public CropPanelListener,
|
||||
public ICMPanelListener,
|
||||
@@ -64,8 +68,10 @@ class ToolPanelCoordinator : public ToolPanelListener,
|
||||
|
||||
WhiteBalance* whitebalance;
|
||||
Vignetting* vignetting;
|
||||
LensGeometry* lensgeom;
|
||||
Rotate* rotate;
|
||||
Distortion* distortion;
|
||||
PerspCorrection* perspective;
|
||||
CACorrection* cacorrection;
|
||||
ColorShift* colorshift;
|
||||
HLRecovery* hlrecovery;
|
||||
|
Reference in New Issue
Block a user