LCP (Lens Correction Profile) support

see issue 1343
This commit is contained in:
Oliver Duis
2012-05-17 21:41:48 +02:00
parent f38752bd00
commit 2d59057d57
28 changed files with 665 additions and 74 deletions

View File

@@ -8,7 +8,7 @@ set (BASESOURCEFILES
coarsepanel.cc cacorrection.cc hlrec.cc chmixer.cc
resize.cc icmpanel.cc crop.cc shadowshighlights.cc
impulsedenoise.cc dirpyrdenoise.cc epd.cc
exifpanel.cc toolpanel.cc
exifpanel.cc toolpanel.cc lensprofile.cc
sharpening.cc vibrance.cc rgbcurves.cc
whitebalance.cc vignetting.cc rotate.cc distortion.cc
crophandler.cc dirbrowser.cc
@@ -40,9 +40,9 @@ if (WIN32)
#set_target_properties (rth PROPERTIES LINK_FLAGS "-mwindows")
else (WIN32)
include_directories (${EXTRA_INCDIR} ${GLIB2_INCLUDE_DIRS} ${GLIBMM_INCLUDE_DIRS}
${GTK_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} ${GIOMM_INCLUDE_DIRS} ${IPTCDATA_INCLUDE_DIRS} ${LCMS_INCLUDE_DIRS} ${GTHREAD_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS} )
${GTK_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} ${GIOMM_INCLUDE_DIRS} ${IPTCDATA_INCLUDE_DIRS} ${LCMS_INCLUDE_DIRS} ${EXPAT_INCLUDE_DIRS} ${GTHREAD_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS} )
link_directories (${EXTRA_LIBDIR} ${GLIB2_LIBRARY_DIRS} ${GLIBMM_LIBRARY_DIRS}
${GTK_LIBRARY_DIRS} ${GTKMM_LIBRARY_DIRS} ${GIO_LIBRARY_DIRS} ${GIOMM_LIBRARY_DIRS} ${IPTCDATA_LIBRARY_DIRS} ${LCMS_LIBRARY_DIRS} ${GTHREAD_LIBRARY_DIRS} ${GOBJECT_LIBRARY_DIRS})
${GTK_LIBRARY_DIRS} ${GTKMM_LIBRARY_DIRS} ${GIO_LIBRARY_DIRS} ${GIOMM_LIBRARY_DIRS} ${IPTCDATA_LIBRARY_DIRS} ${LCMS_LIBRARY_DIRS} ${EXPAT_LIBRARY_DIRS} ${GTHREAD_LIBRARY_DIRS} ${GOBJECT_LIBRARY_DIRS})
endif (WIN32)
# create config.h which defines where data are stored
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
@@ -53,6 +53,6 @@ set_target_properties (rth PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS}" OUTPUT_
#target_link_libraries (rth rtengine ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${TIFF_LIBRARIES} ${EXTRA_LIB} ${GOBJECT_LIBRARIES} ${GTHREAD_LIBRARIES}
# ${GLIB2_LIBRARIES} ${GLIBMM_LIBRARIES} ${GTK_LIBRARIES} ${GTKMM_LIBRARIES} ${GIO_LIBRARIES} ${GIOMM_LIBRARIES} ${LCMS_LIBRARIES} ${IPTCDATA_LIBRARIES})
target_link_libraries (rth rtengine ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${TIFF_LIBRARIES} ${GOBJECT_LIBRARIES} ${GTHREAD_LIBRARIES}
${GLIB2_LIBRARIES} ${GLIBMM_LIBRARIES} ${GTK_LIBRARIES} ${GTKMM_LIBRARIES} ${GIO_LIBRARIES} ${GIOMM_LIBRARIES} ${LCMS_LIBRARIES} ${IPTCDATA_LIBRARIES} ${EXTRA_LIB_RTGUI})
${GLIB2_LIBRARIES} ${GLIBMM_LIBRARIES} ${GTK_LIBRARIES} ${GTKMM_LIBRARIES} ${GIO_LIBRARIES} ${GIOMM_LIBRARIES} ${LCMS_LIBRARIES} ${EXPAT_LIBRARIES} ${IPTCDATA_LIBRARIES} ${EXTRA_LIB_RTGUI})
install (TARGETS rth DESTINATION ${BINDIR})

View File

