From: Pierre C. <Ba...@us...> - 2011-05-31 14:14:11
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 617b3078e3af5ed2d37e4a380167ef65d924f3ab (commit) via d7fb053a920e6e635455a28769ab678d4b36d82f (commit) from e68d5b4809d5c09a37344baebd657acb2b5d197b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 617b3078e3af5ed2d37e4a380167ef65d924f3ab Author: chambart <cha...@cr...> Date: Tue May 31 16:12:39 2011 +0200 [info] krobot_webcam pass arguments to krobo-find-object commit d7fb053a920e6e635455a28769ab678d4b36d82f Author: chambart <cha...@cr...> Date: Tue May 31 16:08:09 2011 +0200 [info] vision: apply an homography transformation to matched circles ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/tools/krobot_webcam.ml b/info/control2011/src/tools/krobot_webcam.ml index b1cf643..83382b9 100644 --- a/info/control2011/src/tools/krobot_webcam.ml +++ b/info/control2011/src/tools/krobot_webcam.ml @@ -29,8 +29,8 @@ let rec parse bus objects ic = parse bus [] ic end else begin (* Otherwise read one and add it to the current list of objects. *) - let cx, cy, w, h, alpha = Scanf.sscanf line "%d %d %d %d %f" (fun cx cy w h alpha -> (cx, cy, w, h, alpha)) in - parse bus ({ x = float cx; y = float cy } :: objects) ic + let cx, cy = Scanf.sscanf line "%f %f" (fun cx cy-> (cx, cy)) in + parse bus ({ x = cx; y = cy } :: objects) ic end (* +-----------------------------------------------------------------+ @@ -81,8 +81,11 @@ lwt () = (* Handle krobot message. *) E.keep (E.map (handle_message bus) (Krobot_bus.recv bus)); + (* for printf to print floats with points and not colons *) + Unix.putenv "LANG" "C"; + (* Launch the objects finder. *) - let process = Lwt_process.open_process_in ("krobot-find-objects", [|"krobot-find-objects"|]) in + let process = Lwt_process.open_process_in ("krobot-find-objects", [|"krobot-find-objects"; Sys.argv.(1); Sys.argv.(2); Sys.argv.(3)|]) in (* Read the first separator. *) lwt _ = Lwt_io.read_line process#stdout in diff --git a/info/vision/coupe2011/findBallse.c b/info/vision/coupe2011/findBallse.c index d5abdb9..988e155 100644 --- a/info/vision/coupe2011/findBallse.c +++ b/info/vision/coupe2011/findBallse.c @@ -35,6 +35,8 @@ IplImage *image01 = 0, *image02 = 0, *image03 = 0, *imCont = 0, *imFill = 0, *im /* Whether to display the result on the screen or not using HighGUI. */ int display = 0; +CvMat* homography; + /* +-----------------------------------------------------------------+ | Config file parsing | +-----------------------------------------------------------------+ */ @@ -112,6 +114,9 @@ void process_image() CvPoint2D32f* PointArray2D32f; int i, j, meanRad; + CvMat* src; + CvMat* dst; + // Changement d'espace de couleur cvCvtColor(image01, imHSV, CV_BGR2HSV); @@ -160,7 +165,7 @@ void process_image() cont = cvCreateSeq(CV_SEQ_ELTYPE_POINT, sizeof(CvSeq), sizeof(CvPoint) , stor); /* Print a separator. */ - printf("====="); + printf("=====\n"); if (cont) { // Threshold the source image. This needful for cvFindContours(). @@ -214,8 +219,16 @@ void process_image() meanRad = (size.width + size.height) / 2; if (meanRad >= params.minCont && meanRad <= params.maxCont) { + + // tansform matched elipsis to table coordinates + src = cvCreateMat(1, 1, CV_32FC2); + dst = cvCreateMat(1, 1, CV_32FC2); + src->data.fl[0] = (float) center.x; + dst->data.fl[1] = (float) center.y; + cvPerspectiveTransform(point1, point2, homography); + /* Print ellipsis parameters on stdout. */ - printf("%d %d %d %d %f\n", center.x, center.y, size.width, size.height, box->angle); + printf("%f %f\n", dst->data.fl[0], dst->data.fl[1]); if (display) { // Draw current contour. @@ -235,6 +248,8 @@ void process_image() } } + fflush(stdout); + // On libère la mémoire if (display) { free(imCont->roi); @@ -286,6 +301,18 @@ int main( int argc, char** argv ) // Même chose avec l'image pour conversion imHSV = cvCreateImage(cvSize(image01->width,image01->height), IPL_DEPTH_8U, 3); + // create and initialise homograpy matrix + homography = cvCreateMat(3, 3, CV_32F); + homography->data.fl[0] = -0.00109182286542; + homography->data.fl[1] = -0.0570392236114; + homography->data.fl[2] = 7.99883031845; + homography->data.fl[3] = -0.00867976341397; + homography->data.fl[4] = -0.0176480710506; + homography->data.fl[5] = 3.60714673996; + homography->data.fl[6] = -0.000370743422536; + homography->data.fl[7] = -0.0184959284961; + homography->data.fl[8] = 1.0; + while (!quit) { // Récupère une image de la webcam hooks/post-receive -- krobot |