View Single Post
  #3   Spotlight this post!  
Unread 21-01-2012, 10:18
Bongle's Avatar
Bongle Bongle is offline
Registered User
FRC #2702 (REBotics)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Waterloo
Posts: 1,069
Bongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond repute
Send a message via MSN to Bongle
Re: Axis Camera 206 Tracking

Here's some very basic code that declares an image, gets it from the camera, analyzes it for bright spots (areas with pixels brighter than 215), and loop through the results, sending them to output.

You will likely want to run this on a separate task, as it greatly slows down the main operatorcontrol loop and makes the robot drive less smoothly.

ColorImage image(IMAQ_IMAGE_RGB);

camera.GetImage(&image);
BinaryImage* binImage;
binImage = image.ThresholdRGB(215,256,215,256,215,256);
if (binImage)
{
vector<ParticleAnalysisReport>* vPAR = binImage->GetOrderedParticleAnalysisReports();
if (vPAR)
{
for (int i=0;i<vPAR->size();i++)
{
ParticleAnalysisReport& par = (*vPAR)[i];
if (par.particleArea > 500)
{
printf("i=%i,\tx=%d\ty=%d,\tbs=%d\r\n", i, par.center_mass_x, par.center_mass_y, (int)par.particleArea);
}
}
delete vPAR;
}
delete binImage;
}


By the way, what is the one line we need to get the tracking on the DS working? We haven't been able to get the live feed yet.
Reply With Quote