Now you can download a copy of these docs so you can use them offline! Download now
VisionAPI.h
1 /********************************************************************************
2 * Project : FIRST Motor Controller
3 * File Name : VisionAPI.h
4 * Contributors : ELF, JDG, ARK, EMF
5 * Creation Date : June 22, 2008
6 * Revision History : Source code & revision history maintained at sourceforge.WPI.edu
7 * File Description : Globally defined values for the FIRST Vision API
8 *
9 * API: Because nivision.h uses C++ style comments, any file including this
10 * must be a .cpp (not .c).
11 */
12 /*----------------------------------------------------------------------------*/
13 /* Copyright (c) FIRST 2008. All Rights Reserved. */
14 /* Open Source Software - may be modified and shared by FRC teams. The code */
15 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
16 /*----------------------------------------------------------------------------*/
17 
18 #ifndef __VISIONAPI_H__
19 #define __VISIONAPI_H__
20 
21 #include "nivision.h"
22 
23 /* Constants */
24 
25 #define DEFAULT_BORDER_SIZE 3 //VisionAPI.frcCreateImage
26 #define DEFAULT_SATURATION_THRESHOLD 40 //TrackAPI.FindColor
27 
28 /* Forward Declare Data Structures */
29 typedef struct FindEdgeOptions_struct FindEdgeOptions;
30 typedef struct CircularEdgeReport_struct CircularEdgeReport;
31 
32 /* Data Structures */
33 
36  int imageHeight;
37  int imageWidth;
38  double imageTimestamp;
39  int particleIndex; // the particle index analyzed
40  /* X-coordinate of the point representing the average position of the
41  * total particle mass, assuming every point in the particle has a constant density */
42  int center_mass_x; // MeasurementType: IMAQ_MT_CENTER_OF_MASS_X
43  /* Y-coordinate of the point representing the average position of the
44  * total particle mass, assuming every point in the particle has a constant density */
45  int center_mass_y; // MeasurementType: IMAQ_MT_CENTER_OF_MASS_Y
46  double center_mass_x_normalized; //Center of mass x value normalized to -1.0 to +1.0 range
47  double center_mass_y_normalized; //Center of mass y value normalized to -1.0 to +1.0 range
48  /* Area of the particle */
49  double particleArea; // MeasurementType: IMAQ_MT_AREA
50  /* Bounding Rectangle */
51  Rect boundingRect; // left/top/width/height
52  /* Percentage of the particle Area covering the Image Area. */
53  double particleToImagePercent; // MeasurementType: IMAQ_MT_AREA_BY_IMAGE_AREA
54  /* Percentage of the particle Area in relation to its Particle and Holes Area */
55  double particleQuality; // MeasurementType: IMAQ_MT_AREA_BY_PARTICLE_AND_HOLES_AREA
57 
59 typedef struct ColorReport_struct {
60  int numberParticlesFound; // Number of particles found for this color
61  int largestParticleNumber; // The particle index of the largest particle
62  /* Color information */
63  float particleHueMax; // HistogramReport: hue max
64  float particleHueMin; // HistogramReport: hue max
65  float particleHueMean; // HistogramReport: hue mean
66  float particleSatMax; // HistogramReport: saturation max
67  float particleSatMin; // HistogramReport: saturation max
68  float particleSatMean; // HistogramReport: saturation mean
69  float particleLumMax; // HistogramReport: luminance max
70  float particleLumMin; // HistogramReport: luminance max
71  float particleLumMean; // HistogramReport: luminance mean
72 } ColorReport;
73 
74 
75 /* Image Management functions */
76 
77 /* Create: calls imaqCreateImage. Border size is set to some default value */
78 Image* frcCreateImage( ImageType type );
79 
80 /* Dispose: calls imaqDispose */
81 int frcDispose( void* object );
82 int frcDispose( const char* filename, ... ) ;
83 
84 /* Copy: calls imaqDuplicateImage */
85 int frcCopyImage( Image* dest, const Image* source );
86 
87 /* Image Extraction: Crop: calls imaqScale */
88 int frcCrop( Image* dest, const Image* source, Rect rect );
89 
90 /* Image Extraction: Scale: calls imaqScale. Scales entire image */
91 int frcScale(Image* dest, const Image* source, int xScale, int yScale, ScalingMode scaleMode );
92 
93 /* Read Image : calls imaqReadFile */
94 int frcReadImage( Image* image, const char* fileName );
95 /* Write Image : calls imaqWriteFile */
96 int frcWriteImage( const Image* image, const char* fileName);
97 
98 /* Measure Intensity functions */
99 
100 /* Histogram: calls imaqHistogram */
101 HistogramReport* frcHistogram( const Image* image, int numClasses, float min, float max, Rect rect );
102 /* Color Histogram: calls imaqColorHistogram2 */
103 ColorHistogramReport* frcColorHistogram(const Image* image, int numClasses, ColorMode mode, Image* mask);
104 
105 /* Get Pixel Value: calls imaqGetPixel */
106 int frcGetPixelValue( const Image* image, Point pixel, PixelValue* value );
107 
108 /* Particle Analysis functions */
109 
110 /* Particle Filter: calls imaqParticleFilter3 */
111 int frcParticleFilter(Image* dest, Image* source, const ParticleFilterCriteria2* criteria,
112  int criteriaCount, const ParticleFilterOptions* options, Rect rect, int* numParticles);
113 int frcParticleFilter(Image* dest, Image* source, const ParticleFilterCriteria2* criteria,
114  int criteriaCount, const ParticleFilterOptions* options, int* numParticles);
115 /* Morphology: calls imaqMorphology */
116 int frcMorphology(Image* dest, Image* source, MorphologyMethod method);
117 int frcMorphology(Image* dest, Image* source, MorphologyMethod method, const StructuringElement* structuringElement);
118 /* Reject Border: calls imaqRejectBorder */
119 int frcRejectBorder(Image* dest, Image* source);
120 int frcRejectBorder(Image* dest, Image* source, int connectivity8);
121 /* Count Particles: calls imaqCountParticles */
122 int frcCountParticles(Image* image, int* numParticles);
123 /* Particle Analysis Report: calls imaqMeasureParticle */
124 int frcParticleAnalysis(Image* image, int particleNumber, ParticleAnalysisReport* par);
125 
126 /* Image Enhancement functions */
127 
128 /* Equalize: calls imaqEqualize */
129 int frcEqualize(Image* dest, const Image* source, float min, float max);
130 int frcEqualize(Image* dest, const Image* source, float min, float max, const Image* mask);
131 
132 /* Color Equalize: calls imaqColorEqualize */
133 int frcColorEqualize(Image* dest, const Image* source);
134 int frcColorEqualize(Image* dest, const Image* source, int colorEqualization);
135 
136 /* Image Thresholding & Conversion functions */
137 
138 /* Smart Threshold: calls imaqLocalThreshold */
139 int frcSmartThreshold(Image* dest, const Image* source, unsigned int windowWidth, unsigned int windowHeight,
140  LocalThresholdMethod method, double deviationWeight, ObjectType type);
141 int frcSmartThreshold(Image* dest, const Image* source, unsigned int windowWidth, unsigned int windowHeight,
142  LocalThresholdMethod method, double deviationWeight, ObjectType type, float replaceValue);
143 
144 /* Simple Threshold: calls imaqThreshold */
145 int frcSimpleThreshold(Image* dest, const Image* source, float rangeMin, float rangeMax, float newValue);
146 int frcSimpleThreshold(Image* dest, const Image* source, float rangeMin, float rangeMax);
147 
148 /* Color/Hue Threshold: calls imaqColorThreshold */
149 int frcColorThreshold(Image* dest, const Image* source, ColorMode mode,
150  const Range* plane1Range, const Range* plane2Range, const Range* plane3Range);
151 int frcColorThreshold(Image* dest, const Image* source, int replaceValue, ColorMode mode,
152  const Range* plane1Range, const Range* plane2Range, const Range* plane3Range);
153 int frcHueThreshold(Image* dest, const Image* source, const Range* hueRange);
154 int frcHueThreshold(Image* dest, const Image* source, const Range* hueRange, int minSaturation);
155 
156 /* Extract ColorHue Plane: calls imaqExtractColorPlanes */
157 int frcExtractColorPlanes(const Image* image, ColorMode mode, Image* plane1, Image* plane2, Image* plane3);
158 int frcExtractHuePlane(const Image* image, Image* huePlane);
159 int frcExtractHuePlane(const Image* image, Image* huePlane, int minSaturation);
160 
161 #endif
162 
163 

Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by doxygen 1.8.6