aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN.N. <sevyves@users.sourceforge.net>2009-06-25 19:02:13 +0000
committerN.N. <sevyves@users.sourceforge.net>2009-06-25 19:02:13 +0000
commitc98c7477d7cf37b37972ca0dfedc95fdb6ab50f3 (patch)
tree1fa9df789780c3cc0dced9d305e74ba93458d7da
parent70ec82a6a6b1ae40dbbd55b8cfcb86ac0a879ae4 (diff)
follow the color blobs
svn path=/trunk/externals/pdp_opencv/; revision=11817
-rw-r--r--pdp_opencv_floodfill.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/pdp_opencv_floodfill.c b/pdp_opencv_floodfill.c
index 7e697ca..0c287a5 100644
--- a/pdp_opencv_floodfill.c
+++ b/pdp_opencv_floodfill.c
@@ -126,12 +126,6 @@ static void pdp_opencv_floodfill_process_rgb(t_pdp_opencv_floodfill *x)
CvScalar color = CV_RGB( x->x_r[i], x->x_g[i], x->x_b[i] );
cvFloodFill( x->color_img, seed, color, CV_RGB( x->x_lo, x->x_lo, x->x_lo ),
CV_RGB( x->x_up, x->x_up, x->x_up ), &comp, flags, NULL );
- SETFLOAT(&x->x_list[0], i);
- SETFLOAT(&x->x_list[1], comp.rect.x);
- SETFLOAT(&x->x_list[2], comp.rect.y);
- SETFLOAT(&x->x_list[3], comp.rect.width);
- SETFLOAT(&x->x_list[4], comp.rect.height);
- outlet_list( x->x_outlet1, 0, 5, x->x_list );
}
else
{
@@ -139,13 +133,17 @@ static void pdp_opencv_floodfill_process_rgb(t_pdp_opencv_floodfill *x)
CvScalar brightness = cvRealScalar((x->x_r[i]*2 + x->x_g[i]*7 + x->x_b[i] + 5)/10);
cvFloodFill( x->gray_img, seed, brightness, cvRealScalar(x->x_lo),
cvRealScalar(x->x_up), &comp, flags, NULL );
- SETFLOAT(&x->x_list[0], i);
- SETFLOAT(&x->x_list[1], comp.rect.x);
- SETFLOAT(&x->x_list[2], comp.rect.y);
- SETFLOAT(&x->x_list[3], comp.rect.width);
- SETFLOAT(&x->x_list[4], comp.rect.height);
- outlet_list( x->x_outlet1, 0, 5, x->x_list );
}
+ SETFLOAT(&x->x_list[0], i);
+ SETFLOAT(&x->x_list[1], comp.rect.x);
+ SETFLOAT(&x->x_list[2], comp.rect.y);
+ SETFLOAT(&x->x_list[3], comp.rect.width);
+ SETFLOAT(&x->x_list[4], comp.rect.height);
+ outlet_list( x->x_outlet1, 0, 5, x->x_list );
+
+ // follow the blob
+ x->x_xcomp[i] = comp.rect.x + ( comp.rect.width / 2 );
+ x->x_ycomp[i] = comp.rect.y + ( comp.rect.height / 2 );
}
}