Browse Source

optimize the image process procedure.

gsp 2 years ago
parent
commit
047873bd61

+ 3 - 3
OTSCPP/OTSImagePro/OTSImageProcess.cpp

@@ -1013,7 +1013,7 @@ namespace OTSIMGPROC
 		linearSmooth5(firstSmoothChart, secondSmooth, MAXBYTE);
 		linearSmooth5(secondSmooth, secondSmooth, MAXBYTE);
 		linearSmooth5(secondSmooth, secondSmooth, MAXBYTE);
-		linearSmooth5(secondSmooth, secondSmooth, MAXBYTE);
+		//linearSmooth5(secondSmooth, secondSmooth, MAXBYTE);
 		
 		//2. get down edge		
 		int nLengthEdge = MAXBYTE + 2;
@@ -2021,8 +2021,8 @@ namespace OTSIMGPROC
 		BYTE* pPixel = inImg->GetImageDataPointer();
 		Mat cvcopyImg = Mat(rows, cols, CV_8UC1, pPixel);
 		//Mat blurImg;
-		medianBlur(cvcopyImg, cvcopyImg, 7);//get rid of the noise point.
-		//cv::GaussianBlur(cvcopyImg, cvcopyImg, Size(3, 3), 7);
+		medianBlur(cvcopyImg, cvcopyImg, 11);//get rid of the noise point.
+		//cv::GaussianBlur(cvcopyImg, cvcopyImg, Size(3, 3), 3);
 		//inImg->SetImageData(cvcopyImg.data, width, height);
 		/*outImg = inImg;*/
 	}

+ 35 - 32
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -180,6 +180,8 @@ namespace OTSIncAReportGraph.Controls
         //背景使用原图
         private bool OriginalBackground = false;
 
+    
+
         static System.Windows.Forms.Timer delaytimer = new System.Windows.Forms.Timer();
         Logger log;
         /// <summary>
@@ -239,7 +241,7 @@ namespace OTSIncAReportGraph.Controls
 
             m_frm_userprogress = new Frm_UserProgress();
 
-            //m_mythread_state = false;
+          
 
             m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
             
@@ -356,7 +358,7 @@ namespace OTSIncAReportGraph.Controls
           
             List<Field> fieldlist = resultFile.List_OTSField;
 
-            //防止有时底层返回的Field的List是0,直接返回
+          
             if (fieldlist.Count == 0)
             {
                 ProgressBarUpdate(100, "field number =0 !....");
@@ -368,7 +370,7 @@ namespace OTSIncAReportGraph.Controls
             Application.DoEvents();
             ProgressBarUpdate(15, str29);
 
-            //第一次循环,用来计算单个Field的像素分辨率,和将所有的物理位置存放到List当中
+        
             List<Point> list_point = new List<Point>();
             int fieldwidth = 0, fieldheight = 0;
             //获取到该field的分辨率大小,循环中都是一样的
@@ -383,7 +385,7 @@ namespace OTSIncAReportGraph.Controls
 
             for (int i = 0; i < fieldlist.Count(); i++)
             {
-                //然后取出物理坐标,这个一会要与分辨率坐标进行变算一下
+             
                 Point ls_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };
                 list_point.Add(ls_point);
             }
@@ -586,46 +588,46 @@ namespace OTSIncAReportGraph.Controls
         #region 绘制函数
         protected override void OnPaint(PaintEventArgs e)//处理重绘情况
         {
-            if (OriginalBackground)
-            {
-                DrawOriginalImageAsBackground(e);
-            }
-            else
-            {
-                #region //填充个背景色矩形-----------------------------------------------
-                SolidBrush b = new SolidBrush(m_backrangecolor);
-                e.Graphics.FillRectangle(b, m_backRect);
-                #endregion
-            }
-
+           
+                if (OriginalBackground)
+                {
+                    DrawOriginalImageAsBackground(e);
+                }
+                else
+                {
 
-            
+                    SolidBrush b = new SolidBrush(m_backrangecolor);
+                    e.Graphics.FillRectangle(b, m_backRect);
 
+                }
 
-            #region //计算并进行绘制部份------------------------------------   
 
-            foreach (DisplayParticle item in m_list_allDPart)
-            {
-                DisplayParticle dp =item;
-                if (isReView)
+                foreach (DisplayParticle item in m_list_allDPart)
                 {
-                    if (dp.objParticleData.FieldId == reViewFieldId && dp.objParticleData.ParticleId == reViewParticleId)
+                    DisplayParticle dp = item;
+                    if (isReView)
+                    {
+                        if (dp.objParticleData.FieldId == reViewFieldId && dp.objParticleData.ParticleId == reViewParticleId)
+                        {
+                            dp.IsSelect = true;
+                        }
+                    }
+
+                    if (dp.GetPaintState() != PaintState.NOPAINT)
                     {
-                        dp.IsSelect = true;
+                        dp.OnPaint(e);
                     }
-                }
 
-                if (dp.GetPaintState() != PaintState.NOPAINT)
-                {
-                    dp.OnPaint(e);
+
                 }
 
 
-            }
+           
+           
 
 
 
-            #endregion
+          
 
             #region //判断是否使用了矩形或圆形工具进行多选,是的话,那么这里就开始绘制------------------------
             if (m_SelectTool.IsSelecting)
@@ -817,7 +819,7 @@ namespace OTSIncAReportGraph.Controls
 
 
            
-                ImageZoom(currentZoom, new PointF(e.X, e.Y));
+            ImageZoom(currentZoom, new PointF(e.X, e.Y));
            
 
             Invalidate();
@@ -891,6 +893,7 @@ namespace OTSIncAReportGraph.Controls
 
         protected override void OnMouseMove(MouseEventArgs e)
         {
+        
             //当前鼠标的位置,用来绘制鼠标线用
             m_mouse_now_point = e.Location;
             if (m_ParticleSegmentation.IsParticleSegmentation)
@@ -970,7 +973,7 @@ namespace OTSIncAReportGraph.Controls
                         m_backRect.Location.Y + e.Y - m_beforedrag_pointf.Y, m_backRect.Width, m_backRect.Height);
                     m_beforedrag_pointf = e.Location;
 
-
+                
                 }
                 else 
                 {

+ 2 - 10
OTSIncAReportApp/2-CommonFunction/CommonClass/DisplayParticle.cs

@@ -680,20 +680,12 @@ namespace OTSIncAReportGraph
                 if (m_listdsegment.Count > 0)
                 {
 
-                    //DisplaySegment ds = m_listdsegment[0];
+                   
                     if (this.ShowMode == SegmentShowMode.DRAWPOINT)
                     {
-                        //try
-                        //{
+                      
                             e.Graphics.DrawImage(m_image, m_rect);
 
-                        //}
-                        //catch (Exception ex)
-                        //{
-                        //    NLog.LogManager.GetCurrentClassLogger().Error(ex.ToString());
-                        //}
-
-
                     }
                     else
                     {