@@ -134,8 +134,8 @@ void ParamsEdited::set (bool v) {
coarse.vflip = v;
commonTrans.autofill = v;
rotate.degree = v;
distortion.uselensfun = v;
distortion.amount = v;
lensProf.lcpFile = v;
perspective.horizontal = v;
perspective.vertical = v;
cacorrection.red = v;
@@ -327,8 +327,8 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
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;
distortion.uselensfun = distortion.uselensfun && p.distortion.uselensfun == other.distortion.uselensfun;
distortion.amount = distortion.amount && p.distortion.amount == other.distortion.amount;
lensProf.lcpFile = lensProf.lcpFile && p.lensProf.lcpFile == other.lensProf.lcpFile;
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;
@@ -519,8 +519,8 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
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 = dontforceSet && options.baBehav[ADDSET_ROTATE_DEGREE] ? toEdit.rotate.degree + mods.rotate.degree : mods.rotate.degree;
if (distortion.uselensfun) toEdit.distortion.uselensfun = mods.distortion.uselensfun;
if (distortion.amount) toEdit.distortion.amount = dontforceSet && options.baBehav[ADDSET_DIST_AMOUNT] ? toEdit.distortion.amount + mods.distortion.amount : mods.distortion.amount;
if (lensProf.lcpFile) toEdit.lensProf.lcpFile = mods.lensProf.lcpFile;
if (perspective.horizontal) toEdit.perspective.horizontal = dontforceSet && options.baBehav[ADDSET_PERSPECTIVE] ? toEdit.perspective.horizontal + mods.perspective.horizontal : mods.perspective.horizontal;
if (perspective.vertical) toEdit.perspective.vertical = dontforceSet && options.baBehav[ADDSET_PERSPECTIVE] ? toEdit.perspective.vertical + mods.perspective.vertical : mods.perspective.vertical;
if (cacorrection.red) toEdit.cacorrection.red = dontforceSet && options.baBehav[ADDSET_CA] ? toEdit.cacorrection.red + mods.cacorrection.red : mods.cacorrection.red;

View File

@@ -243,10 +243,14 @@ class RotateParamsEdited {
class DistortionParamsEdited {
public:
bool uselensfun;
bool amount;
};
class LensProfParamsEdited {
public:
bool lcpFile;
};
class PerspectiveParamsEdited {
public:
@@ -386,6 +390,7 @@ class ParamsEdited {
CommonTransformParamsEdited commonTrans;
RotateParamsEdited rotate;
DistortionParamsEdited distortion;
LensProfParamsEdited lensProf;
PerspectiveParamsEdited perspective;
CACorrParamsEdited cacorrection;
VignettingParamsEdited vignetting;

View File

@@ -70,6 +70,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) {
distortion = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_DISTORTION")));
cacorr = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_CACORRECTION")));
vignetting = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_VIGNETTING")));
lcp = Gtk::manage (new Gtk::CheckButton (M("TP_LENSPROFILE_LABEL")));
// options in composition:
coarserot = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_COARSETRANS")));
@@ -149,6 +150,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) {
vboxes[3]->pack_start (*distortion, Gtk::PACK_SHRINK, 2);
vboxes[3]->pack_start (*cacorr, Gtk::PACK_SHRINK, 2);
vboxes[3]->pack_start (*vignetting, Gtk::PACK_SHRINK, 2);
vboxes[3]->pack_start (*lcp, Gtk::PACK_SHRINK, 2);
vboxes[4]->pack_start (*composition, Gtk::PACK_SHRINK, 2);
vboxes[4]->pack_start (*hseps[4], Gtk::PACK_SHRINK, 2);
@@ -260,6 +262,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) {
distortionConn = distortion->signal_toggled().connect (sigc::bind (sigc::mem_fun(*lens, &Gtk::CheckButton::set_inconsistent), true));
cacorrConn = cacorr->signal_toggled().connect (sigc::bind (sigc::mem_fun(*lens, &Gtk::CheckButton::set_inconsistent), true));
vignettingConn = vignetting->signal_toggled().connect (sigc::bind (sigc::mem_fun(*lens, &Gtk::CheckButton::set_inconsistent), true));
lcpConn = lcp->signal_toggled().connect (sigc::bind (sigc::mem_fun(*lens, &Gtk::CheckButton::set_inconsistent), true));
coarserotConn = coarserot->signal_toggled().connect (sigc::bind (sigc::mem_fun(*composition, &Gtk::CheckButton::set_inconsistent), true));
finerotConn = finerot->signal_toggled().connect (sigc::bind (sigc::mem_fun(*composition, &Gtk::CheckButton::set_inconsistent), true));
@@ -495,16 +498,19 @@ void PartialPasteDlg::lensToggled () {
distortionConn.block (true);
cacorrConn.block (true);
vignettingConn.block (true);
lcpConn.block (true);
lens->set_inconsistent (false);
distortion->set_active (lens->get_active ());
cacorr->set_active (lens->get_active ());
vignetting->set_active (lens->get_active ());
lcp->set_active (lens->get_active ());
distortionConn.block (false);
cacorrConn.block (false);
vignettingConn.block (false);
lcpConn.block (false);
}
void PartialPasteDlg::compositionToggled () {
@@ -600,6 +606,7 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param
if (!distortion->get_active ()) filterPE.distortion = falsePE.distortion;
if (!cacorr->get_active ()) filterPE.cacorrection = falsePE.cacorrection;
if (!vignetting->get_active ()) filterPE.vignetting = falsePE.vignetting;
if (!lcp->get_active ()) filterPE.lensProf = falsePE.lensProf;
if (!coarserot->get_active ()) filterPE.coarse = falsePE.coarse;
if (!finerot->get_active ()) filterPE.rotate = falsePE.rotate;

View File

@@ -66,6 +66,7 @@ class PartialPasteDlg : public Gtk::Dialog {
Gtk::CheckButton* distortion;
Gtk::CheckButton* cacorr;
Gtk::CheckButton* vignetting;
Gtk::CheckButton* lcp;
// options in composition:
Gtk::CheckButton* coarserot;
@@ -109,7 +110,7 @@ class PartialPasteDlg : public Gtk::Dialog {
sigc::connection wbConn, exposureConn, hlrecConn, shConn, labcurveConn;
sigc::connection sharpenConn, gradsharpenConn, microcontrastConn, impdenConn, dirpyrdenConn, waveqConn, defringeConn, epdConn, dirpyreqConn;
sigc::connection vibranceConn, chmixerConn, hsveqConn, rgbcurvesConn;
sigc::connection distortionConn, cacorrConn, vignettingConn;
sigc::connection distortionConn, cacorrConn, vignettingConn, lcpConn;
sigc::connection coarserotConn, finerotConn, cropConn, resizeConn, perspectiveConn, commonTransConn;
sigc::connection exifchConn, iptcConn, icmConn, gamcsconn;
sigc::connection df_fileConn, df_AutoSelectConn, ff_fileConn, ff_AutoSelectConn, ff_BlurRadiusConn, ff_BlurTypeConn;

View File

@@ -468,7 +468,7 @@ rtengine::IImage8* Thumbnail::processThumbImage (const rtengine::procparams::Pro
else
{
// Full thumbnail: apply profile
image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, cfs.camera, scale );
image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, cfs.camera, cfs.focalLen, scale );
}
tpp->getDimensions(lastW,lastH,lastScale);
@@ -493,7 +493,7 @@ rtengine::IImage8* Thumbnail::upgradeThumbImage (const rtengine::procparams::Pro
return 0;
}
rtengine::IImage8* image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, cfs.camera, scale );
rtengine::IImage8* image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, cfs.camera, cfs.focalLen, scale );
tpp->getDimensions(lastW,lastH,lastScale);
delete tpp;

View File

@@ -52,6 +52,7 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
lcurve = Gtk::manage (new LCurve ());
rgbcurves = Gtk::manage (new RGBCurves ());
lensgeom = Gtk::manage (new LensGeometry ());
lensProf = Gtk::manage (new LensProfilePanel ());
distortion = Gtk::manage (new Distortion ());
rotate = Gtk::manage (new Rotate ());
vibrance = Gtk::manage (new Vibrance ());
@@ -97,6 +98,7 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
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(), lensProf, M("TP_LENSPROFILE_LABEL")); toolPanels.push_back (lensProf);
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);

View File

@@ -45,6 +45,7 @@
#include "chmixer.h"
#include "hlrec.h"
#include "cacorrection.h"
#include "lensprofile.h"
#include "distortion.h"
#include "perspective.h"
#include "rotate.h"
@@ -83,6 +84,7 @@ class ToolPanelCoordinator : public ToolPanelListener,
WhiteBalance* whitebalance;
Vignetting* vignetting;
LensGeometry* lensgeom;
LensProfilePanel* lensProf;
Rotate* rotate;
Distortion* distortion;
PerspCorrection* perspective;