public override void ImageCutToList() { ImageConnectCut ic = new ImageConnectCut(base.imageMatrix); int[,] singleMatrix = ImageHandle.GetPictureSquence(ic.ConnectedLayerAreaMatrix); ic = new ImageConnectCut(singleMatrix); resetMatrix = ImageHandle.ResetMatrix(ic.ConnectedLayerAreaMatrix); ic = new ImageConnectCut(resetMatrix); clearMatrixByWidthAndHeight = ic.ClearMarixByWidthAndHeight(22, 38, 4, 32); base._cutCharImageList = ic.GetCodeList(); }
private static bool IsImpactConnect(int[,] matrix, int type) { ImageConnectCut ic = new ImageConnectCut(matrix); var conNum = ic.ConnectedLayerAreaNumList.Count; int[,] matrixChange = null; if (type == 1) { matrixChange = new int[, ] { { matrix[0, 0], 0, matrix[0, 2] }, { matrix[1, 0], matrix[1, 1], matrix[1, 2] } }; } if (type == 2) { matrixChange = new int[, ] { { matrix[0, 0], matrix[0, 1] }, { 0, matrix[1, 1] }, { matrix[2, 0], matrix[2, 1] } }; } if (type == 3) { matrixChange = new int[, ] { { matrix[0, 0], matrix[0, 1] }, { matrix[1, 0], 0 }, { matrix[2, 0], matrix[2, 1] } }; } if (type == 4) { matrixChange = new int[, ] { { matrix[0, 0], matrix[0, 1], matrix[0, 2] }, { matrix[1, 0], 0, matrix[1, 2] } }; } if (type == 5) { matrixChange = new int[, ] { { matrix[0, 0], matrix[0, 1], matrix[0, 2] }, { matrix[1, 0], 0, matrix[1, 2] }, { matrix[2, 0], matrix[2, 1], matrix[2, 2] } }; } ImageConnectCut icc = new ImageConnectCut(matrixChange); var conNumC = icc.ConnectedLayerAreaNumList.Count; if (conNum == conNumC) { return(false); } else { return(true); } }
public override string ImageRecognize() { if (base._cutCharImageList.Count == 4) { ImageConnectCut ica = new ImageConnectCut(resetMatrix); clearMatrixByWidthAndHeight = ica.ClearMarixByWidthAndHeight(22, 38, 4, 64);//宽粘连 base._cutCharImageList = ica.GetCodeList(); if (base._cutCharImageList.Count == 4) { ica = new ImageConnectCut(resetMatrix); clearMatrixByWidthAndHeight = ica.ClearMarixByWidthAndHeight(22, 70, 4, 38);//高粘连 base._cutCharImageList = ica.GetCodeList(); } } if (base._cutCharImageList.Count == 7) { return(OCRImageRecognize(ImageHandle.CreateImage(clearMatrixByWidthAndHeight)).Replace(" ", "").Trim()); } else { return(ImageRecognize(base._cutCharImageList)); } }