mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-11 12:09:51 +08:00
Fixed build errors with log2 not defined on some os
This commit is contained in:
@@ -3425,6 +3425,7 @@ Signature * Memory::createSignature(const SensorData & data, const Transform & p
|
|||||||
UASSERT(keypoints3D.size() == 0 || keypoints3D.size() == wordIds.size());
|
UASSERT(keypoints3D.size() == 0 || keypoints3D.size() == wordIds.size());
|
||||||
unsigned int i=0;
|
unsigned int i=0;
|
||||||
float decimationRatio = preDecimation / _imagePostDecimation;
|
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)
|
for(std::list<int>::iterator iter=wordIds.begin(); iter!=wordIds.end() && i < keypoints.size(); ++iter, ++i)
|
||||||
{
|
{
|
||||||
cv::KeyPoint kpt = keypoints[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.x *= decimationRatio;
|
||||||
kpt.pt.y *= decimationRatio;
|
kpt.pt.y *= decimationRatio;
|
||||||
kpt.size *= decimationRatio;
|
kpt.size *= decimationRatio;
|
||||||
kpt.octave += log2(preDecimation);
|
kpt.octave += log2value;
|
||||||
}
|
}
|
||||||
words.insert(std::pair<int, cv::KeyPoint>(*iter, kpt));
|
words.insert(std::pair<int, cv::KeyPoint>(*iter, kpt));
|
||||||
|
|
||||||
|
|||||||
@@ -253,12 +253,13 @@ Transform Odometry::process(SensorData & data, OdometryInfo * info)
|
|||||||
|
|
||||||
// transform back the keypoints in the original image
|
// transform back the keypoints in the original image
|
||||||
std::vector<cv::KeyPoint> kpts = decimatedData.keypoints();
|
std::vector<cv::KeyPoint> kpts = decimatedData.keypoints();
|
||||||
|
double log2value = log(_imageDecimation)/log(2);
|
||||||
for(unsigned int i=0; i<kpts.size(); ++i)
|
for(unsigned int i=0; i<kpts.size(); ++i)
|
||||||
{
|
{
|
||||||
kpts[i].pt.x *= _imageDecimation;
|
kpts[i].pt.x *= _imageDecimation;
|
||||||
kpts[i].pt.y *= _imageDecimation;
|
kpts[i].pt.y *= _imageDecimation;
|
||||||
kpts[i].size *= _imageDecimation;
|
kpts[i].size *= _imageDecimation;
|
||||||
kpts[i].octave += log2(_imageDecimation);
|
kpts[i].octave += log2value;
|
||||||
}
|
}
|
||||||
data.setFeatures(kpts, decimatedData.descriptors());
|
data.setFeatures(kpts, decimatedData.descriptors());
|
||||||
|
|
||||||
@@ -277,7 +278,7 @@ Transform Odometry::process(SensorData & data, OdometryInfo * info)
|
|||||||
iter->second.pt.x *= _imageDecimation;
|
iter->second.pt.x *= _imageDecimation;
|
||||||
iter->second.pt.y *= _imageDecimation;
|
iter->second.pt.y *= _imageDecimation;
|
||||||
iter->second.size *= _imageDecimation;
|
iter->second.size *= _imageDecimation;
|
||||||
iter->second.octave += log2(_imageDecimation);
|
iter->second.octave += log2value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user