View Single Post
  #1   Spotlight this post!  
Unread 18-02-2010, 16:59
TPNigl TPNigl is offline
Registered User
FRC #0069 (Team HYPER)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Quincy, MA
Posts: 94
TPNigl is an unknown quantity at this point
Camera particleToImagePercent not working

So what we are trying to do currently is get a feed from the camera stating the percentage of the area of the soccer ball is compared to the whole camera image. I am getting odd numbers though. They have ranged from .0075 to 11.86. I have no clue how to read these and I haven't been able to find it. Also, we keep getting a watchdog error with the following code in teleopContinuous. Any ideas? Thanks everybody!

Code:
Watchdog.getInstance().feed();
         Timer.delay(10.0);
         int numParticle = 0;
         
         m_autoPeriodicLoops++;
         numParticle = 0;

         try
         {
            if (cam.freshImage())
            {
                colorImage = cam.getImage();
                binaryImage = colorImage.thresholdRGB(80, 110, 150, 180, 80, 110);
                ParticleAnalysisReport[] par = binaryImage.getOrderedParticleAnalysisReports();
                ParticleAnalysisReport par2 = par[0];

                double percentageSum, soccerBallPercentage;

                m_DriverStationLCD.println(DriverStationLCD.Line.kUser3,1,"" + par[numParticle].particleToImagePercent);
                numParticle++;

                /*for (int i=0; i<par.length-1; i++)
                 {

                    percentageSum = par2.particleToImagePercent;
                    soccerBallPercentage = percentageSum/par.length;
                 }*/
            }
         }

         catch (AxisCameraException ex)
         {
            ex.printStackTrace();
         }

         catch (NIVisionException ex)
         {
            ex.printStackTrace();
         }
__________________


2011 Pit Crew:
2011 CT Xerox Creativity Award

HYPER Alumni