zty 2 лет назад
Родитель
Сommit
4a60a0c724

+ 7 - 8
OTSCPP/OTSImagePro/FieldMgr.cpp

@@ -380,8 +380,7 @@ namespace OTSIMGPROC {
 		// pixel size (micros)
 		//double dPixelSize = (double)dScanFiledSizeX / (double)ImageSizeByPixel.cx;
 
-		double dOverLapSizeX = m_Overlap * dScanFiledSizeX / pixelx;
-		double dOverLapSizeY = m_Overlap * dScanFiledSizeY / pixely;
+		double dOverLapSize = m_Overlap * dScanFiledSizeX / pixelx;
 
 		// the measure domain rectangle 
 		CRect rectMeasureDomain = m_pMeasureArea->GetDomainRect();
@@ -394,8 +393,8 @@ namespace OTSIMGPROC {
 		OTS_GET_IMAGE_MODE nStartMode = (OTS_GET_IMAGE_MODE)m_fieldStartMode;
 			
 			// calculate total columns, rows and make sure the domain area be covered
-			int nTotalCols = (int)(ceil((double)rectMeasureDomain.Width() / (dScanFiledSizeX - dOverLapSizeX)));
-			int nTotalRows = (int)(ceil((double)rectMeasureDomain.Height() / (dScanFiledSizeY - dOverLapSizeY)));
+			int nTotalCols = (int)(ceil((double)rectMeasureDomain.Width() / (dScanFiledSizeX - dOverLapSize)));
+			int nTotalRows = (int)(ceil((double)rectMeasureDomain.Height() / (dScanFiledSizeY - dOverLapSize)));
 
 			// calculate column on the left of the centre point
 			int nLeftCols = nTotalCols / 2;
@@ -408,16 +407,16 @@ namespace OTSIMGPROC {
 			nTotalRows = nRowsOnTop * 2 + 1;
 
 			// calculate left, right field column position (x only
-			int nLeftMostColX = poiDomainCentre.x - nLeftCols * ((int)dScanFiledSizeX - (int)dOverLapSizeX);
-			int nUpMostRowY = poiDomainCentre.y - nRowsOnTop * ((int)dScanFiledSizeY - (int)dOverLapSizeY);
+			int nLeftMostColX = poiDomainCentre.x - nLeftCols * ((int)dScanFiledSizeX - (int)dOverLapSize);
+			int nUpMostRowY = poiDomainCentre.y - nRowsOnTop * ((int)dScanFiledSizeY - (int)dOverLapSize);
 				
 				std::vector <std::vector <CPoint>> pointMatrics(nTotalRows, std::vector<CPoint>(nTotalCols));
 				for (int i = 0; i < nTotalRows; i++)
 				{
 					for (int j = 0; j < nTotalCols; j++)
 					{
-						pointMatrics[i][j].x = nLeftMostColX + j * ((int)dScanFiledSizeX - (int)dOverLapSizeX);
-						pointMatrics[i][j].y = nUpMostRowY + i * ((int)dScanFiledSizeY - (int)dOverLapSizeY);
+						pointMatrics[i][j].x = nLeftMostColX + j * ((int)dScanFiledSizeX - (int)dOverLapSize);
+						pointMatrics[i][j].y = nUpMostRowY + i * ((int)dScanFiledSizeY - (int)dOverLapSize);
 					}
 				}
 				std::vector <std::vector <int>> sequenceMat; //construct an matrics map to the pointMatrics,but the content is the sequence number.

+ 58 - 23
OTSIncAMeasureApp/ServiceCenter/CImageHandler.cs

@@ -475,7 +475,14 @@ namespace OTSModelSharp.ServiceInterface
                     Rectangle leftRectangle = (Rectangle)leftParticles.GetParticleRect();
                     if (leftRectangle.Left > resolutionSize.Width - overlap)//未跨界
                     {
-                        particleClrs.Add(leftParticles);
+                        if (leftRectangle.Right == resolutionSize.Width)//颗粒右侧在边界处截断
+                        {
+
+                        }
+                        else
+                        {
+                            particleClrs.Add(leftParticles);
+                        }
                     }
                 }
             }
@@ -485,9 +492,16 @@ namespace OTSModelSharp.ServiceInterface
                 foreach (var upParticles in left_upField.GetListAnalysisParticles())
                 {
                     Rectangle upRectangle = (Rectangle)upParticles.GetParticleRect();
-                    if (upRectangle.Top > resolutionSize.Height - overlap)//未跨界
+                    if (upRectangle.Top > resolutionSize.Height - overlap / 2)//未跨界
                     {
-                        particleClrs.Add(upParticles);
+                        if (upRectangle.Bottom == resolutionSize.Height)//颗粒下方在边界处截断
+                        {
+
+                        }
+                        else
+                        {
+                            particleClrs.Add(upParticles);
+                        }
                     }
                 }
             }
