mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
fixed some warnings in Windows
fixed Transform::getNorm() git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1436 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -187,7 +187,8 @@ cv::Mat CameraImages::captureImage()
|
||||
if(fileName.size())
|
||||
{
|
||||
ULOGGER_DEBUG("Loading image : %s", fullPath.c_str());
|
||||
#if CV_MAJOR_VERSION >=2 and CV_MINOR_VERSION >=4
|
||||
|
||||
#if CV_MAJOR_VERSION >=2 && CV_MINOR_VERSION >=4
|
||||
img = cv::imread(fullPath.c_str(), cv::IMREAD_UNCHANGED);
|
||||
#else
|
||||
img = cv::imread(fullPath.c_str(), -1);
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
#include <opencv2/imgproc/imgproc_c.h>
|
||||
#include <opencv2/gpu/gpu.hpp>
|
||||
#include <opencv2/core/version.hpp>
|
||||
#if CV_MAJOR_VERSION >=2 and CV_MINOR_VERSION >=4
|
||||
|
||||
#if CV_MAJOR_VERSION >=2 && CV_MINOR_VERSION >=4
|
||||
#include <opencv2/nonfree/gpu.hpp>
|
||||
#include <opencv2/nonfree/features2d.hpp>
|
||||
#endif
|
||||
|
||||
@@ -712,13 +712,14 @@ std::map<int, Transform> Memory::getNeighborLinks(int signatureId, bool ignoreNe
|
||||
// maxCheckedInDatabase = -1 means no limit to check in database (default)
|
||||
// maxCheckedInDatabase = 0 means don't check in database
|
||||
std::map<int, int> Memory::getNeighborsId(int signatureId,
|
||||
unsigned int margin, // 0 means infinite margin
|
||||
int margin, // 0 means infinite margin
|
||||
int maxCheckedInDatabase, // default -1 (no limit)
|
||||
bool incrementMarginOnLoop, // default false
|
||||
bool ignoreLoopIds, // default false
|
||||
double * dbAccessTime
|
||||
) const
|
||||
{
|
||||
UASSERT(margin >= 0);
|
||||
//UDEBUG("signatureId=%d, neighborsMargin=%d", signatureId, margin);
|
||||
if(dbAccessTime)
|
||||
{
|
||||
@@ -734,7 +735,7 @@ std::map<int, int> Memory::getNeighborsId(int signatureId,
|
||||
std::set<int> currentMargin;
|
||||
std::set<int> nextMargin;
|
||||
nextMargin.insert(signatureId);
|
||||
unsigned int m = 0;
|
||||
int m = 0;
|
||||
while((margin == 0 || m < margin) && nextMargin.size())
|
||||
{
|
||||
curentMarginList = std::list<int>(nextMargin.begin(), nextMargin.end());
|
||||
|
||||
@@ -1094,8 +1094,9 @@ bool Rtabmap::process(const Image & image)
|
||||
{
|
||||
//Load neighbors
|
||||
ULOGGER_INFO("Retrieving locations... around id=%d", _retrievedId);
|
||||
unsigned int neighborhoodSize = _bayesFilter->getPredictionLC().size()-1;
|
||||
unsigned int margin = neighborhoodSize;
|
||||
int neighborhoodSize = (int)_bayesFilter->getPredictionLC().size()-1;
|
||||
UASSERT(neighborhoodSize >= 0);
|
||||
int margin = neighborhoodSize;
|
||||
|
||||
UTimer timeGetN;
|
||||
unsigned int nbLoadedFromDb = 0;
|
||||
@@ -1105,7 +1106,7 @@ bool Rtabmap::process(const Image & image)
|
||||
double timeGetNeighborsSpaceDb = 0.0;
|
||||
std::map<int, int> neighbors;
|
||||
bool firstPassDone = false;
|
||||
unsigned int m = 0;
|
||||
int m = 0;
|
||||
int nbDirectNeighborsInDb = 0;
|
||||
|
||||
// priority in time
|
||||
@@ -1127,7 +1128,7 @@ bool Rtabmap::process(const Image & image)
|
||||
{
|
||||
neighbors.erase(iter++);
|
||||
}
|
||||
else if((unsigned int)iter->second == m)
|
||||
else if(iter->second == m)
|
||||
{
|
||||
if(reactivatedIdsSet.find(iter->first) == reactivatedIdsSet.end())
|
||||
{
|
||||
@@ -1178,7 +1179,7 @@ bool Rtabmap::process(const Image & image)
|
||||
{
|
||||
neighbors.erase(iter++);
|
||||
}
|
||||
else if((unsigned int)iter->second == m)
|
||||
else if(iter->second == m)
|
||||
{
|
||||
if(reactivatedIdsSet.find(iter->first) == reactivatedIdsSet.end())
|
||||
{
|
||||
@@ -1407,7 +1408,7 @@ bool Rtabmap::process(const Image & image)
|
||||
{
|
||||
lcHypothesisReactivated = sLoop->isSaved()?1.0f:0.0f;
|
||||
}
|
||||
dictionarySize = _memory->getVWDictionary()->getVisualWords().size();
|
||||
dictionarySize = (int)_memory->getVWDictionary()->getVisualWords().size();
|
||||
refWordsCount = (int)signature->getWords().size();
|
||||
refUniqueWordsCount = (int)uUniqueKeys(signature->getWords()).size();
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ void Transform::getTranslation(float & x, float & y, float & z) const
|
||||
|
||||
float Transform::getNorm() const
|
||||
{
|
||||
return std::sqrt(this->getNorm());
|
||||
return std::sqrt(this->getNormSquared());
|
||||
}
|
||||
|
||||
float Transform::getNormSquared() const
|
||||
|
||||
@@ -752,7 +752,7 @@ pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudFromDepthRGB(
|
||||
|
||||
cv::Mat depth2DFromPointCloud(const pcl::PointCloud<pcl::PointXYZ> & cloud)
|
||||
{
|
||||
cv::Mat depth2d(1, cloud.size(), CV_32FC2);
|
||||
cv::Mat depth2d(1, (int)cloud.size(), CV_32FC2);
|
||||
for(unsigned int i=0; i<cloud.size(); ++i)
|
||||
{
|
||||
depth2d.at<cv::Vec2f>(i)[0] = cloud.at(i).x;
|
||||
@@ -791,7 +791,7 @@ cv::Mat uncompressImage(const std::vector<unsigned char> & bytes)
|
||||
cv::Mat image;
|
||||
if(bytes.size())
|
||||
{
|
||||
#if CV_MAJOR_VERSION >=2 and CV_MINOR_VERSION >=4
|
||||
#if CV_MAJOR_VERSION >=2 && CV_MINOR_VERSION >=4
|
||||
image = cv::imdecode(bytes, cv::IMREAD_UNCHANGED);
|
||||
#else
|
||||
image = cv::imdecode(bytes, -1);
|
||||
@@ -805,7 +805,7 @@ std::vector<unsigned char> compressData(const cv::Mat & data)
|
||||
std::vector<unsigned char> bytes;
|
||||
if(!data.empty())
|
||||
{
|
||||
uLong sourceLen = data.total()*data.elemSize();
|
||||
uLong sourceLen = uLong(data.total())*uLong(data.elemSize());
|
||||
uLong destLen = compressBound(sourceLen);
|
||||
bytes.resize(destLen);
|
||||
int errCode = compress(
|
||||
@@ -847,13 +847,13 @@ cv::Mat uncompressData(const std::vector<unsigned char> & bytes)
|
||||
uFormat("size=%d, height=%d width=%d type=%d", bytes.size(), height, width, type).c_str());
|
||||
|
||||
data = cv::Mat(height, width, type);
|
||||
uLongf totalUncompressed = data.total()*data.elemSize();
|
||||
uLongf totalUncompressed = uLongf(data.total())*uLongf(data.elemSize());
|
||||
|
||||
int errCode = uncompress(
|
||||
(Bytef*)data.data,
|
||||
&totalUncompressed,
|
||||
(const Bytef*)bytes.data(),
|
||||
bytes.size());
|
||||
uLong(bytes.size()));
|
||||
|
||||
if(errCode == Z_MEM_ERROR)
|
||||
{
|
||||
@@ -918,8 +918,8 @@ void extractXYZCorrespondencesRANSAC(const std::multimap<int, pcl::PointXYZ> & w
|
||||
std::vector<uchar> status(pairs.size(), 0);
|
||||
//Convert Keypoints to a structure that OpenCV understands
|
||||
//3 dimensions (Homogeneous vectors)
|
||||
cv::Mat points1(1, pairs.size(), CV_32FC2);
|
||||
cv::Mat points2(1, pairs.size(), CV_32FC2);
|
||||
cv::Mat points1(1, (int)pairs.size(), CV_32FC2);
|
||||
cv::Mat points2(1, (int)pairs.size(), CV_32FC2);
|
||||
|
||||
float * points1data = points1.ptr<float>(0);
|
||||
float * points2data = points2.ptr<float>(0);
|
||||
@@ -1147,7 +1147,7 @@ Transform transformFromXYZCorrespondences(
|
||||
}
|
||||
else if(inliers)
|
||||
{
|
||||
*inliers = correspondencesInliers.size();
|
||||
*inliers = (int)correspondencesInliers.size();
|
||||
}
|
||||
|
||||
//std::cout << "transformMatrix: " << transformMatrix << std::endl;
|
||||
@@ -1521,7 +1521,7 @@ pcl::PolygonMesh::Ptr createMesh(
|
||||
float gp3MaximumSurfaceAngle,
|
||||
float gp3MinimumAngle,
|
||||
float gp3MaximumAngle,
|
||||
float gp3NormalConsistency)
|
||||
bool gp3NormalConsistency)
|
||||
{
|
||||
pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr cloudWithNormalsNoNaN = removeNaNNormalsFromPointCloud(cloudWithNormals);
|
||||
|
||||
@@ -1663,7 +1663,13 @@ bool saveTOROGraph(
|
||||
const std::map<int, Transform> & poses,
|
||||
const std::multimap<int, Link> & edgeConstraints)
|
||||
{
|
||||
FILE * file = fopen(fileName.c_str(), "w");
|
||||
FILE * file = 0;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
fopen_s(&file, fileName.c_str(), "w");
|
||||
#else
|
||||
file = fopen(fileName.c_str(), "w");
|
||||
#endif
|
||||
|
||||
if(file)
|
||||
{
|
||||
@@ -1712,7 +1718,12 @@ bool loadTOROGraph(const std::string & fileName,
|
||||
std::map<int, Transform> & poses,
|
||||
std::multimap<int, std::pair<int, Transform> > & edgeConstraints)
|
||||
{
|
||||
FILE * file = fopen(fileName.c_str(), "r");
|
||||
FILE * file = 0;
|
||||
#ifdef _MSC_VER
|
||||
fopen_s(&file, fileName.c_str(), "r");
|
||||
#else
|
||||
file = fopen(fileName.c_str(), "r");
|
||||
#endif
|
||||
|
||||
if(file)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user