summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Tracker_PT/point_extractor.cpp
diff options
context:
space:
mode:
authorPatrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb>2012-09-21 14:00:34 +0000
committerPatrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb>2012-09-21 14:00:34 +0000
commitab0d60becc2d1b89c812193c179892d6acd4912f (patch)
tree2dae7d2c10e1cc3a5bd73ee8ae2ee609c69a1b7b /FTNoIR_Tracker_PT/point_extractor.cpp
parentddc63cdda186fe31435fde839c3d5b68040a0d0f (diff)
RAII-style dll management 1: Replaced autoptr and release with virtual destructors
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@155 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Tracker_PT/point_extractor.cpp')
-rw-r--r--FTNoIR_Tracker_PT/point_extractor.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/FTNoIR_Tracker_PT/point_extractor.cpp b/FTNoIR_Tracker_PT/point_extractor.cpp
index a415f24e..b26f7068 100644
--- a/FTNoIR_Tracker_PT/point_extractor.cpp
+++ b/FTNoIR_Tracker_PT/point_extractor.cpp
@@ -66,44 +66,44 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr
}
//*/
- // Method 2: floodfill
- /*
- // extract blobs
- struct BlobInfo
- {
- BlobInfo() : m00(0), m10(0), m01(0) {}
- long m00;
- long m10;
- long m01;
- };
- vector<BlobInfo> blobs;
- int blob_count = 1;
-
- for (int y=0; y < frame_bw.rows; y++) {
- for (int x=0; x < frame_bw.cols; x++) {
- if (frame_bw.at<unsigned char>(y,x) != 255) continue;
- Rect rect;
- floodFill(frame_bw, Point(x,y), Scalar(blob_count), &rect, Scalar(0), Scalar(0), 4);
- BlobInfo blob;
- for (int i=rect.y; i < (rect.y+rect.height); i++) {
- for (int j=rect.x; j < (rect.x+rect.width); j++) {
- if (frame_bw.at<unsigned char>(i,j) != blob_count) continue;
- blob.m00++;
- blob.m01+=i;
- blob.m10+=j;
- }
- }
- blobs.push_back(blob);
- blob_count++;
- if (blob_count >= 255) break;
- }
- }
-
- // extract points
- Vec2f c;
- points.clear();
- float m00_min = 3.14*min_size*min_size;
- float m00_max = 3.14*max_size*max_size;
+ // Method 2: floodfill
+ /*
+ // extract blobs
+ struct BlobInfo
+ {
+ BlobInfo() : m00(0), m10(0), m01(0) {}
+ long m00;
+ long m10;
+ long m01;
+ };
+ vector<BlobInfo> blobs;
+ int blob_count = 1;
+
+ for (int y=0; y < frame_bw.rows; y++) {
+ for (int x=0; x < frame_bw.cols; x++) {
+ if (frame_bw.at<unsigned char>(y,x) != 255) continue;
+ Rect rect;
+ floodFill(frame_bw, Point(x,y), Scalar(blob_count), &rect, Scalar(0), Scalar(0), 4);
+ BlobInfo blob;
+ for (int i=rect.y; i < (rect.y+rect.height); i++) {
+ for (int j=rect.x; j < (rect.x+rect.width); j++) {
+ if (frame_bw.at<unsigned char>(i,j) != blob_count) continue;
+ blob.m00++;
+ blob.m01+=i;
+ blob.m10+=j;
+ }
+ }
+ blobs.push_back(blob);
+ blob_count++;
+ if (blob_count >= 255) break;
+ }
+ }
+
+ // extract points
+ Vec2f c;
+ points.clear();
+ float m00_min = 3.14*min_size*min_size;
+ float m00_max = 3.14*max_size*max_size;
for (vector<BlobInfo>::iterator iter = blobs.begin();
iter!= blobs.end();
++iter)
@@ -114,8 +114,8 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr
c[0] = (m.m10/float(m.m00) - frame.cols/2)/frame.cols;
c[1] = -(m.m01/float(m.m00) - frame.rows/2)/frame.cols;
points.push_back(c);
- }
- */
+ }
+ */
// draw output image
if (draw_output)