@@ -503,19 +517,19 @@ namespace OTSModelSharp.ServiceInterface
             {
                 if (i == 0)//首张
                 {
-                    matCombin.Add(new Mat(list_mats[i], new Rect(0, 0, list_mats[i].Width - OverlapParam - 200, list_mats[i].Height)));
-                    matStitch.Add(new Mat(list_mats[i], new Rect(list_mats[i].Width - OverlapParam - 200, 0, OverlapParam + 200, list_mats[i].Height)));
+                    matCombin.Add(new Mat(list_mats[i], new Rect(0, 0, list_mats[i].Width - OverlapParam - 100, list_mats[i].Height)));
+                    matStitch.Add(new Mat(list_mats[i], new Rect(list_mats[i].Width - OverlapParam - 100, 0, OverlapParam + 100, list_mats[i].Height)));
                 }
                 else if(i == list_mats.Count() - 1)//末张
                 {
-                    matStitch.Add(new Mat(list_mats[i], new Rect(0, 0, OverlapParam + 200, list_mats[i].Height)));
-                    matCombin.Add(new Mat(list_mats[i], new Rect(OverlapParam + 200, 0, list_mats[i].Width - OverlapParam - 200, list_mats[i].Height)));
+                    matStitch.Add(new Mat(list_mats[i], new Rect(0, 0, OverlapParam + 100, list_mats[i].Height)));
+                    matCombin.Add(new Mat(list_mats[i], new Rect(OverlapParam + 100, 0, list_mats[i].Width - OverlapParam - 100, list_mats[i].Height)));
                 }
                 else
                 {
-                    matStitch.Add(new Mat(list_mats[i], new Rect(0, 0, OverlapParam + 200, list_mats[i].Height)));
-                    matCombin.Add(new Mat(list_mats[i], new Rect(OverlapParam + 200, 0, list_mats[i].Width - (OverlapParam + 200) * 2, list_mats[i].Height)));
-                    matStitch.Add(new Mat(list_mats[i], new Rect(list_mats[i].Width - OverlapParam - 200, 0, OverlapParam + 200, list_mats[i].Height)));
+                    matStitch.Add(new Mat(list_mats[i], new Rect(0, 0, OverlapParam + 100, list_mats[i].Height)));
+                    matCombin.Add(new Mat(list_mats[i], new Rect(OverlapParam + 100, 0, list_mats[i].Width - (OverlapParam + 100) * 2, list_mats[i].Height)));
+                    matStitch.Add(new Mat(list_mats[i], new Rect(list_mats[i].Width - OverlapParam - 100, 0, OverlapParam + 100, list_mats[i].Height)));
                 }
             }
 
@@ -527,7 +541,7 @@ namespace OTSModelSharp.ServiceInterface
                 }
                 else
                 {
-                    matCombin.Insert(i + 1, StitchImageX((int)(OverlapParam * 1.5), type, matStitch[i], matStitch[i + 1]));
+                    matCombin.Insert(i + 1, StitchImageX((int)(OverlapParam / 2 * 1.2), type, matStitch[i], matStitch[i + 1]));
                 }
             }
 
