Updated signal objectsFound() to send the object rect and full homography
git-svn-id: http://find-object.googlecode.com/svn/trunk/find_object@62 620bd6b2-0a58-f614-fd9a-1bd335dccda9
This commit is contained in:
parent
095aa8a1e9
commit
03341c215d
@ -400,7 +400,7 @@ void MainWindow::update(const cv::Mat & image)
|
||||
std::vector<cv::Point2f> mpts_1, mpts_2;
|
||||
std::vector<int> indexes_1, indexes_2;
|
||||
std::vector<uchar> outlier_mask;
|
||||
QMap<int, QPoint> objectsPos;
|
||||
QMap<int, QPair<QRect, QTransform> > objectsDetected;
|
||||
float minMatchedDistance = -1.0f;
|
||||
float maxMatchedDistance = -1.0f;
|
||||
for(int i=0; i<dataTree_.rows; ++i)
|
||||
@ -500,9 +500,11 @@ void MainWindow::update(const cv::Mat & image)
|
||||
|
||||
// find center of object
|
||||
QRect rect = objects_.at(j)->image().rect();
|
||||
QPoint pos(rect.width()/2, rect.height()/2);
|
||||
objectsPos.insert(objects_.at(j)->id(), hTransform.map(pos));
|
||||
|
||||
objectsDetected.insert(objects_.at(j)->id(), QPair<QRect, QTransform>(rect, hTransform));
|
||||
// Example getting the center of the object in the scene using the homography
|
||||
//QPoint pos(rect.width()/2, rect.height()/2);
|
||||
//hTransform.map(pos)
|
||||
|
||||
// add rectangle
|
||||
if(this->isVisible())
|
||||
{
|
||||
@ -535,9 +537,9 @@ void MainWindow::update(const cv::Mat & image)
|
||||
ui_->label_minMatchedDistance->setNum(minMatchedDistance);
|
||||
ui_->label_maxMatchedDistance->setNum(maxMatchedDistance);
|
||||
|
||||
if(objectsPos.size())
|
||||
if(objectsDetected.size())
|
||||
{
|
||||
emit objectsFound(objectsPos);
|
||||
emit objectsFound(objectsDetected);
|
||||
}
|
||||
}
|
||||
else if(this->isVisible())
|
||||
|
||||
@ -49,7 +49,7 @@ private slots:
|
||||
void update(const cv::Mat & image);
|
||||
|
||||
signals:
|
||||
void objectsFound(const QMap<int, QPoint> &);
|
||||
void objectsFound(const QMap<int, QPair<QRect, QTransform> > &);
|
||||
|
||||
private:
|
||||
void showObject(ObjWidget * obj);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user