|
@@ -1731,7 +1731,7 @@ namespace OTSIMGPROC
|
|
|
const int nLineType = 8;
|
|
|
// get rectangle of the particle
|
|
|
CRect rect = a_pOTSPart->GetParticleRect();
|
|
|
- if (a_pOTSPart->GetArea() < 80 * a_PixelSize)// the particle is too small that openCV can't calculate a width value of it. Then we take the upright rect of the particle as it's minArea rect.
|
|
|
+ if (a_pOTSPart->GetArea() < 30 * a_PixelSize)// the particle is too small that openCV can't calculate a width value of it. Then we take the upright rect of the particle as it's minArea rect.
|
|
|
{
|
|
|
double w = 0, h = 0;
|
|
|
w = (double)rect.Width()*a_PixelSize;
|
|
@@ -1760,9 +1760,9 @@ namespace OTSIMGPROC
|
|
|
//--------abstract the contour of the particle.
|
|
|
Mat cvcopyImg;
|
|
|
medianBlur(particleImage, cvcopyImg, 5);//smooth the edge
|
|
|
- //Mat cvContourImg = Mat::zeros(rect.Height() + nExpand_Size, rect.Width() + nExpand_Size, CV_8U);
|
|
|
+
|
|
|
vector<vector<Point>>contours;
|
|
|
- //Canny(cvcopyImg, cvcopyImg, 20, 20 * 2, 3);
|
|
|
+
|
|
|
findContours(cvcopyImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
|
|
|
if (contours.size()==0)// the particle is too odd that openCV can't find a contour of it. Then we take the upright rect of the particle as it's minArea rect.
|
|
|
{
|