@@ -545,19 +559,19 @@ namespace OTSModelSharp.ServiceInterface
             {
                 if (i == 0)//首张
                 {
-                    matCombin.Add(new Mat(list_mats[i], new Rect(0, 0, list_mats[i].Width, list_mats[i].Height - OverlapParam - 200)));
-                    matStitch.Add(new Mat(list_mats[i], new Rect(0, list_mats[i].Height - OverlapParam - 200, list_mats[i].Width, OverlapParam + 200)));
+                    matCombin.Add(new Mat(list_mats[i], new Rect(0, 0, list_mats[i].Width, list_mats[i].Height - OverlapParam - 100)));
+                    matStitch.Add(new Mat(list_mats[i], new Rect(0, list_mats[i].Height - OverlapParam - 100, list_mats[i].Width, OverlapParam + 100)));
                 }
                 else if (i == list_mats.Count() - 1)//末张
                 {
-                    matStitch.Add(new Mat(list_mats[i], new Rect(0, 0, list_mats[i].Width, OverlapParam + 200)));
-                    matCombin.Add(new Mat(list_mats[i], new Rect(0, OverlapParam + 200, list_mats[i].Width, list_mats[i].Height - OverlapParam - 200)));
+                    matStitch.Add(new Mat(list_mats[i], new Rect(0, 0, list_mats[i].Width, OverlapParam + 100)));
+                    matCombin.Add(new Mat(list_mats[i], new Rect(0, OverlapParam + 100, list_mats[i].Width, list_mats[i].Height - OverlapParam - 100)));
                 }
                 else
                 {
-                    matStitch.Add(new Mat(list_mats[i], new Rect(0, 0, list_mats[i].Width, OverlapParam + 200)));
-                    matCombin.Add(new Mat(list_mats[i], new Rect(0, OverlapParam + 200, list_mats[i].Width, list_mats[i].Height - (OverlapParam + 200) * 2)));
-                    matStitch.Add(new Mat(list_mats[i], new Rect(0, list_mats[i].Height - OverlapParam - 200, list_mats[i].Width, OverlapParam + 200)));
+                    matStitch.Add(new Mat(list_mats[i], new Rect(0, 0, list_mats[i].Width, OverlapParam + 100)));
+                    matCombin.Add(new Mat(list_mats[i], new Rect(0, OverlapParam + 100, list_mats[i].Width, list_mats[i].Height - (OverlapParam + 100) * 2)));
+                    matStitch.Add(new Mat(list_mats[i], new Rect(0, list_mats[i].Height - OverlapParam - 100, list_mats[i].Width, OverlapParam + 100)));
                 }
             }
 
@@ -569,7 +583,7 @@ namespace OTSModelSharp.ServiceInterface
                 }
                 else
                 {
-                    matCombin.Insert(i + 1, StitchImageY((int)(OverlapParam), type, matStitch[i], matStitch[i + 1]));
+                    matCombin.Insert(i + 1, StitchImageY(OverlapParam, type, matStitch[i], matStitch[i + 1]));
                 }
             }
 
@@ -639,8 +653,8 @@ namespace OTSModelSharp.ServiceInterface
             MStitch mStitch = new MStitch();
             mStitch.Pwidth = newImg1.Width;
             mStitch.Pheight = newImg1.Height;
-            mStitch.W_min = min_w;
-            mStitch.W_max = min_w + 50;
+            mStitch.W_min = min_w - 100;
+            mStitch.W_max = min_w + 100;
             mStitch.H_min = newImg1.Height;
             mStitch.minval = 255;
             mStitch.im = newImg1;
@@ -871,7 +885,18 @@ namespace OTSModelSharp.ServiceInterface
                         double ColorR = imageParam.mStitch.im.At<Vec3b>(y1, x1).Item0 * (1.0 - w) + imageParam.im.At<Vec3b>(y2, x2).Item0 * w;
                         double ColorG = imageParam.mStitch.im.At<Vec3b>(y1, x1).Item1 * (1.0 - w) + imageParam.im.At<Vec3b>(y2, x2).Item1 * w;
                         double ColorB = imageParam.mStitch.im.At<Vec3b>(y1, x1).Item2 * (1.0 - w) + imageParam.im.At<Vec3b>(y2, x2).Item2 * w;
-                        imageParam.mStitch.im.Set<Vec3b>(y1, x1, new Vec3b((byte)ColorR, (byte)ColorG, (byte)ColorB));
+                        if (imageParam.mStitch.im.At<Vec3b>(y1, x1).Item0 == imageParam.mStitch.im.At<Vec3b>(y1, x1).Item1 &&
+                            imageParam.mStitch.im.At<Vec3b>(y1, x1).Item1 == imageParam.mStitch.im.At<Vec3b>(y1, x1).Item2 &&
+                            imageParam.im.At<Vec3b>(y2, x2).Item0 == imageParam.im.At<Vec3b>(y2, x2).Item1 &&
+                            imageParam.im.At<Vec3b>(y2, x2).Item1 == imageParam.im.At<Vec3b>(y2, x2).Item2)
+                        {
+                            imageParam.mStitch.im.Set<Vec3b>(y1, x1, new Vec3b((byte)ColorR, (byte)ColorG, (byte)ColorB));
+                        }
+                        else
+                        {
+
+                        }
+
                         y2 = y2 + 1;
                     }
                     x2 = x2 + 1;
