Browse Source

optimize the xraypos algorithm.

gsp 3 years ago
parent
commit
6e8b009708

+ 6 - 12
OTSCPP/OTSImagePro/OTSImageProcess.cpp

@@ -2358,17 +2358,11 @@ namespace OTSIMGPROC
 		int r;
 		Point inscribeCirclecenter;
 		FindInnerCircleInContour(outContour, inscribeCirclecenter, r);
-		//--------------------------------------------------------calculate the xraypos failed, expect improving later!
-		//CPoint xrayPos = a_pOTSPart->GetXRayPos();
-		//double localPos = pointPolygonTest(outContour, Point2f(xrayPos.x, xrayPos.y), false);
-		//if (localPos == 1 || localPos == 0)//像素点在多边形内和边缘 
-		//{
-		//	
-		//}
-		//else
-		//{
-		//	a_pOTSPart->SetXRayPos(CPoint(inscribeCirclecenter.x, inscribeCirclecenter.y));
-		//}
+		//--------------------------------------------------------calculate the xraypos !
+		
+		CRect rec = a_pOTSPart->GetParticleRect();
+	
+		a_pOTSPart->SetXRayPos(CPoint(inscribeCirclecenter.x - nExpand_Size + rec.left - 1, inscribeCirclecenter.y - nExpand_Size + rec.top - 1));
 		//--------------------------------------------------------
 
 		//circle(cvContourImg, inscribeCirclecenter, r, Scalar(200));
@@ -2390,7 +2384,7 @@ namespace OTSIMGPROC
 		int ny = mu.m01 / mu.m00;
 		//circle(cvcopyImg, Point(nx, ny), 1, (255), 1);
 		Point ptCenter = Point((int)nx, (int)ny);
-		if (pointPolygonTest(outContour, ptCenter, false) != 1)// the center point doesn't contain in the contour, we think it as curve shape.
+		if (pointPolygonTest(listEdge, ptCenter, false) != 1)// the center point doesn't contain in the contour, we think it as curve shape.
 		{
 			isStripShape = true;
 		}

+ 1 - 0
OTSIncAMeasureApp/0-OTSModel/OTSDataType/CSampleParam.cs

@@ -53,6 +53,7 @@ namespace OTSDataType
             m_poImageScanParam = new COTSImgScanPrm();
             m_poImageProcessParam = new COTSImageProcParam();
             m_poXRayParam = new COTSXRayParam();
+            m_SlopParam = new CSlopFocusParam();
         }
         void Duplicate(CSampleParam a_oSource)
         {

+ 14 - 1
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -47,7 +47,7 @@ namespace OTSIncAReportGraph.Controls
       
        MoveSEMToParticle=1,
        CopyImage=2,
-            OriginalSplicing= 3
+       OriginalSplicing= 3
 
     }
     /// <summary>
@@ -1923,7 +1923,20 @@ namespace OTSIncAReportGraph.Controls
                 var curfldrec = f.Current_Rect;
                 if (curfldrec.Left > -1000 && curfldrec.Right < this.Width + 1000 && curfldrec.Top > -1000 && curfldrec.Bottom < this.Height + 1000)
                 {
+                   
+                  
                     args.Graphics.DrawImage(f.OriginalImage, f.Current_Rect.X, f.Current_Rect.Y, f.Current_Rect.Width, f.Current_Rect.Height);
+                    Graphics g = args.Graphics;
+                    for (int i = 0; i < f.List_DParticle.Count; i++)
+                    {
+                        PointF xrayPos = new PointF(f.List_DParticle[i].objParticleData.PosX, f.List_DParticle[i].objParticleData.PosY);
+                        
+                        PointF p = new PointF(xrayPos.X / f.OriginalImage.Width*f.Current_Rect.Width+f.Current_Rect.X, xrayPos.Y / f.OriginalImage.Height* f.Current_Rect.Height+f.Current_Rect.Y);
+                        g.DrawString("+", new Font("黑体", 6), new SolidBrush(Color.Red), p);
+                    }
+                   
+                   
+
                 }
             }
 

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

@@ -560,7 +560,8 @@ namespace OTSIncAReportGraph
                 {
                     item.OnPaint(e);
                 }
-              
+
+
             }
             if (GetPaintState() == PaintState.CONCISEPAINT)
             {