WPILib 2012
WPILibRoboticsLibraryforFRC
Vision/BinaryImage.h
00001 /*----------------------------------------------------------------------------*/
00002 /* Copyright (c) FIRST 2008. All Rights Reserved.                                                         */
00003 /* Open Source Software - may be modified and shared by FRC teams. The code   */
00004 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */
00005 /*----------------------------------------------------------------------------*/
00006 
00007 #ifndef __BINARY_IMAGE_H__
00008 #define __BINARY_IMAGE_H__
00009 
00010 #include "MonoImage.h"
00015 #include "Vision2009/VisionAPI.h"
00016 
00017 #include <vector>
00018 #include <algorithm>
00019 using namespace std;
00020 
00021 class BinaryImage : public MonoImage
00022 {
00023 public:
00024         BinaryImage();
00025         virtual ~BinaryImage();
00026         int GetNumberParticles();
00027         ParticleAnalysisReport GetParticleAnalysisReport(int particleNumber);
00028         void GetParticleAnalysisReport(int particleNumber, ParticleAnalysisReport *par);
00029         vector<ParticleAnalysisReport>* GetOrderedParticleAnalysisReports();
00030         virtual void Write(const char *fileName);
00031 private:
00032         bool ParticleMeasurement(int particleNumber, MeasurementType whatToMeasure, int *result);
00033         bool ParticleMeasurement(int particleNumber, MeasurementType whatToMeasure, double *result);
00034         static double NormalizeFromRange(double position, int range);
00035         static bool CompareParticleSizes(ParticleAnalysisReport particle1, ParticleAnalysisReport particle2);
00036 };
00037 
00038 #endif
 All Classes Functions Variables