|
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.
|