diff --git a/App_Code/CommonUse.cs b/App_Code/CommonUse.cs index 57d260f..05e05e1 100644 --- a/App_Code/CommonUse.cs +++ b/App_Code/CommonUse.cs @@ -418,7 +418,7 @@ public class CommonUse { VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint();//所有的轮廓 VectorOfVectorOfPoint selected_contours = new VectorOfVectorOfPoint();//用于存储筛选过后的轮廓 - CvInvoke.FindContours(mat, contours, null, Emgu.CV.CvEnum.RetrType.External, + CvInvoke.FindContours(mat, contours, null, Emgu.CV.CvEnum.RetrType.List, Emgu.CV.CvEnum.ChainApproxMethod.ChainApproxSimple);//提取所有轮廓,操作过程中会对输入图像进行修改 //筛选轮廓。筛选条件:长宽比大于给定值 @@ -1576,10 +1576,12 @@ public class CommonUse return bitmap; } Mat red = channels[2]; + + return red.Bitmap; //commonUse.ShowMatWaitKey("red", red, 0.5); - Mat redBinary = new Mat(); - CvInvoke.Threshold(red, redBinary, 150, 255, ThresholdType.Binary); + //Mat redBinary = new Mat(); + //CvInvoke.Threshold(red, redBinary, 150, 255, ThresholdType.Binary); //commonUse.ShowMatWaitKey("red+binary", redBinary, 0.5); //Mat redDilate = new Mat(); @@ -1590,7 +1592,7 @@ public class CommonUse //CvInvoke.MorphologyEx(redBinary, redDilate, MorphOp.Open, kernel, new Point(-1, -1), 1, BorderType.Default, new MCvScalar(0, 0, 0)); //commonUse.ShowMatWaitKey("redDilate", redDilate, 0.5); - return redBinary.Bitmap; + //return redBinary.Bitmap; } } diff --git a/Temp/Default.aspx.cs b/Temp/Default.aspx.cs index c49a03a..d83e7f7 100644 --- a/Temp/Default.aspx.cs +++ b/Temp/Default.aspx.cs @@ -335,6 +335,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page Image currentFramext = new Image(PictureBoxBitMap); Image myImage = new Image(commonUse.FilterRed(PictureBoxBitMap)); + // 进行中值滤波 CvInvoke.MedianBlur(myImage, myImage, 5); // 进行高斯滤波 @@ -346,14 +347,14 @@ public partial class 外部答题卡_Default : System.Web.UI.Page Bitmap bm_dest = myImage.Bitmap; Image EmguImagex1 = new Image(bm_dest); Mat mat_threshold1 = new Mat(); - CvInvoke.Threshold(EmguImagex1, mat_threshold1, 180, 255, Emgu.CV.CvEnum.ThresholdType.BinaryInv); + CvInvoke.Threshold(EmguImagex1, mat_threshold1, 210, 255, Emgu.CV.CvEnum.ThresholdType.BinaryInv); Mat mat_dilate = commonUse.MyDilate(mat_threshold1); VectorOfVectorOfPoint selected_contours1 = commonUse.GetUsefulContoursDingWei(mat_dilate, 1); //var color_mat1 = commonUse.DrawContours(mat_dilate, selected_contours1); //commonUse.ShowMatWaitKey("44444", color_mat1, 0.8); - //Response.Write(ImgToBase64String(color_mat1.Bitmap)); + ////Response.Write(ImgToBase64String(color_mat1.Bitmap)); //return false; diff --git a/js/index.js b/js/index.js index ce491c4..12f6c3f 100644 --- a/js/index.js +++ b/js/index.js @@ -24,7 +24,7 @@ function CloseHideArea(obj) { ///设置锚点 function SetMao(obj, index) { - if (IsPostionValue == "False") { + if (IsPostionValue.toLowerCase() == "false" || IsPostionValue.toLowerCase() == "0") { alert("无法设置定位点,请修改主模板数据."); return; } @@ -815,7 +815,7 @@ function SetMaoPostion(postiondata) { //alert(IsPostionValue); if (postiondata == "") { - if (IsPostionValue == "1") { + if (IsPostionValue == "1" || IsPostionValue.toLowerCase() == "true") { SetMao(document.getElementById("point_0"), 0); SetMao(document.getElementById("point_1"), 1); SetMao(document.getElementById("point_2"), 2); @@ -823,7 +823,7 @@ function SetMaoPostion(postiondata) { } return; } - if (IsPostionValue == "0") { + if (IsPostionValue == "0" || IsPostionValue.toLowerCase() == "false") { $("#draggable_0").remove(); $("#draggable_1").remove(); $("#draggable_2").remove();