Commit 9c0967be 张士柳

1 个父辈 4ac30f0e
......@@ -523,12 +523,6 @@ int eyemRobustFitCircle(int iPtnNum, EyemOcsDXY *taPoints, int iCalcMode, double
return FUNC_OK;
}
int eyemRobustFitPlane(int iPtnNum, EyemOcsDXYZ *taPoint, int iCalcMode, double dRobustCoef, EyemOcsDABCD &tpPlane)
{
return FUNC_OK;
}
int eyemFitPlane(int iPtnNum, EyemOcsDXYZ *taPoint, int numToIgnore, double &dRMS, EyemOcsDABCD &tpPlane)
{
......
......@@ -432,7 +432,7 @@ extern "C" {
EXPORTS int eyemRobustFitLine(int iPtnNum, EyemOcsDXY *taPoint, int iCalcMode, double dRobustCoef, EyemOcsDABC &tpLine);
EXPORTS int eyemFitCircle(int iPtnNum, EyemOcsDXY *taPoint, int numToIgnore, double &dRMS, EyemOcsDXYR &tpCircle);
EXPORTS int eyemRobustFitCircle(int iPtnNum, EyemOcsDXY *taPoint, int iCalcMode, double dRobustCoef, EyemOcsDXYR &tpCircle);
EXPORTS int eyemFitPlane(int, EyemOcsDXYZ[], int, double, EyemOcsDABCD &);
EXPORTS int eyemFitPlane(int iPtnNum, EyemOcsDXYZ *taPoint, int iCalcMode, double &dRMS, EyemOcsDABCD &tpPlane);
EXPORTS int eyemFitEllipse(int, EyemOcsDXY[], int, double, EyemOcsDXYLSQ *);
EXPORTS int eyemFitEllipseC(int, EyemOcsDXY[], int, double, double[]);
EXPORTS int eyemFitConics(int, EyemOcsDXY[], int, double, double[]);
......
此文件类型无法预览
#pragma once
//
// eyemLib·标头
//
#ifndef __EYEM_LIB_H
#define __EYEM_LIB_H
//#include <Windows.h>
#include <opencv.hpp>
#ifndef EXPORTS
#define EXPORTS __declspec(dllexport)
#endif
#ifndef MAKETYPE
#define MAKETYPE CV_MAKETYPE
#endif
/********************************************************************************************/
/* 通用标头 */
/********************************************************************************************/
// 一般定义
#define FUNC_OK 0 // 正常
#define FUNC_NOT_ENOUGH_MEM (-1) // 工作内存不足
#define FUNC_ILLEGAL_ARGUMENT (-2) // 参数不合适
#define FUNC_IMAGE_NOT_EXIST (-3) // 图像不存在
#define FUNC_CANNOT_CALC (-100) // 不可计算
#define FUNC_CANNOT_USE (-999) // 不可用
// 错误代码 (识别解码)
#define FUNC_FAILED_DETECT (-4) // 未识别到
#define FUNC_FAILED_DECODE (-5) // 未能解码
// 错误代码(矩阵计算)
#define FUNC_DET_EQ_ZERO (-110) // 矩阵表达式为零
#define FUNC_FAILED_EIGEN (-111) // 特征值和特征向量计算失败
#define FUNC_FAILED_SVD (-112) // 奇异值分解计算失败
#define FUNC_FAILED_CHOLESKY (-113) // CHOLESKY分解计算失败
// 错误代码(近似计算)
#define FUNC_FAILED_ROBUST (-130) // 稳健估计失败
#define FUNC_FAILED_ELLIPSE (-131) // 不是椭圆形的
#define FUNC_FAILED_ELLIPSOID (-132) // 不是椭圆体
#define FUNC_FAILED_CONE (-133) // 不是在锥面
// 错误代码(摄像机校准)
#define FUNC_FAILED_HOMOGRAPHY (-150) // 同源矩阵计算失败
#define FUNC_FAILED_CAM_PRM (-151) // 摄像机参数计算失败
#define FUNC_FAILED_BUNDLE_ADJ (-152) // バンドル調整失敗
#define FUNC_FAILED_UNDISTORT (-153) // 失真校正失败
// 常数
#define EPS 1.0e-9 // ε
#define DBL_EPS DBL_EPSILON // ε
#define PI 3.1415926535897932384626433832795 // π
#define PI_DEG 180.0 // π(deg)
#define RAD2DEG (PI_DEG/PI) // rad→deg变换
#define DEG2RAD (PI/PI_DEG) // deg→rad变换
#define TWO_PI (2.0*PI) // 2π
#define PI_BY_2 (PI/2.0) // π/2
#ifndef MIN
#define MIN( a, b ) ( ((a) < (b)) ? (a) : (b) )
#endif
#ifndef MAX
#define MAX( a, b ) ( ((a) > (b)) ? (a) : (b) )
#endif
#ifndef SGN
#define SGN( a ) ( ((a) >= (0)) ? (1) : (-1) )
#endif
#ifndef COMPARE
#define COMPARE( a, b ) ( ((a) > (b)) ? (true) : (false) )
#endif
#define ON 1
#define OFF 0
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#ifndef IntPtr
typedef intptr_t IntPtr;
#endif
//#ifndef LPSTR
//typedef char* LPSTR;
//#endif
// 图像边界处理
#ifndef __EYEM_BORDER
#define __EYEM_BORDER
enum {
EYEM_BORDER_NONE, // 不执行边界处理
EYEM_BORDER_REPLICATE, // 延长最外周灰度值
EYEM_BORDER_REFLECT, // 镜像(相对于最外边缘对称复制)
EYEM_BORDER_ZERO // 填充零灰度
};
#endif
// 图像信息
typedef struct {
void *vpImage; // 地址
int iWidth; // 图像内存 x 方向大小
int iHeight; // 图像内存 y 方向大小
int iDepth; // 图像位深度(参见说明)
int iChannels; // 图像通道数
} EyemImage;
// 矩形定义
typedef struct {
int iXs; // 起始点(左上角) x 坐标
int iYs; // 起始点(左上角) y 坐标
int iWidth; // x 方向大小(宽度)
int iHeight; // y 方向大小(高度)
} EyemRect;
typedef struct {
int iXs; // 起始点(左上角) x 坐标
int iYs; // 起始点(左上角) y 坐标
int iXe; // 端点(右下) x 坐标
int iYe; // 端点(右下) y 坐标
} EyemRect2;
// 矩形定义
typedef struct {
int iXs; // 起始点(左上角) x 坐标
int iYs; // 起始点(左上角) y 坐标
int iWidth; // x 方向大小(宽度)
int iHeight; // y 方向大小(高度)
double dVar; // 可能会使用的值
} EyemRect3;
///////////////////////////////////////////////////////////////////////////////
// Orthogonal Coordinate System
/////////////////////
// int type
//
typedef struct {
int iX; // X坐标
int iY; // Y坐标
} EyemOcsIXY;
typedef struct {
int iX; // X坐标
int iY; // Y坐标
int iZ; // Z坐标
} EyemOcsIXYZ;
typedef struct {
int iX; // X坐标
int iY; // Y坐标
int iQ; // θ
} EyemOcsIXYQ;
typedef struct {
int iX; // X坐标
int iY; // Y坐标
int iR; // 半径
} EyemOcsIXYR; // 用于表示圆
typedef struct {
int iA; // a
int iB; // b
int iC; // c
} EyemOcsIABC; // 用于表示直线(一般形式)
typedef struct {
int iR; // ρ
int iQ; // θ
} EyemOcsIRQ; // 用于表示直线(黑森标准形式)或矢量
typedef struct {
int iX; // X坐标(単位:像素)
int iY; // Y坐标(単位:像素)
int iQ; // 斜率(単位:rad)
int iS; // 刻度
} EyemOcsIXYQS;
/////////////////////
// float type
//
typedef struct {
float fX; // X坐标
float fY; // Y坐标
} EyemOcsFXY;
typedef struct {
float fX; // X坐标
float fY; // Y坐标
float fZ; // Z坐标
} EyemOcsFXYZ;
typedef struct {
float fX; // X坐标
float fY; // Y坐标
float fQ; // θ
} EyemOcsFXYQ;
typedef struct {
float fX; // X坐标
float fY; // Y坐标
float fR; // 半径
} EyemOcsFXYR; // 用于表示圆
typedef struct {
float fA; // a
float fB; // b
float fC; // c
} EyemOcsFABC; // 用于表示直线(一般形式)
typedef struct {
float fR; // ρ
float fQ; // θ
} EyemOcsFRQ; // 用于表示直线(黑森标准形式)或矢量
typedef struct {
float fX; // X坐标(単位:像素)
float fY; // Y坐标(単位:像素)
float fQ; // 斜率(単位:rad)
float fS; // 刻度
} EyemOcsFXYQS;
/////////////////////
// double type
//
typedef struct {
double dX; // X坐标
double dY; // Y坐标
} EyemOcsDXY;
typedef struct {
double dX; // X坐标
double dY; // Y坐标
double dZ; // Z坐标
} EyemOcsDXYZ;
typedef struct {
double dX; // X坐标
double dY; // Y坐标
double dQ; // θ
} EyemOcsDXYQ;
typedef struct {
double dX; // 中心X坐标
double dY; // 中心Y坐标
double dR; // 半径
} EyemOcsDXYR; // 用于表示圆
typedef struct {
double dA; // a
double dB; // b
double dC; // c
} EyemOcsDABC; // 用于表示直线(一般形式)
typedef struct {
double dR; // ρ
double dQ; // θ
} EyemOcsDRQ; // 用于表示直线(黑森标准形状)和矢量
typedef struct {
double dX; // X坐标
double dY; // Y坐标
double dQ; // 旋转角度(单位:rad)
double dS; // 缩放
} EyemOcsDXYQS;
typedef struct {
double dA; // a
double dB; // b
double dC; // c
double dD; // d
} EyemOcsDABCD; // 用于表示平面(一般形式)
typedef struct {
double dXo; // 中心 X 坐标
double dYo; // 中心 Y 坐标
double dL; // 长轴半径
double dS; // 短軸半径
double dQ; // 长轴的斜率(单位:rad)
} EyemOcsDXYLSQ; // 用于表示椭圆
typedef struct {
EyemOcsDXYZ tP; // 直线上一点的坐标
EyemOcsDXYZ tV; // 直线方向矢量
} EyemOcsDPV; // 用于表示三维空间中的直线
typedef struct {
EyemOcsDXYZ tC; // 椭圆体中心
EyemOcsDXYZ tR; // 轴半径(dX:长轴、dY:中轴、dZ:短轴)
double dU; // 长轴投影到 XY 平面与 X 轴的角(单位:rad)
double dV; // 长轴与XY平面之角(单位:rad)
double dW; // 绕长轴旋转角度(单位:rad)
} EyemOcsDCRUVW; // 用于表示椭圆体
/********************************************************************************************/
/* 每个特定于源的标头 */
/********************************************************************************************/
//////////////////////////////////////////////////////////////////////////////////////////////
// 数学计算实用程序(eyemMath.cpp)
//
#ifdef __cplusplus
extern "C" {
#endif
double eyemMathCalcInnerProduct(int, double[], double[]);
void eyemMathCalcOuterProduct(double[], double[], double[]);
int eyemMathCalcAngle(int, double[], double[], double *);
double eyemMathCalcNorm(int, double[]);
double eyemMathCalcArgument(double[]);
int eyemMathNormalization(int, double[]);
int eyemMathStat(int, double[], double *, double *, double *);
double eyemMathMedianI(int, int *);
double eyemMathMedianD(int, double *);
int eyemMathOtsuThreshold1d(int, double[], double *);
double eyemMathAreaTriangle(double, double, double, double, double, double);
double eyemMathSignAreaTriangle(double, double, double, double, double, double);
void eyemMathRotatePoint(double, double, double, double, double, double *, double *);
void eyemMathCreateTransParam(int, double, double, double, double, double *, double *, double *);
void eyemMathTransCoordOfPoint(double, double, double, double, double, double *, double *);
void eyemMathInvTransCoordOfPoint(double, double, double, double, double, double *, double *);
void eyemMathComposeCoord(double, double, double, double, double, double, double *, double *, double *);
double eyemMathInvMatrixOfSyn3X3(double[][3], double[][3]);
void eyemMathInvCoord(double, double, double, double *, double *, double *);
double eyemMathGetDistFromPointToPoint(double, double, double, double);
double eyemMathGetDistFromPointToLine(double, double, double, double, double);
double eyemMathGetDistAndCrossPointFromPointToLine(double, double, double, double, double, double *, double *);
double eyemMathGetDistFromPointToCircle(double, double, double, double, double, double *, double *);
int eyemMathGetDistFromPointToEllipse(double, double, double, double, double, double, double, double *, double *, double *);
int eyemMathCrossPoint(double, double, double, double, double, double, double *, double *);
void eyemMathTransAbcToRq(double, double, double, double *, double *);
double eyemMathCrossAngle(double, double, double, double, double, double);
int eyemMathGetLineFrom2Points(double, double, double, double, double *, double *, double *);
void eyemMathGetOrthogonalLineFromLineAndPoint(double, double, double, double, double *, double *, double *);
int eyemMathCheckAngle(double, double, double);
double eyemMathAddAngle(int, int, double, double);
double eyemMathPrimeAngle(int, int, double);
double eyemMathExtremumOfQuadraticCurves(double, double, double, double *);
double eyemMathExtremumOfQuadraticSurface(double, double, double, double, double, double, double *, double *);
double eyemMathCrossCorrelation(int, double[], double[]);
int eyemMathAutoCorrelation(int, double[], int, double[]);
double eyemMathNormCorrelation(int, double[], double[]);
int eyemMathNormAutoCorrelation(int, double[], int, double[]);
int eyemMathSearchOf1DWithNormCorrelation(int, double[], int, double[], int *, double *);
int eyemMathQuadraticRoots(double[], double[]);
int eyemMathCubicRoots(double[], double[]);
int eyemMathQuarticRoots(double[], double[]);
double eyemMathHorner(int, double[], double);
void eyemMathTransCoord(double, double, double, double, double, double *, double *);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 矩阵计算实用程序(eyemMat.cpp)
//
#ifdef __cplusplus
extern "C" {
#endif
// 函数接口
EXPORTS int eyemMatMalloc(int iWidth, int iHeight, int iChannels, const char *ccSubType, EyemImage *tpImage);
EXPORTS int eyemMatCopy(EyemImage &vpDst, EyemImage vpSrc);
EXPORTS int eyemMatAdd(EyemImage vpA, EyemImage vpB, EyemImage &vpC);
EXPORTS int eyemMatSub(EyemImage tpImageMinuend, EyemImage tpImageSubtrahend, EyemImage &tpDstImg);
EXPORTS int eyemMatAbs(EyemImage &tpImage);
EXPORTS int eyemCvtType(EyemImage tpImage, const char *ccSubType, double alpha, double beta, EyemImage &tpDstImg);
EXPORTS int eyemCvtColor(EyemImage tpImage, int iCCodes, EyemImage &tpDstImg);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 近似计算(稳健估计)(eyemFit.cpp)
//
//稳健估计方法
enum
{
EYEM_DIST_USER = -1, /**< User defined distance */
EYEM_DIST_L1 = 1, /**< distance = |x1-x2| + |y1-y2| */
EYEM_DIST_L12 = 2, /**< L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */
EYEM_DIST_FAIR = 3, /**< distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */
EYEM_DIST_WELSCH = 4, /**< distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */
EYEM_DIST_HUBER = 5, /**< distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */
EYEM_DIST_TUKEY = 6, /**< distance = di<= c ?(1-(di/c)^2)^2 : 0, c=2.718 di=|yi-(axi+b)|*/
EYEM_DIST_CAUCHY = 7, /**< distance = c^2(|x|/c-log(1+|x|/c)), c = 2.385 */
EYEM_DIST_LOGISTIC = 8, /**< distance w = tanh(r) ./ r c = 1.205*/
EYEM_DIST_ANDREWS = 9, /**< w = (abs(r)<pi) .* sin(r) ./ r c= 1.339*/
EYEM_DIST_ATLWORTH = 10 /**< w = 1 * (abs(r)<1) c=2.975*/
};
#ifdef __cplusplus
extern "C" {
#endif
// 函数接口
EXPORTS int eyemFitLine(int iPtnNum, EyemOcsDXY *taPoint, int numToIgnore, EyemOcsDABC &tpLine);
EXPORTS int eyemRobustFitLine(int iPtnNum, EyemOcsDXY *taPoint, int iCalcMode, double dRobustCoef, EyemOcsDABC &tpLine);
EXPORTS int eyemFitPlane(int, EyemOcsDXYZ[], int, double, EyemOcsDABCD *);
EXPORTS int eyemFitCircle(int iPtnNum, EyemOcsDXY *taPoint, int numToIgnore, double &RMS, EyemOcsDXYR &tpCircle);
EXPORTS int eyemFitEllipse(int, EyemOcsDXY[], int, double, EyemOcsDXYLSQ *);
EXPORTS int eyemFitEllipseC(int, EyemOcsDXY[], int, double, double[]);
EXPORTS int eyemFitConics(int, EyemOcsDXY[], int, double, double[]);
EXPORTS int eyemFitParabola(int, EyemOcsDXY[], int, double, EyemOcsDABC *);
EXPORTS int eyemFitEllipsoid(int, EyemOcsDXYZ[], int, double, EyemOcsDCRUVW *);
EXPORTS int eyemFitCone(int, EyemOcsDXYZ[], int, double, double[]);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 二维几何计算(二维卡尺)(eyemClp2d.cpp)
//
#ifdef __cplusplus
extern "C" {
#endif
// 函数接口
EXPORTS void eyemClp2dDistanceTwoPoints(EyemOcsDXY tpPoint1, EyemOcsDXY tpPoint2, double &tpDist);
EXPORTS void eyemClp2dCenterTwoPoints(EyemOcsDXY tpPoint1, EyemOcsDXY tpPoint2, EyemOcsDXY &tpCenter);
EXPORTS int eyemClp2dLineTwoPoints(EyemOcsDXY tpPoint1, EyemOcsDXY tpPoint2, EyemOcsDABC &tpLine);
EXPORTS int eyemClp2dMidperpendicularTwoPoints(EyemOcsDXY tpPoint1, EyemOcsDXY tpPoint2, EyemOcsDABC &tpLine);
EXPORTS int eyemClp2dVerticalLinePointAndLine(EyemOcsDXY tpPoint, EyemOcsDABC tpLine, EyemOcsDABC &tpVertical);
EXPORTS void eyemClp2dLinePointAndSlope(EyemOcsDXY tpPoint, double dSlope, EyemOcsDABC &tpLine);
EXPORTS int eyemClp2dIntersectionTwoLines(EyemOcsDABC tpLine1, EyemOcsDABC tpLine2, EyemOcsDXY &tpPoint);
EXPORTS int eyemClp2dAngleTwoLines(EyemOcsDABC tpLine1, EyemOcsDABC tpLine2, double &dpAngle);
EXPORTS int eyemClp2dCenterLineOfTwoLines(EyemOcsDABC tpLine1, EyemOcsDABC tpLine2, EyemOcsDABC &tpLineC);
EXPORTS int eyemClp2dDistancePointToLine(EyemOcsDXY tpPoint, EyemOcsDABC tpLine, double &dpDist);
EXPORTS int eyemClp2dTranslationOfLine(EyemOcsDABC tpSrcL, EyemOcsDXY tpTrans, EyemOcsDABC &tpDstL);
EXPORTS void eyemClp2dAreaTriangle(EyemOcsDXY tpPoint1, EyemOcsDXY tpPoint2, EyemOcsDXY tpPoint3, double &dpArea);
EXPORTS int eyemClp2dCircleThreePoints(EyemOcsDXY tpPoint1, EyemOcsDXY tpPoint2, EyemOcsDXY tpPoint3, EyemOcsDXYR &tpCircle);
EXPORTS int eyemClp2dIntersectionLineAndCircle(EyemOcsDABC tpLine, EyemOcsDXYR tpCircle, EyemOcsDXY &tpPoint1, EyemOcsDXY &tpPoint2);
EXPORTS int eyemClp2dTangentPointToCircle(EyemOcsDXY tpPoint, EyemOcsDXYR tpCircle, EyemOcsDABC &tpTangent1, EyemOcsDXY &tpContact1, EyemOcsDABC &tpTangent2, EyemOcsDXY &tpContact2);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 3D 几何计算(3D 卡尺)(eyemClp3d.cpp)
//
#ifdef __cplusplus
extern "C" {
#endif
// 函数接口
void eyemClp3dDistanceTwoPoints(EyemOcsDXYZ *, EyemOcsDXYZ *, double *);
void eyemClp3dCenterTwoPoints(EyemOcsDXYZ *, EyemOcsDXYZ *, EyemOcsDXYZ *);
int eyemClp3dLineTwoPoints(EyemOcsDXYZ *, EyemOcsDXYZ *, EyemOcsDPV *);
int eyemClp3dFootOfPerpendicularToLine(EyemOcsDXYZ *, EyemOcsDPV *, EyemOcsDXYZ *);
int eyemClp3dVerticalLinePointAndLine(EyemOcsDXYZ *, EyemOcsDPV *, EyemOcsDPV *);
int eyemClp3dDistancePointToLine(EyemOcsDXYZ *, EyemOcsDPV *, double *);
int eyemClp3dDistanceTwoLines(EyemOcsDPV *, EyemOcsDPV *, double *);
int eyemClp3dPlaneThreePoints(EyemOcsDXYZ *, EyemOcsDXYZ *, EyemOcsDXYZ *, EyemOcsDABCD *);
int eyemClp3dVerticalPlanePointAndVector(EyemOcsDXYZ *, EyemOcsDXYZ *, EyemOcsDABCD *);
int eyemClp3dVerticalLinePointAndPlane(EyemOcsDXYZ *, EyemOcsDABCD *, EyemOcsDPV *);
int eyemClp3dDistancePointToPlane(EyemOcsDXYZ *, EyemOcsDABCD *, double *);
int eyemClp3dIntersectionLineAndPlane(EyemOcsDPV *, EyemOcsDABCD *, EyemOcsDXYZ *);
int eyemClp3dAngleLineAndPlane(EyemOcsDPV *, EyemOcsDABCD *, double *);
int eyemClp3dFootOfPerpendicularToPlane(EyemOcsDXYZ *, EyemOcsDABCD *, EyemOcsDXYZ *);
int eyemClp3dIntersectionTwoPlanes(EyemOcsDABCD *, EyemOcsDABCD *, EyemOcsDPV *);
int eyemClp3dAngleTwoPlanes(EyemOcsDABCD *, EyemOcsDABCD *, double *);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 计算几何(eyemCg.cpp)
//
// 线交叉状态
enum {
EYEM_CG_NOT_INTERSECTION, // 未相交
EYEM_CG_INTERSECTION, // 相交(彼此交叉)
};
// 点位置状态
enum {
EYEM_CG_OUTER, // 在外部
EYEM_CG_INNER, // 在内部
EYEM_CG_BORDER // 在边界上
};
#ifdef __cplusplus
extern "C" {
#endif
// 函数接口
int eyemCgSortByArgument(int n, EyemOcsDXY taSrcPt[], EyemOcsDXY taDstPt[]);
int eyemCgConvexHull(int, EyemOcsDXY[], int *, EyemOcsDXY[]);
int eyemCgSmallestEnclosingCircle(int, EyemOcsDXY[], EyemOcsDXY *, double *);
int eyemCgIntersectionOfTwoSegments(EyemOcsDXY *, EyemOcsDXY *, EyemOcsDXY *, EyemOcsDXY *, int *, EyemOcsDXY *);
int eyemCgPointInConvexPolygon(int, EyemOcsDXY[], EyemOcsDXY *, int *);
int eyemCgIntersectionLineAndConvexPolygon(int, EyemOcsDXY[], EyemOcsDABC *, EyemOcsDXY[]);
int eyemCgIntersectionSegmentAndConvexPolygon(int, EyemOcsDXY[], EyemOcsDXY *, EyemOcsDXY *, EyemOcsDXY[]);
int eyemCgPointInPolygon(int, EyemOcsDXY[], EyemOcsDXY *, int *);
int eyemCgAreaOfPolygon(int, EyemOcsDXY[], double *);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 2 值 blob 分析(eyemBin.cpp)
//
enum {
EYEM_BIN_BLACK, // 黒
EYEM_BIN_WHITE // 白
};
//全局阈值2值化方法
enum {
HUANG,
ISODATA,
LI,
MAXENTROPY,
MEAN,
MOMENTS,
OTSU,
PERCENTILE,
RENYIENTROPY,
SHANBHAG,
TRIANGLE,
YEN
};
//动态阈值2值化方法
enum {
LIGHT,
DARK,
EQUAL,
NOT_EQUAL
};
// 局部阈值2值化方法
enum
{
BINARIZATION_NIBLACK,
BINARIZATION_WOLF,
BINARIZATION_NICK,
BINARIZATION_SAUVOLA
};
// Blob 分析结果
typedef struct {
int iLabel; // 标签
int iArea; // 面积
double dCenterX; // 重心x坐标
double dCenterY; // 重心y坐标
int iXs, iYs, iXe, iYe; // 外接矩形(始点,终点)
int iWidth, iHeight; // 外接矩形(x 方向大小(宽度),y 方向大小(高度))
double dTheta; // 主轴倾斜角(rad)
} EyemBinBlob;
typedef struct {
int iLabel; // 标签
double dX; // x坐标
double dY; // y坐标
double dVx, dVy; // 向量
} EyemChainCode;
#ifdef __cplusplus
extern "C" {
#endif
// 函数接口
EXPORTS int eyemBinThreshold(EyemImage tpSrcImg, int iLightDark, double dThresh, double dMaxVal, EyemImage *tpDstImg);
EXPORTS int eyemBinAutoThreshold(EyemImage tpSrcImg, double dSigma, int iLightDark, int binMethod, EyemImage *tpDstImg);
EXPORTS int eyemBinNiBlack(EyemImage tpSrcImg, int iType, int iWinSize, double dK, int binarizationMethod, double dR, EyemImage *tpDstImg);
EXPORTS int eyemBinDynThreshold(EyemImage tpSrcImg, EyemImage tpPreImg, double dOffset, int iType, EyemImage *tpDstImg);
EXPORTS int eyemBinDilation(EyemImage tpSrcImg, int iBinLevel, int iNum, EyemImage *tpDstImg);
EXPORTS int eyemBinErosion(EyemImage tpSrcImg, int iBinLevel, int iNum, EyemImage *tpDstImg);
EXPORTS int eyemBinOpening(EyemImage tpSrcImg, int iBinLevel, int iNum, EyemImage *tpDstImg);
EXPORTS int eyemBinClosing(EyemImage tpSrcImg, int iBinLevel, int iNum, EyemImage *tpDstImg);
EXPORTS int eyemBinBlob(EyemImage tpImage, IntPtr *hObject, int iAreaThrs, EyemBinBlob **tpResult, int *ipNum, EyemImage *tpDstImg);
EXPORTS int eyemBinBlobFilterByArea(IntPtr hObject, int iMinArea, int iMaxArea);
EXPORTS int eyemBinBlobFilterByLabel(IntPtr hObject, int iLabel);
EXPORTS int eyemBinBlobRender(EyemImage tpImage, IntPtr hObject, EyemImage *tpDstImg);
EXPORTS bool eyemBinFree(IntPtr hObject);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 一维边缘提取(eyemEdge1d.cpp)
//
#ifdef __cplusplus
extern "C" {
#endif
// 函数接口
EXPORTS int eyemEdge1dGenMeasureRect(EyemImage tpImage, EyemOcsDXY tpLineSt, EyemOcsDXY tpLineEd, int iWhRoi, const char *ccSubType, int iTransition, double dSigma, double dAmpThresh, IntPtr *hObject);
EXPORTS int eyemEdge1dGenPosRect(EyemImage tpImage, EyemOcsDXY tpLineSt, EyemOcsDXY tpLineEd, int iWhRoi, int iTransition, double dSigma, double dAmpThresh, IntPtr *hObject);
EXPORTS int eyemEdge1dFitLine(IntPtr hObject, int iClippingEndPoints, int iMaxIterations, double dRobustCoef, EyemOcsDABC *tpLine);
EXPORTS int eyemEdge1dFitCircle(IntPtr hObject, int iClippingEndPoints, int iMaxIterations, double dRobustCoef, EyemOcsDXYR *tpCircle);
EXPORTS int eyemEdge1dFindLine(EyemImage tpImage, EyemOcsDXY tpLineSt, EyemOcsDXY tpLineEd, int iWhRoi, int iTransition, IntPtr *hObject);
EXPORTS bool eyemEdge1dGenMeasureFree(IntPtr hObject);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 二维边缘提取(eyemEdge.cpp)
//
#ifdef __cplusplus
extern "C" {
#endif
// 函数接口
EXPORTS int eyemEdgesPixel(EyemImage tpImage, double dThresh);
EXPORTS int eyemEdgesSubpixel(EyemImage tpImage, IntPtr *hObject, EyemOcsDXY **tpEdges, int iFilter, int iLow, int iHigh);
EXPORTS int eyemSkeleton(EyemImage tpImage, cv::Mat &skeleton);
EXPORTS int eyemSobelAmp(EyemImage tpImage, EyemImage &ImaAmp);
EXPORTS int eyemAutoCanny(EyemImage tpImage, float dSigma = 0.33);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 点云匹配(eyemMatch.cpp)
//
// 处理类型
enum {
EYEM_MATCH_LSQ, // 最小二乗法
EYEM_MATCH_LSQ_S, // 加权最小二乗法
EYEM_MATCH_ROBUST, // 稳健估计・无比例估计
EYEM_MATCH_ROBUST_S, // 稳健估计・带比例估计
EYEM_MATCH_MINMAX, // MINMAX方法・无比例估计
EYEM_MATCH_MINMAX_S // MINMAX方法・带比例估计
};
#ifdef __cplusplus
extern "C" {
#endif
// 函数接口
int eyemMatchBasic(int, EyemOcsDXY[], EyemOcsDXY[], EyemOcsDXYQ *, int, double, EyemOcsDXYQS *);
int eyemMatchDelta(EyemOcsDXYQ *, EyemOcsDXYQS *, double *, double *, double *, double *);
int eyemMatchPoints(int, EyemOcsDXY[], EyemOcsDXY[], EyemOcsDXYQ *, EyemOcsDXYQS *, EyemOcsDXY[], double[]);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 摄像机校准(eyemCalib.cpp)
//
// 模式数据
typedef struct {
int iPtnRefN; // 图案参考点数
EyemOcsDXY *tpObjPt; // 阵列参考点的实际坐标(単位:mm)
EyemOcsDXY *tpImgPt; // 图案参考点的图像坐标(単位:像素)
} EyemCalibPtn;
// 同源矩阵
typedef struct {
double daH[3][3]; // 同源矩阵 H
double daInvH[3][3]; // 矩阵 H 的逆矩阵
} EyemCalibHom;
// 摄像机的内参数(intrinsic parameter)
typedef struct {
double daA[3][3]; // 内参数矩阵
double dK1, dK2; // 径向失真系数
double dK3, dK4, dK5; // 径向失真系数
double daInvA[3][3]; // 内参数矩阵的逆矩阵
} EyemCalibInt;
// 摄像机外部参数(extrinsic parameter)
typedef struct {
double daR[3][3]; // 旋转矩阵
double daT[3]; // 平移矢量
double daRdr[3]; // 旋转矢量(罗德里格斯表示)
} EyemCalibExt;
#ifdef __cplusplus
extern "C" {
#endif
// 函数接口
int eyemCalibCameraCalibrate(int, EyemCalibPtn[], double, EyemCalibInt *, EyemCalibExt[], double *, int);
int eyemCalibCalcHomography(int, void *, void *, double, void *);
int eyemCalibRodrigues(int, double[3], double[3][3]);
int eyemCalibUnDistortPoint(EyemCalibInt *, double, double, double *, double *);
int eyemCalibUnDistortMat(EyemCalibInt *, double, double, double *, double *);
int eyemCalibChange3Dto2D(EyemOcsDXYZ *, EyemCalibInt *, EyemCalibExt *, EyemOcsDXY *, int);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 图像平滑滤镜(eyemSmooth.cpp)
//
#ifdef __cplusplus
extern "C" {
#endif
// 函数接口
EXPORTS int eyemSmoothMean(EyemImage tpImage, int kSizew, int kSizeh, EyemImage *tpDstImg);
EXPORTS int eyemSmoothGaussian(EyemImage tpImage, int kSizew, int kSizeh, double dSigmaX, double dSigmaY, EyemImage *tpDstImg);
EXPORTS int eyemSmoothMedian(EyemImage tpImage, int kSize, EyemImage *tpDstImg);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 图像通用处理(eyemGeneric.cpp)
//
#ifdef __cplusplus
extern "C" {
#endif
// 函数接口
EXPORTS int eyemImageRead(const char *filename, int iFalgs, EyemImage *ucpImage);
EXPORTS int eyemImageReadRaw(const char *filename, int iWidth, int iHeight, int iDepth, EyemImage *tpImage);
EXPORTS int eyemImageFromBitmap(void *vpScan0, int iWidth, int iHeight, int iDepth, int iChannels, EyemImage *tpImage);
EXPORTS int eyemVideoCapture(const char *fileName, IntPtr *hObject, EyemImage **tpImages, int *ipNum);
EXPORTS bool eyemVideoCaptureFree(IntPtr hObject);
EXPORTS void eyemImageFree(EyemImage &ipImage);
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// 其他工具(eyemMisc.cpp)
//
// 条码 解码结果
typedef struct {
double dAngle; // 角度
int iCenterX; // y坐标
int iCenterY; // y坐标
LPSTR lpszType; // 码类型
LPSTR lpszText; // 码内容
} EyemBarCode;
typedef struct {
void *vpImage; // 地址
int iXs; // 图像X坐标
int iYs; // 图像Y坐标
int iWidth; // 图像内存X方向大小
int iHeight; // 图像内存Y方向大小
double dMatchDeg; // 匹配度
LPSTR lpszName; // 名称
} EyemModelID;
#ifdef __cplusplus
extern "C" {
#endif
EXPORTS int eyemDetectAndDecode(EyemImage tpImage, EyemRect tpRoi, const char *ccFileName, const char *ccCodeType, IntPtr *hObject, EyemBarCode **tpResult, int *ipNum, bool bUseNiBlack, int iBlockSize, const int iRangeC, int iSymbolMin, int iSymbolMax, double dScaleUpAndDown = 0.5, double dToleErr = 0.5, double dMinorStep = 1.0);
EXPORTS int eyemDetectAndDecodeUseNN(EyemImage tpImage, EyemRect tpRoi, IntPtr *hObject, EyemBarCode **hResults, int *ipNum, EyemImage *tpDstImg);
EXPORTS int eyemInitNNDataCodeModel(const char *detectorConfigPath, const char *detectorModelPath, const char *superResolutionConfigPath, const char *superResolutionModelPath);
EXPORTS int eyemDetectAndDecodeBarcodeUseNN(EyemImage tpImage, EyemRect tpRoi, IntPtr *hObject, EyemBarCode **hResults, int *ipNum, EyemImage *tpDstImg);
EXPORTS bool eyemDetectAndDecodeFree(IntPtr hObject);
EXPORTS int eyemCountObject(EyemImage tpImage, EyemRect tpRoi, const char *fileName, double dOffset, int iMinArea, int iMaxArea, int iWinSize, LPSTR *lpszNumObj, EyemImage *tpDstImg);
EXPORTS int eyemCountObjectE(EyemImage tpImage, EyemRect tpRoi, const char *fileName, LPSTR *lpszNumObj, EyemImage *tpDstImg);
EXPORTS int eyemCountObjectIrregularParts(EyemImage tpImage, EyemRect tpRoi, const char *fileName, double dOffset, const char * ccSubType, int iMaxArea, int iWinSize, LPSTR *lpszNumObj, EyemImage *tpDstImg);
EXPORTS int eyemCountObjectIrregularPartsE(EyemImage tpImage, EyemRect tpRoi, const char *fileName, const char *ccTplName, IntPtr hModelID, LPSTR *lpszReelNum, EyemImage *tpDstImg);
EXPORTS int eyemAchvTemplateImage(EyemImage tpImage, EyemRect tpRoi, EyemImage *tpDstImg);
EXPORTS int eyemCreateTemplateModel(EyemImage tpImage, EyemRect tpRoi, double dMinScore, const char *ccTplName);
EXPORTS int eyemMatchTemplateModel(EyemImage tpImage, IntPtr hModelID, LPSTR *lpszTplName);
EXPORTS int eyemInitModel(const char *ccTplName, IntPtr *hModelID);
EXPORTS int eyemAchvModelByName(const char *ccTplName, IntPtr hModelID, EyemModelID &tpModelID);
EXPORTS int eyemInsertModel(IntPtr hModelID, const char *ccTplName);
EXPORTS int eyemRemoveModelByName(IntPtr hModelID, const char *ccTplName);
EXPORTS int eyemReleaseModel(IntPtr &hModelID);
EXPORTS int eyemTrackFeature(EyemImage tpPrevImg, EyemImage tpNextImg, EyemRect3 *tpRois, int iRoiNum, int *ipResults, EyemImage *tpDstImg);
EXPORTS int eyemAOIForTSAV(EyemImage tpRefImg, EyemImage tpNextImg, EyemRect3 *tpRois, int iRoiNum);
EXPORTS int eyemMarkerTracing(EyemImage tpImage, double dThreshold, EyemOcsFXYR *tpCircle, bool bHighAccuracy = false);
EXPORTS int eyemMulFuncTool(EyemImage tpImage, EyemRect tpRoi, const char *funcName, double dThreshold, int iNumToIgnore, EyemOcsFXYR *tpCircle, EyemImage *tpDstImg);
EXPORTS int eyemLibImpl(EyemImage tpImage, EyemImage *tpDstImg);
#ifdef __cplusplus
}
#endif
//跳过某接口执行
extern "C" __declspec(dllexport) void setSkipProcessID(int pid);
// 日志回调定义
typedef void(__stdcall*TCallback)(const char* msg);
class Logger
{
public:
Logger(const std::string prefix = "") : prefix_(prefix) {}
public:
void t(const std::string& msg);
private:
std::string prefix_;
};
extern "C" __declspec(dllexport) void setLogCallback(TCallback cb);
#endif/* __EYEM_LIB_H */
此文件的差异太大,无法显示。
#pragma once
//
// eyemMiscͷ
//
#ifndef __EYEM_MISC_H
#define __EYEM_MISC_H
#include <io.h>
#include <fstream>
#include <direct.h>
#include "eyemLib.h"
#include <tbb\tbb.h>
extern Logger logger;
constexpr double c = PI / 180.;
extern int killProcessID;
#endif/* __EYEM_MISC_H */
此文件太大,无法显示。
此文件太大,无法显示。
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!