Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
digiKam
Commits
09e5724c
Commit
09e5724c
authored
Nov 28, 2013
by
Gilles Caulier
🗼
Browse files
apply patch from Teemu Rytilahti to handle properly multiple matches of lens from lensfun
REVIEW: 111021
CCBUGS: 303848
parent
a732720a
Changes
1
Hide whitespace changes
Inline
Side-by-side
libs/dimg/filters/lens/lensfuniface.cpp
View file @
09e5724c
...
...
@@ -262,19 +262,14 @@ LensFunIface::MetadataMatch LensFunIface::findFromMetadata(const DMetadata& meta
if
(
!
d
->
lensDescription
.
isEmpty
())
{
QMap
<
int
,
LensPtr
>
bestMatches
;
QString
lensCutted
;
LensList
lensList
;
LensList
lensMatches
;
QString
lensCutted
;
LensList
lensList
;
// STAGE 1, search in LensFun database as well.
lensList
=
findLenses
(
d
->
usedCamera
,
d
->
lensDescription
);
kDebug
()
<<
"* Check for lens by direct query ("
<<
d
->
lensDescription
<<
" : "
<<
lensList
.
count
()
<<
")"
;
if
(
!
lensList
.
isEmpty
())
{
bestMatches
.
insert
(
lensList
.
count
(),
lensList
.
at
(
0
));
}
lensMatches
.
append
(
lensList
);
// STAGE 2, Adapt exiv2 strings to lensfun strings for Nikon.
lensCutted
=
d
->
lensDescription
;
...
...
@@ -286,11 +281,7 @@ LensFunIface::MetadataMatch LensFunIface::findFromMetadata(const DMetadata& meta
lensCutted
.
replace
(
"IF-ID"
,
"ED-IF"
);
lensList
=
findLenses
(
d
->
usedCamera
,
lensCutted
);
kDebug
()
<<
"* Check for Nikon lens ("
<<
lensCutted
<<
" : "
<<
lensList
.
count
()
<<
")"
;
if
(
!
lensList
.
isEmpty
())
{
bestMatches
.
insert
(
lensList
.
count
(),
lensList
.
at
(
0
));
}
lensMatches
.
append
(
lensList
);
}
// TODO : Add here more specific lens maker rules.
...
...
@@ -303,15 +294,11 @@ LensFunIface::MetadataMatch LensFunIface::findFromMetadata(const DMetadata& meta
lensCutted
.
replace
(
" mm"
,
"mn"
);
lensList
=
findLenses
(
d
->
usedCamera
,
lensCutted
);
kDebug
()
<<
"* Check for no maker lens ("
<<
lensCutted
<<
" : "
<<
lensList
.
count
()
<<
")"
;
if
(
!
lensList
.
isEmpty
())
{
bestMatches
.
insert
(
lensList
.
count
(),
lensList
.
at
(
0
));
}
lensMatches
.
append
(
lensList
);
// Display the results.
if
(
best
Matches
.
isEmpty
())
if
(
lens
Matches
.
isEmpty
())
{
kDebug
()
<<
"lens matches : NOT FOUND"
;
exactMatch
&=
false
;
...
...
@@ -319,18 +306,34 @@ LensFunIface::MetadataMatch LensFunIface::findFromMetadata(const DMetadata& meta
else
{
// Best case for an exact match is to have only one item returned by Lensfun searches.
QMap
<
int
,
LensPtr
>::
const_iterator
it
=
bestMatches
.
constFind
(
1
);
if
(
it
!=
bestMatches
.
constEnd
())
if
(
lensMatches
.
count
()
==
1
)
{
setUsedLens
(
best
Matches
[
it
.
key
()
]
);
setUsedLens
(
lens
Matches
.
first
());
kDebug
()
<<
"Lens found : "
<<
d
->
settings
.
lensModel
;
kDebug
()
<<
"Crop Factor : "
<<
d
->
settings
.
cropFactor
;
}
else
{
kDebug
()
<<
"lens matches : more than one..."
;
exactMatch
&=
false
;
const
lfLens
*
exact
=
0
;
Q_FOREACH
(
const
lfLens
*
const
l
,
lensMatches
)
{
if
(
l
->
Model
==
d
->
lensDescription
)
{
kDebug
()
<<
"found exact match from"
<<
lensMatches
.
count
()
<<
"possitibilites:"
<<
l
->
Model
;
exact
=
l
;
}
}
if
(
exact
)
{
setUsedLens
(
exact
);
}
else
{
exactMatch
&=
false
;
}
}
}
}
...
...
@@ -422,9 +425,12 @@ LensFunIface::MetadataMatch LensFunIface::findFromMetadata(const DMetadata& meta
temp
=
temp
.
remove
(
" m"
);
bool
ok
;
d
->
settings
.
subjectDistance
=
temp
.
toDouble
(
&
ok
);
if
(
!
ok
)
{
if
(
!
ok
)
{
d
->
settings
.
subjectDistance
=
-
1.0
;
}
kDebug
()
<<
"Subject dist. : "
<<
d
->
settings
.
subjectDistance
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment