|
@@ -631,11 +631,8 @@ namespace o0.Project
|
|
|
//var ScreenLocateTexLightedMat = texture.Too0Mat();
|
|
//var ScreenLocateTexLightedMat = texture.Too0Mat();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /// <param name="ScreenLocateTexture">用于算法检测线段的图片</param>
|
|
|
|
|
- /// <param name="ChoosableLineTex">输出备选线段</param>
|
|
|
|
|
- /// <param name="ScreenQuadTex">输出最终结果</param>
|
|
|
|
|
/// <param name="lineWidth">识别的最小线段长度</param>
|
|
/// <param name="lineWidth">识别的最小线段长度</param>
|
|
|
- /// <param name="debugImage">这个参数如果不为null,则执行debug操作</param>
|
|
|
|
|
|
|
+ /// <param name="debugImages">这个参数如果不为null且数量大于0,则执行debug操作</param>
|
|
|
void QuadrilateralFit(List<Texture2D> debugImages = null, float lineWidth = 10)
|
|
void QuadrilateralFit(List<Texture2D> debugImages = null, float lineWidth = 10)
|
|
|
{
|
|
{
|
|
|
// 屏幕黑白差值,存放多批次的图像用于识别, 该List数量不能等于 0
|
|
// 屏幕黑白差值,存放多批次的图像用于识别, 该List数量不能等于 0
|
|
@@ -680,7 +677,6 @@ namespace o0.Project
|
|
|
string log = $"[ScreenLocate Auto] Size: ({Size.x},{Size.y}), 卷积核Size: {conSize}, 最小线段长度: {minLength}";
|
|
string log = $"[ScreenLocate Auto] Size: ({Size.x},{Size.y}), 卷积核Size: {conSize}, 最小线段长度: {minLength}";
|
|
|
|
|
|
|
|
var allLines = new List<LineIdentified>();
|
|
var allLines = new List<LineIdentified>();
|
|
|
- Texture2D ScreenLocateTexture = null;
|
|
|
|
|
List<Texture2D> LocateTexTemp = new List<Texture2D>();
|
|
List<Texture2D> LocateTexTemp = new List<Texture2D>();
|
|
|
List<Matrix> ScreenLocateMatList = new List<Matrix>();
|
|
List<Matrix> ScreenLocateMatList = new List<Matrix>();
|
|
|
foreach (var batch in PixelsMultipleBatches.Index())
|
|
foreach (var batch in PixelsMultipleBatches.Index())
|
|
@@ -692,9 +688,9 @@ namespace o0.Project
|
|
|
log += $"\r\n识别图片{batch}, 识别到的线段数量为: {lineCount}";
|
|
log += $"\r\n识别图片{batch}, 识别到的线段数量为: {lineCount}";
|
|
|
ScreenLocateMatList.Add(ScreenLocateMat);
|
|
ScreenLocateMatList.Add(ScreenLocateMat);
|
|
|
}
|
|
}
|
|
|
- ScreenLocateTexture = LocateTexTemp[0];
|
|
|
|
|
|
|
+ Texture2D ScreenLocateTexture = LocateTexTemp[0]; // for output
|
|
|
|
|
|
|
|
- // 过滤得到四边形的四条边
|
|
|
|
|
|
|
+ // 过滤得到四边形的四条边, ScreenLocateMatList[0]默认是屏幕的黑白色差
|
|
|
var quadLines = FilterLines(ScreenLocateMatList, allLines, GetAvgPoint(ScreenLocateMatList[0]),
|
|
var quadLines = FilterLines(ScreenLocateMatList, allLines, GetAvgPoint(ScreenLocateMatList[0]),
|
|
|
out Line[] oldLines, out List<Line> possibleLines,
|
|
out Line[] oldLines, out List<Line> possibleLines,
|
|
|
Screen, conSize, conSize, minLength);
|
|
Screen, conSize, conSize, minLength);
|
|
@@ -837,7 +833,7 @@ namespace o0.Project
|
|
|
int ZIMIdentifyQuadLSD(ref List<LineIdentified> allLines, int batch, (Matrix edgeMat, Matrix edgeDirMat) edgeGradient,
|
|
int ZIMIdentifyQuadLSD(ref List<LineIdentified> allLines, int batch, (Matrix edgeMat, Matrix edgeDirMat) edgeGradient,
|
|
|
float minLength = 100)
|
|
float minLength = 100)
|
|
|
{
|
|
{
|
|
|
- var l = edgeGradient.edgeMat.IdentifyLineLSD(edgeGradient.edgeDirMat, minLength, 20, LineCaptureSize: new Vector(0, 5));
|
|
|
|
|
|
|
+ var l = edgeGradient.edgeMat.IdentifyLineLSD(edgeGradient.edgeDirMat, minLength, 50, LineCaptureSize: new Vector(10, 6));
|
|
|
if (l == null || l.Count == 0)
|
|
if (l == null || l.Count == 0)
|
|
|
return 0;
|
|
return 0;
|
|
|
allLines.AddRange(l.Select((i) => new LineIdentified(batch, i)));
|
|
allLines.AddRange(l.Select((i) => new LineIdentified(batch, i)));
|