|
@@ -1337,10 +1337,10 @@ namespace OTSIMGPROC
|
|
|
|
|
|
Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);
|
|
|
Mat blurImg;
|
|
|
- medianBlur(cvcopyImg, blurImg, 5);//get rid of the noise point.
|
|
|
+ //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;
|
|
@@ -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,8 +1753,8 @@ namespace OTSIMGPROC
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- COTSImageProcess::BErode3(pPixel, pTempImg, 5, nHeightImg, nWidthImg);
|
|
|
- COTSImageProcess::BDilate3(pTempImg, pPixel, 5, nHeightImg, nWidthImg);
|
|
|
+ COTSImageProcess::BErode3(pPixel, pTempImg, 3, nHeightImg, nWidthImg);
|
|
|
+ COTSImageProcess::BDilate3(pTempImg, pPixel, 3, nHeightImg, nWidthImg);
|
|
|
|
|
|
a_pBinImgOut->SetImageData(pPixel, nWidthImg, nHeightImg);
|
|
|
|
|
@@ -1813,11 +1813,11 @@ namespace OTSIMGPROC
|
|
|
pPixel[i] = 0;
|
|
|
}
|
|
|
}
|
|
|
- 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;
|
|
|
+ /*COTSImageProcess::BErode3(pPixel, pTempImg, 3, nHeightImg, nWidthImg);
|
|
|
+ COTSImageProcess::BDilate3(pTempImg, pPixel, 3, 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,11 +1877,11 @@ namespace OTSIMGPROC
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- COTSImageProcess::BErode3(pPixel, pTempImg, 5, nHeightImg, nWidthImg);
|
|
|
- COTSImageProcess::BDilate3(pTempImg, pPixel, 5, nHeightImg, nWidthImg);
|
|
|
- /*Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);
|
|
|
+ /*COTSImageProcess::BErode3(pPixel, pTempImg, 3, nHeightImg, nWidthImg);
|
|
|
+ COTSImageProcess::BDilate3(pTempImg, pPixel, 3, nHeightImg, nWidthImg);*/
|
|
|
+ Mat cvcopyImg = Mat(nHeightImg, nWidthImg, CV_8UC1, pPixel);
|
|
|
medianBlur(cvcopyImg, cvcopyImg, 5);
|
|
|
- pPixel = cvcopyImg.data;*/
|
|
|
+ pPixel = cvcopyImg.data;
|
|
|
}
|
|
|
a_pBinImgOut->SetImageData(pPixel,nWidthImg,nHeightImg);
|
|
|
|
|
@@ -2635,19 +2635,28 @@ namespace OTSIMGPROC
|
|
|
std::map<std::string, std::vector<EleAreaPercentage>> mapEleData;
|
|
|
|
|
|
CPosXrayPtr pXray1 = p->GetXrayInfo();
|
|
|
- for (auto ele : pXray1->GetElementQuantifyData())
|
|
|
+ if (pXray1 != nullptr)
|
|
|
{
|
|
|
- mapEleData[ele->GetName().GetBuffer()].push_back(EleAreaPercentage(p->GetArea() / allPartArea, ele));
|
|
|
+
|
|
|
+ for (auto ele : pXray1->GetElementQuantifyData())
|
|
|
+ {
|
|
|
+ mapEleData[ele->GetName().GetBuffer()].push_back(EleAreaPercentage(p->GetArea() / allPartArea, ele));
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
|
|
|
for (auto other : pair.second)
|
|
|
{
|
|
|
auto otherXray = other->GetXrayInfo();
|
|
|
- for (auto eledata : otherXray->GetElementQuantifyData())
|
|
|
+ if (otherXray != nullptr)
|
|
|
{
|
|
|
- mapEleData[eledata->GetName().GetBuffer()].push_back(EleAreaPercentage(other->GetArea() / allPartArea, eledata));
|
|
|
+ for (auto eledata : otherXray->GetElementQuantifyData())
|
|
|
+ {
|
|
|
+ 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.
|
|
|
|