fixed Debug build errors, changed all Q_ASSERT to UASSERT
git-svn-id: http://find-object.googlecode.com/svn/trunk/find_object@417 620bd6b2-0a58-f614-fd9a-1bd335dccda9
This commit is contained in:
parent
c879fae867
commit
84166e6ddc
@ -58,7 +58,7 @@ AddObjectDialog::AddObjectDialog(Camera * camera, const cv::Mat & image, bool mi
|
|||||||
|
|
||||||
detector_ = Settings::createKeypointDetector();
|
detector_ = Settings::createKeypointDetector();
|
||||||
extractor_ = Settings::createDescriptorExtractor();
|
extractor_ = Settings::createDescriptorExtractor();
|
||||||
Q_ASSERT(detector_ != 0 && extractor_ != 0);
|
UASSERT(detector_ != 0 && extractor_ != 0);
|
||||||
|
|
||||||
connect(ui_->pushButton_cancel, SIGNAL(clicked()), this, SLOT(cancel()));
|
connect(ui_->pushButton_cancel, SIGNAL(clicked()), this, SLOT(cancel()));
|
||||||
connect(ui_->pushButton_back, SIGNAL(clicked()), this, SLOT(back()));
|
connect(ui_->pushButton_back, SIGNAL(clicked()), this, SLOT(back()));
|
||||||
|
|||||||
@ -49,7 +49,7 @@ FindObject::FindObject(QObject * parent) :
|
|||||||
extractor_(Settings::createDescriptorExtractor())
|
extractor_(Settings::createDescriptorExtractor())
|
||||||
{
|
{
|
||||||
qRegisterMetaType<find_object::DetectionInfo>("find_object::DetectionInfo");
|
qRegisterMetaType<find_object::DetectionInfo>("find_object::DetectionInfo");
|
||||||
Q_ASSERT(detector_ != 0 && extractor_ != 0);
|
UASSERT(detector_ != 0 && extractor_ != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
FindObject::~FindObject() {
|
FindObject::~FindObject() {
|
||||||
@ -117,7 +117,7 @@ const ObjSignature * FindObject::addObject(const QString & filePath)
|
|||||||
|
|
||||||
const ObjSignature * FindObject::addObject(const cv::Mat & image, int id, const QString & filename)
|
const ObjSignature * FindObject::addObject(const cv::Mat & image, int id, const QString & filename)
|
||||||
{
|
{
|
||||||
Q_ASSERT(id >= 0);
|
UASSERT(id >= 0);
|
||||||
ObjSignature * s = new ObjSignature(id, image, filename);
|
ObjSignature * s = new ObjSignature(id, image, filename);
|
||||||
if(!this->addObject(s))
|
if(!this->addObject(s))
|
||||||
{
|
{
|
||||||
@ -129,7 +129,7 @@ const ObjSignature * FindObject::addObject(const cv::Mat & image, int id, const
|
|||||||
|
|
||||||
bool FindObject::addObject(ObjSignature * obj)
|
bool FindObject::addObject(ObjSignature * obj)
|
||||||
{
|
{
|
||||||
Q_ASSERT(obj != 0 && obj->id() >= 0);
|
UASSERT(obj != 0 && obj->id() >= 0);
|
||||||
if(obj->id() && objects_.contains(obj->id()))
|
if(obj->id() && objects_.contains(obj->id()))
|
||||||
{
|
{
|
||||||
UERROR("object with id %d already added!", obj->id());
|
UERROR("object with id %d already added!", obj->id());
|
||||||
@ -171,7 +171,7 @@ void FindObject::updateDetectorExtractor()
|
|||||||
delete extractor_;
|
delete extractor_;
|
||||||
detector_ = Settings::createKeypointDetector();
|
detector_ = Settings::createKeypointDetector();
|
||||||
extractor_ = Settings::createDescriptorExtractor();
|
extractor_ = Settings::createDescriptorExtractor();
|
||||||
Q_ASSERT(detector_ != 0 && extractor_ != 0);
|
UASSERT(detector_ != 0 && extractor_ != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<cv::KeyPoint> limitKeypoints(const std::vector<cv::KeyPoint> & keypoints, int maxKeypoints)
|
std::vector<cv::KeyPoint> limitKeypoints(const std::vector<cv::KeyPoint> & keypoints, int maxKeypoints)
|
||||||
@ -664,7 +664,7 @@ public:
|
|||||||
minMatchedDistance_(-1.0f),
|
minMatchedDistance_(-1.0f),
|
||||||
maxMatchedDistance_(-1.0f)
|
maxMatchedDistance_(-1.0f)
|
||||||
{
|
{
|
||||||
Q_ASSERT(index && descriptors);
|
UASSERT(descriptors);
|
||||||
}
|
}
|
||||||
virtual ~SearchThread() {}
|
virtual ~SearchThread() {}
|
||||||
|
|
||||||
@ -760,7 +760,7 @@ public:
|
|||||||
kptsB_(kptsB),
|
kptsB_(kptsB),
|
||||||
code_(DetectionInfo::kRejectedUndef)
|
code_(DetectionInfo::kRejectedUndef)
|
||||||
{
|
{
|
||||||
Q_ASSERT(matches && kptsA && kptsB);
|
UASSERT(matches && kptsA && kptsB);
|
||||||
}
|
}
|
||||||
virtual ~HomographyThread() {}
|
virtual ~HomographyThread() {}
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,7 @@ MainWindow::MainWindow(FindObject * findObject, Camera * camera, QWidget * paren
|
|||||||
objectsModified_(false),
|
objectsModified_(false),
|
||||||
tcpServer_(0)
|
tcpServer_(0)
|
||||||
{
|
{
|
||||||
Q_ASSERT(findObject_ != 0);
|
UASSERT(findObject_ != 0);
|
||||||
|
|
||||||
ui_ = new Ui_mainWindow();
|
ui_ = new Ui_mainWindow();
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
@ -565,7 +565,7 @@ void MainWindow::addObjectFromScene()
|
|||||||
ObjWidget * obj = 0;
|
ObjWidget * obj = 0;
|
||||||
ObjSignature * signature = 0;
|
ObjSignature * signature = 0;
|
||||||
dialog->retrieveObject(&obj, &signature);
|
dialog->retrieveObject(&obj, &signature);
|
||||||
Q_ASSERT(obj!=0 && signature!=0);
|
UASSERT(obj!=0 && signature!=0);
|
||||||
findObject_->addObject(signature);
|
findObject_->addObject(signature);
|
||||||
obj->setId(signature->id());
|
obj->setId(signature->id());
|
||||||
objWidgets_.insert(obj->id(), obj);
|
objWidgets_.insert(obj->id(), obj);
|
||||||
@ -1028,7 +1028,7 @@ void MainWindow::update(const cv::Mat & image)
|
|||||||
label->setText(QString("%1 matches").arg(jter.value().size()));
|
label->setText(QString("%1 matches").arg(jter.value().size()));
|
||||||
|
|
||||||
ObjWidget * obj = objWidgets_.value(id);
|
ObjWidget * obj = objWidgets_.value(id);
|
||||||
Q_ASSERT(obj != 0);
|
UASSERT(obj != 0);
|
||||||
|
|
||||||
for(QMultiMap<int, int>::const_iterator iter = jter.value().constBegin(); iter!= jter.value().constEnd(); ++iter)
|
for(QMultiMap<int, int>::const_iterator iter = jter.value().constBegin(); iter!= jter.value().constEnd(); ++iter)
|
||||||
{
|
{
|
||||||
@ -1084,7 +1084,7 @@ void MainWindow::update(const cv::Mat & image)
|
|||||||
{
|
{
|
||||||
int id = iter.key();
|
int id = iter.key();
|
||||||
ObjWidget * obj = objWidgets_.value(id);
|
ObjWidget * obj = objWidgets_.value(id);
|
||||||
Q_ASSERT(obj != 0);
|
UASSERT(obj != 0);
|
||||||
|
|
||||||
// COLORIZE (should be done in the GUI thread)
|
// COLORIZE (should be done in the GUI thread)
|
||||||
QTransform hTransform = iter.value();
|
QTransform hTransform = iter.value();
|
||||||
|
|||||||
@ -332,7 +332,7 @@ public:
|
|||||||
descriptors = cv::Mat();
|
descriptors = cv::Mat();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Q_ASSERT(descriptorsGPU.type() == CV_32F);
|
UASSERT(descriptorsGPU.type() == CV_32F);
|
||||||
descriptors = cv::Mat(descriptorsGPU.size(), CV_32F);
|
descriptors = cv::Mat(descriptorsGPU.size(), CV_32F);
|
||||||
descriptorsGPU.download(descriptors);
|
descriptorsGPU.download(descriptors);
|
||||||
}
|
}
|
||||||
@ -444,7 +444,7 @@ protected:
|
|||||||
descriptors = cv::Mat();
|
descriptors = cv::Mat();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Q_ASSERT(descriptorsGPU.type() == CV_8U);
|
UASSERT(descriptorsGPU.type() == CV_8U);
|
||||||
descriptors = cv::Mat(descriptorsGPU.size(), CV_8U);
|
descriptors = cv::Mat(descriptorsGPU.size(), CV_8U);
|
||||||
descriptorsGPU.download(descriptors);
|
descriptorsGPU.download(descriptors);
|
||||||
}
|
}
|
||||||
@ -626,7 +626,7 @@ KeypointDetector * Settings::createKeypointDetector()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_ASSERT(detectorGPU!=0 || detector!=0);
|
UASSERT(detectorGPU!=0 || detector!=0);
|
||||||
if(detectorGPU)
|
if(detectorGPU)
|
||||||
{
|
{
|
||||||
return new KeypointDetector(detectorGPU);
|
return new KeypointDetector(detectorGPU);
|
||||||
@ -760,7 +760,7 @@ DescriptorExtractor * Settings::createDescriptorExtractor()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_ASSERT(extractorGPU!=0 || extractor!=0);
|
UASSERT(extractorGPU!=0 || extractor!=0);
|
||||||
if(extractorGPU)
|
if(extractorGPU)
|
||||||
{
|
{
|
||||||
return new DescriptorExtractor(extractorGPU);
|
return new DescriptorExtractor(extractorGPU);
|
||||||
@ -987,13 +987,13 @@ KeypointDetector::KeypointDetector(cv::FeatureDetector * featureDetector) :
|
|||||||
featureDetector_(featureDetector),
|
featureDetector_(featureDetector),
|
||||||
gpuFeature2D_(0)
|
gpuFeature2D_(0)
|
||||||
{
|
{
|
||||||
Q_ASSERT(featureDetector_!=0);
|
UASSERT(featureDetector_!=0);
|
||||||
}
|
}
|
||||||
KeypointDetector::KeypointDetector(GPUFeature2D * gpuFeature2D) :
|
KeypointDetector::KeypointDetector(GPUFeature2D * gpuFeature2D) :
|
||||||
featureDetector_(0),
|
featureDetector_(0),
|
||||||
gpuFeature2D_(gpuFeature2D)
|
gpuFeature2D_(gpuFeature2D)
|
||||||
{
|
{
|
||||||
Q_ASSERT(gpuFeature2D_!=0);
|
UASSERT(gpuFeature2D_!=0);
|
||||||
}
|
}
|
||||||
void KeypointDetector::detect(const cv::Mat & image,
|
void KeypointDetector::detect(const cv::Mat & image,
|
||||||
std::vector<cv::KeyPoint> & keypoints,
|
std::vector<cv::KeyPoint> & keypoints,
|
||||||
@ -1013,13 +1013,13 @@ DescriptorExtractor::DescriptorExtractor(cv::DescriptorExtractor * descriptorExt
|
|||||||
descriptorExtractor_(descriptorExtractor),
|
descriptorExtractor_(descriptorExtractor),
|
||||||
gpuFeature2D_(0)
|
gpuFeature2D_(0)
|
||||||
{
|
{
|
||||||
Q_ASSERT(descriptorExtractor_!=0);
|
UASSERT(descriptorExtractor_!=0);
|
||||||
}
|
}
|
||||||
DescriptorExtractor::DescriptorExtractor(GPUFeature2D * gpuFeature2D) :
|
DescriptorExtractor::DescriptorExtractor(GPUFeature2D * gpuFeature2D) :
|
||||||
descriptorExtractor_(0),
|
descriptorExtractor_(0),
|
||||||
gpuFeature2D_(gpuFeature2D)
|
gpuFeature2D_(gpuFeature2D)
|
||||||
{
|
{
|
||||||
Q_ASSERT(gpuFeature2D_!=0);
|
UASSERT(gpuFeature2D_!=0);
|
||||||
}
|
}
|
||||||
void DescriptorExtractor::compute(const cv::Mat & image,
|
void DescriptorExtractor::compute(const cv::Mat & image,
|
||||||
std::vector<cv::KeyPoint> & keypoints,
|
std::vector<cv::KeyPoint> & keypoints,
|
||||||
|
|||||||
@ -27,6 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "find_object/Settings.h"
|
#include "find_object/Settings.h"
|
||||||
|
|
||||||
|
#include "find_object/utilite/ULogger.h"
|
||||||
#include "Vocabulary.h"
|
#include "Vocabulary.h"
|
||||||
#include <QtCore/QVector>
|
#include <QtCore/QVector>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -67,7 +68,7 @@ QMultiMap<int, int> Vocabulary::addWords(const cv::Mat & descriptors, int object
|
|||||||
bool globalSearch = false;
|
bool globalSearch = false;
|
||||||
if(!indexedDescriptors_.empty() && indexedDescriptors_.rows >= (int)k)
|
if(!indexedDescriptors_.empty() && indexedDescriptors_.rows >= (int)k)
|
||||||
{
|
{
|
||||||
Q_ASSERT(indexedDescriptors_.type() == descriptors.type() && indexedDescriptors_.cols == descriptors.cols);
|
UASSERT(indexedDescriptors_.type() == descriptors.type() && indexedDescriptors_.cols == descriptors.cols);
|
||||||
this->search(descriptors, results, dists, k);
|
this->search(descriptors, results, dists, k);
|
||||||
|
|
||||||
if( dists.type() == CV_32S )
|
if( dists.type() == CV_32S )
|
||||||
@ -88,7 +89,7 @@ QMultiMap<int, int> Vocabulary::addWords(const cv::Mat & descriptors, int object
|
|||||||
QMultiMap<float, int> fullResults; // nearest descriptors sorted by distance
|
QMultiMap<float, int> fullResults; // nearest descriptors sorted by distance
|
||||||
if(notIndexedDescriptors_.rows)
|
if(notIndexedDescriptors_.rows)
|
||||||
{
|
{
|
||||||
Q_ASSERT(newWords.type() == descriptors.type() && newWords.cols == descriptors.cols);
|
UASSERT(notIndexedDescriptors_.type() == descriptors.type() && notIndexedDescriptors_.cols == descriptors.cols);
|
||||||
|
|
||||||
// Check if this descriptor matches with a word not already added to the vocabulary
|
// Check if this descriptor matches with a word not already added to the vocabulary
|
||||||
// Do linear search only
|
// Do linear search only
|
||||||
@ -198,8 +199,11 @@ void Vocabulary::update()
|
|||||||
{
|
{
|
||||||
if(!notIndexedDescriptors_.empty())
|
if(!notIndexedDescriptors_.empty())
|
||||||
{
|
{
|
||||||
Q_ASSERT(indexedDescriptors_.cols == notIndexedDescriptors_.cols &&
|
if(!indexedDescriptors_.empty())
|
||||||
indexedDescriptors_.type() == notIndexedDescriptors_.type() );
|
{
|
||||||
|
UASSERT(indexedDescriptors_.cols == notIndexedDescriptors_.cols &&
|
||||||
|
indexedDescriptors_.type() == notIndexedDescriptors_.type() );
|
||||||
|
}
|
||||||
|
|
||||||
//concatenate descriptors
|
//concatenate descriptors
|
||||||
indexedDescriptors_.push_back(notIndexedDescriptors_);
|
indexedDescriptors_.push_back(notIndexedDescriptors_);
|
||||||
@ -218,11 +222,9 @@ void Vocabulary::update()
|
|||||||
|
|
||||||
void Vocabulary::search(const cv::Mat & descriptors, cv::Mat & results, cv::Mat & dists, int k)
|
void Vocabulary::search(const cv::Mat & descriptors, cv::Mat & results, cv::Mat & dists, int k)
|
||||||
{
|
{
|
||||||
Q_ASSERT(notIndexedDescriptors_.empty() && notIndexedWordIds_.size() == 0);
|
|
||||||
|
|
||||||
if(!indexedDescriptors_.empty())
|
if(!indexedDescriptors_.empty())
|
||||||
{
|
{
|
||||||
Q_ASSERT(descriptors.type() == indexedDescriptors_.type() && descriptors.cols == indexedDescriptors_.cols);
|
UASSERT(descriptors.type() == indexedDescriptors_.type() && descriptors.cols == indexedDescriptors_.cols);
|
||||||
|
|
||||||
if(Settings::isBruteForceNearestNeighbor())
|
if(Settings::isBruteForceNearestNeighbor())
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user