|
@@ -205,8 +205,15 @@ namespace OTSIMGPROC
|
|
|
}
|
|
|
BYTE nAveGray = (BYTE)(nPixelAll / nPixelNum);
|
|
|
pParticle->SetAveGray(nAveGray);
|
|
|
-
|
|
|
+ auto fieldOTSRect = m_pFieldData->GetOTSRect();
|
|
|
+ CPoint leftTop = fieldOTSRect.GetTopLeft();
|
|
|
+
|
|
|
+ CRect rectInSinglefld = pParticle->GetParticleRect();
|
|
|
+ CPoint OTSLeftTop = CPoint(leftTop.x + rectInSinglefld.left * a_pixelSize, leftTop.y - rectInSinglefld.top * a_pixelSize);
|
|
|
+ CPoint OTSRightBottom = CPoint(leftTop.x + rectInSinglefld.right * a_pixelSize, leftTop.y - rectInSinglefld.bottom * a_pixelSize);
|
|
|
|
|
|
+ COTSRect recInOTSCord = COTSRect(OTSLeftTop, OTSRightBottom);
|
|
|
+ pParticle->SetOTSRect(recInOTSCord);
|
|
|
|
|
|
}
|
|
|
m_pFieldData->SetParticleList(listParticleOut);
|
|
@@ -380,7 +387,15 @@ namespace OTSIMGPROC
|
|
|
}
|
|
|
BYTE nAveGray = (BYTE)(nPixelAll / nPixelNum);
|
|
|
pParticle->SetAveGray(nAveGray);
|
|
|
+ auto fieldOTSRect = m_pFieldData->GetOTSRect();
|
|
|
+ CPoint leftTop = fieldOTSRect.GetTopLeft();
|
|
|
|
|
|
+ CRect rectInSinglefld = pParticle->GetParticleRect();
|
|
|
+ CPoint OTSLeftTop = CPoint(leftTop.x + rectInSinglefld.left * a_pixelSize, leftTop.y - rectInSinglefld.top * a_pixelSize);
|
|
|
+ CPoint OTSRightBottom = CPoint(leftTop.x + rectInSinglefld.right * a_pixelSize, leftTop.y - rectInSinglefld.bottom * a_pixelSize);
|
|
|
+
|
|
|
+ COTSRect recInOTSCord = COTSRect(OTSLeftTop, OTSRightBottom);
|
|
|
+ pParticle->SetOTSRect(recInOTSCord);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -393,25 +408,62 @@ namespace OTSIMGPROC
|
|
|
|
|
|
return TRUE;
|
|
|
}
|
|
|
- BOOL COTSImageProcess::FilterParticlesByOverlap(COTSFieldDataPtr m_pFieldData)
|
|
|
+ void COTSImageProcess::FilterParticlesByOverlap(COTSFieldDataPtr m_pFieldData)
|
|
|
{
|
|
|
int overlap = m_imageProcessParam->GetOverlapParam();
|
|
|
|
|
|
- COTSRect outBorderRect = m_pFieldData->GetRect();
|
|
|
+ COTSRect outBorderRect = m_pFieldData->GetOTSRect();
|
|
|
CPoint p1 = outBorderRect.GetTopLeft();
|
|
|
CPoint p2 = outBorderRect.GetBottomRight();
|
|
|
COTSRect inBorderRect = COTSRect(p1.x + overlap, p1.y - overlap, p2.x - overlap, p2.y + overlap);
|
|
|
+ CPoint inRecLt = inBorderRect.GetTopLeft();
|
|
|
+ CPoint inRecRb = inBorderRect.GetBottomRight();
|
|
|
COTSParticleList allparts = m_pFieldData->GetParticleList();
|
|
|
-
|
|
|
+
|
|
|
+ COTSParticleList finalparts;
|
|
|
for (auto p : allparts)
|
|
|
{
|
|
|
auto partRec = p->GetOTSRect();
|
|
|
-
|
|
|
+ CPoint lt = partRec.GetTopLeft();
|
|
|
+ CPoint rb = partRec.GetBottomRight();
|
|
|
+ if (inBorderRect.PointInRect(lt) && inBorderRect.PointInRect(rb))//totally inside
|
|
|
+ {
|
|
|
+ finalparts.push_back(p);
|
|
|
+ }
|
|
|
+ if (inBorderRect.PointInRect(rb) && (lt.x<inRecLt.x))//on left side
|
|
|
+ {
|
|
|
+ if (m_pFieldData->GetLeftBorderParticlesBiasDefine())
|
|
|
+ {
|
|
|
+ finalparts.push_back(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (inBorderRect.PointInRect(rb) && ( lt.y>inRecLt.y))//on top side
|
|
|
+ {
|
|
|
+ if (m_pFieldData->GetUpBorderParticlesBiasDefine())
|
|
|
+ {
|
|
|
+ finalparts.push_back(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (inBorderRect.PointInRect(lt) && (rb.x > inRecRb.x) )//on right side
|
|
|
+ {
|
|
|
+ if (m_pFieldData->GetRightBorderParticlesBiasDefine())
|
|
|
+ {
|
|
|
+ finalparts.push_back(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (inBorderRect.PointInRect(lt) && (rb.y < inRecRb.y) )//on bottom side
|
|
|
+ {
|
|
|
+ if (m_pFieldData->GetDownBorderParticlesBiasDefine())
|
|
|
+ {
|
|
|
+ finalparts.push_back(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ m_pFieldData->SetParticleList(finalparts);
|
|
|
+
|
|
|
|
|
|
- return 0;
|
|
|
}
|
|
|
CIntRangePtr COTSImageProcess::CalBackground(CBSEImgPtr m_pBSEImg)
|
|
|
{
|
|
@@ -434,9 +486,7 @@ namespace OTSIMGPROC
|
|
|
|
|
|
linearSmooth5(originChartData, firstSmoothChart, MAXBYTE);
|
|
|
linearSmooth5(firstSmoothChart, secondSmooth, MAXBYTE);
|
|
|
- //linearSmooth5(secondSmooth, secondSmooth, MAXBYTE);
|
|
|
- /*linearSmooth5(secondSmooth, secondSmooth, MAXBYTE);
|
|
|
- linearSmooth5(secondSmooth, secondSmooth, MAXBYTE);*/
|
|
|
+
|
|
|
|
|
|
//2. get down edge
|
|
|
int nLengthEdge = MAXBYTE + 2;
|