Thread: Camera bug
View Single Post
  #9   Spotlight this post!  
Unread 09-02-2012, 00:46
Method's Avatar
Method Method is offline
Registered User
no team
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Ca
Posts: 38
Method is an unknown quantity at this point
Re: Camera bug

nvm got it!



ColorImage image(IMAQ_IMAGE_RGB);
camera.GetImage(&image);
BinaryImage *thresholdImage = image.ThresholdRGB(threshold);
BinaryImage *bigObjectsImage = thresholdImage->RemoveSmallObjects(false, 2); // remove small objects (noise)
BinaryImage *convexHullImage = bigObjectsImage->ConvexHull(false); // fill in partial and full rectangles
BinaryImage *filteredImage = convexHullImage->ParticleFilter(criteria, 2); // find the rectangles
vector<ParticleAnalysisReport> *particles = filteredImage->GetOrderedParticleAnalysisReports(); // get the results

driverOut->PrintfLine(DriverStationLCD::kUser_Line2, "Target Select, numTargets: %n", (int)particles->size());
driverOut->UpdateLCD();


delete particles;
delete filteredImage;
delete convexHullImage;
delete bigObjectsImage;
delete thresholdImage;
delete &image;
Reply With Quote