profile lens correction: show a warning if the lens profile has a crop factor greater than the selected camera
This commit is contained in:
@@ -2158,3 +2158,4 @@ ZOOMPANEL_ZOOMOUT;Zoom Out\nShortcut: <b>-</b>
|
||||
LENSPROFILE_CORRECTION_AUTOMATCH;Auto-matched correction parameters
|
||||
LENSPROFILE_CORRECTION_MANUAL;Manual correction parameters
|
||||
LENSPROFILE_CORRECTION_LCPFILE;LCP File
|
||||
LENSPROFILE_LENS_WARNING;Warning: the crop factor used for lens profiling is larger than the crop factor of the camera, the results might be wrong.
|
@@ -206,6 +206,16 @@ Glib::ustring LFLens::getLens() const
|
||||
}
|
||||
|
||||
|
||||
float LFLens::getCropFactor() const
|
||||
{
|
||||
if (data_) {
|
||||
return data_->CropFactor;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LFDatabase
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -75,6 +75,7 @@ public:
|
||||
Glib::ustring getMake() const;
|
||||
Glib::ustring getLens() const;
|
||||
Glib::ustring getDisplayString() const { return getLens(); }
|
||||
float getCropFactor() const;
|
||||
private:
|
||||
friend class LFDatabase;
|
||||
const lfLens *data_;
|
||||
|
@@ -86,6 +86,11 @@ LensProfilePanel::LensProfilePanel () :
|
||||
hb = Gtk::manage(new Gtk::HBox());
|
||||
hb->pack_start(*Gtk::manage(new Gtk::Label(M("EXIFFILTER_LENS"))), Gtk::PACK_SHRINK, 4);
|
||||
hb->pack_start(*lensfunLenses);
|
||||
warning = Gtk::manage(new Gtk::Image());
|
||||
warning->set_from_icon_name("dialog-warning", Gtk::ICON_SIZE_LARGE_TOOLBAR);
|
||||
warning->set_tooltip_text(M("LENSPROFILE_LENS_WARNING"));
|
||||
warning->hide();
|
||||
hb->pack_start(*warning, Gtk::PACK_SHRINK, 4);
|
||||
pack_start(*hb);
|
||||
|
||||
corrLcpFile = Gtk::manage(new Gtk::RadioButton(corrGroup));
|
||||
@@ -219,10 +224,35 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa
|
||||
corrOff->set_active(true);
|
||||
}
|
||||
|
||||
updateLensfunWarning();
|
||||
|
||||
enableListener ();
|
||||
conUseDist.block(false);
|
||||
}
|
||||
|
||||
|
||||
void LensProfilePanel::updateLensfunWarning()
|
||||
{
|
||||
warning->hide();
|
||||
if (corrLensfunManual->get_active()) {
|
||||
const LFDatabase *db = LFDatabase::getInstance();
|
||||
|
||||
auto itc = lensfunCameras->get_active();
|
||||
if (!itc) {
|
||||
return;
|
||||
}
|
||||
LFCamera c = db->findCamera((*itc)[lf->lensfunModelCam.make], (*itc)[lf->lensfunModelCam.model]);
|
||||
auto itl = lensfunLenses->get_active();
|
||||
if (!itl) {
|
||||
return;
|
||||
}
|
||||
LFLens l = db->findLens(LFCamera(), (*itl)[lf->lensfunModelLens.lens]);
|
||||
if (l.getCropFactor() - c.getCropFactor() >= 0.01) {
|
||||
warning->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LensProfilePanel::setRawMeta(bool raw, const rtengine::ImageMetaData* pMeta)
|
||||
{
|
||||
if (!raw || pMeta->getFocusDist() <= 0) {
|
||||
@@ -430,6 +460,8 @@ void LensProfilePanel::onLensfunCameraChanged()
|
||||
listener->panelChanged(EvLensCorrLensfunCamera, name);
|
||||
}
|
||||
}
|
||||
|
||||
updateLensfunWarning();
|
||||
}
|
||||
|
||||
|
||||
@@ -449,6 +481,8 @@ void LensProfilePanel::onLensfunLensChanged()
|
||||
listener->panelChanged(EvLensCorrLensfunLens, name);
|
||||
}
|
||||
}
|
||||
|
||||
updateLensfunWarning();
|
||||
}
|
||||
|
||||
|
||||
@@ -526,6 +560,8 @@ void LensProfilePanel::onCorrModeChanged()
|
||||
mode = M("GENERAL_UNCHANGED");
|
||||
}
|
||||
|
||||
updateLensfunWarning();
|
||||
|
||||
if (listener) {
|
||||
listener->panelChanged(EvLensCorrMode, mode);
|
||||
}
|
||||
|
@@ -49,6 +49,7 @@ protected:
|
||||
Gtk::RadioButton *corrUnchanged;
|
||||
MyComboBox *lensfunCameras;
|
||||
MyComboBox *lensfunLenses;
|
||||
Gtk::Image *warning;
|
||||
|
||||
class LFDbHelper {
|
||||
public:
|
||||
@@ -86,6 +87,7 @@ protected:
|
||||
bool setLensfunCamera(const Glib::ustring &make, const Glib::ustring &model);
|
||||
bool setLensfunLens(const Glib::ustring &lens);
|
||||
bool checkLensfunCanCorrect(bool automatch);
|
||||
void updateLensfunWarning();
|
||||
|
||||
public:
|
||||
|
||||
|
Reference in New Issue
Block a user