Changeset 417

Show
Ignore:
Timestamp:
02/17/07 17:21:57 (2 years ago)
Author:
anthony_rowe
Message:

noise filter

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/cc3-ilp/cc3_color_track.c

    r399 r417  
    6767 
    6868      if (cc3_g_pixbuf_frame.coi == CC3_CHANNEL_ALL) { 
    69         if (pixel[0] >= pkt->lower_bound.channel[0] 
     69         if (pixel[0] >= pkt->lower_bound.channel[0] 
    7070            && pixel[0] <= pkt->upper_bound.channel[0] 
    7171            && pixel[1] >= pkt->lower_bound.channel[1] 
     
    7474            && pixel[2] <= pkt->upper_bound.channel[2]) 
    7575          pixel_good = 1; 
    76            
    77           pixel += 3; 
     76       
     77        pixel += 3; 
    7878      } 
    7979      else { 
     
    8787      } 
    8888 
     89      if(pkt->track_invert==1) pixel_good=!pixel_good; 
    8990      if (pixel_good) { 
    9091        pkt->num_pixels++; 
     
    156157{ 
    157158  uint32_t x, y; 
     159  uint8_t seq_count; 
    158160 
    159161  for (x = 0; x < MAX_BINARY_WIDTH; x++) 
     
    161163 
    162164  for (y = pkt->scratch_y; y < (pkt->scratch_y + img->height); y++) 
     165  { 
     166    seq_count=0; 
    163167    for (x = 0; x < img->width; x++) { 
    164168      bool pixel_good = 0; 
     
    183187      } 
    184188 
     189      if(pkt->track_invert==1) pixel_good=!pixel_good; 
    185190      /*      pkt->binary_scanline[0]=0x01020304;  
    186191         pkt->binary_scanline[1]=0x05060708;  
     
    188193         pkt->binary_scanline[3]=0x0D0E0F10;  
    189194         pkt->binary_scanline[4]=0x11121314;  
    190        */ if (pixel_good) { 
     195       */ 
     196       if(pixel_good) 
     197       { 
     198             if(  seq_count<255) seq_count++; 
     199       } else seq_count=0; 
     200       
     201       if (pixel_good && seq_count>pkt->noise_filter) { 
    191202        uint8_t block, offset; 
    192203        block = x / 8; 
     
    207218      } 
    208219    } 
    209  
     220  } 
    210221  pkt->scratch_y = y; 
    211222 
  • trunk/lib/cc3-ilp/cc3_color_track.h

    r302 r417  
    3434    uint32_t int_density; 
    3535    uint8_t noise_filter; 
     36    bool track_invert; 
    3637    uint8_t binary_scanline[MAX_BINARY_WIDTH]; 
    3738    cc3_pixel_t upper_bound; 
  • trunk/projects/cmucam2/cmucam2.c

    r416 r417  
    5151  GET_WINDOW, 
    5252  LED_0, 
     53  NOISE_FILTER, 
    5354  TRACK_INVERT, 
    5455  CMUCAM2_CMD_END               // Must be last entry so array sizes are correct 
     
    8788  line_mode = false; 
    8889  t_pkt.track_invert = false; 
     90  t_pkt.noise_filter = 0; 
    8991  t_pkt.lower_bound.channel[0] = 16; 
    9092  t_pkt.upper_bound.channel[0] = 240; 
     
    204206                t_pkt.track_invert=1; 
    205207        break; 
    206  
     208  
     209     case NOISE_FILTER: 
     210        if (n != 1 ) { 
     211          error = true; 
     212          break; 
     213        } 
     214        else 
     215          print_ACK (); 
     216          t_pkt.noise_filter=arg_list[0]; 
     217        break; 
    207218 
    208219      case LINE_MODE: 
     
    661672  cmucam2_cmds[TRACK_WINDOW] = "TW"; 
    662673  cmucam2_cmds[GET_WINDOW] = "GW"; 
     674  cmucam2_cmds[NOISE_FILTER] = "NF"; 
    663675  cmucam2_cmds[GET_TRACK] = "GT"; 
    664676  cmucam2_cmds[LED_0] = "L0";