|
@@ -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,7 +1336,7 @@ namespace OTSIMGPROC
|
|
|
// get the area image
|
|
|
|
|
|
Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);
|
|
|
- Mat blurImg;
|
|
|
+ //Mat blurImg;
|
|
|
//medianBlur(cvcopyImg, blurImg, 5);//get rid of the noise point.
|
|
|
|
|
|
Mat labels, stats, centroids;
|
|
@@ -1506,7 +1506,7 @@ namespace OTSIMGPROC
|
|
|
|
|
|
|
|
|
Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);
|
|
|
- Mat blurImg;
|
|
|
+ //Mat blurImg;
|
|
|
//medianBlur(cvcopyImg, blurImg, 3);//smooth the edge
|
|
|
|
|
|
|
|
@@ -1753,9 +1753,11 @@ namespace OTSIMGPROC
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- COTSImageProcess::BErode3(pPixel, pTempImg, 3, nHeightImg, nWidthImg);
|
|
|
- COTSImageProcess::BDilate3(pTempImg, pPixel, 3, 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;
|
|
@@ -1813,8 +1815,8 @@ namespace OTSIMGPROC
|
|
|
pPixel[i] = 0;
|
|
|
}
|
|
|
}
|
|
|
- /*COTSImageProcess::BErode3(pPixel, pTempImg, 3, nHeightImg, nWidthImg);
|
|
|
- COTSImageProcess::BDilate3(pTempImg, pPixel, 3, 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;
|
|
@@ -1877,8 +1879,8 @@ namespace OTSIMGPROC
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- /*COTSImageProcess::BErode3(pPixel, pTempImg, 3, nHeightImg, nWidthImg);
|
|
|
- COTSImageProcess::BDilate3(pTempImg, pPixel, 3, nHeightImg, nWidthImg);*/
|
|
|
+ COTSImageProcess::BErode3(pPixel, pTempImg, 5, nHeightImg, nWidthImg);
|
|
|
+ COTSImageProcess::BDilate3(pTempImg, pPixel, 5, nHeightImg, nWidthImg);
|
|
|
Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);
|
|
|
medianBlur(cvcopyImg, cvcopyImg, 5);
|
|
|
pPixel = cvcopyImg.data;
|
|
@@ -2635,28 +2637,19 @@ namespace OTSIMGPROC
|
|
|
std::map<std::string, std::vector<EleAreaPercentage>> mapEleData;
|
|
|
|
|
|
CPosXrayPtr pXray1 = p->GetXrayInfo();
|
|
|
- if (pXray1 != nullptr)
|
|
|
+ for (auto ele : pXray1->GetElementQuantifyData())
|
|
|
{
|
|
|
-
|
|
|
- for (auto ele : pXray1->GetElementQuantifyData())
|
|
|
- {
|
|
|
- mapEleData[ele->GetName().GetBuffer()].push_back(EleAreaPercentage(p->GetArea() / allPartArea, ele));
|
|
|
- }
|
|
|
+ mapEleData[ele->GetName().GetBuffer()].push_back(EleAreaPercentage(p->GetArea() / allPartArea, ele));
|
|
|
}
|
|
|
-
|
|
|
|
|
|
for (auto other : pair.second)
|
|
|
{
|
|
|
auto otherXray = other->GetXrayInfo();
|
|
|
- if (otherXray != nullptr)
|
|
|
+ for (auto eledata : otherXray->GetElementQuantifyData())
|
|
|
{
|
|
|
- for (auto eledata : otherXray->GetElementQuantifyData())
|
|
|
- {
|
|
|
- mapEleData[eledata->GetName().GetBuffer()].push_back(EleAreaPercentage(other->GetArea() / allPartArea, eledata));
|
|
|
+ mapEleData[eledata->GetName().GetBuffer()].push_back(EleAreaPercentage(other->GetArea() / allPartArea, eledata));
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
// third,we calculate all the element's new percentage data and get a new element chemistry list.
|
|
|
|