Added homographyComputed parameter
git-svn-id: http://find-object.googlecode.com/svn/trunk/find_object@63 620bd6b2-0a58-f614-fd9a-1bd335dccda9
This commit is contained in:
parent
03341c215d
commit
921206332c
@ -405,6 +405,8 @@ void MainWindow::update(const cv::Mat & image)
|
|||||||
float maxMatchedDistance = -1.0f;
|
float maxMatchedDistance = -1.0f;
|
||||||
for(int i=0; i<dataTree_.rows; ++i)
|
for(int i=0; i<dataTree_.rows; ++i)
|
||||||
{
|
{
|
||||||
|
QColor color((Qt::GlobalColor)(j % 12 + 7 ));
|
||||||
|
color.setAlpha(alpha);
|
||||||
bool matched = false;
|
bool matched = false;
|
||||||
// Check if this descriptor matches with those of the objects
|
// Check if this descriptor matches with those of the objects
|
||||||
if(Settings::getNearestNeighbor_nndrRatioUsed() &&
|
if(Settings::getNearestNeighbor_nndrRatioUsed() &&
|
||||||
@ -447,11 +449,20 @@ void MainWindow::update(const cv::Mat & image)
|
|||||||
}
|
}
|
||||||
mpts_2.push_back(keypoints.at(results.at<int>(i,0)).pt);
|
mpts_2.push_back(keypoints.at(results.at<int>(i,0)).pt);
|
||||||
indexes_2.push_back(results.at<int>(i,0));
|
indexes_2.push_back(results.at<int>(i,0));
|
||||||
|
|
||||||
|
// colorize all matched if homography is not computed
|
||||||
|
if(!Settings::getHomography_homographyComputed())
|
||||||
|
{
|
||||||
|
objects_.at(j)->setKptColor(indexes_1.back(), color);
|
||||||
|
ui_->imageView_source->setKptColor(results.at<int>(i,0), color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i+1 >= dataRange_.at(j))
|
if(i+1 >= dataRange_.at(j))
|
||||||
{
|
{
|
||||||
QLabel * label = ui_->dockWidget_objects->findChild<QLabel*>(QString("%1detection").arg(objects_.at(j)->id()));
|
QLabel * label = ui_->dockWidget_objects->findChild<QLabel*>(QString("%1detection").arg(objects_.at(j)->id()));
|
||||||
|
if(Settings::getHomography_homographyComputed())
|
||||||
|
{
|
||||||
if(mpts_1.size() >= Settings::getHomography_minimumInliers())
|
if(mpts_1.size() >= Settings::getHomography_minimumInliers())
|
||||||
{
|
{
|
||||||
cv::Mat H = findHomography(mpts_1,
|
cv::Mat H = findHomography(mpts_1,
|
||||||
@ -460,8 +471,6 @@ void MainWindow::update(const cv::Mat & image)
|
|||||||
Settings::getHomography_ransacReprojThr(),
|
Settings::getHomography_ransacReprojThr(),
|
||||||
outlier_mask);
|
outlier_mask);
|
||||||
uint inliers=0, outliers=0;
|
uint inliers=0, outliers=0;
|
||||||
QColor color((Qt::GlobalColor)(j % 12 + 7 ));
|
|
||||||
color.setAlpha(alpha);
|
|
||||||
for(unsigned int k=0; k<mpts_1.size();++k)
|
for(unsigned int k=0; k<mpts_1.size();++k)
|
||||||
{
|
{
|
||||||
if(outlier_mask.at(k))
|
if(outlier_mask.at(k))
|
||||||
@ -526,6 +535,11 @@ void MainWindow::update(const cv::Mat & image)
|
|||||||
{
|
{
|
||||||
label->setText(QString("Too low matches (%1)").arg(mpts_1.size()));
|
label->setText(QString("Too low matches (%1)").arg(mpts_1.size()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label->setText(QString("%1 matches").arg(mpts_1.size()));
|
||||||
|
}
|
||||||
mpts_1.clear();
|
mpts_1.clear();
|
||||||
mpts_2.clear();
|
mpts_2.clear();
|
||||||
indexes_1.clear();
|
indexes_1.clear();
|
||||||
|
|||||||
@ -126,6 +126,7 @@ class Settings
|
|||||||
|
|
||||||
PARAMETER(General, nextObjID, uint, 1);
|
PARAMETER(General, nextObjID, uint, 1);
|
||||||
|
|
||||||
|
PARAMETER(Homography, homographyComputed, bool, true);
|
||||||
PARAMETER(Homography, ransacReprojThr, double, 1.0);
|
PARAMETER(Homography, ransacReprojThr, double, 1.0);
|
||||||
PARAMETER(Homography, minimumInliers, uint, 10);
|
PARAMETER(Homography, minimumInliers, uint, 10);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user