|
@@ -235,6 +235,8 @@ namespace OTSDataType
|
|
|
if ( sim> 0.95)
|
|
|
{
|
|
|
log.Warn("remove left side duplicate particle,similarity:" + sim.ToString("F3"));
|
|
|
+ log.Warn("P1:" + p.GetImgPortraitString());
|
|
|
+ log.Warn("P2:" + p1.GetImgPortraitString());
|
|
|
findsimilar = true;
|
|
|
break;
|
|
|
}
|
|
@@ -243,7 +245,11 @@ namespace OTSDataType
|
|
|
}
|
|
|
if (findsimilar == false)
|
|
|
{
|
|
|
- finalparts.Add(p);
|
|
|
+ if (!finalparts.Contains(p))//particles in the four corner are processed more than one time
|
|
|
+ {
|
|
|
+ finalparts.Add(p);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -280,6 +286,8 @@ namespace OTSDataType
|
|
|
if (sim > 0.95)
|
|
|
{
|
|
|
log.Warn("remove upside duplicate particle,similarity:" + sim.ToString("F3"));
|
|
|
+ log.Warn("P1:" + p.GetImgPortraitString());
|
|
|
+ log.Warn("P2:" + p1.GetImgPortraitString());
|
|
|
findsimilar = true;
|
|
|
break;
|
|
|
}
|
|
@@ -288,7 +296,10 @@ namespace OTSDataType
|
|
|
}
|
|
|
if (findsimilar == false)
|
|
|
{
|
|
|
- finalparts.Add(p);
|
|
|
+ if (!finalparts.Contains(p))
|
|
|
+ {
|
|
|
+ finalparts.Add(p);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -298,7 +309,10 @@ namespace OTSDataType
|
|
|
{
|
|
|
foreach (var p in this.GetSideParticlesByOverlap(SORTING_DIRECTION.UP, overlap))
|
|
|
{
|
|
|
- finalparts.Add(p);
|
|
|
+ if (!finalparts.Contains(p))
|
|
|
+ {
|
|
|
+ finalparts.Add(p);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (rightField != null && rightField.measureSequence < this.measureSequence)
|
|
@@ -325,6 +339,8 @@ namespace OTSDataType
|
|
|
if (sim > 0.95)
|
|
|
{
|
|
|
log.Warn("remove right side duplicate particle,similarity:" + sim.ToString("F3"));
|
|
|
+ log.Warn("P1:" + p.GetImgPortraitString());
|
|
|
+ log.Warn("P2:" + p1.GetImgPortraitString());
|
|
|
findsimilar = true;
|
|
|
break;
|
|
|
}
|
|
@@ -333,7 +349,10 @@ namespace OTSDataType
|
|
|
}
|
|
|
if (findsimilar == false)
|
|
|
{
|
|
|
- finalparts.Add(p);
|
|
|
+ if (!finalparts.Contains(p))
|
|
|
+ {
|
|
|
+ finalparts.Add(p);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -343,7 +362,10 @@ namespace OTSDataType
|
|
|
{
|
|
|
foreach (var p in this.GetSideParticlesByOverlap(SORTING_DIRECTION.RIGHT, overlap))
|
|
|
{
|
|
|
- finalparts.Add(p);
|
|
|
+ if (!finalparts.Contains(p))
|
|
|
+ {
|
|
|
+ finalparts.Add(p);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (downField != null && downField.measureSequence < this.measureSequence)
|
|
@@ -370,6 +392,8 @@ namespace OTSDataType
|
|
|
if (sim > 0.95)
|
|
|
{
|
|
|
log.Warn("remove down side duplicate particle,similarity:" + sim.ToString("F3"));
|
|
|
+ log.Warn("P1:" + p.GetImgPortraitString());
|
|
|
+ log.Warn("P2:" + p1.GetImgPortraitString());
|
|
|
findsimilar = true;
|
|
|
break;
|
|
|
}
|
|
@@ -378,7 +402,10 @@ namespace OTSDataType
|
|
|
}
|
|
|
if (findsimilar == false)
|
|
|
{
|
|
|
- finalparts.Add(p);
|
|
|
+ if (!finalparts.Contains(p))
|
|
|
+ {
|
|
|
+ finalparts.Add(p);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -388,30 +415,38 @@ namespace OTSDataType
|
|
|
{
|
|
|
foreach (var p in this.GetSideParticlesByOverlap(SORTING_DIRECTION.DOWN, overlap))
|
|
|
{
|
|
|
- finalparts.Add(p);
|
|
|
+ if (!finalparts.Contains(p))
|
|
|
+ {
|
|
|
+ finalparts.Add(p);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
foreach (var p in this.GetSideParticlesByOverlap(SORTING_DIRECTION.CENTER, overlap))
|
|
|
{
|
|
|
- finalparts.Add(p);
|
|
|
+ if (!finalparts.Contains(p))
|
|
|
+ {
|
|
|
+ finalparts.Add(p);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
this.SetListAnalysisParticles(finalparts);
|
|
|
+ log.Info("removing duplicate particles result:" + finalparts.Count);
|
|
|
}
|
|
|
private List<COTSParticleClr> GetSideParticlesByOverlap(SORTING_DIRECTION direction,int overlap)
|
|
|
{
|
|
|
List<COTSParticleClr> sideparts = new List<COTSParticleClr>();
|
|
|
if (direction == SORTING_DIRECTION.LEFT)
|
|
|
{
|
|
|
- foreach (var p in this.GetAllParticles())
|
|
|
+ var leftborderParts = this.GetLeftBorderedParticles();
|
|
|
+ foreach (var p in this.GetListAnalysisParticles())
|
|
|
{
|
|
|
int left = 0, top = 0, right = 0, bottom = 0;
|
|
|
p.GetOTSRect(ref left, ref top, ref right, ref bottom);
|
|
|
|
|
|
if ((right - this.GetOTSRect().GetTopLeft().X) < 2 * overlap)
|
|
|
{
|
|
|
- if (left != this.GetOTSRect().GetTopLeft().X || Math.Abs(left-right)>2*overlap )//not on the border or it's a big particle
|
|
|
+ if (!leftborderParts.Contains(p) || Math.Abs(left-right)>2*overlap )//not on the border or it's a big particle
|
|
|
{
|
|
|
sideparts.Add(p);
|
|
|
}
|
|
@@ -423,13 +458,14 @@ namespace OTSDataType
|
|
|
}
|
|
|
if (direction == SORTING_DIRECTION.RIGHT)
|
|
|
{
|
|
|
- foreach (var p in this.GetAllParticles())
|
|
|
+ var rightborderParts = this.GetRightBorderedParticles();
|
|
|
+ foreach (var p in this.GetListAnalysisParticles())
|
|
|
{
|
|
|
int left = 0, top = 0, right = 0, bottom = 0;
|
|
|
p.GetOTSRect(ref left, ref top, ref right, ref bottom);
|
|
|
if ((this.GetOTSRect().GetBottomRight().X-left) < 2 * overlap)
|
|
|
{
|
|
|
- if (right != this.GetOTSRect().GetBottomRight().X || Math.Abs(left - right) > 2 * overlap)//not on the border
|
|
|
+ if (!rightborderParts.Contains(p)|| Math.Abs(left - right) > 2 * overlap)//not on the border or is a big part
|
|
|
{
|
|
|
sideparts.Add(p);
|
|
|
}
|
|
@@ -440,13 +476,14 @@ namespace OTSDataType
|
|
|
}
|
|
|
if (direction == SORTING_DIRECTION.UP)
|
|
|
{
|
|
|
- foreach (var p in this.GetAllParticles())
|
|
|
+ var upborderParts = this.GetTopBorderedParticles();
|
|
|
+ foreach (var p in this.GetListAnalysisParticles())
|
|
|
{
|
|
|
int left = 0, top = 0, right = 0, bottom = 0;
|
|
|
p.GetOTSRect(ref left, ref top, ref right, ref bottom);
|
|
|
if ((this.GetOTSRect().GetTopLeft().Y - bottom) < 2 * overlap)
|
|
|
{
|
|
|
- if (top != this.GetOTSRect().GetTopLeft().Y || Math.Abs(top - bottom) > 2 * overlap)//not on the border
|
|
|
+ if (!upborderParts.Contains(p) || Math.Abs(top - bottom) > 2 * overlap)//not on the border
|
|
|
{
|
|
|
sideparts.Add(p);
|
|
|
}
|
|
@@ -457,13 +494,14 @@ namespace OTSDataType
|
|
|
}
|
|
|
if (direction == SORTING_DIRECTION.DOWN)
|
|
|
{
|
|
|
- foreach (var p in this.GetAllParticles())
|
|
|
+ var downborderParts = this.GetBottomBorderedParticles();
|
|
|
+ foreach (var p in this.GetListAnalysisParticles())
|
|
|
{
|
|
|
int left = 0, top = 0, right = 0, bottom = 0;
|
|
|
p.GetOTSRect(ref left, ref top, ref right, ref bottom);
|
|
|
if ((top-this.GetOTSRect().GetBottomRight().Y ) < 2 * overlap)
|
|
|
{
|
|
|
- if (bottom != this.GetOTSRect().GetBottomRight().Y || Math.Abs(top - bottom) > 2 * overlap)//not on the border
|
|
|
+ if (!downborderParts.Contains(p)|| Math.Abs(top - bottom) > 2 * overlap)//not on the border
|
|
|
{
|
|
|
sideparts.Add(p);
|
|
|
}
|
|
@@ -474,7 +512,7 @@ namespace OTSDataType
|
|
|
}
|
|
|
if (direction == SORTING_DIRECTION.CENTER)
|
|
|
{
|
|
|
- foreach (var p in this.GetAllParticles())
|
|
|
+ foreach (var p in this.GetListAnalysisParticles())
|
|
|
{
|
|
|
int left = 0, top = 0, right = 0, bottom = 0;
|
|
|
p.GetOTSRect(ref left, ref top, ref right, ref bottom);
|
|
@@ -546,7 +584,7 @@ namespace OTSDataType
|
|
|
|
|
|
|
|
|
}
|
|
|
- log.Info("Total Particles: (>" + rMin.ToString("f2") + "): "+ "<" + rMax.ToString("f2") + "): " + m_listAllParticles.Count);
|
|
|
+ log.Info("Total analysis Particles: (>" + rMin.ToString("f2") + "): "+ "<" + rMax.ToString("f2") + "): " + m_listAnalysisParticles.Count);
|
|
|
|
|
|
|
|
|
|
|
@@ -605,21 +643,14 @@ namespace OTSDataType
|
|
|
public bool PositionEquals(COTSField a_oSource)
|
|
|
{
|
|
|
|
|
|
- var xoffSet = imgwidth * m_pixelSize /2;
|
|
|
- var yoffSet = imgheight * m_pixelSize/2 ;
|
|
|
- if (a_oSource.m_otsPos.X < (m_otsPos.X+xoffSet) && a_oSource.m_otsPos.X>( m_otsPos.X-xoffSet))
|
|
|
+
|
|
|
+ if (a_oSource.m_otsPos == this.m_otsPos)
|
|
|
{
|
|
|
- if (a_oSource.m_otsPos.Y < (m_otsPos.Y + yoffSet) && a_oSource.m_otsPos.Y > (m_otsPos.Y - yoffSet))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
-
|
|
|
+ return true;
|
|
|
}
|
|
|
- else
|
|
|
+ else
|
|
|
{
|
|
|
return false;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -653,7 +684,7 @@ namespace OTSDataType
|
|
|
public List<COTSParticleClr> GetTopBorderedParticles()
|
|
|
{
|
|
|
List<COTSParticleClr> parts = new List<COTSParticleClr>();
|
|
|
- foreach (var p in m_listAllParticles)
|
|
|
+ foreach (var p in m_listAnalysisParticles)
|
|
|
{
|
|
|
|
|
|
var segs = p.GetFeature().GetSegmentsList();//COTSSegment
|
|
@@ -672,7 +703,7 @@ namespace OTSDataType
|
|
|
public List< COTSParticleClr > GetBottomBorderedParticles()
|
|
|
{
|
|
|
List<COTSParticleClr> parts = new List<COTSParticleClr>();
|
|
|
- foreach (var p in m_listAllParticles)
|
|
|
+ foreach (var p in m_listAnalysisParticles)
|
|
|
{
|
|
|
var segs = p.GetFeature().GetSegmentsList();
|
|
|
foreach (var seg in segs)
|
|
@@ -691,7 +722,7 @@ namespace OTSDataType
|
|
|
public List<COTSParticleClr> GetLeftBorderedParticles()
|
|
|
{
|
|
|
List<COTSParticleClr> parts = new List<COTSParticleClr>();
|
|
|
- foreach (var p in m_listAllParticles)
|
|
|
+ foreach (var p in m_listAnalysisParticles)
|
|
|
{
|
|
|
var segs = p.GetFeature().GetSegmentsList();
|
|
|
foreach (var seg in segs)
|
|
@@ -710,7 +741,7 @@ namespace OTSDataType
|
|
|
public List <COTSParticleClr> GetRightBorderedParticles()
|
|
|
{
|
|
|
List<COTSParticleClr> parts = new List<COTSParticleClr>();
|
|
|
- foreach (var p in m_listAllParticles)
|
|
|
+ foreach (var p in m_listAnalysisParticles)
|
|
|
{
|
|
|
var segs = p.GetFeature().GetSegmentsList();
|
|
|
foreach (var seg in segs)
|