Add format script which invokes clang-format on the C++ source code (#41)

On Windows machines, clang-format.exe must be in the PATH environment variable.
This commit is contained in:
Tyler Veness
2016-05-20 17:30:37 -07:00
committed by Peter Johnson
parent 68690643d2
commit e14e45da76
383 changed files with 13787 additions and 13198 deletions

View File

@@ -7,8 +7,8 @@
#pragma once
#include <thread>
#include <string>
#include <thread>
#include "HAL/cpp/priority_mutex.h"
#include "ErrorBase.h"
@@ -49,7 +49,7 @@ class AxisCamera : public ErrorBase {
enum Rotation { kRotation_0, kRotation_180 };
explicit AxisCamera(std::string const &cameraHost);
explicit AxisCamera(std::string const& cameraHost);
virtual ~AxisCamera();
AxisCamera(const AxisCamera&) = delete;
@@ -57,11 +57,11 @@ class AxisCamera : public ErrorBase {
bool IsFreshImage() const;
int GetImage(Image *image);
int GetImage(ColorImage *image);
HSLImage *GetImage();
int CopyJPEG(char **destImage, unsigned int &destImageSize,
unsigned int &destImageBufferSize);
int GetImage(Image* image);
int GetImage(ColorImage* image);
HSLImage* GetImage();
int CopyJPEG(char** destImage, unsigned int& destImageSize,
unsigned int& destImageBufferSize);
void WriteBrightness(int brightness);
int GetBrightness();
@@ -119,5 +119,5 @@ class AxisCamera : public ErrorBase {
void ReadImagesFromCamera();
bool WriteParameters();
int CreateCameraSocket(std::string const &requestString, bool setError);
int CreateCameraSocket(std::string const& requestString, bool setError);
};

View File

@@ -41,7 +41,7 @@ typedef enum DebugOutputType_enum {
/* debug */
void SetDebugFlag(DebugOutputType flag);
void dprintf(const char *tempString, ...); /* Variable argument list */
void dprintf(const char* tempString, ...); /* Variable argument list */
/* set FRC ranges for drive */
double RangeToNormalized(double pixel, int range);
@@ -50,18 +50,18 @@ float NormalizeToRange(float normalizedValue, float minRange, float maxRange);
float NormalizeToRange(float normalizedValue);
/* system utilities */
void ShowActivity(char *fmt, ...);
void ShowActivity(char* fmt, ...);
double ElapsedTime(double startTime);
/* servo panning utilities */
class Servo;
double SinPosition(double *period, double sinStart);
double SinPosition(double* period, double sinStart);
void panInit();
void panInit(double period);
void panForTarget(Servo *panServo);
void panForTarget(Servo *panServo, double sinStart);
void panForTarget(Servo* panServo);
void panForTarget(Servo* panServo, double sinStart);
/* config file read utilities */
int processFile(char *inputFile, char *outputString, int lineNumber);
int emptyString(char *string);
void stripString(char *string);
int processFile(char* inputFile, char* outputString, int lineNumber);
int emptyString(char* string);
void stripString(char* string);

View File

@@ -14,8 +14,8 @@
*/
#include "Vision/VisionAPI.h"
#include <vector>
#include <algorithm>
#include <vector>
class BinaryImage : public MonoImage {
public:
@@ -23,20 +23,20 @@ class BinaryImage : public MonoImage {
int GetNumberParticles();
ParticleAnalysisReport GetParticleAnalysisReport(int particleNumber);
void GetParticleAnalysisReport(int particleNumber,
ParticleAnalysisReport *par);
std::vector<ParticleAnalysisReport> *GetOrderedParticleAnalysisReports();
BinaryImage *RemoveSmallObjects(bool connectivity8, int erosions);
BinaryImage *RemoveLargeObjects(bool connectivity8, int erosions);
BinaryImage *ConvexHull(bool connectivity8);
BinaryImage *ParticleFilter(ParticleFilterCriteria2 *criteria,
ParticleAnalysisReport* par);
std::vector<ParticleAnalysisReport>* GetOrderedParticleAnalysisReports();
BinaryImage* RemoveSmallObjects(bool connectivity8, int erosions);
BinaryImage* RemoveLargeObjects(bool connectivity8, int erosions);
BinaryImage* ConvexHull(bool connectivity8);
BinaryImage* ParticleFilter(ParticleFilterCriteria2* criteria,
int criteriaCount);
virtual void Write(const char *fileName);
virtual void Write(const char* fileName);
private:
bool ParticleMeasurement(int particleNumber, MeasurementType whatToMeasure,
int *result);
int* result);
bool ParticleMeasurement(int particleNumber, MeasurementType whatToMeasure,
double *result);
double* result);
static double NormalizeFromRange(double position, int range);
static bool CompareParticleSizes(ParticleAnalysisReport particle1,
ParticleAnalysisReport particle2);

View File

@@ -7,65 +7,65 @@
#pragma once
#include "ImageBase.h"
#include "BinaryImage.h"
#include "ImageBase.h"
#include "Threshold.h"
class ColorImage : public ImageBase {
public:
ColorImage(ImageType type);
virtual ~ColorImage() = default;
BinaryImage *ThresholdRGB(int redLow, int redHigh, int greenLow,
BinaryImage* ThresholdRGB(int redLow, int redHigh, int greenLow,
int greenHigh, int blueLow, int blueHigh);
BinaryImage *ThresholdHSL(int hueLow, int hueHigh, int saturationLow,
BinaryImage* ThresholdHSL(int hueLow, int hueHigh, int saturationLow,
int saturationHigh, int luminenceLow,
int luminenceHigh);
BinaryImage *ThresholdHSV(int hueLow, int hueHigh, int saturationLow,
BinaryImage* ThresholdHSV(int hueLow, int hueHigh, int saturationLow,
int saturationHigh, int valueHigh, int valueLow);
BinaryImage *ThresholdHSI(int hueLow, int hueHigh, int saturationLow,
BinaryImage* ThresholdHSI(int hueLow, int hueHigh, int saturationLow,
int saturationHigh, int intensityLow,
int intensityHigh);
BinaryImage *ThresholdRGB(Threshold &threshold);
BinaryImage *ThresholdHSL(Threshold &threshold);
BinaryImage *ThresholdHSV(Threshold &threshold);
BinaryImage *ThresholdHSI(Threshold &threshold);
MonoImage *GetRedPlane();
MonoImage *GetGreenPlane();
MonoImage *GetBluePlane();
MonoImage *GetHSLHuePlane();
MonoImage *GetHSVHuePlane();
MonoImage *GetHSIHuePlane();
MonoImage *GetHSLSaturationPlane();
MonoImage *GetHSVSaturationPlane();
MonoImage *GetHSISaturationPlane();
MonoImage *GetLuminancePlane();
MonoImage *GetValuePlane();
MonoImage *GetIntensityPlane();
void ReplaceRedPlane(MonoImage *plane);
void ReplaceGreenPlane(MonoImage *plane);
void ReplaceBluePlane(MonoImage *plane);
void ReplaceHSLHuePlane(MonoImage *plane);
void ReplaceHSVHuePlane(MonoImage *plane);
void ReplaceHSIHuePlane(MonoImage *plane);
void ReplaceHSLSaturationPlane(MonoImage *plane);
void ReplaceHSVSaturationPlane(MonoImage *plane);
void ReplaceHSISaturationPlane(MonoImage *plane);
void ReplaceLuminancePlane(MonoImage *plane);
void ReplaceValuePlane(MonoImage *plane);
void ReplaceIntensityPlane(MonoImage *plane);
BinaryImage* ThresholdRGB(Threshold& threshold);
BinaryImage* ThresholdHSL(Threshold& threshold);
BinaryImage* ThresholdHSV(Threshold& threshold);
BinaryImage* ThresholdHSI(Threshold& threshold);
MonoImage* GetRedPlane();
MonoImage* GetGreenPlane();
MonoImage* GetBluePlane();
MonoImage* GetHSLHuePlane();
MonoImage* GetHSVHuePlane();
MonoImage* GetHSIHuePlane();
MonoImage* GetHSLSaturationPlane();
MonoImage* GetHSVSaturationPlane();
MonoImage* GetHSISaturationPlane();
MonoImage* GetLuminancePlane();
MonoImage* GetValuePlane();
MonoImage* GetIntensityPlane();
void ReplaceRedPlane(MonoImage* plane);
void ReplaceGreenPlane(MonoImage* plane);
void ReplaceBluePlane(MonoImage* plane);
void ReplaceHSLHuePlane(MonoImage* plane);
void ReplaceHSVHuePlane(MonoImage* plane);
void ReplaceHSIHuePlane(MonoImage* plane);
void ReplaceHSLSaturationPlane(MonoImage* plane);
void ReplaceHSVSaturationPlane(MonoImage* plane);
void ReplaceHSISaturationPlane(MonoImage* plane);
void ReplaceLuminancePlane(MonoImage* plane);
void ReplaceValuePlane(MonoImage* plane);
void ReplaceIntensityPlane(MonoImage* plane);
void ColorEqualize();
void LuminanceEqualize();
private:
BinaryImage *ComputeThreshold(ColorMode colorMode, int low1, int high1,
BinaryImage* ComputeThreshold(ColorMode colorMode, int low1, int high1,
int low2, int high2, int low3, int high3);
void Equalize(bool allPlanes);
MonoImage *ExtractColorPlane(ColorMode mode, int planeNumber);
MonoImage *ExtractFirstColorPlane(ColorMode mode);
MonoImage *ExtractSecondColorPlane(ColorMode mode);
MonoImage *ExtractThirdColorPlane(ColorMode mode);
void ReplacePlane(ColorMode mode, MonoImage *plane, int planeNumber);
void ReplaceFirstColorPlane(ColorMode mode, MonoImage *plane);
void ReplaceSecondColorPlane(ColorMode mode, MonoImage *plane);
void ReplaceThirdColorPlane(ColorMode mode, MonoImage *plane);
MonoImage* ExtractColorPlane(ColorMode mode, int planeNumber);
MonoImage* ExtractFirstColorPlane(ColorMode mode);
MonoImage* ExtractSecondColorPlane(ColorMode mode);
MonoImage* ExtractThirdColorPlane(ColorMode mode);
void ReplacePlane(ColorMode mode, MonoImage* plane, int planeNumber);
void ReplaceFirstColorPlane(ColorMode mode, MonoImage* plane);
void ReplaceSecondColorPlane(ColorMode mode, MonoImage* plane);
void ReplaceThirdColorPlane(ColorMode mode, MonoImage* plane);
};

View File

@@ -15,6 +15,6 @@
class HSLImage : public ColorImage {
public:
HSLImage();
HSLImage(const char *fileName);
HSLImage(const char* fileName);
virtual ~HSLImage() = default;
};

View File

@@ -8,8 +8,8 @@
#pragma once
#include <stdio.h>
#include "nivision.h"
#include "ErrorBase.h"
#include "nivision.h"
#define DEFAULT_BORDER_SIZE 3
@@ -17,11 +17,11 @@ class ImageBase : public ErrorBase {
public:
ImageBase(ImageType type);
virtual ~ImageBase();
virtual void Write(const char *fileName);
virtual void Write(const char* fileName);
int GetHeight();
int GetWidth();
Image *GetImaqImage();
Image* GetImaqImage();
protected:
Image *m_imaqImage;
Image* m_imaqImage;
};

View File

@@ -16,9 +16,9 @@ class MonoImage : public ImageBase {
MonoImage();
virtual ~MonoImage() = default;
std::vector<EllipseMatch> *DetectEllipses(
EllipseDescriptor *ellipseDescriptor, CurveOptions *curveOptions,
ShapeDetectionOptions *shapeDetectionOptions, ROI *roi);
std::vector<EllipseMatch> *DetectEllipses(
EllipseDescriptor *ellipseDescriptor);
std::vector<EllipseMatch>* DetectEllipses(
EllipseDescriptor* ellipseDescriptor, CurveOptions* curveOptions,
ShapeDetectionOptions* shapeDetectionOptions, ROI* roi);
std::vector<EllipseMatch>* DetectEllipses(
EllipseDescriptor* ellipseDescriptor);
};

View File

@@ -15,6 +15,6 @@
class RGBImage : public ColorImage {
public:
RGBImage();
RGBImage(const char *fileName);
RGBImage(const char* fileName);
virtual ~RGBImage() = default;
};

View File

@@ -9,18 +9,18 @@
#include "nivision.h"
/* Constants */
/* Constants */
#define DEFAULT_BORDER_SIZE 3 // VisionAPI.frcCreateImage
#define DEFAULT_BORDER_SIZE 3 // VisionAPI.frcCreateImage
#define DEFAULT_SATURATION_THRESHOLD 40 // TrackAPI.FindColor
/* Forward Declare Data Structures */
/* Forward Declare Data Structures */
typedef struct FindEdgeOptions_struct FindEdgeOptions;
typedef struct CircularEdgeReport_struct CircularEdgeReport;
/* Data Structures */
/* Data Structures */
/** frcParticleAnalysis returns this structure */
/** frcParticleAnalysis returns this structure */
typedef struct ParticleAnalysisReport_struct {
int imageHeight;
int imageWidth;
@@ -28,12 +28,14 @@ typedef struct ParticleAnalysisReport_struct {
int particleIndex; // the particle index analyzed
/* X-coordinate of the point representing the average position of the
* total particle mass, assuming every point in the particle has a constant
* density */
* density
*/
int center_mass_x; // MeasurementType: IMAQ_MT_CENTER_OF_MASS_X
/* Y-coordinate of the point representing the average position of the
* total particle mass, assuming every point in the particle has a constant
* density */
int center_mass_y; // MeasurementType: IMAQ_MT_CENTER_OF_MASS_Y
* density
*/
int center_mass_y; // MeasurementType: IMAQ_MT_CENTER_OF_MASS_Y
double center_mass_x_normalized; // Center of mass x value normalized to -1.0
// to +1.0 range
double center_mass_y_normalized; // Center of mass y value normalized to -1.0
@@ -66,7 +68,7 @@ typedef struct ColorReport_struct {
float particleLumMean; // HistogramReport: luminance mean
} ColorReport;
/* Image Management functions */
/* Image Management functions */
/* Create: calls imaqCreateImage. Border size is set to some default value */
Image* frcCreateImage(ImageType type);
@@ -90,7 +92,7 @@ int frcReadImage(Image* image, const char* fileName);
/* Write Image : calls imaqWriteFile */
int frcWriteImage(const Image* image, const char* fileName);
/* Measure Intensity functions */
/* Measure Intensity functions */
/* Histogram: calls imaqHistogram */
HistogramReport* frcHistogram(const Image* image, int numClasses, float min,
@@ -102,7 +104,7 @@ ColorHistogramReport* frcColorHistogram(const Image* image, int numClasses,
/* Get Pixel Value: calls imaqGetPixel */
int frcGetPixelValue(const Image* image, Point pixel, PixelValue* value);
/* Particle Analysis functions */
/* Particle Analysis functions */
/* Particle Filter: calls imaqParticleFilter3 */
int frcParticleFilter(Image* dest, Image* source,
@@ -126,7 +128,7 @@ int frcCountParticles(Image* image, int* numParticles);
int frcParticleAnalysis(Image* image, int particleNumber,
ParticleAnalysisReport* par);
/* Image Enhancement functions */
/* Image Enhancement functions */
/* Equalize: calls imaqEqualize */
int frcEqualize(Image* dest, const Image* source, float min, float max);
@@ -137,7 +139,7 @@ int frcEqualize(Image* dest, const Image* source, float min, float max,
int frcColorEqualize(Image* dest, const Image* source);
int frcColorEqualize(Image* dest, const Image* source, int colorEqualization);
/* Image Thresholding & Conversion functions */
/* Image Thresholding & Conversion functions */
/* Smart Threshold: calls imaqLocalThreshold */
int frcSmartThreshold(Image* dest, const Image* source,