|
@@ -456,29 +456,29 @@ namespace OTSIMGPROC
|
|
|
|
|
|
|
|
|
std::vector<CPoint> matrixPs;
|
|
|
+ GetMatrixPointsFromRect(rect, xrayStep, matrixPs);
|
|
|
+ //int colnum = ceil((double)rect.Width() / xrayStep + 0.5);
|
|
|
+ //if (colnum % 2 == 0) colnum += 1;//let the number to be an odd number.Then we can make the middle point in the center of the particle exactly.
|
|
|
+ //int rownum = ceil((double)rect.Height() / xrayStep + 0.5);
|
|
|
+ //if (rownum % 2 == 0) rownum += 1;
|
|
|
|
|
|
- int colnum = ceil((double)rect.Width() / xrayStep + 0.5);
|
|
|
- if (colnum % 2 == 0) colnum += 1;//let the number to be an odd number.Then we can make the middle point in the center of the particle exactly.
|
|
|
- int rownum = ceil((double)rect.Height() / xrayStep + 0.5);
|
|
|
- if (rownum % 2 == 0) rownum += 1;
|
|
|
+ //CPoint theFirst = CPoint(rect.left - (colnum * xrayStep - rect.Width()) / 2 + xrayStep / 2, rect.top - (rownum * xrayStep - rect.Height()) / 2 + xrayStep / 2);
|
|
|
|
|
|
- CPoint theFirst = CPoint(rect.left - (colnum * xrayStep - rect.Width()) / 2 + xrayStep / 2, rect.top - (rownum * xrayStep - rect.Height()) / 2 + xrayStep / 2);
|
|
|
|
|
|
+ //for (int i = 0; i < rownum; i++)
|
|
|
+ //{
|
|
|
+ // for (int j = 0; j < colnum; j++)
|
|
|
+ // {
|
|
|
+ // double x = (double)theFirst.x + (double)j * xrayStep;
|
|
|
+ // double y = (double)theFirst.y + (double)i * xrayStep;
|
|
|
+ // CPoint thePoint = CPoint(x, y);
|
|
|
|
|
|
- for (int i = 0; i < rownum; i++)
|
|
|
- {
|
|
|
- for (int j = 0; j < colnum; j++)
|
|
|
- {
|
|
|
- double x = (double)theFirst.x + (double)j * xrayStep;
|
|
|
- double y = (double)theFirst.y + (double)i * xrayStep;
|
|
|
- CPoint thePoint = CPoint(x, y);
|
|
|
|
|
|
+ // matrixPs.push_back(thePoint);
|
|
|
|
|
|
- matrixPs.push_back(thePoint);
|
|
|
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
int i = 0;
|
|
|
COTSParticleList matrixParts;
|
|
|
for (auto point : matrixPs)
|
|
@@ -559,6 +559,16 @@ namespace OTSIMGPROC
|
|
|
std::vector<CPoint> seeds;
|
|
|
seeds.clear();
|
|
|
FindSeedsByGrayScale(noBgImg, a_PixelSize, seeds);
|
|
|
+ std::vector<CPoint> matrixseeds;
|
|
|
+ matrixseeds.clear();
|
|
|
+ if (seeds.size() <20)
|
|
|
+ {
|
|
|
+ auto step = areaRng.GetStart() * 4;
|
|
|
+ GetMatrixPointsFromRect(fieldImg->GetImageRect(), step / a_PixelSize, matrixseeds);
|
|
|
+ seeds.insert(seeds.end(), matrixseeds.begin(), matrixseeds.end());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
Mat matImg = GetMatDataFromBseImg(noBgImg);
|
|
|
|
|
@@ -1644,6 +1654,36 @@ namespace OTSIMGPROC
|
|
|
|
|
|
|
|
|
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ BOOL COTSImageProcess::GetMatrixPointsFromRect(CRect rect, double xrayStep, std::vector<CPoint>& matrixPs)
|
|
|
+ {
|
|
|
+ int colnum = ceil((double)rect.Width() / xrayStep + 0.5);
|
|
|
+ if (colnum % 2 == 0) colnum += 1;//let the number to be an odd number.Then we can make the middle point in the center of the particle exactly.
|
|
|
+ int rownum = ceil((double)rect.Height() / xrayStep + 0.5);
|
|
|
+ if (rownum % 2 == 0) rownum += 1;
|
|
|
+
|
|
|
+ CPoint theFirst = CPoint(rect.left - (colnum * xrayStep - rect.Width()) / 2 + xrayStep / 2, rect.top - (rownum * xrayStep - rect.Height()) / 2 + xrayStep / 2);
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i < rownum; i++)
|
|
|
+ {
|
|
|
+ for (int j = 0; j < colnum; j++)
|
|
|
+ {
|
|
|
+ double x = (double)theFirst.x + (double)j * xrayStep;
|
|
|
+ double y = (double)theFirst.y + (double)i * xrayStep;
|
|
|
+ CPoint thePoint = CPoint(x, y);
|
|
|
+
|
|
|
+ if (rect.PtInRect(thePoint))
|
|
|
+ {
|
|
|
+ matrixPs.push_back(thePoint);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
|