修改所有区域卷积
This commit is contained in:
parent
0ed659e482
commit
00f4b9c95d
@ -1,4 +1,5 @@
|
||||
using OpenCvSharp;
|
||||
using Sunny.UI.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -14,7 +15,6 @@ namespace HisenceYoloDetection
|
||||
{
|
||||
public static class CheckDiffSciHelper
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -68,8 +68,6 @@ namespace HisenceYoloDetection
|
||||
{
|
||||
Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
|
||||
}
|
||||
// Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
|
||||
|
||||
|
||||
|
||||
//Rect area2 = new Rect(148,30,229,222);
|
||||
@ -95,7 +93,7 @@ namespace HisenceYoloDetection
|
||||
}
|
||||
Cv2.Resize(thr1, thr1, new Size(550, 270));
|
||||
Cv2.Resize(thr2, thr2, new Size(550, 270));
|
||||
DateTime dt= DateTime.Now;
|
||||
|
||||
string filename = dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString();
|
||||
|
||||
string savePath4 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "_thr1.png");
|
||||
@ -108,9 +106,9 @@ namespace HisenceYoloDetection
|
||||
Cv2.ImWrite(savePath3, thr2);
|
||||
|
||||
// 创建卷积核
|
||||
Mat filter1 = new Mat(15, 15, MatType.CV_32F, new Scalar(0));
|
||||
filter1.Row(7).SetTo(new Scalar(0.025));
|
||||
filter1.Col(7).SetTo(new Scalar(0.025));
|
||||
Mat filter1 = new Mat(5, 5, MatType.CV_32F, new Scalar(0));
|
||||
filter1.Row(2).SetTo(new Scalar(0.025));
|
||||
filter1.Col(2).SetTo(new Scalar(0.025));
|
||||
|
||||
// 应用卷积
|
||||
Mat final_result1 = new Mat();
|
||||
@ -190,6 +188,7 @@ namespace HisenceYoloDetection
|
||||
return isMatch;
|
||||
}
|
||||
|
||||
|
||||
public static Rect strChangeRect(string strrect)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(strrect))
|
||||
|
@ -195,10 +195,11 @@ namespace HisenceYoloDetection
|
||||
|
||||
bool st = ManagerModelHelper.StrMatch2(s1, s2);
|
||||
|
||||
//Rect rect = new Rect(0, 0, 0, 0);
|
||||
// string path2 = "D:\\Hisence\\SQLImages\\BatchW81XBModelWNHA62SASUA\\3\\BatchW81XBModelWNHA62SASUAresult.jpg";
|
||||
//Mat cameraMat = Cv2.ImRead(path2);
|
||||
//bool ifg = CheckDiffSciHelper.CheckDiffSci(path2, cameraMat, rect, rect, false, "D://Hisence//Test");
|
||||
Rect rect = new Rect(0, 0, 0, 0);
|
||||
string path2 = "D:\\Hisence\\SQLImages\\LR1006G4SILVERWJ060480U0SW901N120105\\4\\LR1006G4SILVERWJ060480U0SW901N120105result.jpg";
|
||||
string path23 = "D:\\Hisence\\SQLImages\\LR1006G4SILVERWJ060480U0SW901N120105\\4\\L1.jpg";
|
||||
Mat cameraMat = Cv2.ImRead(path23);
|
||||
bool ifg = CheckDiffSciHelper.CheckDiffSci(path2, cameraMat, rect, rect, false, "D://Hisence//Test");
|
||||
|
||||
string vBarPath = "D:\\Hisence\\类型\\Lp\\202452414231.jpg";
|
||||
string vCam1OnePath = "D:\\Hisence\\类型\\Lp\\001.jpg";
|
||||
@ -2927,8 +2928,13 @@ namespace HisenceYoloDetection
|
||||
if (!saveimage)
|
||||
{
|
||||
SQLStr = SQlxK_HisenceWord.ThreeblockMainWord;
|
||||
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.ThreeblockMainWord, SQlxK_HisenceWord.ThreeblockMainWord);
|
||||
if (!OneIF)
|
||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.ThreeblockMainWord, SQlxK_HisenceWord.ThreeblockMainWord);
|
||||
|
||||
Rect rect = new Rect(0, 0, 0, 0);
|
||||
string PathSql = SQlxK_HisenceWord.ThreeblockPath;
|
||||
|
||||
juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test");
|
||||
if (!OneIF1 || !juanjiMatch)
|
||||
{
|
||||
DisplayResult(mLcut);
|
||||
//显示错误的板
|
||||
@ -2951,8 +2957,13 @@ namespace HisenceYoloDetection
|
||||
if (!saveimage)
|
||||
{
|
||||
SQLStr = SQlxK_HisenceWord.FourblockMainWord;
|
||||
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.FourblockMainWord, SQlxK_HisenceWord.FourblockMainWord);
|
||||
if (!OneIF)
|
||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.FourblockMainWord, SQlxK_HisenceWord.FourblockMainWord);
|
||||
|
||||
Rect rect = new Rect(0, 0, 0, 0);
|
||||
string PathSql = SQlxK_HisenceWord.FourblockPath;
|
||||
|
||||
juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test");
|
||||
if (!OneIF1 || !juanjiMatch)
|
||||
{
|
||||
DisplayResult(mLcut);
|
||||
//显示错误的板
|
||||
@ -2975,8 +2986,12 @@ namespace HisenceYoloDetection
|
||||
if (!saveimage)
|
||||
{
|
||||
SQLStr = SQlxK_HisenceWord.FiveblockMainWord;
|
||||
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.FiveblockMainWord, SQlxK_HisenceWord.FiveblockMainWord);
|
||||
if (!OneIF)
|
||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.FiveblockMainWord, SQlxK_HisenceWord.FiveblockMainWord);
|
||||
Rect rect = new Rect(0, 0, 0, 0);
|
||||
string PathSql = SQlxK_HisenceWord.FiveblockMainWord;
|
||||
|
||||
juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test");
|
||||
if (!OneIF1 || !juanjiMatch)
|
||||
{
|
||||
DisplayResult(mLcut);
|
||||
//显示错误的板
|
||||
@ -2998,7 +3013,13 @@ namespace HisenceYoloDetection
|
||||
if (!saveimage)
|
||||
{
|
||||
SQLStr = SQlxK_HisenceWord.SixblockMainWord;
|
||||
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.SixblockMainWord, SQlxK_HisenceWord.SixblockMainWord);
|
||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.SixblockMainWord, SQlxK_HisenceWord.SixblockMainWord);
|
||||
|
||||
Rect rect = new Rect(0, 0, 0, 0);
|
||||
string PathSql = SQlxK_HisenceWord.SixblockPath;
|
||||
|
||||
juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test");
|
||||
if (!OneIF1 || !juanjiMatch)
|
||||
if (!OneIF)
|
||||
{
|
||||
// DisplayResult(mLcut);
|
||||
@ -3022,8 +3043,12 @@ namespace HisenceYoloDetection
|
||||
if (!saveimage)
|
||||
{
|
||||
SQLStr = SQlxK_HisenceWord.SevenblockMainWord;
|
||||
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.SevenblockMainWord, SQlxK_HisenceWord.SevenblockMainWord);
|
||||
if (!OneIF)
|
||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.SevenblockMainWord, SQlxK_HisenceWord.SevenblockMainWord);
|
||||
Rect rect = new Rect(0, 0, 0, 0);
|
||||
string PathSql = SQlxK_HisenceWord.SevenblockPath;
|
||||
|
||||
juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test");
|
||||
if (!OneIF1 || !juanjiMatch)
|
||||
{
|
||||
//DisplayResult(mLcut);
|
||||
//显示错误的板
|
||||
@ -3045,8 +3070,12 @@ namespace HisenceYoloDetection
|
||||
if (!saveimage)
|
||||
{
|
||||
SQLStr = SQlxK_HisenceWord.EightblockMainWord;
|
||||
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.EightblockMainWord, SQlxK_HisenceWord.EightblockMainWord);
|
||||
if (!OneIF)
|
||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.EightblockMainWord, SQlxK_HisenceWord.EightblockMainWord);
|
||||
Rect rect = new Rect(0, 0, 0, 0);
|
||||
string PathSql = SQlxK_HisenceWord.EightblockPath;
|
||||
|
||||
juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test");
|
||||
if (!OneIF1 || !juanjiMatch)
|
||||
{
|
||||
// DisplayResult(mLcut);
|
||||
//显示错误的板
|
||||
@ -3067,10 +3096,9 @@ namespace HisenceYoloDetection
|
||||
using (StreamWriter sw = new StreamWriter(txtLog, true))
|
||||
{
|
||||
|
||||
if (blockIndex == "2")
|
||||
{
|
||||
sw.WriteLine("¾í»ýÆ¥Åä" + juanjiMatch);
|
||||
}
|
||||
|
||||
sw.WriteLine("¿é" + blockIndex + "¾í»ýÆ¥Åä" + juanjiMatch);
|
||||
|
||||
sw.WriteLine("块" + blockIndex + "数据库" + SQLStr + "关键字" + MainWoidStr + "结果" + OneIF + "\n");
|
||||
sw.WriteLine("块" + blockIndex + " 所有字 " + TextWoidStr + "\n");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user