diff --git a/App_Code/CommonUse.cs b/App_Code/CommonUse.cs
index dad6cdb..8c462e3 100644
--- a/App_Code/CommonUse.cs
+++ b/App_Code/CommonUse.cs
@@ -187,7 +187,8 @@ public class CommonUse
int W = Convert.ToInt32(Convert.ToDouble(postCutList[2]));
int H = Convert.ToInt32(Convert.ToDouble(postCutList[3]));
-
+ //var aaa=commonUse.DrawGridByXY(color_mat, X, W, 1, Y, H, 1);
+ //ShowMatWaitKey("123", aaa, 0.8);
string mx = "";
try
@@ -416,7 +417,7 @@ public class CommonUse
//外接矩形宽、高需在给定范围内
// bool bo = (rect.Width / rect.Height >= ratio && (rect.Width > 3 && rect.Height > 2) && (area > 200 && area <= 4500));
- bool bo = ((rect.Width > 3 && rect.Height > 2) && (area > 100 && area <= 15000));
+ bool bo = ((rect.Width > 3 && rect.Height > 2) && (area > 1 && area <= 150000));
//bool bo = pxNums > 130 && pxNums < 300;
if (bo)
{
@@ -1309,6 +1310,42 @@ public class CommonUse
return mat_color;
}
+ public Mat DrawGridByXY(Mat img, int x_begin, int x_interval, int x_num, int y_begin, int y_interval, int y_num)
+ {
+
+
+ Mat src = img;
+
+ //转换颜色空间
+ Mat mat_color = new Mat();
+ if (src.NumberOfChannels == 1)
+ CvInvoke.CvtColor(src, mat_color, Emgu.CV.CvEnum.ColorConversion.Gray2Bgr);
+ else
+ mat_color = src;
+
+ for (int i = 0; i <= x_num; i++)
+ {
+ //先画竖线
+ Point p1 = new Point(x_begin + x_interval * i, y_begin);
+ Point p2 = new Point(x_begin + x_interval * i, y_begin + y_interval * y_num);
+ CvInvoke.Line(mat_color, p1, p2, new MCvScalar(0, 0, 255), 1);
+ }
+
+ for (int i = 0; i <= y_num; i++)
+ {
+ //再画横线
+ Point p1 = new Point(x_begin, y_begin + y_interval * i);
+ Point p2 = new Point(x_begin + x_interval * x_num, y_begin + y_interval * i);
+ CvInvoke.Line(mat_color, p1, p2, new MCvScalar(0, 0, 255), 1);
+ }
+
+ //img.Image = mat_color;
+
+
+ return mat_color;
+ }
+
+
///
/// 画出给定轮廓
///
diff --git a/Temp/UserTemp.aspx.cs b/Temp/UserTemp.aspx.cs
index b87a30f..02b219c 100644
--- a/Temp/UserTemp.aspx.cs
+++ b/Temp/UserTemp.aspx.cs
@@ -173,11 +173,16 @@ public partial class Temp_UserTemp : System.Web.UI.Page
- CvInvoke.Threshold(imagex, mat_threshold1, 254, 255, Emgu.CV.CvEnum.ThresholdType.BinaryInv);
+ CvInvoke.Threshold(imagex, mat_threshold1, 200, 255, Emgu.CV.CvEnum.ThresholdType.BinaryInv);
Mat mat_dilate1 = commonUse.MyDilate(mat_threshold1);
VectorOfVectorOfPoint selected_contours1;
selected_contours1 = commonUse.GetUsefulContoursDingWei(mat_dilate1, 1);
Image currentFramext = new Image(PictureBoxBitMap);
+
+ //Mat color_mat1 = commonUse.DrawContours(currentFramext.Mat, selected_contours1);
+
+ //commonUse.ShowMatWaitKey("shijuan bianjie", color_mat1, 0.6);
+
Mat color_mxxx = commonUse.GetPostionXYByFindPostionAndXieLv(imagex.Mat, selected_contours1, GetData[0], out PYPostionList, currentFramext, out xielv);
if (xielv == -100)
{