Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1025 connectés 

  FORUM HardWare.fr
  Programmation
  C

  Transformer un code hors ligne en mode en ligne

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Transformer un code hors ligne en mode en ligne

n°1996019
djwa
Posté le 25-05-2010 à 16:58:32  profilanswer
 

Bonjour,  
 
j'ai un programme qui fonctionne sur un robot munie d'une webcam.
Je voudrais le modifier pour qu'il puisse fonctionner en mode hors ligne  
c'est a dire sur un pc avec une image que je lui donne et non les image fournie par la webcam.
 
Voilà le code:

Code :
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <cc3.h>
  4. #include <cc3_ilp.h>
  5. #include <cc3_color_track.h>
  6. void simple_track_color(cc3_track_pkt_t* t_pkt);
  7. int main(void) {
  8.   cc3_track_pkt_t t_pkt;
  9.   cc3_uart_init (0,
  10.   CC3_UART_RATE_115200,
  11.   CC3_UART_MODE_8N1,
  12.   CC3_UART_BINMODE_TEXT);
  13.   cc3_camera_init ();
  14.   //cc3_camera_set_colorspace(CC3_COLORSPACE_YCRCB);
  15.   cc3_camera_set_resolution(CC3_CAMERA_RESOLUTION_LOW);
  16.   //cc3_pixbuf_frame_set_subsample(CC3_SUBSAMPLE_NEAREST, 2, 2);
  17.  
  18.   // init pixbuf with width and height
  19.   cc3_pixbuf_load();
  20.   // Load in your tracking parameters
  21.   t_pkt.lower_bound.channel[CC3_CHANNEL_RED] = 150;
  22.   t_pkt.upper_bound.channel[CC3_CHANNEL_RED] = 255;
  23.   t_pkt.lower_bound.channel[CC3_CHANNEL_GREEN] = 0;
  24.   t_pkt.upper_bound.channel[CC3_CHANNEL_GREEN] = 50;
  25.   t_pkt.lower_bound.channel[CC3_CHANNEL_BLUE] = 0;
  26.   t_pkt.upper_bound.channel[CC3_CHANNEL_BLUE] = 50;
  27.   t_pkt.noise_filter = 2;
  28.  
  29.   while(true) {
  30.     simple_track_color(&t_pkt);
  31.     printf( "centroid = %d,%d bounding box = %d,%d,%d,%d num pix= %d density = %d\n",
  32.      t_pkt.centroid_x, t_pkt.centroid_y,
  33.      t_pkt.x0,t_pkt.y0,t_pkt.x1,t_pkt.y1,
  34.      t_pkt.num_pixels, t_pkt.int_density );
  35.    }
  36.  
  37. }
  38. void simple_track_color(cc3_track_pkt_t * t_pkt)
  39. {
  40.   cc3_image_t img;
  41.   img.channels = 3;
  42.   img.width = cc3_g_pixbuf_frame.width;
  43.   img.height = 1;               // image will hold just 1 row for scanline processing
  44.   img.pix = cc3_malloc_rows (1);
  45.   if (img.pix == NULL) {
  46.     return;
  47.   }
  48.     cc3_pixbuf_load ();
  49.     if (cc3_track_color_scanline_start (t_pkt) != 0) {
  50.       while (cc3_pixbuf_read_rows (img.pix, 1)) {
  51.    // This does the HSV conversion  
  52.    // cc3_rgb2hsv_row(img.pix,img.width);
  53.            cc3_track_color_scanline (&img, t_pkt);
  54.           }
  55.         }
  56.     cc3_track_color_scanline_finish (t_pkt);
  57.   free (img.pix);
  58.   return;
  59. }


 
Est ce que quelqu'un pourrais m'aider? Merci.


---------------
http://forum.hardware.fr/forum2.ph [...] w=0&nojs=0
mood
Publicité
Posté le 25-05-2010 à 16:58:32  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C

  Transformer un code hors ligne en mode en ligne

 

Sujets relatifs
Problème dans les code HTML et CSSsaut de ligne dans une base de données?
Probleme de fgets sur une lignecode vb avec BD sql
[HS] ligneGCC supprime du code à mon insu !?
Transformer une URL pour chaque utilisateurs[RESOLU]execueter un .php en ligne de commande
FREEBOX : perdu localhost après passage en mode routeurCalque sur une seule ligne
Plus de sujets relatifs à : Transformer un code hors ligne en mode en ligne


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR