fixed compilation error on Windows (on util3d::removeNaNFromPointCloud() method)

increased stability of new actions added (New/Open/Close database).

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1933 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2014-10-28 04:16:36 +00:00
parent d950c88373
commit 4340748fec
10 changed files with 60 additions and 89 deletions

View File

@@ -1964,7 +1964,7 @@ void DBDriverSqlite3::stepImage(sqlite3_stmt * ppStmt,
if(image.size())
{
rc = sqlite3_bind_blob(ppStmt, index++, image.data(), image.size(), SQLITE_STATIC);
rc = sqlite3_bind_blob(ppStmt, index++, image.data(), (int)image.size(), SQLITE_STATIC);
}
else
{
@@ -2015,7 +2015,7 @@ void DBDriverSqlite3::stepDepth(sqlite3_stmt * ppStmt,
if(depth.size())
{
rc = sqlite3_bind_blob(ppStmt, index++, depth.data(), depth.size(), SQLITE_STATIC);
rc = sqlite3_bind_blob(ppStmt, index++, depth.data(), (int)depth.size(), SQLITE_STATIC);
}
else
{
@@ -2045,7 +2045,7 @@ void DBDriverSqlite3::stepDepth(sqlite3_stmt * ppStmt,
if(depth2d.size())
{
rc = sqlite3_bind_blob(ppStmt, index++, depth2d.data(), depth2d.size(), SQLITE_STATIC);
rc = sqlite3_bind_blob(ppStmt, index++, depth2d.data(), (int)depth2d.size(), SQLITE_STATIC);
}
else
{

View File

@@ -92,7 +92,7 @@ void Feature2D::filterKeypointsByDepth(
}
else
{
cv::Mat newDescriptors(keypoints.size(), descriptors.cols, descriptors.type());
cv::Mat newDescriptors((int)keypoints.size(), descriptors.cols, descriptors.type());
int di = 0;
for(unsigned int i=0; i<indexes.size(); ++i)
{
@@ -159,7 +159,7 @@ void Feature2D::filterKeypointsByDisparity(
}
else
{
cv::Mat newDescriptors(keypoints.size(), descriptors.cols, descriptors.type());
cv::Mat newDescriptors((int)keypoints.size(), descriptors.cols, descriptors.type());
int di = 0;
for(unsigned int i=0; i<indexes.size(); ++i)
{
@@ -205,7 +205,7 @@ void Feature2D::limitKeypoints(std::vector<cv::KeyPoint> & keypoints, cv::Mat &
}
// Remove them from the signature
int removed = hessianMap.size()-maxKeypoints;
int removed = (int)hessianMap.size()-maxKeypoints;
std::multimap<float, int>::reverse_iterator iter = hessianMap.rbegin();
std::vector<cv::KeyPoint> kptsTmp(maxKeypoints);
cv::Mat descriptorsTmp;
@@ -228,7 +228,7 @@ void Feature2D::limitKeypoints(std::vector<cv::KeyPoint> & keypoints, cv::Mat &
}
}
}
ULOGGER_DEBUG("%d keypoints removed, (kept %d), minimum response=%f", removed, keypoints.size(), kptsTmp.size()?kptsTmp.back().response:0.0f);
ULOGGER_DEBUG("%d keypoints removed, (kept %d), minimum response=%f", removed, (int)keypoints.size(), kptsTmp.size()?kptsTmp.back().response:0.0f);
ULOGGER_DEBUG("removing words time = %f s", timer.ticks());
keypoints = kptsTmp;
if(descriptors.rows)

View File

@@ -1033,7 +1033,7 @@ void Memory::clear()
_lastSignature?_lastSignature->id():0,
UProcessInfo::getMemoryUsage(),
_dbDriver->getMemoryUsed(),
_vwd->getVisualWords().size());
(int)_vwd->getVisualWords().size());
}
UDEBUG("");
@@ -2936,7 +2936,7 @@ int Memory::getNi(int signatureId) const
const Signature * s = this->getSignature(signatureId);
if(s)
{
ni = ((Signature *)s)->getWords().size();
ni = (int)((Signature *)s)->getWords().size();
}
else
{
@@ -3055,7 +3055,7 @@ Signature * Memory::createSignature(const SensorData & data, bool keepRawData, S
}
}
int treeSize= _workingMem.size() + _stMem.size();
int treeSize= int(_workingMem.size() + _stMem.size());
int meanWordsPerLocation = 0;
if(treeSize > 0)
{

View File

@@ -228,7 +228,7 @@ Transform OdometryBOW::computeTransform(const SensorData & data, int * quality,
const Signature * newSignature = _memory->getLastWorkingSignature();
if(newSignature)
{
nFeatures = newSignature->getWords().size();
nFeatures = (int)newSignature->getWords().size();
}
if(previousSignature && newSignature)
@@ -260,7 +260,7 @@ Transform OdometryBOW::computeTransform(const SensorData & data, int * quality,
if((int)inliers1->size() >= this->getMinInliers())
{
correspondences = inliers1->size();
correspondences = (int)inliers1->size();
// the transform returned is global odometry pose, not incremental one
std::vector<int> inliersV;
@@ -272,7 +272,7 @@ Transform OdometryBOW::computeTransform(const SensorData & data, int * quality,
this->getRefineIterations()>0, 3.0, this->getRefineIterations(),
&inliersV);
inliers = inliersV.size();
inliers = (int)inliersV.size();
if(!transform.isNull())
{
// make it incremental

View File

@@ -280,6 +280,15 @@ void Rtabmap::init(const std::string & configFile, const std::string & databaseP
void Rtabmap::close()
{
_retrievedId = 0;
_lcHypothesisValue = 0;
_lcHypothesisId = 0;
_lastProcessTime = 0.0;
_optimizedPoses.clear();
_constraints.clear();
_mapCorrection.setIdentity();
_mapTransform.setIdentity();
flushStatisticLogs();
if(_foutFloat)
{

View File

@@ -108,7 +108,7 @@ void Signature::addNeighbor(int neighbor, const Transform & transform)
void Signature::removeNeighbor(int neighborId)
{
int count = _neighbors.erase(neighborId);
int count = (int)_neighbors.erase(neighborId);
if(count)
{
_neighborsModified = true;
@@ -172,7 +172,7 @@ float Signature::compareTo(const Signature * s) const
if(words.size() != 0 && _words.size() != 0)
{
std::list<std::pair<int, std::pair<cv::KeyPoint, cv::KeyPoint> > > pairs;
int totalWords = _words.size()>words.size()?_words.size():words.size();
unsigned int totalWords = _words.size()>words.size()?_words.size():words.size();
EpipolarGeometry::findPairs(words, _words, pairs);
similarity = float(pairs.size()) / float(totalWords);
@@ -244,22 +244,7 @@ SensorData Signature::toSensorData()
void Signature::uncompressData()
{
if(_imageRaw.empty() && _image.size())
{
//uncompress data
util3d::CompressionThread ctImage(&_image, true);
util3d::CompressionThread ctDepth(&_depth, true);
util3d::CompressionThread ctDepth2D(&_depth2D, false);
ctImage.start();
ctDepth.start();
ctDepth2D.start();
ctImage.join();
ctDepth.join();
ctDepth2D.join();
_imageRaw = ctImage.getUncompressedData();
_depthRaw = ctDepth.getUncompressedData();
_depth2DRaw = ctDepth2D.getUncompressedData();
}
uncompressData(&_imageRaw, &_depthRaw, &_depth2DRaw);
}
void Signature::uncompressData(cv::Mat * image, cv::Mat * depth, cv::Mat * depth2D) const
@@ -298,15 +283,15 @@ void Signature::uncompressData(cv::Mat * image, cv::Mat * depth, cv::Mat * depth
ctImage.join();
ctDepth.join();
ctDepth2D.join();
if(image)
if(image && image->empty())
{
*image = ctImage.getUncompressedData();
}
if(depth)
if(depth && depth->empty())
{
*depth = ctDepth.getUncompressedData();
}
if(depth2D)
if(depth2D && depth2D->empty())
{
*depth2D = ctDepth2D.getUncompressedData();
}

View File

@@ -1443,7 +1443,7 @@ Transform transformFromXYZCorrespondences(
std::vector<int> target_indices (cloud1->size());
// Copy the query-match indices
for (size_t i = 0; i < cloud1->size(); ++i)
for (int i = 0; i < (int)cloud1->size(); ++i)
{
source_indices[i] = i;
target_indices[i] = i;
@@ -1486,8 +1486,8 @@ Transform transformFromXYZCorrespondences(
// Select the new inliers based on the optimized coefficients and new threshold
model->selectWithinDistance (new_model_coefficients, error_threshold, new_inliers);
UDEBUG("RANSAC refineModel: Number of inliers found (before/after): %zu/%zu, with an error threshold of %g.",
prev_inliers.size (), new_inliers.size (), error_threshold);
UDEBUG("RANSAC refineModel: Number of inliers found (before/after): %d/%d, with an error threshold of %f.",
(int)prev_inliers.size (), (int)new_inliers.size (), error_threshold);
if (new_inliers.empty ())
{
@@ -1503,7 +1503,7 @@ Transform transformFromXYZCorrespondences(
double variance = model->computeVariance ();
error_threshold = sqrt (std::min (inlier_distance_threshold_sqr, sigma_sqr * variance));
UDEBUG ("RANSAC refineModel: New estimated error threshold: %g on iteration %d out of %d.",
UDEBUG ("RANSAC refineModel: New estimated error threshold: %f on iteration %d out of %d.",
error_threshold, refine_iterations, refineModelIterations);
inlier_changed = false;
std::swap (prev_inliers, new_inliers);
@@ -1568,7 +1568,7 @@ Transform transformFromXYZCorrespondences(
bestTransformation.row (3) = model_coefficients.segment<4>(12);
transform = util3d::transformFromEigen4f(bestTransformation);
UDEBUG("RANSAC inliers=%zu/%zu tf=%s", inliers.size(), cloud1->size(), transform.prettyPrint().c_str());
UDEBUG("RANSAC inliers=%d/%d tf=%s", (int)inliers.size(), (int)cloud1->size(), transform.prettyPrint().c_str());
return transform.inverse(); // inverse to get actual pose transform (not correspondences transform)
}