Commit e7982bd2 SK

Thresh has 0 Blobs bug

1 个父辈 5a066174
...@@ -466,15 +466,15 @@ namespace Acc.Img ...@@ -466,15 +466,15 @@ namespace Acc.Img
double len = hist.Get<double>(i); double len = hist.Get<double>(i);
if (len > 100) if (len > 100)
{//灰度值的像素数小于100的忽略 {//灰度值的像素数小于100的忽略
percent = percent + len / total;
if (startIndex == -1) if (startIndex == -1)
{ {
startIndex = i; startIndex = i;
} }
endIndex = i - 1;
percent = percent + len / total;
//近似的认为元器件的灰度值 数量占总数的百分比小于10% //近似的认为元器件的灰度值 数量占总数的百分比小于10%
if (percent > 0.1) if (percent > 0.1)
{ {
endIndex = i - 1;
break; break;
} }
} }
...@@ -594,7 +594,7 @@ namespace Acc.Img ...@@ -594,7 +594,7 @@ namespace Acc.Img
standArea = blobArea; standArea = blobArea;
} }
imageMat = threshMat; imageMat = threshMat;
Console.WriteLine(threshIndex + "==== Blob: " + blobCount + " Area:" + theArea); Console.WriteLine("thresh: " + threshIndex + " Blob: " + blobCount + " Area:" + theArea);
return resultBlobs; return resultBlobs;
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!