Add the 2014 C++ vision classes back in

Most of the old vision code still compiles with minimal changes. I haven't
tested it extensively, since the AxisCamera class isn't done, but it
should work, as it was barely modified.

Java bindings are still TODO, since they used some JNA stuff that probably
won't work now.

Change-Id: I8edf991410cb30b932379f277cee9d329ee35009
This commit is contained in:
Thomas Clark
2014-12-23 15:55:36 -05:00
parent b4097fbd58
commit 53473e21be
21 changed files with 3635 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2014. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
#include "Vision/MonoImage.h"
#include "nivision.h"
using namespace std;
MonoImage::MonoImage() : ImageBase(IMAQ_IMAGE_U8)
{
}
MonoImage::~MonoImage()
{
}
/**
* Look for ellipses in an image.
* Given some input parameters, look for any number of ellipses in an image.
* @param ellipseDescriptor Ellipse descriptor
* @param curveOptions Curve options
* @param shapeDetectionOptions Shape detection options
* @param roi Region of Interest
* @returns a vector of EllipseMatch structures (0 length vector on no match)
*/
vector<EllipseMatch> * MonoImage::DetectEllipses(
EllipseDescriptor *ellipseDescriptor, CurveOptions *curveOptions,
ShapeDetectionOptions *shapeDetectionOptions, ROI *roi)
{
int numberOfMatches;
EllipseMatch *e = imaqDetectEllipses(m_imaqImage, ellipseDescriptor,
curveOptions, shapeDetectionOptions, roi, &numberOfMatches);
vector<EllipseMatch> *ellipses = new vector<EllipseMatch>;
if (e == NULL)
{
return ellipses;
}
for (int i = 0; i < numberOfMatches; i++)
{
ellipses->push_back(e[i]);
}
imaqDispose(e);
return ellipses;
}
vector<EllipseMatch> * MonoImage::DetectEllipses(
EllipseDescriptor *ellipseDescriptor)
{
vector<EllipseMatch> *ellipses = DetectEllipses(ellipseDescriptor, NULL,
NULL, NULL);
return ellipses;
}