Commit 9ad8bd85 张士柳

1 个父辈 24544381
......@@ -346,7 +346,7 @@ namespace eyemLib_Sharp
/// 圆形Mark点定位
/// </summary>
/// <param name="tpImage">图像</param>
/// <param name="tpHSVModel">HSV阈值</param>
/// <param name="tpHSVModel">HSV阈值范围</param>
/// <param name="tpCircle">结果</param>
/// <param name="tpDstImg">结果图</param>
/// <param name="bHighAccuracy">是否使用高精度</param>
......@@ -401,15 +401,6 @@ namespace eyemLib_Sharp
//例程
public static void eyeyTestTemplateModelMethod(string fileName)
{
#region //从本地读图
EyemImage image, tpDstImg;
int flag = eyemImageRead(fileName, -1, out image);
if (flag != 0)
{
Console.WriteLine("读图失败!");
return;
}
////红色分割
//EyemHSVModel tpHsvModel = new EyemHSVModel();
//tpHsvModel.dpRangeL = new double[] { 0, 43, 46 }; tpHsvModel.dpRangeU = new double[] { 10, 255, 255 };
......@@ -425,6 +416,15 @@ namespace eyemLib_Sharp
//tpHsvModel.dpRangeL = new double[] { 100, 43, 46 }; tpHsvModel.dpRangeU = new double[] { 124, 255, 255 };
//tpHsvModel.dpRangeLExt = new double[] { 0, 0, 0 }; tpHsvModel.dpRangeUExt = new double[] { 0, 0, 0 };
#region //从本地读图
//EyemImage image, tpDstImg;
//int flag = eyemImageRead(fileName, -1, out image);
//if (flag != 0)
//{
// Console.WriteLine("读图失败!");
// return;
//}
//EyemOcsFXYR tpCircle = new EyemOcsFXYR();
//flag = eyemMarkerTracing(image, tpHsvModel, ref tpCircle, out tpDstImg);
......
......@@ -208,7 +208,7 @@ inline bool BarcodeDetector::isValidCoord(const cv::Point &coord, const cv::Size
return false;
}
if ((unsigned)coord.x > (unsigned) (limit.width - 1) || ((unsigned)coord.y > (unsigned) (limit.height - 1)))
if ((unsigned)coord.x > (unsigned) (limit.width - 1) || ((unsigned)coord.y >(unsigned) (limit.height - 1)))
{
return false;
}
......@@ -438,6 +438,7 @@ bool BarcodeDetector::detect(cv::Mat img, std::vector<cv::Point>& points)
}
}
updatePointsResult(points, trans_points);
return true;
}
void BarcodeDetector::drawBarcode(cv::Mat& img, const std::vector<cv::Point>& points) {
......
......@@ -417,7 +417,7 @@ static int Otsu(int hist[])
// The float casting here is to avoid compiler warning about loss of precision and
// will prevent overflow in the case of large saturated images
denom = (double)(N1) * (N - N1); // Maximum value of denom is (N^2)/4 = approx. 3E10
denom = (double)(N1)* (N - N1); // Maximum value of denom is (N^2)/4 = approx. 3E10
if (denom != 0) {
// Float here is to avoid loss of precision when dividing
......@@ -1325,7 +1325,10 @@ int eyemBinClosing(EyemImage tpSrcImg, int iBinLevel, int iNum, EyemImage *tpDst
int eyemBinBlob(EyemImage tpImage, IntPtr *hObject, int iAreaThrs, EyemBinBlob **tpResult, int *ipNum, EyemImage *tpDstImg)
{
CV_Assert(tpImage.vpImage != NULL);
cv::Mat image = cv::Mat(tpImage.iHeight, tpImage.iWidth, MAKETYPE(tpImage.iDepth, tpImage.iChannels), tpImage.vpImage).clone();
if (image.empty()) {
return FUNC_IMAGE_NOT_EXIST;
}
......
......@@ -162,24 +162,21 @@ int eyemEdgesSubpixel(EyemImage tpImage, int iFilter, int iLow, int iHigh)
int eyemSobelAmp(EyemImage tpImage, EyemImage &ImaAmp)
{
cv::Mat image(tpImage.iHeight, tpImage.iWidth, CV_8UC1, tpImage.vpImage);
CV_Assert(NULL != tpImage.vpImage&&tpImage.iDepth == 0);
cv::Mat image = cv::Mat(tpImage.iHeight, tpImage.iWidth, MAKETYPE(tpImage.iDepth, tpImage.iChannels), tpImage.vpImage).clone();
if (image.empty()) {
return FUNC_IMAGE_NOT_EXIST;
}
cv::Mat dx, dy;
cv::spatialGradient(image, dx, dy);
cv::Mat mag;
cv::magnitude(dx, dy, mag);
return FUNC_OK;
}
int eyemSkeleton(EyemImage tpImage, cv::Mat &skeleton)
{
cv::Mat image(tpImage.iHeight, tpImage.iWidth, CV_8UC1, tpImage.vpImage);
if (image.empty()) {
return FUNC_IMAGE_NOT_EXIST;
}
......@@ -193,15 +190,6 @@ int eyemAutoCanny(EyemImage tpImage, double dSigma = 0.33)
if (image.empty()) {
return FUNC_IMAGE_NOT_EXIST;
}
cv::Mat F;
cv::GaussianBlur(image, F, cv::Size(3, 3), 0, 0);
////get the median value of the matrix
//double v = medianMat(output);
////generate the thresholds
//int lower = (int)std::max(0.0, (1, 0 - sigma)*v);
//int upper = (int)std::min(255.0, (1, 0 + sigma)*v);
////apply canny operator
//cv::Canny(output, output, lower, upper, 3);
return FUNC_OK;
}
......@@ -543,7 +543,7 @@ int eyemPolarTrans(EyemImage tpImage, EyemOcsDXY tpCenter, int iRadius, int iSap
cv::Size szMap(iSapLength, 1);
//采样图像
int m = 0; float *pPolarBuf = new float[szMap.width*szMap.height * sizeof(float_t)];
for (float t = -CV_PI; t < CV_PI; t += plusStep, m++)
for (double t = -CV_PI; t < CV_PI; t += plusStep, m++)
{
//路径上的点
float _plusX = float(tpCenter.dX + (float)(iRadius + n)*cos(t));
......
......@@ -795,6 +795,7 @@ extern "C" {
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);
EXPORTS int eyemShockFilter(EyemImage tpImage, int kSize, double dSigma, double dBlend, const int iIter, EyemImage *tpDstImg);
#ifdef __cplusplus
}
......
......@@ -74,8 +74,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>D:\opencv420\build\include;D:\opencv420\build\include\opencv2;D:\tbb2017_20170604oss\include;D:\zxing-cpp-master\core\src;D:\zxing-cpp-master\opencv\src;D:\feature_extract\include;D:\feature_extract\include\ncnn;$(IncludePath)</IncludePath>
<LibraryPath>D:\opencv420\build\x64\vc14\lib;D:\tbb2017_20170604oss\lib\intel64\vc14;D:\zxing-cpp-master\build\Debug;D:\feature_extract\lib;$(LibraryPath)</LibraryPath>
<IncludePath>D:\opencv420\build\include;D:\opencv420\build\include\opencv2;D:\tbb2017_20170604oss\include;D:\zxing-cpp-master\core\src;D:\zxing-cpp-master\opencv\src;$(IncludePath)</IncludePath>
<LibraryPath>D:\opencv420\build\x64\vc14\lib;D:\tbb2017_20170604oss\lib\intel64\vc14;D:\zxing-cpp-master\build\Debug;$(LibraryPath)</LibraryPath>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
......@@ -83,8 +83,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>D:\opencv420\build\include;D:\opencv420\build\include\opencv2;D:\tbb2017_20170604oss\include;D:\zxing-cpp-master\core\src;D:\zxing-cpp-master\opencv\src;D:\feature_extract\include;D:\feature_extract\include\ncnn;$(IncludePath)</IncludePath>
<LibraryPath>D:\opencv420\build\x64\vc14\lib;D:\tbb2017_20170604oss\lib\intel64\vc14;D:\zxing-cpp-master\build\Release;D:\feature_extract\lib;$(LibraryPath)</LibraryPath>
<IncludePath>D:\opencv420\build\include;D:\opencv420\build\include\opencv2;D:\tbb2017_20170604oss\include;D:\zxing-cpp-master\core\src;D:\zxing-cpp-master\opencv\src;$(IncludePath)</IncludePath>
<LibraryPath>D:\opencv420\build\x64\vc14\lib;D:\tbb2017_20170604oss\lib\intel64\vc14;D:\zxing-cpp-master\build\Release;$(LibraryPath)</LibraryPath>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
......@@ -119,7 +119,7 @@
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libdmtx.lib;libzxing-debug.lib;libdecoded.lib;libresnet.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>libdmtx.lib;libzxing-debug.lib;libdecoded.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
......@@ -161,7 +161,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libdmtx.lib;libzxing.lib;libdecode.lib;libresnet.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>libdmtx.lib;libzxing.lib;libdecode.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
......
......@@ -18,10 +18,8 @@ int eyemMatMalloc(int iWidth, int iHeight, int iChannels, const char *ccSubType,
}
//图像信息
tpImage->iWidth = iWidth; tpImage->iHeight = iHeight; tpImage->iChannels = iChannels;
//内存尺寸
int _Size = iWidth*iHeight*iChannels;
//分配所需内存
if (strcmp(ccSubType, "uint8_t") == 0) {
tpImage->iDepth = 0;
......@@ -625,16 +623,6 @@ int eyemMatAt(EyemImage tpImage, EyemOcsIXY tpPoint)
return FUNC_OK;
}
//int eyemCopyRegion(EyemImage tpImage, EyemRotateRect tpRoi, EyemImage *tpDstImg)
//{
// CV_Assert(NULL != tpImage.vpImage);
//
// cv::Mat image = cv::Mat(tpImage.iHeight, tpImage.iWidth, MAKETYPE(tpImage.iDepth, tpImage.iChannels), tpImage.vpImage).clone();
//
//
// return FUNC_OK;
//}
int eyemNormalize(EyemImage &tpImage)
{
CV_Assert(NULL != tpImage.vpImage);
......@@ -676,4 +664,44 @@ int eyemNormalize(EyemImage &tpImage)
memcpy(tpImage.vpImage, image.data, _Size);
return FUNC_OK;
}
int eyemScaleImage(EyemImage tpImage, EyemImage *tpDstImg)
{
CV_Assert(NULL != tpImage.vpImage);
cv::Mat image = cv::Mat(tpImage.iHeight, tpImage.iWidth, MAKETYPE(tpImage.iDepth, tpImage.iChannels), tpImage.vpImage).clone();
return FUNC_OK;
}
int eyemScaleImageMax(EyemImage tpImage, EyemImage *tpDstImg)
{
CV_Assert(NULL != tpImage.vpImage);
cv::Mat image = cv::Mat(tpImage.iHeight, tpImage.iWidth, MAKETYPE(tpImage.iDepth, tpImage.iChannels), tpImage.vpImage).clone();
return FUNC_OK;
}
int eyemWarpShiftSubpix(EyemImage tpImage, double dShiftX, double dShiftY, EyemImage *tpDstImg, int iInterMethod = 1)
{
CV_Assert(NULL != tpImage.vpImage);
cv::Mat image = cv::Mat(tpImage.iHeight, tpImage.iWidth, MAKETYPE(tpImage.iDepth, tpImage.iChannels), tpImage.vpImage).clone();
double matx[6];
cv::Mat matM = cv::Mat(2, 3, CV_64F, matx);
matM.at<double>(0, 0) = 1.0;
matM.at<double>(0, 1) = 0.0;
matM.at<double>(0, 2) = dShiftX;
matM.at<double>(1, 0) = 0.0;
matM.at<double>(1, 1) = 1.0;
matM.at<double>(1, 2) = dShiftY;
cv::Mat imageShift;
cv::warpAffine(image, imageShift, matM, image.size(), iInterMethod, 0);
return FUNC_OK;
}
\ No newline at end of file
此文件太大,无法显示。
此文件太大,无法显示。
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!