@@ -896,7 +921,17 @@ namespace OTSModelSharp.ServiceInterface
                         double ColorR = imageParam.mStitch.im.At<Vec3b>(y1, x1).Item0 * (1.0 - w) + imageParam.im.At<Vec3b>(y2, x2).Item0 * w;
                         double ColorG = imageParam.mStitch.im.At<Vec3b>(y1, x1).Item1 * (1.0 - w) + imageParam.im.At<Vec3b>(y2, x2).Item1 * w;
                         double ColorB = imageParam.mStitch.im.At<Vec3b>(y1, x1).Item2 * (1.0 - w) + imageParam.im.At<Vec3b>(y2, x2).Item2 * w;
-                        imageParam.mStitch.im.Set<Vec3b>(y1, x1, new Vec3b((byte)ColorR, (byte)ColorG, (byte)ColorB));
+                        if (imageParam.mStitch.im.At<Vec3b>(y1, x1).Item0 == imageParam.mStitch.im.At<Vec3b>(y1, x1).Item1 &&
+                            imageParam.mStitch.im.At<Vec3b>(y1, x1).Item1 == imageParam.mStitch.im.At<Vec3b>(y1, x1).Item2 &&
+                            imageParam.im.At<Vec3b>(y2, x2).Item0 == imageParam.im.At<Vec3b>(y2, x2).Item1 &&
+                            imageParam.im.At<Vec3b>(y2, x2).Item1 == imageParam.im.At<Vec3b>(y2, x2).Item2)
+                        {
+                            imageParam.mStitch.im.Set<Vec3b>(y1, x1, new Vec3b((byte)ColorR, (byte)ColorG, (byte)ColorB));
+                        }
+                        else
+                        {
+
+                        }
 
                         y2 = y2 + 1;
                     }

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

@@ -1400,7 +1400,11 @@ namespace OTSIncAReportGraph.Controls
             {
                 if (dp.IsSelect)
                 {
-                    selectedParts.Add((DisplayParticle)dp);
+                    DisplayParticle displayParticle = (DisplayParticle)dp;
+                    Point point = CalculateParticleCenterPosition(resultFile, new Point(displayParticle.SEMPosX, displayParticle.SEMPosY), new Point(displayParticle.objParticleData.PosX, displayParticle.objParticleData.PosY));
+                    displayParticle.SEMPosX = point.X;
+                    displayParticle.SEMPosY = point.Y;
+                    selectedParts.Add(displayParticle);
                     Particle particle = new Particle();
                     particle.FieldId = ((OTSIncAReportGraph.DisplayParticle)dp).FieldId;
                     particle.ParticleId = ((OTSIncAReportGraph.DisplayParticle)dp).ParticleId;

+ 4 - 4
OTSIncAReportApp/1-UI/Control_Grids/OTSIncAReportGridsFuncation/OTSReportGridsFun.cs

@@ -191,10 +191,10 @@ namespace OTSIncAReportGrids.OTSIncAReportGridsFuncation
             }
            
 
-            if (m_SEMConnectionState)
-            {
-                isSuccess = m_cfun.MoveSEMToPoint(new Point((int)in_PositionX, (int)in_PositionY), ls_PositionR);
-            }
+            //if (m_SEMConnectionState)
+            //{
+            //    isSuccess = m_cfun.MoveSEMToPoint(new Point((int)in_PositionX, (int)in_PositionY), ls_PositionR);
+            //}
 
             return isSuccess;
         }

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

@@ -114,6 +114,7 @@ namespace OTSIncAReportGraph
             {
                 return objParticleData.SEMPosX;
             }
+            set { objParticleData.SEMPosX = value; }
         }
         public int SEMPosY 
         {
@@ -121,6 +122,7 @@ namespace OTSIncAReportGraph
             {
                 return objParticleData.SEMPosY;
             }
+            set { objParticleData.SEMPosY = value; }
         }