|
@@ -1042,11 +1042,11 @@ namespace OTSIMGPROC
|
|
|
Mat blurImg;
|
|
|
Mat srcImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);
|
|
|
|
|
|
- medianBlur(srcImg, blurImg, 3);//smooth the edge
|
|
|
+ //medianBlur(srcImg, blurImg, 3);//smooth the edge
|
|
|
|
|
|
|
|
|
COTSParticleList listParticleOut;
|
|
|
- if (!GetParticles(0,0,nWidthImg, nHeightImg, blurImg.data, listParticleOut))
|
|
|
+ if (!GetParticles(0,0,nWidthImg, nHeightImg, srcImg.data, listParticleOut))
|
|
|
{
|
|
|
COTSParticleList listParticleEmpty;
|
|
|
listParticleEmpty.clear();
|
|
@@ -1179,13 +1179,13 @@ namespace OTSIMGPROC
|
|
|
// get the area image
|
|
|
|
|
|
Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);
|
|
|
- Mat blurImg;
|
|
|
- medianBlur(cvcopyImg, blurImg, 5);//smooth the edge
|
|
|
+ //Mat blurImg;
|
|
|
+ //medianBlur(cvcopyImg, blurImg, 5);//smooth the edge
|
|
|
|
|
|
vector<vector<Point>>contours;
|
|
|
|
|
|
|
|
|
- findContours(blurImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
|
|
|
+ findContours(cvcopyImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
|
|
|
|
|
|
COTSParticleList listParticleOut;
|
|
|
for (size_t i = 0; i < contours.size(); i++)
|
|
@@ -1336,11 +1336,11 @@ namespace OTSIMGPROC
|
|
|
// get the area image
|
|
|
|
|
|
Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);
|
|
|
- Mat blurImg;
|
|
|
- medianBlur(cvcopyImg, blurImg, 5);//get rid of the noise point.
|
|
|
+ //Mat blurImg;
|
|
|
+ //medianBlur(cvcopyImg, blurImg, 5);//get rid of the noise point.
|
|
|
|
|
|
Mat labels, stats, centroids;
|
|
|
- int number = connectedComponentsWithStats(blurImg, labels, stats, centroids, 8, CV_16U);
|
|
|
+ int number = connectedComponentsWithStats(cvcopyImg, labels, stats, centroids, 8, CV_16U);
|
|
|
|
|
|
|
|
|
|
|
@@ -1360,7 +1360,7 @@ namespace OTSIMGPROC
|
|
|
|
|
|
Rect rectMax = Rect(x, y, w, h);
|
|
|
Mat rectROI = labels(rectMax).clone();
|
|
|
- Mat imageROI = blurImg(rectMax).clone();
|
|
|
+ Mat imageROI = cvcopyImg(rectMax).clone();
|
|
|
|
|
|
//exclude the point which intersect into this bounding box but is not in this group.
|
|
|
int curlabel = i;
|
|
@@ -1753,9 +1753,11 @@ namespace OTSIMGPROC
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- COTSImageProcess::BErode3(pPixel, pTempImg, 5, nHeightImg, nWidthImg);
|
|
|
- COTSImageProcess::BDilate3(pTempImg, pPixel, 5, nHeightImg, nWidthImg);
|
|
|
-
|
|
|
+ /*COTSImageProcess::BErode3(pPixel, pTempImg, 5, nHeightImg, nWidthImg);
|
|
|
+ COTSImageProcess::BDilate3(pTempImg, pPixel, 5, nHeightImg, nWidthImg);*/
|
|
|
+ Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);// use the medianblur method to achieve the same effect as open morphology(errod and dialate).
|
|
|
+ medianBlur(cvcopyImg, cvcopyImg, 5);
|
|
|
+ pPixel = cvcopyImg.data;
|
|
|
a_pBinImgOut->SetImageData(pPixel, nWidthImg, nHeightImg);
|
|
|
|
|
|
foundedPixelNum = nNumParticle;
|
|
@@ -1815,9 +1817,9 @@ namespace OTSIMGPROC
|
|
|
}
|
|
|
COTSImageProcess::BErode3(pPixel, pTempImg, 5, nHeightImg, nWidthImg);
|
|
|
COTSImageProcess::BDilate3(pTempImg, pPixel, 5, nHeightImg, nWidthImg);
|
|
|
- //Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);// use the medianblur method to achieve the same effect as open morphology(errod and dialate).
|
|
|
- //medianBlur(cvcopyImg, cvcopyImg, 5);
|
|
|
- //pPixel = cvcopyImg.data;
|
|
|
+ Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);// use the medianblur method to achieve the same effect as open morphology(errod and dialate).
|
|
|
+ medianBlur(cvcopyImg, cvcopyImg, 5);
|
|
|
+ pPixel = cvcopyImg.data;
|
|
|
|
|
|
|
|
|
}
|
|
@@ -1879,9 +1881,9 @@ namespace OTSIMGPROC
|
|
|
}
|
|
|
COTSImageProcess::BErode3(pPixel, pTempImg, 5, nHeightImg, nWidthImg);
|
|
|
COTSImageProcess::BDilate3(pTempImg, pPixel, 5, nHeightImg, nWidthImg);
|
|
|
- /*Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);
|
|
|
+ Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);
|
|
|
medianBlur(cvcopyImg, cvcopyImg, 5);
|
|
|
- pPixel = cvcopyImg.data;*/
|
|
|
+ pPixel = cvcopyImg.data;
|
|
|
}
|
|
|
a_pBinImgOut->SetImageData(pPixel,nWidthImg,nHeightImg);
|
|
|
|