Fixed build errors with log2 not defined on some os

This commit is contained in:
matlabbe
2016-04-08 17:20:13 -04:00
parent dece54ca3e
commit ab35106359
2 changed files with 5 additions and 3 deletions

View File

@@ -3425,6 +3425,7 @@ Signature * Memory::createSignature(const SensorData & data, const Transform & p
UASSERT(keypoints3D.size() == 0 || keypoints3D.size() == wordIds.size());
unsigned int i=0;
float decimationRatio = preDecimation / _imagePostDecimation;
double log2value = log(preDecimation)/log(2);
for(std::list<int>::iterator iter=wordIds.begin(); iter!=wordIds.end() && i < keypoints.size(); ++iter, ++i)
{
cv::KeyPoint kpt = keypoints[i];
@@ -3434,7 +3435,7 @@ Signature * Memory::createSignature(const SensorData & data, const Transform & p
kpt.pt.x *= decimationRatio;
kpt.pt.y *= decimationRatio;
kpt.size *= decimationRatio;
kpt.octave += log2(preDecimation);
kpt.octave += log2value;
}
words.insert(std::pair<int, cv::KeyPoint>(*iter, kpt));

View File

@@ -253,12 +253,13 @@ Transform Odometry::process(SensorData & data, OdometryInfo * info)
// transform back the keypoints in the original image
std::vector<cv::KeyPoint> kpts = decimatedData.keypoints();
double log2value = log(_imageDecimation)/log(2);
for(unsigned int i=0; i<kpts.size(); ++i)
{
kpts[i].pt.x *= _imageDecimation;
kpts[i].pt.y *= _imageDecimation;
kpts[i].size *= _imageDecimation;
kpts[i].octave += log2(_imageDecimation);
kpts[i].octave += log2value;
}
data.setFeatures(kpts, decimatedData.descriptors());
@@ -277,7 +278,7 @@ Transform Odometry::process(SensorData & data, OdometryInfo * info)
iter->second.pt.x *= _imageDecimation;
iter->second.pt.y *= _imageDecimation;
iter->second.size *= _imageDecimation;
iter->second.octave += log2(_imageDecimation);
iter->second.octave += log2value;
}
}
}