Comments (5)
Confirmed. There is some suspicious usage, or rather non-usage, of the camera specifications when searching for a matching lens profile.
from rawtherapee.
Thanks for looking into it
from rawtherapee.
I did some testing with the code and managed to fix the problem. I need to clean the patch up and also understand why the camera details weren't used to look up the lens. It looks intentional, but the rationale is not clear.
Patch
diff --git a/rtengine/rtlensfun.cc b/rtengine/rtlensfun.cc
index fc5bb0017..5bf154592 100644
--- a/rtengine/rtlensfun.cc
+++ b/rtengine/rtlensfun.cc
@@ -460,20 +460,38 @@ LFCamera LFDatabase::findCamera(const Glib::ustring &make, const Glib::ustring &
}
-LFLens LFDatabase::findLens(const LFCamera &camera, const Glib::ustring &name) const
+LFLens LFDatabase::findLens(const LFCamera &camera, const Glib::ustring &name, bool autoMatch) const
{
LFLens ret;
if (data_ && !name.empty()) {
MyMutex::MyLock lock(lfDBMutex);
- if (!camera.data_) {
+ if (!autoMatch) {
// Only the lens name provided. Try to find exact match by name.
LFLens candidate;
+ LFLens bestCandidate;
+ const auto isCStringIn = [](const char *str, const char *const *list) {
+ for (auto element = list[0]; element[0]; element++) {
+ if (!strcmp(str, element)) {
+ return true;
+ }
+ }
+ return false;
+ };
for (auto lens_list = data_->GetLenses(); lens_list[0]; lens_list++) {
candidate.data_ = lens_list[0];
- if (name == candidate.getLens()) {
- return candidate;
+ if ((!bestCandidate.data_ ||
+ (bestCandidate.data_->CropFactor > camera.data_->CropFactor
+ ? bestCandidate.data_->CropFactor > candidate.data_->CropFactor
+ : candidate.data_->CropFactor <= camera.data_->CropFactor &&
+ bestCandidate.data_->CropFactor < candidate.data_->CropFactor)) &&
+ name == candidate.getLens() &&
+ isCStringIn(camera.data_->Mount, candidate.data_->Mounts)) {
+ bestCandidate.data_ = candidate.data_;
}
}
+ if (bestCandidate.data_) {
+ return bestCandidate;
+ }
}
auto found = data_->FindLenses(camera.data_, nullptr, name.c_str());
for (size_t pos = 0; !found && pos < name.size(); ) {
@@ -562,12 +580,7 @@ std::unique_ptr<LFModifier> LFDatabase::findModifier(
}
const LFCamera c = findCamera(make, model, lensProf.lfAutoMatch());
- const LFLens l = findLens(
- lensProf.lfAutoMatch()
- ? c
- : LFCamera(),
- lens
- );
+ const LFLens l = findLens(c, lens, lensProf.lfAutoMatch());
bool swap_xy = false;
if (rawRotationDeg >= 0) {
diff --git a/rtengine/rtlensfun.h b/rtengine/rtlensfun.h
index bcce77f34..1d941246f 100644
--- a/rtengine/rtlensfun.h
+++ b/rtengine/rtlensfun.h
@@ -121,7 +121,7 @@ public:
std::vector<LFCamera> getCameras() const;
std::vector<LFLens> getLenses() const;
LFCamera findCamera(const Glib::ustring &make, const Glib::ustring &model, bool autoMatch) const;
- LFLens findLens(const LFCamera &camera, const Glib::ustring &name) const;
+ LFLens findLens(const LFCamera &camera, const Glib::ustring &name, bool autoMatch) const;
std::unique_ptr<LFModifier> findModifier(
const procparams::LensProfParams &lensProf,
diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc
index 0e17b3f40..5f42a1cde 100644
--- a/rtgui/lensprofile.cc
+++ b/rtgui/lensprofile.cc
@@ -251,7 +251,7 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa
if (pp->lensProf.lfAutoMatch()) {
if (metadata) {
- const LFLens l = db->findLens(c, metadata->getLens());
+ const LFLens l = db->findLens(c, metadata->getLens(), true);
setLensfunLens(l.getLens());
}
} else if (pp->lensProf.lfManual()) {
@@ -522,7 +522,7 @@ void LensProfilePanel::onCorrModeChanged(const Gtk::RadioButton* rbChanged)
} else if (metadata) {
const LFDatabase* const db = LFDatabase::getInstance();
const LFCamera c = db->findCamera(metadata->getMake(), metadata->getModel(), true);
- const LFLens l = db->findLens(c, metadata->getLens());
+ const LFLens l = db->findLens(c, metadata->getLens(), true);
setLensfunCamera(c.getMake(), c.getModel());
setLensfunLens(l.getLens());
}
@@ -808,7 +808,7 @@ void LensProfilePanel::updateLensfunWarning()
return;
}
- const LFLens l = db->findLens(LFCamera(), (*itl)[lf->lensfunModelLens.lens]);
+ const LFLens l = db->findLens(c, (*itl)[lf->lensfunModelLens.lens], false);
const float lenscrop = l.getCropFactor();
const float camcrop = c.getCropFactor();
from rawtherapee.
hi, I don't have that much experience with rawtherapee development, should I apply this to head or can I apply this over v5.10? is there any kind of nightly build available? regards
from rawtherapee.
The patch is intended to be a progress report and solicit feedback from other developers who are interested. If you want to try it, I created the patch on top of the dev branch. However, it might also work on v5.10. There's no automated build available until I create a pull request.
from rawtherapee.
Related Issues (20)
- History is getting spammed when Color Appearance & Lighting module is enabled Build 5.10-190 on dev branch. HOT 8
- A gamma shift issue/color change after saving to jpg HOT 1
- No DateTime (= editing date) in EXIF data of exported photo
- Please support Rust-free `librsvg` HOT 4
- Resulting JPG file is locked after Save As, Linux build 5.10-194 HOT 6
- JPG Export best-quality really chroma subsampling 4:4:4 ? HOT 1
- Film Negative - Improper assumption of mapping between raw values and transmission coefficient HOT 11
- RawTherapee 5.10 not responsive after start HOT 4
- Am I misunderstanding TP_LOCALLAB_AVOIDCOLORSHIFT_TOOLTIP? HOT 3
- Feature request: export pictures in HEIF 10bit HOT 3
- The GUI doesn't open on first install (Windows). HOT 1
- Wavelets - malfunction for the “selective range” part HOT 1
- Program resources not loaded when installed in directory with special characters HOT 7
- Build fails with libjpeg-turbo 3.0.3: Undefined symbols for architecture x86_64: "_jpeg_std_message_table" HOT 12
- Sony ILCE-6700 has invalid pixels on the right border HOT 1
- Chinese (Simplified) translation (intended for) Rawtherapee 5.8 (or 5.9?) HOT 1
- Please consider implementing a better way to preview and scroll through presets HOT 1
- Update GUI in Japanese HOT 1
- Add/Edit Exif not possible, if Exif data is not available in photo HOT 3
- Assertion '__n < this->size()' failed. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rawtherapee.