diff options
author | Patrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb> | 2012-12-31 12:33:18 +0000 |
---|---|---|
committer | Patrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb> | 2012-12-31 12:33:18 +0000 |
commit | 4c95700fc6848d46a33b565df7eb81ada2b32987 (patch) | |
tree | a0f13e7a70f2e22516b9fae6177e7e8b7af269fe /FTNoIR_Tracker_PT/point_extractor.cpp | |
parent | 977f25772f449e79089059820453bb7499ff4d35 (diff) |
Updated PointTracker
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@200 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Tracker_PT/point_extractor.cpp')
-rw-r--r-- | FTNoIR_Tracker_PT/point_extractor.cpp | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/FTNoIR_Tracker_PT/point_extractor.cpp b/FTNoIR_Tracker_PT/point_extractor.cpp index b26f7068..4aa1a658 100644 --- a/FTNoIR_Tracker_PT/point_extractor.cpp +++ b/FTNoIR_Tracker_PT/point_extractor.cpp @@ -6,7 +6,6 @@ */
#include "point_extractor.h"
-
#include <QDebug>
using namespace cv;
@@ -39,36 +38,7 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr //erode(frame_bw, frame_bw, Mat(), Point(-1,-1), min_size); //destroys information -> bad for subpixel accurarcy
// find connected components...
- // Method 1: contours
- //*
- // find contours
- vector< vector<Point> > contours;
- findContours(frame_bw.clone(), contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
-
- // extract points
- // TODO: use proximity to old points for classification
- float r;
- Vec2f c;
- Point2f dummy;
- points.clear();
- for (vector< vector<Point> >::iterator iter = contours.begin();
- iter!= contours.end();
- ++iter)
- {
- minEnclosingCircle(*iter, dummy, r);
- if (r > max_size) continue;
- Moments m = moments(*iter);
- if (m.m00 < 3.14*min_size*min_size) continue;
- // convert to centered camera coordinate system with y axis upwards
- c[0] = (m.m10/m.m00 - frame.cols/2)/frame.cols;
- c[1] = -(m.m01/m.m00 - frame.rows/2)/frame.cols;
- points.push_back(c);
- }
- //*/
-
- // Method 2: floodfill
- /*
- // extract blobs
+ // extract blobs with floodfill
struct BlobInfo
{
BlobInfo() : m00(0), m10(0), m01(0) {}
@@ -97,6 +67,7 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr blob_count++;
if (blob_count >= 255) break;
}
+ if (blob_count >= 255) break;
}
// extract points
@@ -115,7 +86,6 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr c[1] = -(m.m01/float(m.m00) - frame.rows/2)/frame.cols;
points.push_back(c);
}
- */
// draw output image
if (draw_output)
|