mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
GUI/Source: color only option now also available for stereo cameras (meaning only left frame published). Db: fixed non-valid 3d words saved when no ones were in the signature (on loading, we don't set words3 if they are all null).
This commit is contained in:
@@ -189,9 +189,16 @@ void CameraThread::postUpdate(SensorData * dataPtr, CameraInfo * info) const
|
||||
{
|
||||
UASSERT(dataPtr!=0);
|
||||
SensorData & data = *dataPtr;
|
||||
if(_colorOnly && !data.depthRaw().empty())
|
||||
if(_colorOnly)
|
||||
{
|
||||
data.setRGBDImage(data.imageRaw(), cv::Mat(), data.cameraModels());
|
||||
if(!data.depthRaw().empty())
|
||||
{
|
||||
data.setRGBDImage(data.imageRaw(), cv::Mat(), data.cameraModels());
|
||||
}
|
||||
else if(!data.rightRaw().empty())
|
||||
{
|
||||
data.setRGBDImage(data.imageRaw(), cv::Mat(), data.stereoCameraModel().left());
|
||||
}
|
||||
}
|
||||
|
||||
if(_distortionModel && !data.depthRaw().empty())
|
||||
|
||||
@@ -3080,6 +3080,7 @@ void DBDriverSqlite3::loadSignaturesQuery(const std::list<int> & ids, std::list<
|
||||
std::multimap<int, cv::KeyPoint> visualWords;
|
||||
std::multimap<int, cv::Point3f> visualWords3;
|
||||
std::multimap<int, cv::Mat> descriptors;
|
||||
bool allWords3NaN = true;
|
||||
cv::Point3f depth(0,0,0);
|
||||
|
||||
// Process the result if one
|
||||
@@ -3131,6 +3132,11 @@ void DBDriverSqlite3::loadSignaturesQuery(const std::list<int> & ids, std::list<
|
||||
visualWords.insert(visualWords.end(), std::make_pair(visualWordId, kpt));
|
||||
visualWords3.insert(visualWords3.end(), std::make_pair(visualWordId, depth));
|
||||
|
||||
if(allWords3NaN && util3d::isFinite(depth))
|
||||
{
|
||||
allWords3NaN = false;
|
||||
}
|
||||
|
||||
if(uStrNumCmp(_version, "0.11.2") >= 0)
|
||||
{
|
||||
descriptorSize = sqlite3_column_int(ppStmt, index++); // VisualWord descriptor size
|
||||
@@ -3172,9 +3178,12 @@ void DBDriverSqlite3::loadSignaturesQuery(const std::list<int> & ids, std::list<
|
||||
else
|
||||
{
|
||||
(*iter)->setWords(visualWords);
|
||||
(*iter)->setWords3(visualWords3);
|
||||
if(!allWords3NaN)
|
||||
{
|
||||
(*iter)->setWords3(visualWords3);
|
||||
}
|
||||
(*iter)->setWordsDescriptors(descriptors);
|
||||
ULOGGER_DEBUG("Add %d keypoints, %d 3d points and %d descriptors to node %d", (int)visualWords.size(), (int)visualWords3.size(), (int)descriptors.size(), (*iter)->id());
|
||||
ULOGGER_DEBUG("Add %d keypoints, %d 3d points and %d descriptors to node %d", (int)visualWords.size(), allWords3NaN?0:(int)visualWords3.size(), (int)descriptors.size(), (*iter)->id());
|
||||
}
|
||||
|
||||
//reset
|
||||
@@ -4191,6 +4200,7 @@ void DBDriverSqlite3::saveQuery(const std::list<Signature *> & signatures)
|
||||
query = queryStepKeypoint();
|
||||
rc = sqlite3_prepare_v2(_ppDb, query.c_str(), -1, &ppStmt, 0);
|
||||
UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error (%s): %s", _version.c_str(), sqlite3_errmsg(_ppDb)).c_str());
|
||||
float nanFloat = std::numeric_limits<float>::quiet_NaN ();
|
||||
for(std::list<Signature *>::const_iterator i=signatures.begin(); i!=signatures.end(); ++i)
|
||||
{
|
||||
UASSERT((*i)->getWords3().empty() || (*i)->getWords().size() == (*i)->getWords3().size());
|
||||
@@ -4200,7 +4210,7 @@ void DBDriverSqlite3::saveQuery(const std::list<Signature *> & signatures)
|
||||
std::multimap<int, cv::Mat>::const_iterator d=(*i)->getWordsDescriptors().begin();
|
||||
for(std::multimap<int, cv::KeyPoint>::const_iterator w=(*i)->getWords().begin(); w!=(*i)->getWords().end(); ++w)
|
||||
{
|
||||
cv::Point3f pt(0,0,0);
|
||||
cv::Point3f pt(nanFloat,nanFloat,nanFloat);
|
||||
if(p!=(*i)->getWords3().end())
|
||||
{
|
||||
UASSERT(w->first == p->first); // must be same id!
|
||||
|
||||
Reference in New Issue
Block a user