Browse Source

improve the xraypos algorithm.

gsp 3 years ago
parent
commit
fc081b0e6f

+ 12 - 0
OTSCPP/OTSImagePro/OTSImageProcess.cpp

@@ -2329,6 +2329,7 @@ namespace OTSIMGPROC
 				curve2.push_back(pt);
 			}
 		}
+
 		double d_perp1 = 0, d_perp2 = 0;
 		for (unsigned int i = 0; i < curve1.size(); i++)
 		{
@@ -2351,6 +2352,17 @@ namespace OTSIMGPROC
 		int r;
 		Point inscribeCirclecenter;
 		FindInnerCircleInContour(outContour, inscribeCirclecenter, r);
+		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));
+		}
+
 		//circle(cvContourImg, inscribeCirclecenter, r, Scalar(200));
 		a_pOTSPart->SetDInscr(r * 2 * a_PixelSize);
 		//---------------calculate the image other caracater: length/width  realArea/minRectangeArea etc. we can use these propertes to do forward process.

+ 6 - 3
OTSIncAMeasureApp/0-OTSModel/Measure/1-OTSInclution/SmplMeasureInclution.cs

@@ -51,6 +51,11 @@ namespace OTSModelSharp
             log.Info("Begin to filter particles!");
             InitFieldParticles();
             CalculateParticleAbsolutPos();
+
+            log.Info("Begin to Calculate the image property of every particle!");
+            var analysisparts = curFldData.GetListAnalysisParticles();
+            curFldData.CalParticleImageProp(analysisparts);//calculate particle image property such as feret diameter, DMAX etc.
+
             COTSXRayParam pXRayParam = m_Sample.GetMsrParams().GetXRayParam();
 
             if (pXRayParam.GetUsingXray() == true)
@@ -60,9 +65,7 @@ namespace OTSModelSharp
              
                 Thread.Sleep(100);
             }
-            log.Info("Begin to Calculate the image property of every particle!");
-            var analysisparts = curFldData.GetListAnalysisParticles();
-            curFldData.CalParticleImageProp(analysisparts);//calculate particle image property such as feret diameter, DMAX etc.
+            
 
             log.Info("Begin to classify particles! particle num:"+ curFldData.GetListAnalysisParticles().Count);
             ClassifyFieldParticles();

+ 6 - 3
OTSIncAMeasureApp/0-OTSModel/Measure/2-OTSCleanliness/SmplMeasureCleanliness.cs

@@ -48,6 +48,12 @@ namespace OTSModelSharp
             // second step :filter the finded particles.
             FilterParticles((CFieldDataClean)curFldData);
             CalculateParticleAbsolutPos();
+
+
+            log.Info("Begin to Calculate the image property of every particle!");
+            var analysisparts = curFldDataCln.ListBigParticles;
+            curFldData.CalParticleImageProp(analysisparts);//calculate particle image property such as feret diameter, DMAX etc
+
             COTSXRayParam pXRayParam = m_Sample.GetMsrParams().GetXRayParam();
             //collect xray data.
             if (pXRayParam.GetUsingXray() == true)
@@ -60,9 +66,6 @@ namespace OTSModelSharp
 
 
 
-            log.Info("Begin to Calculate the image property of every particle!");
-            var analysisparts = curFldDataCln.ListBigParticles;
-            curFldData.CalParticleImageProp(analysisparts);//calculate particle image property such as feret diameter, DMAX etc.
 
 
             ClassifyFieldParticles();