Enhanced lens identification with Canon cameras, Issue 2228
This commit is contained in:
@@ -687,7 +687,7 @@ class CALensInterpreter : public IntLensInterpreter< int > {
|
||||
|
||||
it_t r;
|
||||
size_t nFound = choices.count( lensID );
|
||||
if( 1== nFound ) {
|
||||
if(1 == nFound) {
|
||||
r = choices.find ( lensID );
|
||||
return r->second;
|
||||
}
|
||||
@@ -705,7 +705,8 @@ class CALensInterpreter : public IntLensInterpreter< int > {
|
||||
maxApertureAtFocal = pow(2.0, apertureTag->toDouble()/64.0);
|
||||
if( unitTag ){
|
||||
double unit = unitTag->toDouble();
|
||||
if( unit==0. ) unit=1;
|
||||
if( unit==0. )
|
||||
unit=1;
|
||||
if( focalLengthTag )
|
||||
focalLength = focalLengthTag->toDouble();
|
||||
if( focalLengthMinTag )
|
||||
@@ -714,7 +715,6 @@ class CALensInterpreter : public IntLensInterpreter< int > {
|
||||
focalLengthMax = focalLengthMaxTag->toDouble()/unit;
|
||||
}
|
||||
|
||||
if (0 == nFound) {
|
||||
std::ostringstream s;
|
||||
s << "Unknown ";
|
||||
if (focalLengthMin > 0.)
|
||||
@@ -725,11 +725,12 @@ class CALensInterpreter : public IntLensInterpreter< int > {
|
||||
s << "mm";
|
||||
|
||||
s << " (" << lensID << ")";
|
||||
if (0 == nFound) {
|
||||
return s.str();
|
||||
}
|
||||
double deltaMin = 1000.;
|
||||
|
||||
std::string bestMatch("Unknown");
|
||||
std::string bestMatch(s.str());
|
||||
std::ostringstream candidates;
|
||||
for (r = choices.lower_bound(lensID); r != choices.upper_bound(lensID); r++) {
|
||||
double a1,a2,f1,f2,lensAperture,dif;
|
||||
@@ -755,7 +756,7 @@ class CALensInterpreter : public IntLensInterpreter< int > {
|
||||
lensAperture = exp( log(a1)+(log(a2)-log(a1))/(log(f2)-log(f1))*(log(focalLength)-log(f1)) );
|
||||
|
||||
dif = abs(lensAperture - maxApertureAtFocal);
|
||||
}else
|
||||
} else
|
||||
dif = 0;
|
||||
|
||||
if( dif < deltaMin ){
|
||||
|
Reference in New Issue
Block a user