aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Villeret <avilleret@users.sourceforge.net>2014-07-13 13:58:17 +0000
committerAntoine Villeret <avilleret@users.sourceforge.net>2014-07-13 13:58:17 +0000
commitf8fceccb7fecde32923dbe46693e99ee09b89525 (patch)
tree99a39159bac6897b3c1f39b46b6b4109da2f266e
parentc22214a573a75feddb2c38857d155c5b54b77b19 (diff)
fix build on MacOSX
improve help patch (contours) svn path=/trunk/externals/pix_opencv/; revision=17329
-rw-r--r--configure.ac19
l---------help/model1
-rw-r--r--help/pix_opencv_contours-help.pd864
-rw-r--r--src/Makefile.am5
-rw-r--r--src/pix_opencv_clahe.cc4
-rw-r--r--src/pix_opencv_clahe.h2
-rw-r--r--src/pix_opencv_contours.cc71
-rw-r--r--src/pix_opencv_contours.h1
8 files changed, 413 insertions, 554 deletions
diff --git a/configure.ac b/configure.ac
index 513109f..706f484 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,6 +11,9 @@ AC_SUBST(PD_CPPFLAGS)
AC_SUBST(PD_LDFLAGS)
AC_SUBST(GEM_CPPFLAGS)
AC_SUBST(GEM_LDFLAGS)
+AC_SUBST(OPENCV_CFLAGS)
+AC_SUBST(OPENCV_LDFLAGS)
+AC_SUBST(OPENCV_LIBS)
AC_SUBST(FACETRACKER_CPPFLAGS)
AC_SUBST(FACETRACKER_LDFLAGS)
AC_SUBST(EXTENSION)
@@ -149,17 +152,19 @@ else
fi
AC_MSG_RESULT([$EXTENSION])
-AC_CHECK_LIB([opencv_core], [error],,[AC_MSG_ERROR([[please install libopencv_core and try again]])])
-AC_CHECK_LIB([opencv_imgproc], [cvCvtColor],,[AC_MSG_ERROR([[please install libopencv_imgproc and try again]])])
-AC_CHECK_LIB([opencv_legacy], [_Z38cvCreateModuleBlobTrackAnalysisHistPVSv],,[AC_MSG_ERROR([[please install libopencv_legacy and try again]])])
+
+PKG_CHECK_EXISTS([opencv >= 2.4],[AC_DEFINE([HAVE_BGSUB],[1], [Define if opencv version >= 2.4])]);
+PKG_CHECK_EXISTS([opencv >= 2.4.5],[AC_DEFINE([HAVE_CLAHE],[1], [Define if opencv version >= 2.4.5])]);
+
+AC_CHECK_LIB([opencv_core], [error],,[PKG_CHECK_MODULES([OPENCV],[opencv > 2.0],,[AC_MSG_RESULT(["warning ! can't find OpenCV !"])])])
+AC_CHECK_LIB([opencv_imgproc], [cvCvtColor],,)
+AC_CHECK_LIB([opencv_legacy], [_Z38cvCreateModuleBlobTrackAnalysisHistPVSv],,)
AC_CHECK_LIB([opencv_objdetect], [cvHaarDetectObjects],,)
AC_CHECK_LIB([opencv_ml], [_ZN10CvKNearestC1EPK5CvMatS2_S2_bi],,)
AC_CHECK_LIB([opencv_ocl], [_init],,)
-AC_CHECK_LIB([opencv_calib3d], [cvFindChessboardCorners],,[AC_MSG_ERROR([[please install libopencv_calib3d and try again]])])
-AC_CHECK_LIB([opencv_video], [_ZTSN2cv20BackgroundSubtractorE],,[AC_MSG_ERROR([[please install libopencv_video and try again]])])
+AC_CHECK_LIB([opencv_calib3d], [cvFindChessboardCorners],,)
+AC_CHECK_LIB([opencv_video], [_ZTSN2cv20BackgroundSubtractorE],,)
AC_CHECK_LIB([opencv_nonfree],[_ZN2cv18initModule_nonfreeEv],,)
-PKG_CHECK_EXISTS([opencv >= 2.4],[AC_DEFINE([HAVE_BGSUB],[1], [Define if opencv version >= 2.4])]);
-PKG_CHECK_EXISTS([opencv >= 2.4.5],[AC_DEFINE([HAVE_CLAHE],[1], [Define if opencv version >= 2.4.5])]);
AC_OUTPUT(Makefile src/Makefile)
diff --git a/help/model b/help/model
deleted file mode 120000
index bce1528..0000000
--- a/help/model
+++ /dev/null
@@ -1 +0,0 @@
-../model/ \ No newline at end of file
diff --git a/help/pix_opencv_contours-help.pd b/help/pix_opencv_contours-help.pd
index f14f0f8..0abf6a7 100644
--- a/help/pix_opencv_contours-help.pd
+++ b/help/pix_opencv_contours-help.pd
@@ -1,4 +1,4 @@
-#N canvas 849 245 794 766 10;
+#N canvas 408 133 794 766 10;
#X declare -lib pix_opencv;
#X obj 472 35 cnv 15 300 500 empty empty empty 20 12 0 14 -228992 -66577
0;
@@ -48,7 +48,6 @@
#X text 37 75 [pix_opencv_contours] finds contours in incomming image
\, simplifies it according to the epsilon value and outputs contours
with area greater than a threshold.;
-#X text 30 339 Inlet 1: message: area threshold [float];
#X text 25 457 Outlet 2: contour \, convexhull and convexity defect
output;
#X text 37 126 contrary to [pix_opencv_contour_convexhull] \, [pix_opencv_contours]
@@ -70,199 +69,21 @@ point (2 floats)> <depth point (2 floats)> depth;
#X obj 476 193 cnv 15 280 80 empty empty empty 20 12 0 14 -4034 -66577
0;
#X obj 541 151 pix_texture;
-#X obj 487 76 t b a a;
-#X obj 487 57 gemhead 1;
+#X obj 487 74 t b a a;
+#X obj 487 55 gemhead 1;
#X msg 542 214 epsilon \$1;
-#X floatatom 542 197 5 0 0 0 - - -, f 5;
-#X obj 625 121 loadbang;
#X obj 541 171 rectangle 5.333 4;
#X obj 514 116 t a a;
#X msg 617 214 area \$1;
-#X floatatom 617 197 5 0 0 0 - - -, f 5;
-#X msg 659 142 10;
-#X msg 625 141 2;
-#N canvas 1167 234 474 845 draw_rotrect 0;
-#X obj 71 506 GEMglVertex2d;
-#X obj 71 586 GEMglVertex2d;
-#X obj 71 666 GEMglVertex2d;
-#X obj 71 746 GEMglVertex2d;
-#X obj 71 766 GEMglEnd;
-#X obj 71 277 alpha;
-#X obj 143 178 list split 1;
-#X obj 71 420 GEMglBegin GL_LINE_LOOP;
-#X obj 177 198 list split 8;
-#X msg 363 324 0 0 0 0 0 0 0 0;
-#X obj 32 -8 inlet INFO;
-#X obj 71 256 gemhead;
-#X obj 15 147 loadbang;
-#X msg 15 168 0;
-#X obj 71 52 t b a b;
-#X obj 211 504 list split 2;
-#X obj 177 448 list split 2;
-#X obj 137 472 unpack;
-#X obj 211 525 unpack;
-#X obj 245 564 list split 2;
-#X obj 245 585 unpack;
-#X obj 279 664 list split 2;
-#X obj 279 685 unpack;
-#X obj 90 84 list split 2;
-#X obj 95 154 list append;
-#X obj 292 81 t b;
-#X obj 32 32 route 0;
-#X floatatom 342 463 5 0 0 0 - - -, f 5;
-#X obj 342 442 list length;
-#X obj 71 400 GEMglLineWidth 1;
-#X obj 71 327 translateXYZ -5.3333 4 0;
-#X obj 71 361 scaleXYZ 10.6666 -8 0;
-#X obj 124 107 list split 20;
-#X obj 71 302 color 1 1 0 1;
-#X obj 124 128 t b b a;
-#X obj 32 13 route info;
-#X connect 0 0 1 0;
-#X connect 1 0 2 0;
-#X connect 2 0 3 0;
-#X connect 3 0 4 0;
-#X connect 5 0 33 0;
-#X connect 6 1 8 0;
-#X connect 7 0 0 0;
-#X connect 8 0 16 0;
-#X connect 9 0 16 0;
-#X connect 10 0 35 0;
-#X connect 11 0 5 0;
-#X connect 12 0 13 0;
-#X connect 13 0 11 0;
-#X connect 14 1 23 0;
-#X connect 14 2 25 0;
-#X connect 15 0 18 0;
-#X connect 15 1 19 0;
-#X connect 16 0 17 0;
-#X connect 16 1 15 0;
-#X connect 17 0 0 1;
-#X connect 17 1 0 2;
-#X connect 18 0 1 1;
-#X connect 18 1 1 2;
-#X connect 19 0 20 0;
-#X connect 19 1 21 0;
-#X connect 20 0 2 1;
-#X connect 20 1 2 2;
-#X connect 21 0 22 0;
-#X connect 22 0 3 1;
-#X connect 22 1 3 2;
-#X connect 23 1 32 0;
-#X connect 24 0 32 0;
-#X connect 25 0 9 0;
-#X connect 26 1 14 0;
-#X connect 28 0 27 0;
-#X connect 29 0 7 0;
-#X connect 30 0 31 0;
-#X connect 31 0 29 0;
-#X connect 32 0 34 0;
-#X connect 32 1 24 1;
-#X connect 33 0 30 0;
-#X connect 34 0 24 0;
-#X connect 34 1 11 0;
-#X connect 34 2 6 0;
-#X connect 34 2 28 0;
-#X connect 35 0 26 0;
-#X restore 658 323 pd draw_rotrect;
#X obj 487 240 pix_opencv_contours;
-#N canvas 955 337 674 695 drawdefects 0;
-#X obj 191 301 gemhead;
-#X obj 134 217 loadbang;
-#X msg 134 238 0;
-#X obj 210 116 list split 2;
-#X obj 215 186 list append;
-#X obj 191 375 scaleXYZ 10.6666 -8 0;
-#X obj 244 160 t b b a;
-#X obj 210 76 inlet DEFECTS;
-#X obj 210 96 route convexitydefects;
-#X obj 244 139 list split 7;
-#X obj 191 335 color 1 0 0 1;
-#X obj 191 355 translateXYZ -5.3333 4 0;
-#N canvas 895 575 739 379 ortho_point 0;
-#X obj 192 7 inlet;
-#X obj 192 57 t a a;
-#X obj 204 238 *;
-#X obj 174 238 *;
-#X obj 114 124 unpack 0 0 0 0;
-#X obj 114 279 +;
-#X obj 154 279 +;
-#X obj 114 340 outlet;
-#X obj 174 320 outlet;
-#X obj 153 198 -;
-#X msg 153 178 1 \$1;
-#X obj 144 238 *;
-#X obj 114 238 *;
-#X obj 219 84 list split 6;
-#X text 519 123 dot product;
-#X floatatom 244 163 5 0 0 0 - - -, f 5;
-#X obj 300 29 t b;
-#X msg 343 68 0 1 1 1 0.5 0.5;
-#X obj 219 124 expr abs(($f3-$f1)*($f6-$f2)+($f4-$f2)*($f5-$f1));
-#X obj 302 158 expr $f1*sqrt(10.666*8);
-#X connect 0 0 1 0;
-#X connect 1 0 4 0;
-#X connect 1 1 13 0;
-#X connect 2 0 6 1;
-#X connect 3 0 5 1;
-#X connect 4 0 12 0;
-#X connect 4 1 11 0;
-#X connect 4 2 3 0;
-#X connect 4 3 2 0;
-#X connect 5 0 7 0;
-#X connect 6 0 8 0;
-#X connect 9 0 11 1;
-#X connect 9 0 12 1;
-#X connect 10 0 9 0;
-#X connect 11 0 6 0;
-#X connect 12 0 5 0;
-#X connect 13 0 18 0;
-#X connect 16 0 17 0;
-#X connect 17 0 1 0;
-#X connect 18 0 15 0;
-#X connect 18 0 19 0;
-#X connect 19 0 2 1;
-#X connect 19 0 3 1;
-#X connect 19 0 10 0;
-#X restore 328 515 pd ortho_point;
-#X obj 191 475 translateXYZ 10.6666 -8 0;
-#X msg 240 451 \$5;
-#X msg 289 451 \$6;
-#X obj 191 556 circle 0.01;
-#X msg 204 530 draw line;
-#X obj 204 506 loadbang;
-#X obj 354 369 t a;
-#X connect 0 0 10 0;
-#X connect 1 0 2 0;
-#X connect 2 0 0 0;
-#X connect 3 1 9 0;
-#X connect 4 0 9 0;
-#X connect 5 0 13 0;
-#X connect 6 0 4 0;
-#X connect 6 1 0 0;
-#X connect 6 2 19 0;
-#X connect 7 0 8 0;
-#X connect 8 0 3 0;
-#X connect 9 0 6 0;
-#X connect 9 1 4 1;
-#X connect 10 0 11 0;
-#X connect 11 0 5 0;
-#X connect 13 0 16 0;
-#X connect 14 0 13 1;
-#X connect 15 0 13 2;
-#X connect 17 0 16 0;
-#X connect 18 0 17 0;
-#X connect 19 0 15 0;
-#X connect 19 0 14 0;
-#X restore 542 294 pd drawdefects;
-#N canvas 168 587 1126 291 options 0;
+#N canvas 571 659 1126 291 options 0;
#X obj 57 147 tgl 15 1 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X msg 57 167 contours \$1;
#X obj 57 251 outlet;
-#X obj 147 147 tgl 15 1 empty empty empty 17 7 0 10 -262144 -1 -1 0
+#X obj 147 147 tgl 15 1 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
-#X obj 247 147 tgl 15 1 empty empty empty 17 7 0 10 -262144 -1 -1 0
+#X obj 247 147 tgl 15 1 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X msg 147 167 convexhulls \$1;
#X msg 247 167 convexitydefects \$1;
@@ -280,56 +101,58 @@ point (2 floats)> <depth point (2 floats)> depth;
#X text 550 71 first set some tables (they are dynamically resized)
;
#X text 550 151 tell it what tables to use;
-#X text 582 200 enable disable table output (automatically enable when
-ou set table);
#X text 569 256 see [pd draw_contour_gemvertexbuffer] for an example
of drawing contours;
-#N canvas 789 194 596 300 draw_contour_gemvertexbuffer 0;
-#X obj 175 173 loadbang;
-#X obj 135 65 translateXYZ -0.5 -0.5 0;
-#X obj 135 42 scaleXYZ 10.6666 -8 1;
-#X obj 135 87 t a b;
-#X obj 135 -9 gemhead 1000;
-#X obj 135 17 alpha 0;
-#X msg 161 130 posX drawX \, posY drawY \, colorG drawZ \, colorA drawZ
+#N canvas 682 180 596 318 draw_contour_gemvertexbuffer 0;
+#X obj 175 193 loadbang;
+#X obj 135 85 translateXYZ -0.5 -0.5 0;
+#X obj 135 62 scaleXYZ 10.6666 -8 1;
+#X obj 135 107 t a b;
+#X obj 135 11 gemhead 1000;
+#X msg 161 150 posX drawX \, posY drawY \, colorG drawZ \, colorA drawZ
;
-#X msg 175 193 draw line;
-#X obj 135 245 gemvertexbuffer;
-#X obj 161 108 inlet;
-#X obj 269 174 r point_number;
-#X msg 269 201 resize \$1;
-#X floatatom 342 206 5 0 0 0 - - -, f 5;
-#X connect 0 0 7 0;
+#X obj 135 265 gemvertexbuffer;
+#X obj 161 128 inlet;
+#X obj 269 194 r point_number;
+#X msg 269 221 resize \$1;
+#X floatatom 342 226 5 0 0 0 - - -, f 5;
+#X obj 135 -12 r draw_contours;
+#X msg 175 214 draw lineloop;
+#X obj 135 35 alpha;
+#X connect 0 0 12 0;
#X connect 1 0 3 0;
#X connect 2 0 1 0;
-#X connect 3 0 8 0;
-#X connect 3 1 6 0;
-#X connect 4 0 5 0;
-#X connect 5 0 2 0;
-#X connect 6 0 8 0;
-#X connect 7 0 8 0;
+#X connect 3 0 6 0;
+#X connect 3 1 5 0;
+#X connect 4 0 13 0;
+#X connect 5 0 6 0;
+#X connect 7 0 5 0;
+#X connect 8 0 9 0;
+#X connect 8 0 10 0;
#X connect 9 0 6 0;
-#X connect 10 0 11 0;
-#X connect 10 0 12 0;
-#X connect 11 0 8 0;
+#X connect 11 0 4 0;
+#X connect 12 0 6 0;
+#X connect 13 0 2 0;
#X restore 797 147 pd draw_contour_gemvertexbuffer;
#X obj 797 126 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X text 813 127 draw with gemvertexbuffer;
-#X msg 379 80 repeat_point \$1;
-#X floatatom 379 62 5 0 0 0 - - -, f 5;
-#X text 348 47 repeat the first point n times;
#X msg 383 167 cvblobOutput \$1;
-#X obj 383 148 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+#X obj 383 148 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X text 25 57 -2 for only contours with no child (aka holes);
-#X obj 564 89 table drawX 1000;
-#X obj 564 109 table drawY 1000;
-#X obj 564 129 table drawZ 1000;
#X text 543 5 to improve performance and avoid "stack overflow" (because
contours could have a huge number of points) you can use table output
instead of list output;
+#X text 582 200 enable/disable table output (automatically enable when
+you set tables);
+#X obj 373 188 s draw_cvblob;
+#X obj 47 187 s draw_contours;
+#X obj 564 89 table drawX 10000;
+#X obj 564 109 table drawY 10000;
+#X obj 564 129 table drawZ 10000;
#X connect 0 0 1 0;
+#X connect 0 0 27 0;
#X connect 1 0 2 0;
#X connect 3 0 5 0;
#X connect 4 0 6 0;
@@ -340,11 +163,10 @@ instead of list output;
#X connect 12 0 2 0;
#X connect 13 0 14 0;
#X connect 14 0 2 0;
-#X connect 20 0 19 0;
-#X connect 22 0 2 0;
-#X connect 23 0 22 0;
-#X connect 25 0 2 0;
-#X connect 26 0 25 0;
+#X connect 19 0 18 0;
+#X connect 21 0 2 0;
+#X connect 22 0 21 0;
+#X connect 22 0 26 0;
#X restore 674 213 pd options;
#X text 489 347 color legend :;
#X text 522 364 yellow = bounding box;
@@ -352,101 +174,122 @@ instead of list output;
#X text 534 385 blue = convexhull;
#X text 534 397 pink = convexhull edge with defects;
#X text 540 409 red = farthest point from convexhull;
-#N canvas 630 223 621 734 draw_contours 0;
-#X obj 178 132 list split 2;
-#X obj 170 593 GEMglEnd;
-#X obj 300 590 GEMglVertex2d;
-#X obj 212 263 list append;
-#X obj 241 237 t b a;
-#X obj 241 216 list split 2;
-#X obj 341 495 unpack;
-#X obj 310 257 t b a;
-#X obj -101 364 color 1 0 0 1;
-#X obj 405 545 * -8;
-#X obj 405 565 + 4;
-#X obj -101 422 GEMglLineWidth 2;
-#X obj 341 545 * 10.6666;
-#X obj 341 565 - 5.33333;
-#X obj 170 564 gemlist;
-#X obj 300 421 gemlist;
-#X obj -62 242 gemhead;
-#X obj -62 187 loadbang;
-#X msg -62 208 0;
-#X obj 133 161 unpack 0 0;
-#X floatatom 133 182 5 0 0 0 nb_of_segments - -, f 5;
-#X obj 107 -65 inlet CONTOUR;
-#X obj -101 334 gemlist;
-#X obj 212 159 t b a b b;
-#X obj 106 -44 route convexhull contour convexitydefects;
-#X obj 187 1 t a b;
-#X msg -17 320 0 0 1 1;
-#X msg -25 299 0 1 0 1;
-#X obj 106 0 t a b;
-#X obj 268 1 list split 2;
-#X obj 290 96 list append;
-#X obj 319 76 t b a;
-#X obj 302 28 t b a b b;
-#X obj 268 -19 t a b;
-#X msg -7 340 1 0 1 1;
-#X obj 319 55 list split 7;
-#X obj 346 116 list split 4;
-#X obj -101 459 GEMglBegin GL_LINE_LOOP;
-#X obj -115 -62 inlet;
-#X obj -115 -40 t a a a;
-#X connect 0 0 19 0;
-#X connect 0 1 23 0;
-#X connect 2 0 14 1;
-#X connect 3 0 5 0;
+#N canvas 927 173 981 904 draw_contours 0;
+#X obj 43 253 list split 2;
+#X obj 111 820 GEMglVertex2d;
+#X obj 13 661 list append;
+#X obj 42 635 t b a;
+#X obj 42 614 list split 2;
+#X obj 142 746 unpack;
+#X obj 111 679 t b a;
+#X obj 102 500 color 1 0 0 1;
+#X obj 206 773 * -8;
+#X obj 206 793 + 4;
+#X obj 102 528 GEMglLineWidth 2;
+#X obj 142 773 * 10.6666;
+#X obj 142 793 - 5.33333;
+#X obj 111 701 gemlist;
+#X obj 23 414 gemhead;
+#X obj 23 349 loadbang;
+#X msg 23 374 0;
+#X obj 26 62 inlet CONTOUR;
+#X obj 26 106 route convexhull contour convexitydefects;
+#X msg 53 171 0 0 1 1;
+#X msg 134 192 0 1 0 1;
+#X obj 249 155 list split 2;
+#X obj 271 250 list append;
+#X obj 300 230 t b a;
+#X obj 188 131 t a b;
+#X obj 300 209 list split 7;
+#X obj 327 270 list split 4;
+#X obj 107 151 t a b;
+#X obj 26 150 t a b;
+#X obj 215 239 t a;
+#X obj 486 531 gemhead;
+#X obj 486 605 scaleXYZ 10.6666 -8 0;
+#X obj 467 429 t b b a;
+#X obj 486 565 color 1 0 0 1;
+#X obj 486 585 translateXYZ -5.3333 4 0;
+#X obj 486 705 translateXYZ 10.6666 -8 0;
+#X obj 486 786 circle 0.01;
+#X msg 499 760 draw line;
+#X obj 499 736 loadbang;
+#X obj 693 605 t a;
+#X msg 535 681 \$1;
+#X msg 584 681 \$2;
+#X obj 425 473 loadbang;
+#X msg 425 495 0;
+#X msg 215 188 1 0 1 1;
+#X obj 23 446 t a b a;
+#X obj 42 485 list;
+#X obj 77 369 t b a;
+#X obj 23 567 GEMglEnd;
+#X obj 102 552 GEMglBegin GL_LINE_LOOP;
+#X connect 0 1 47 0;
+#X connect 2 0 4 0;
+#X connect 3 0 2 0;
+#X connect 3 1 6 0;
#X connect 4 0 3 0;
-#X connect 4 1 7 0;
-#X connect 5 0 4 0;
-#X connect 5 1 3 1;
-#X connect 6 0 12 0;
-#X connect 6 1 9 0;
-#X connect 7 0 15 0;
-#X connect 7 1 6 0;
-#X connect 8 0 11 0;
-#X connect 9 0 10 0;
-#X connect 10 0 2 2;
-#X connect 11 0 37 0;
-#X connect 12 0 13 0;
-#X connect 13 0 2 1;
-#X connect 14 0 1 0;
-#X connect 15 0 2 0;
+#X connect 4 1 2 1;
+#X connect 5 0 11 0;
+#X connect 5 1 8 0;
+#X connect 6 0 13 0;
+#X connect 6 1 5 0;
+#X connect 7 0 10 0;
+#X connect 8 0 9 0;
+#X connect 9 0 1 2;
+#X connect 10 0 49 0;
+#X connect 11 0 12 0;
+#X connect 12 0 1 1;
+#X connect 13 0 1 0;
+#X connect 14 0 45 0;
+#X connect 15 0 16 0;
+#X connect 16 0 14 0;
#X connect 17 0 18 0;
-#X connect 18 0 16 0;
-#X connect 19 0 20 0;
-#X connect 21 0 24 0;
-#X connect 22 0 8 0;
-#X connect 23 0 14 0;
-#X connect 23 1 5 0;
-#X connect 23 2 22 0;
-#X connect 23 3 16 0;
-#X connect 24 0 28 0;
-#X connect 24 1 25 0;
-#X connect 24 2 33 0;
-#X connect 25 0 0 0;
-#X connect 25 1 27 0;
-#X connect 26 0 8 1;
-#X connect 27 0 8 1;
+#X connect 18 0 28 0;
+#X connect 18 1 27 0;
+#X connect 18 2 24 0;
+#X connect 19 0 29 0;
+#X connect 20 0 29 0;
+#X connect 21 1 25 0;
+#X connect 22 0 25 0;
+#X connect 23 0 22 0;
+#X connect 23 1 26 0;
+#X connect 24 0 21 0;
+#X connect 24 1 44 0;
+#X connect 25 0 23 0;
+#X connect 25 1 22 1;
+#X connect 26 0 47 0;
+#X connect 26 1 32 0;
+#X connect 27 0 0 0;
+#X connect 27 1 20 0;
#X connect 28 0 0 0;
-#X connect 28 1 26 0;
-#X connect 29 1 32 0;
-#X connect 30 0 35 0;
-#X connect 31 0 30 0;
-#X connect 31 1 36 0;
-#X connect 32 1 35 0;
-#X connect 33 0 29 0;
-#X connect 33 1 34 0;
-#X connect 34 0 8 1;
-#X connect 35 0 31 0;
-#X connect 35 1 30 1;
-#X connect 36 0 23 0;
-#X connect 37 0 15 1;
-#X connect 38 0 39 0;
-#X connect 39 0 22 1;
-#X restore 504 513 pd draw_contours;
-#N canvas 13 321 1198 730 info 0;
+#X connect 28 1 19 0;
+#X connect 29 0 7 1;
+#X connect 30 0 33 0;
+#X connect 31 0 35 0;
+#X connect 32 1 30 0;
+#X connect 32 2 39 0;
+#X connect 33 0 34 0;
+#X connect 34 0 31 0;
+#X connect 35 0 36 0;
+#X connect 37 0 36 0;
+#X connect 38 0 37 0;
+#X connect 39 0 41 0;
+#X connect 39 0 40 0;
+#X connect 40 0 35 1;
+#X connect 41 0 35 2;
+#X connect 42 0 43 0;
+#X connect 43 0 30 0;
+#X connect 44 0 29 0;
+#X connect 45 0 48 0;
+#X connect 45 1 46 0;
+#X connect 45 2 7 0;
+#X connect 46 0 4 0;
+#X connect 47 0 14 0;
+#X connect 47 1 46 1;
+#X restore 542 323 pd draw_contours;
+#N canvas 154 308 1198 730 info 0;
#X obj -67 115 cnv 15 250 40 empty empty empty 20 12 0 14 -4034 -66577
0;
#X obj -68 292 cnv 15 350 20 empty empty empty 20 12 0 14 -4034 -66577
@@ -484,17 +327,6 @@ instead of list output;
#X msg 54 513 0.681584 0.808552 0.679688 0.789583 0.704353 0.785198
0.70625 0.804167;
#X text 59 495 rotrect corners coordinates;
-#X obj 570 153 list split 20;
-#X obj 570 175 t b a;
-#X obj 617 222 list;
-#X msg 597 259 \$15;
-#X obj 597 281 +;
-#X obj 625 281 f;
-#X msg 620 122 0;
-#X obj 582 303 f;
-#X obj 551 119 t b a b;
-#X floatatom 582 325 5 0 0 0 - - -, f 5;
-#X text 445 323 total number of points;
#X obj 177 194 list split 1;
#X obj -140 220 cnv 15 350 20 empty empty empty 20 12 0 14 -4034 -66577
0;
@@ -524,23 +356,24 @@ instead of list output;
#X obj 736 107 unpack f f;
#X floatatom 736 129 5 0 0 0 - - -, f 5;
#X floatatom 793 130 5 0 0 0 - - -, f 5;
-#X obj 776 195 s point_number;
+#X obj 794 250 s point_number;
#X text 723 144 contours;
#X text 797 145 points;
#X text 690 160 total counts of contours and points;
-#X connect 5 0 63 0;
+#X text 9 -35 activate cvblob output before trying this !;
+#X obj 794 197 + 3;
+#X connect 5 0 52 0;
#X connect 6 0 22 0;
#X connect 6 1 7 0;
-#X connect 6 1 39 0;
-#X connect 7 0 42 0;
-#X connect 11 0 49 0;
+#X connect 7 0 31 0;
+#X connect 11 0 38 0;
#X connect 11 1 15 0;
#X connect 12 0 13 0;
#X connect 12 1 14 0;
#X connect 15 0 12 0;
-#X connect 15 1 48 0;
+#X connect 15 1 37 0;
#X connect 17 0 27 0;
-#X connect 17 1 62 0;
+#X connect 17 1 51 0;
#X connect 18 0 19 0;
#X connect 19 0 20 0;
#X connect 20 0 6 1;
@@ -550,42 +383,27 @@ instead of list output;
#X connect 22 1 7 1;
#X connect 27 0 28 0;
#X connect 28 0 29 0;
-#X connect 31 0 32 0;
-#X connect 31 1 33 1;
-#X connect 32 0 33 0;
-#X connect 32 1 34 0;
-#X connect 33 0 31 0;
-#X connect 34 0 35 0;
-#X connect 35 0 36 0;
-#X connect 35 0 38 1;
-#X connect 36 0 35 1;
-#X connect 37 0 35 1;
-#X connect 38 0 40 0;
-#X connect 39 0 38 0;
-#X connect 39 1 31 0;
-#X connect 39 2 37 0;
-#X connect 42 0 44 0;
-#X connect 42 1 11 0;
-#X connect 48 0 52 0;
-#X connect 48 1 17 0;
-#X connect 49 0 50 0;
-#X connect 49 1 51 0;
-#X connect 52 0 53 0;
-#X connect 52 1 55 0;
-#X connect 62 0 58 0;
-#X connect 62 1 59 0;
-#X connect 63 0 6 0;
-#X connect 63 1 64 0;
-#X connect 64 0 65 0;
-#X connect 64 1 66 0;
-#X connect 64 1 67 0;
-#X restore 675 294 pd info;
+#X connect 31 0 33 0;
+#X connect 31 1 11 0;
+#X connect 37 0 41 0;
+#X connect 37 1 17 0;
+#X connect 38 0 39 0;
+#X connect 38 1 40 0;
+#X connect 41 0 42 0;
+#X connect 41 1 44 0;
+#X connect 51 0 47 0;
+#X connect 51 1 48 0;
+#X connect 52 0 6 0;
+#X connect 52 1 53 0;
+#X connect 53 0 54 0;
+#X connect 53 1 55 0;
+#X connect 55 0 61 0;
+#X connect 61 0 56 0;
+#X restore 672 295 pd info;
#X text 29 498 <num of contour> 20 <contour area> <rotrect corners
coordinates (8 floats)> <rotrect center position (2 floats)> <rotrect
size (2 floats)> <angle in degrees> <number of points> <contour length>
0 0 0 0;
-#X obj 554 32 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
#X text 30 369 Inlet 1: message: contours <0|1>;
#X text 30 379 Inlet 1: message: convexhull <0|1>;
#X text 30 389 Inlet 1: message: convexitydefects <0|1>;
@@ -593,139 +411,197 @@ size (2 floats)> <angle in degrees> <number of points> <contour length>
;
#X text 30 409 Inlet 1: message: taboutput <0|1>;
#X text 30 359 Inlet 1: message: hierarchy_level [float];
-#X obj 514 96 pix_image examples/dessin.tif;
-#N canvas 865 237 931 731 cvblob 0;
-#X obj 87 321 gemlist;
-#X obj 87 301 t b a;
-#X obj 328 306 list append;
-#X obj 323 198 list split 2;
-#X obj 323 142 list append;
-#X obj 99 108 t b a;
-#X obj 357 280 t b a;
-#X obj 87 511 translateXYZ;
-#X msg 228 354 \$2;
-#X obj 87 361 alpha 1;
-#X obj 87 471 translateXYZ -0.5 -0.5 0;
-#X obj 87 535 scaleXYZ 0.125 0.25 0;
-#X msg 267 354 \$3;
-#X msg 242 468 \$4;
-#X obj 271 333 t a a;
-#X obj 87 581 circle 0.5;
-#X obj 87 431 color 1 0 0 0.2;
-#X obj 87 341 separator;
-#X msg 307 504 \$1;
-#X obj 87 621 color 1 1 0 1;
-#X obj 357 246 list split 6;
-#X msg 426 194 \$2;
-#X obj 174 627 loadbang;
-#X msg 174 646 12;
-#X msg 329 382 \$6;
-#X obj 329 404 > 0;
-#X obj 329 425 sel 1 0;
-#X msg 328 446 1 0 0 0.2;
-#X msg 348 466 0 1 0 0.2;
-#X obj 87 601 translateXYZ 0.2 0.2 0;
-#X text 547 280 here is an example on how to display blobs with Gem
-;
-#X obj 87 451 scaleXYZ 10.666 -8 0;
-#X obj 87 682 text2d;
-#X text 452 195 <- be careful ! the size of the cvblob matrix could
-change;
-#X text 534 212 please check second element to gets matrix width (number
-of value per blob);
-#X obj 323 164 t a a;
-#X obj 386 11 inlet cvblob;
-#X obj 386 33 route cvblob;
-#X obj 240 490 sqrt;
-#X obj 99 83 spigot;
-#X obj 386 55 t a a;
-#X msg 413 77 \$1;
-#X floatatom 413 99 5 0 0 0 - - -, f 5;
-#X obj 99 19 inlet;
-#X connect 0 0 17 0;
-#X connect 1 0 0 0;
-#X connect 1 1 14 0;
-#X connect 2 0 20 0;
-#X connect 3 1 20 0;
-#X connect 4 0 35 0;
-#X connect 5 0 4 0;
-#X connect 5 1 0 1;
-#X connect 6 0 2 0;
-#X connect 6 1 1 0;
-#X connect 7 0 11 0;
-#X connect 8 0 7 1;
-#X connect 9 0 16 0;
-#X connect 10 0 7 0;
-#X connect 11 0 15 0;
-#X connect 12 0 7 2;
-#X connect 13 0 38 0;
-#X connect 14 0 12 0;
-#X connect 14 0 8 0;
+#N canvas 230 125 955 706 cvblob 0;
+#X obj 328 216 list append;
+#X obj 323 148 list split 2;
+#X obj 357 190 t b a;
+#X obj 357 169 list split 6;
+#X msg 426 144 \$2;
+#X obj 323 114 t a a;
+#X obj 323 71 inlet cvblob;
+#X obj 323 93 route cvblob;
+#N canvas 65 87 922 824 drawrotrec 0;
+#X obj 341 569 GEMglVertex2d;
+#X obj 341 619 GEMglVertex2d;
+#X obj 341 689 GEMglVertex2d;
+#X obj 341 729 GEMglVertex2d;
+#X obj 341 749 GEMglEnd;
+#X obj 341 340 alpha;
+#X obj 341 483 GEMglBegin GL_LINE_LOOP;
+#X obj 447 261 list split 8;
+#X msg 562 391 0 0 0 0 0 0 0 0;
+#X obj 341 319 gemhead;
+#X obj 285 210 loadbang;
+#X msg 285 231 0;
+#X obj 341 117 t b a b;
+#X obj 481 537 list split 2;
+#X obj 447 511 list split 2;
+#X obj 407 535 unpack;
+#X obj 481 558 unpack;
+#X obj 515 587 list split 2;
+#X obj 515 608 unpack;
+#X obj 549 637 list split 2;
+#X obj 549 658 unpack;
+#X obj 562 184 t b;
+#X floatatom 612 526 5 0 0 0 - - -, f 5;
+#X obj 612 505 list length;
+#X obj 341 463 GEMglLineWidth 1;
+#X obj 341 390 translateXYZ -5.3333 4 0;
+#X obj 341 424 scaleXYZ 10.6666 -8 0;
+#X obj 341 365 color 1 1 0 1;
+#X obj 413 234 list split 7;
+#X obj 341 91 inlet;
+#X connect 0 0 1 0;
+#X connect 1 0 2 0;
+#X connect 2 0 3 0;
+#X connect 3 0 4 0;
+#X connect 5 0 27 0;
+#X connect 6 0 0 0;
+#X connect 7 0 14 0;
+#X connect 8 0 14 0;
+#X connect 9 0 5 0;
+#X connect 10 0 11 0;
+#X connect 11 0 9 0;
+#X connect 12 0 9 0;
+#X connect 12 1 28 0;
+#X connect 12 2 21 0;
+#X connect 13 0 16 0;
+#X connect 13 1 17 0;
+#X connect 14 0 15 0;
#X connect 14 1 13 0;
-#X connect 14 1 18 0;
-#X connect 14 1 24 0;
-#X connect 15 0 29 0;
-#X connect 16 0 31 0;
-#X connect 17 0 9 0;
-#X connect 18 0 32 0;
-#X connect 19 0 32 0;
-#X connect 20 0 6 0;
-#X connect 20 1 2 1;
-#X connect 21 0 20 1;
-#X connect 22 0 23 0;
-#X connect 23 0 32 1;
-#X connect 24 0 25 0;
+#X connect 15 0 0 1;
+#X connect 15 1 0 2;
+#X connect 16 0 1 1;
+#X connect 16 1 1 2;
+#X connect 17 0 18 0;
+#X connect 17 1 19 0;
+#X connect 18 0 2 1;
+#X connect 18 1 2 2;
+#X connect 19 0 20 0;
+#X connect 20 0 3 1;
+#X connect 20 1 3 2;
+#X connect 21 0 8 0;
+#X connect 23 0 22 0;
+#X connect 24 0 6 0;
#X connect 25 0 26 0;
-#X connect 26 0 27 0;
-#X connect 26 1 28 0;
-#X connect 27 0 16 1;
-#X connect 28 0 16 1;
-#X connect 29 0 19 0;
-#X connect 31 0 10 0;
-#X connect 35 0 3 0;
-#X connect 35 1 21 0;
-#X connect 36 0 37 0;
-#X connect 37 0 40 0;
-#X connect 38 0 11 1;
-#X connect 38 0 11 2;
-#X connect 39 0 5 0;
-#X connect 40 0 4 1;
-#X connect 40 1 41 0;
-#X connect 41 0 42 0;
-#X connect 41 0 39 1;
-#X connect 43 0 39 0;
-#X restore 664 365 pd cvblob;
-#X text 506 492 WARNING ! this crashes;
+#X connect 26 0 24 0;
+#X connect 27 0 25 0;
+#X connect 28 1 7 0;
+#X connect 29 0 12 0;
+#X restore 474 353 pd drawrotrec;
+#X text 452 145 <- size of each blob data;
+#X floatatom 437 171 5 0 0 0 - - -, f 5;
+#X text 405 193 split blobs;
+#N canvas 65 82 450 542 draw_potatoe 0;
+#X obj 90 108 t b a;
+#X obj 90 318 translateXYZ;
+#X msg 231 161 \$2;
+#X obj 90 168 alpha 1;
+#X obj 90 278 translateXYZ -0.5 -0.5 0;
+#X obj 90 342 scaleXYZ 0.125 0.25 0;
+#X msg 270 161 \$3;
+#X msg 245 255 \$4;
+#X obj 274 140 t a a;
+#X obj 90 388 circle 0.5;
+#X obj 90 238 color 1 0 0 0.2;
+#X obj 90 148 separator;
+#X msg 310 311 \$1;
+#X obj 90 428 color 1 1 0 1;
+#X obj 177 434 loadbang;
+#X msg 177 453 12;
+#X msg 332 189 \$6;
+#X obj 332 211 > 0;
+#X obj 332 232 sel 1 0;
+#X msg 331 253 1 0 0 0.2;
+#X msg 351 273 0 1 0 0.2;
+#X obj 90 408 translateXYZ 0.2 0.2 0;
+#X obj 90 258 scaleXYZ 10.666 -8 0;
+#X obj 90 489 text2d;
+#X obj 245 277 sqrt;
+#X obj 245 299 / 2;
+#X obj 90 128 gemhead;
+#X obj 57 65 loadbang;
+#X msg 57 87 0;
+#X obj 90 88 inlet;
+#X connect 0 0 26 0;
+#X connect 0 1 8 0;
+#X connect 1 0 5 0;
+#X connect 2 0 1 1;
+#X connect 3 0 10 0;
+#X connect 4 0 1 0;
+#X connect 5 0 9 0;
+#X connect 6 0 1 2;
+#X connect 7 0 24 0;
+#X connect 8 0 6 0;
+#X connect 8 0 2 0;
+#X connect 8 1 7 0;
+#X connect 8 1 12 0;
+#X connect 8 1 16 0;
+#X connect 9 0 21 0;
+#X connect 10 0 22 0;
+#X connect 11 0 3 0;
+#X connect 12 0 23 0;
+#X connect 13 0 23 0;
+#X connect 14 0 15 0;
+#X connect 15 0 23 1;
+#X connect 16 0 17 0;
+#X connect 17 0 18 0;
+#X connect 18 0 19 0;
+#X connect 18 1 20 0;
+#X connect 19 0 10 1;
+#X connect 20 0 10 1;
+#X connect 21 0 13 0;
+#X connect 22 0 4 0;
+#X connect 24 0 25 0;
+#X connect 25 0 5 1;
+#X connect 25 0 5 2;
+#X connect 26 0 11 0;
+#X connect 27 0 28 0;
+#X connect 28 0 26 0;
+#X connect 29 0 0 0;
+#X restore 362 355 pd draw_potatoe;
+#X connect 0 0 3 0;
+#X connect 1 1 3 0;
+#X connect 2 0 0 0;
+#X connect 2 1 8 0;
+#X connect 2 1 12 0;
+#X connect 3 0 2 0;
+#X connect 3 1 0 1;
+#X connect 4 0 3 1;
+#X connect 4 0 10 0;
+#X connect 5 0 1 0;
+#X connect 5 1 4 0;
+#X connect 6 0 7 0;
+#X connect 7 0 5 0;
+#X restore 598 295 pd cvblob;
#X text 20 488 cvblob;
#X text 25 467 Outlet 3: info output;
#X text 20 558 count <number of contour> <total number of point>;
-#X text 612 516 fix me !;
-#X obj 487 171 pix_rgba;
-#X obj 487 141 pix_video;
-#X obj 532 603 declare -lib pix_opencv;
+#X obj 504 730 declare -lib pix_opencv;
+#X obj 487 141 pix_buf;
+#X obj 542 196 nbx 5 14 0 1e+37 0 1 empty empty empty 0 -8 0 10 -262144
+-1 -1 2 256;
+#X obj 617 196 nbx 5 14 0 1e+37 0 1 empty empty empty 0 -8 0 10 -262144
+-1 -1 10 256;
+#X obj 487 171 pix_gray;
+#X text 30 339 Inlet 1: message: area [float];
+#X obj 514 96 pix_image examples/dessin.tif;
#X connect 13 0 14 0;
#X connect 14 0 13 0;
-#X connect 35 0 41 0;
-#X connect 36 0 75 0;
-#X connect 36 1 67 0;
-#X connect 37 0 36 0;
-#X connect 38 0 48 0;
-#X connect 39 0 38 0;
-#X connect 40 0 46 0;
-#X connect 40 0 45 0;
-#X connect 42 0 75 0;
-#X connect 42 1 35 0;
-#X connect 43 0 48 0;
-#X connect 44 0 43 0;
-#X connect 45 0 44 0;
-#X connect 46 0 39 0;
-#X connect 48 0 68 0;
-#X connect 48 1 49 0;
-#X connect 48 2 68 1;
-#X connect 48 2 47 0;
-#X connect 48 2 58 0;
-#X connect 50 0 48 0;
-#X connect 60 0 37 0;
-#X connect 67 0 42 0;
-#X connect 74 0 48 0;
-#X connect 75 0 74 0;
+#X connect 34 0 38 0;
+#X connect 35 0 63 0;
+#X connect 35 1 68 0;
+#X connect 36 0 35 0;
+#X connect 37 0 41 0;
+#X connect 39 0 63 0;
+#X connect 39 1 34 0;
+#X connect 40 0 41 0;
+#X connect 41 1 49 0;
+#X connect 41 2 58 0;
+#X connect 41 2 50 0;
+#X connect 42 0 41 0;
+#X connect 63 0 66 0;
+#X connect 64 0 37 0;
+#X connect 65 0 40 0;
+#X connect 66 0 41 0;
+#X connect 68 0 39 0;
diff --git a/src/Makefile.am b/src/Makefile.am
index 2457e78..51666a3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,8 +2,9 @@
AUTOMAKE_OPTIONS = foreign
pkglib_LTLIBRARIES = pix_opencv.la
-pix_opencv_la_CXXFLAGS = @GEM_CPPFLAGS@ @PD_CPPFLAGS@ @FACETRACKER_CPPFLAGS@
-pix_opencv_la_LDFLAGS = -module -avoid-version -shared -shrext .@EXTENSION@ @GEM_LDFLAGS@ @PD_LDFLAGS@ @FACETRACKER_LDFLAGS@
+pix_opencv_la_CXXFLAGS = @GEM_CPPFLAGS@ @PD_CPPFLAGS@ @FACETRACKER_CPPFLAGS@ @OPENCV_CFLAGS@
+pix_opencv_la_LDFLAGS = -module -avoid-version -shared -shrext .@EXTENSION@ @GEM_LDFLAGS@ @PD_LDFLAGS@ @FACETRACKER_LDFLAGS@ @OPENCV_LDFLAGS@
+pix_opencv_la_LIBADD = @OPENCV_LIBS@
pix_opencv_la_includedir=$(includedir)/src
pix_opencv_la_include_HEADERS = Blob.hpp \
blobtrack.h \
diff --git a/src/pix_opencv_clahe.cc b/src/pix_opencv_clahe.cc
index 4de7cfc..625158f 100644
--- a/src/pix_opencv_clahe.cc
+++ b/src/pix_opencv_clahe.cc
@@ -33,7 +33,7 @@ CPPEXTERN_NEW_WITH_THREE_ARGS(pix_opencv_clahe, t_floatarg, A_DEFFLOAT, t_floata
//
/////////////////////////////////////////////////////////
pix_opencv_clahe :: pix_opencv_clahe(t_float clipLimit, int width, int height)
- : m_clipLimit(40), m_tileGridSize(Size(8,8)), m_rendering(false)
+ : m_clipLimit(40), m_tileGridSize(cv::Size(8,8)), m_rendering(false)
{
if ( clipLimit > 0. ){
m_clipLimit = clipLimit;
@@ -42,7 +42,7 @@ pix_opencv_clahe :: pix_opencv_clahe(t_float clipLimit, int width, int height)
m_tileGridSize=cv::Size(width, height);
} else if (width > 0 || height > 0) {
int max = width > height ? width : height;
- m_tileGridSize=Size ( max, max );
+ m_tileGridSize=cv::Size ( max, max );
}
}
diff --git a/src/pix_opencv_clahe.h b/src/pix_opencv_clahe.h
index 6d03a53..91d54d3 100644
--- a/src/pix_opencv_clahe.h
+++ b/src/pix_opencv_clahe.h
@@ -78,7 +78,7 @@ class GEM_EXPORT pix_opencv_clahe : public GemPixObj
bool m_gpuMode;
float m_clipLimit;
- Size m_tileGridSize;
+ cv::Size m_tileGridSize;
bool m_rendering;
};
#endif // for header file
diff --git a/src/pix_opencv_contours.cc b/src/pix_opencv_contours.cc
index bf4410d..23d470e 100644
--- a/src/pix_opencv_contours.cc
+++ b/src/pix_opencv_contours.cc
@@ -35,7 +35,6 @@ CPPEXTERN_NEW(pix_opencv_contours)
//
/////////////////////////////////////////////////////////
pix_opencv_contours :: pix_opencv_contours() : \
- m_repeat_point(1), \
m_epsilon(2), \
m_enable_contours(1), \
m_enable_hulls(1), \
@@ -301,7 +300,6 @@ void pix_opencv_contours :: obj_setupCallback(t_class *classPtr)
CPPEXTERN_MSG1(classPtr, "hierarchy_level", hierarchyMess, double);
CPPEXTERN_MSG1(classPtr, "taboutput", taboutputMess, float);
CPPEXTERN_MSG3(classPtr, "settab", tableMess, t_symbol*, t_symbol*, t_symbol*);
- CPPEXTERN_MSG1(classPtr, "repeat_point", repeat_pointMess, float);
}
void pix_opencv_contours :: outputCount(){
@@ -309,7 +307,7 @@ void pix_opencv_contours :: outputCount(){
for( size_t i = 0 ; i < m_contours.size(); i++ ){
m_totalPointsCount+=m_contours[i].size();
}
- m_totalPointsCount+=m_contours.size()*m_repeat_point*2; // add 2 points for each contour (on start and end)
+ m_totalPointsCount+=m_contours.size()*2; // add 2 points for each contour (on start and end)
t_atom count_atom[2];
SETFLOAT(count_atom, m_contours.size());
@@ -369,7 +367,7 @@ void pix_opencv_contours :: outputBlobs(imageStruct &image){
apt2+=2;
}
- SETFLOAT(apt+15, m_contours[i].size()+m_repeat_point*2); // number of points in segment
+ SETFLOAT(apt+15, m_contours[i].size()); // number of points in segment
SETFLOAT(apt+16, (float) length);
}
}
@@ -390,38 +388,25 @@ void pix_opencv_contours :: outputContours(imageStruct &image){
{
if (!m_contours[i].empty() && m_contours[i].size() > 2) {
- int size = 2+(m_repeat_point*2+m_contours[i].size())*2;
+ int size = 2+2*m_contours[i].size();
t_atom*acontours = new t_atom[size];
t_atom* apt=acontours;
- SETFLOAT(apt, static_cast<t_float>(m_repeat_point*2+m_contours[i].size()));
+ SETFLOAT(apt, static_cast<t_float>(m_contours[i].size()));
SETFLOAT(apt+1, 2.0);
apt+=2;
-
- for ( size_t j = 0 ; j < m_repeat_point ; j++){
- cv::Point pt = m_contours[i][0];
- SETFLOAT(apt, (float) pt.x/image.xsize);
- SETFLOAT(apt+1,(float) pt.y/image.ysize);
- apt+=2;
- }
-
- for ( size_t j = 1 ; j < m_contours[i].size() ; j++){
+
+ size_t j;
+ for ( j = 0 ; j < m_contours[i].size() ; j++){
cv::Point pt = m_contours[i][j];
SETFLOAT(apt,(float) pt.x/image.xsize);
SETFLOAT(apt+1,(float) pt.y/image.ysize);
apt+=2;
}
-
- for ( size_t j = 0 ; j < m_repeat_point ; j++){
- cv::Point pt = m_contours[i][0]; // repeat the first point to close the contour
- SETFLOAT(apt, (float) pt.x/image.xsize);
- SETFLOAT(apt+1,(float) pt.y/image.ysize);
- apt+=2;
- }
-
+
outlet_anything(m_dataout_middle, gensym("contour"), size, acontours);
if(acontours) {
- delete acontours;
+ delete[] acontours;
acontours=NULL;
}
}
@@ -436,7 +421,7 @@ void pix_opencv_contours :: outputContours(imageStruct &image){
return;
}
- int vecxsize(0), vecysize(0), veczsize(0);
+ int vecxsize(0), vecysize(0), veczsize(0), vecsize(0);
t_garray *ax, *ay, *az;
t_word *vecx, *vecy, *vecz;
@@ -487,11 +472,13 @@ void pix_opencv_contours :: outputContours(imageStruct &image){
}
}
+ vecsize=min(min(vecxsize,vecysize),veczsize);
+
int n=0;
for( size_t i = 0 ; i < m_contours.size(); i++ )
{
- if (n >= vecxsize || n>=vecysize || n>=veczsize)
+ if ( n >= vecsize )
{
error("array are not wide enough");
break;
@@ -501,14 +488,12 @@ void pix_opencv_contours :: outputContours(imageStruct &image){
cv::Point pt;
pt = m_contours[i][0];
//~ start with blank point
- for (j=0; j<m_repeat_point; j++){
- vecx[n].w_float = (float) pt.x/image.xsize;
- vecy[n].w_float = (float) pt.y/image.ysize;
- vecz[n].w_float = 0.;
- n++;
- }
+ vecx[n].w_float = (float) pt.x/image.xsize;
+ vecy[n].w_float = (float) pt.y/image.ysize;
+ vecz[n].w_float = 0.;
+ n++;
- for ( j = 0 ; j < m_contours[i].size() && n < vecxsize ; j++) {
+ for ( j = 0 ; j < m_contours[i].size() ; j++) {
pt = m_contours[i][j];
@@ -517,16 +502,15 @@ void pix_opencv_contours :: outputContours(imageStruct &image){
vecz[n].w_float = 1.;
n++;
}
+
// close contour
- pt = m_contours[i][0];
- for (j=0; j<m_repeat_point && n < vecxsize; j++){ // TODO what is this loop ??? m_repeat_point is either 0 or 1...
- vecx[n].w_float = (float) pt.x/image.xsize;
- vecy[n].w_float = (float) pt.y/image.ysize;
- vecz[n].w_float = 0.;
- n++;
+ if ( n < vecsize ){
+ pt = m_contours[i][0];
+ vecx[n].w_float = (float) pt.x/image.xsize;
+ vecy[n].w_float = (float) pt.y/image.ysize;
+ vecz[n].w_float = 1.;
+ n++;
}
-
-
}
//~ comment the redraw fnt if not needed
garray_redraw(ax);
@@ -575,11 +559,6 @@ void pix_opencv_contours :: taboutputMess(float arg)
m_taboutput = arg > 0;
}
-void pix_opencv_contours :: repeat_pointMess(float arg)
-{
- m_repeat_point = arg > 1 ? arg : 1;
-}
-
void pix_opencv_contours :: tableMess(t_symbol*xarray, t_symbol*yarray, t_symbol*zarray)
{
// check if arrays exist
diff --git a/src/pix_opencv_contours.h b/src/pix_opencv_contours.h
index 01810e3..fd30e6b 100644
--- a/src/pix_opencv_contours.h
+++ b/src/pix_opencv_contours.h
@@ -76,7 +76,6 @@ private:
std::vector<std::vector<int> > m_convexhulls;
std::vector<int> m_area;
- unsigned int m_repeat_point;
double m_epsilon;