Commit de2afb31 张士柳

1 个父辈 201558f5
...@@ -506,7 +506,7 @@ namespace eyemLib_Sharp ...@@ -506,7 +506,7 @@ namespace eyemLib_Sharp
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct EyemOcsDRQ // 直線(ヘッセの標準形)やベクトルの表現に使用 public struct EyemOcsDRQ // 用于表示直线(黑森标准形状)和矢量
{ {
double dR; // ρ double dR; // ρ
double dQ; // θ double dQ; // θ
...@@ -515,14 +515,14 @@ namespace eyemLib_Sharp ...@@ -515,14 +515,14 @@ namespace eyemLib_Sharp
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct EyemOcsDXYQS public struct EyemOcsDXYQS
{ {
double dX; // X座標 double dX; // X坐标
double dY; // Y座標 double dY; // Y坐标
double dQ; // 回転角(単位:rad) double dQ; // 旋转角度(単位:rad)
double dS; // スケール double dS; // 规模
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct EyemOcsDABCD // 平面(一般形)の表現に使用 public struct EyemOcsDABCD // 用于表示平面(一般形式)
{ {
double dA; // a double dA; // a
double dB; // b double dB; // b
...@@ -531,30 +531,30 @@ namespace eyemLib_Sharp ...@@ -531,30 +531,30 @@ namespace eyemLib_Sharp
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct EyemOcsDXYLSQ // 楕円の表現に使用 public struct EyemOcsDXYLSQ // 用于表示椭圆
{ {
double dXo; // 中心のX座標 double dXo; // 中心X坐标
double dYo; // 中心のY座標 double dYo; // 中心Y坐标
double dL; // 長軸半径 double dL; // 长轴半径
double dS; // 短半径 double dS; // 短半径
double dQ; // 長軸の傾き(単位:rad) double dQ; // 长轴倾斜角(単位:rad)
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct EyemOcsDPV // 3次元空間内の直線の表現に使用 public struct EyemOcsDPV // 用于表示三维空间中的直线
{ {
EyemOcsDXYZ tP; // 直線上の1点の座標 EyemOcsDXYZ tP; // 直线上一点的坐标
EyemOcsDXYZ tV; // 直線の方向ベクトル EyemOcsDXYZ tV; // 直线方向矢量
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct EyemOcsDCRUVW // 楕円体の表現に使用 public struct EyemOcsDCRUVW // 用于表示椭圆体
{ {
EyemOcsDXYZ tC; // 楕円体の中心 EyemOcsDXYZ tC; // 椭圆体中心
EyemOcsDXYZ tR; // 軸の半径(dX:長軸, dY:中軸, dZ:短軸) EyemOcsDXYZ tR; // 轴半径(dX:长轴、dY:中轴、dZ:短轴)
double dU; // 長軸のXY平面への射影がX軸となす角(単位:rad) double dU; // 长轴投影到 XY 平面与 X 轴的角(单位:rad)
double dV; // 長軸のXY平面とのなす角(単位:rad) double dV; // 长轴与XY平面之角(单位:rad)
double dW; // 長軸まわりの回転角(単位:rad) double dW; // 绕长轴旋转角度(单位:rad)
} }
// Blob 分析结果 // Blob 分析结果
...@@ -710,10 +710,16 @@ namespace eyemLib_Sharp ...@@ -710,10 +710,16 @@ namespace eyemLib_Sharp
#region 项目 #region 项目
//普通器件 //普通器件
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)] [DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemCountObject(EyemImage tpImage, string fileName, ref string pNumObj, out EyemImage tpDstImg); private static extern int eyemCountObject(EyemImage tpImage, string fileName, double dOffset, int iMinArea, int iMaxArea, int iWinSize, ref string pNumObj, out EyemImage tpDstImg);
//异型器件 //异型器件
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)] [DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemCountObjectIrregularParts(EyemImage tpImage, string fileName, string strType, string tplName, double dMinScore, ref string pNumObj, out EyemImage tpDstImg); private static extern int eyemCountObjectIrregularParts(EyemImage tpImage, string fileName, double dOffset, string strType, int iMaxArea, int iWinSize, ref string pNumObj, out EyemImage tpDstImg);
//普通器件(新版本)
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemCountObjectE(EyemImage tpImage, string fileName, ref string pNumObj, out EyemImage tpDstImg);
//异型器件(新版本)
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemCountObjectIrregularPartsE(EyemImage tpImage, string fileName, string ccSubType, string ccTplName, double dMinScore, ref string pNumObj, out EyemImage tpDstImg);
//读码程序 //读码程序
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)] [DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemDetectAndDecode(EyemImage tpImage, EyemRect tpRoi, string fileName, string strCodeType, out DataCodeHandle hObject, out EyemBarCode* tpResults, out int ipNum, bool bUseNiBlack, int iBlockSize, int iRangeC, int iSymbolMin, int iSymbolMax, double dScaleUpAndDown = 0.5, double dToleErr = 0.5, double dMinorStep = 1.0); private static extern int eyemDetectAndDecode(EyemImage tpImage, EyemRect tpRoi, string fileName, string strCodeType, out DataCodeHandle hObject, out EyemBarCode* tpResults, out int ipNum, bool bUseNiBlack, int iBlockSize, int iRangeC, int iSymbolMin, int iSymbolMax, double dScaleUpAndDown = 0.5, double dToleErr = 0.5, double dMinorStep = 1.0);
...@@ -741,7 +747,6 @@ namespace eyemLib_Sharp ...@@ -741,7 +747,6 @@ namespace eyemLib_Sharp
return; return;
} }
//flag = eyemImageMalloc(image.iWidth, image.iHeight, 1, "uint16_t", out image1); //flag = eyemImageMalloc(image.iWidth, image.iHeight, 1, "uint16_t", out image1);
//flag = eyemImageMalloc(image.iWidth, image.iHeight, 1, "int8_t", out image2); //flag = eyemImageMalloc(image.iWidth, image.iHeight, 1, "int8_t", out image2);
...@@ -904,8 +909,9 @@ namespace eyemLib_Sharp ...@@ -904,8 +909,9 @@ namespace eyemLib_Sharp
string pNumObj = ""; string pNumObj = "";
string file = fileName.Split(new string[] { "\\" }, StringSplitOptions.RemoveEmptyEntries)[2]; string file = fileName.Split(new string[] { "\\" }, StringSplitOptions.RemoveEmptyEntries)[2];
//"IP_SMALL_PARTS","IP_LARGE_PARTS","IP_LONG_PARTS","" //"IP_SMALL_PARTS","IP_LARGE_PARTS","IP_LONG_PARTS",""
//eyemCountObject(ucpImage, file.Replace(".png", ""), 35, 0, 100, 5, ref pNumObj, out tpDstImg); //eyemCountObject(image, file.Replace(".png", ""), 35, 0, 100, 5, ref pNumObj, out tpDstImg);
eyemCountObjectIrregularParts(image, file.Replace(".png", ""), "IP_LARGE_PARTS", "D://批量测试图像//template.png", 0.7, ref pNumObj, out tpDstImg); //eyemCountObjectIrregularParts(image, file.Replace(".png", ""), 0.1, "IP_LARGE_PARTS", 100, 7, ref pNumObj, out tpDstImg);
eyemCountObjectIrregularPartsE(image, file.Replace(".png", ""), "IP_LARGE_PARTS", "D://批量测试图像2//template.png", 0.7, ref pNumObj, out tpDstImg);
//int ipNum; EyemBarCode* tpResults; //int ipNum; EyemBarCode* tpResults;
//DataCodeHandle hObject; //DataCodeHandle hObject;
//int iRes = eyemDetectAndDecode(image, tpRoi, file.Replace(".png", ""), "QR_CODE|DATA_MATRIX|CODE_39|CODE_128", out hObject, out tpResults, out ipNum, false, 11, 5, 128, 256, 1d); //int iRes = eyemDetectAndDecode(image, tpRoi, file.Replace(".png", ""), "QR_CODE|DATA_MATRIX|CODE_39|CODE_128", out hObject, out tpResults, out ipNum, false, 11, 5, 128, 256, 1d);
...@@ -915,13 +921,15 @@ namespace eyemLib_Sharp ...@@ -915,13 +921,15 @@ namespace eyemLib_Sharp
// Marshal.FreeCoTaskMem(tpResults[i].hText); Marshal.FreeCoTaskMem(tpResults[i].hType); // Marshal.FreeCoTaskMem(tpResults[i].hText); Marshal.FreeCoTaskMem(tpResults[i].hType);
//} //}
//hObject.Dispose(); //hObject.Dispose();
//sw.Stop(); sw.Stop();
//Console.WriteLine("耗时:" + sw.ElapsedMilliseconds.ToString() + ",结果:" + pNumObj); Console.WriteLine("耗时:" + sw.ElapsedMilliseconds.ToString() + ",结果:" + pNumObj);
//free image //free image
eyemImageFree(ref tpDstImg); eyemImageFree(ref tpDstImg);
eyemImageFree(ref image); eyemImageFree(ref image);
} }
public static void eyemTestVideoCapture(string fileName) public static void eyemTestVideoCapture(string fileName)
{ {
List<EyemRect3> tpRois = new List<EyemRect3>(); List<EyemRect3> tpRois = new List<EyemRect3>();
......
...@@ -25,7 +25,6 @@ namespace eyemLib_Sharp ...@@ -25,7 +25,6 @@ namespace eyemLib_Sharp
foreach (var item in fileNames) foreach (var item in fileNames)
{ {
//EyemLib.eyemReadImageTool(item);
EyemLib.eyemReadImageTool(item); EyemLib.eyemReadImageTool(item);
} }
......
#include "eyemBarCode.h" #include "eyemBarCode.h"
#pragma region 内部使用函数
static void split(const std::string &cStrText, const std::string &cStrDelim, std::vector<std::string> &vStrs) static void split(const std::string &cStrText, const std::string &cStrDelim, std::vector<std::string> &vStrs)
{ {
char *cpStr = new char[strlen(cStrText.c_str()) + 1]; char *cpStr = new char[strlen(cStrText.c_str()) + 1];
...@@ -44,7 +46,7 @@ static void filterByApriltag(cv::Mat &binary, cv::Mat &labels, std::vector<tMap> ...@@ -44,7 +46,7 @@ static void filterByApriltag(cv::Mat &binary, cv::Mat &labels, std::vector<tMap>
int flags = 0; int flags = 0;
double test_line[6]{ 0 };//0 中间那块;1那两块黑色;2外圈那两块 double test_line[6]{ 0 };//0 中间那块;1那两块黑色;2外圈那两块
//向右扫描 //向右扫描
for (int x = vPts[c].Pt.x + 1; x < X - 1; x++) for (int x = vPts[c].Pt.x + 1; x < X - 1; x++)
{ {
//colors为0的不参与统计 //colors为0的不参与统计
...@@ -282,6 +284,8 @@ static double getThreshVal_Otsu_8u(const cv::Mat& _src) ...@@ -282,6 +284,8 @@ static double getThreshVal_Otsu_8u(const cv::Mat& _src)
return max_val; return max_val;
} }
#pragma endregion
static bool decode(std::vector<WaitArea> &waitAreas, cv::Mat &showMat, std::vector<DecodeResult> &strDecodeResults, int iBlockSize, const int iRangeC, double dMinorStep) static bool decode(std::vector<WaitArea> &waitAreas, cv::Mat &showMat, std::vector<DecodeResult> &strDecodeResults, int iBlockSize, const int iRangeC, double dMinorStep)
{ {
//全部解码成功 //全部解码成功
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
int eyemImageRead(const char *fileName, int iFlag, EyemImage *tpImage) int eyemImageRead(const char *fileName, int iFlag, EyemImage *tpImage)
{ {
cv::Mat _src = cv::imread(fileName, iFlag); cv::Mat _src = cv::imread(fileName, iFlag);
if (_src.empty()) if (_src.empty())
return FUNC_IMAGE_NOT_EXIST; return FUNC_IMAGE_NOT_EXIST;
......
...@@ -832,9 +832,12 @@ extern "C" { ...@@ -832,9 +832,12 @@ extern "C" {
#endif #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 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 bool eyemDetectAndDecodeFree(IntPtr hObject); EXPORTS bool eyemDetectAndDecodeFree(IntPtr hObject);
EXPORTS int eyemCountObject(EyemImage tpImage, const char *fileName, LPSTR *lpszNumObj, EyemImage *tpDstImg); EXPORTS int eyemCountObject(EyemImage tpImage, const char *fileName, double dOffset, int iMinArea, int iMaxArea, int iWinSize, LPSTR *lpszNumObj, EyemImage *tpDstImg);
EXPORTS int eyemCountObjectIrregularParts(EyemImage tpImage, const char *fileName, const char * ccSubType, const char *tplName, double dMinScore, LPSTR *lpszNumObj, EyemImage *tpDstImg); EXPORTS int eyemCountObjectE(EyemImage tpImage, const char *fileName, LPSTR *lpszNumObj, EyemImage *tpDstImg);
EXPORTS int eyemCountObjectIrregularParts(EyemImage tpImage, const char *fileName, double dOffset, const char * ccSubType, int iMaxArea, int iWinSize, LPSTR *lpszNumObj, EyemImage *tpDstImg);
EXPORTS int eyemCountObjectIrregularPartsE(EyemImage tpImage, const char *fileName, const char * ccSubType, const char *ccTplName, double dMinScore, LPSTR *lpszNumObj, EyemImage *tpDstImg);
EXPORTS int eyemTrackFeature(EyemImage tpPrevImg, EyemImage tpNextImg, EyemRect3 *tpRois, int iRoiNum, int *ipResults); EXPORTS int eyemTrackFeature(EyemImage tpPrevImg, EyemImage tpNextImg, EyemRect3 *tpRois, int iRoiNum, int *ipResults);
EXPORTS int eyemAOIForTSAV(EyemImage tpRefImg, EyemImage tpNextImg, EyemRect3 *tpRois, int iRoiNum);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!