|
@@ -261,7 +261,7 @@ Mat AdjustContrastY(const Mat& img)
|
|
|
}
|
|
|
|
|
|
|
|
|
-void CVRemoveBG(const cv::Mat& img, cv::Mat& dst,int bgstart,int bgend, long& nNumParticle)
|
|
|
+void CVRemoveBG(const cv::Mat& img, cv::Mat& dst,int bgstart,int bgend/*, long& nNumParticle*/)
|
|
|
{
|
|
|
int min_gray = bgstart;
|
|
|
int max_gray = bgend;
|
|
@@ -279,10 +279,10 @@ void CVRemoveBG(const cv::Mat& img, cv::Mat& dst,int bgstart,int bgend, long& nN
|
|
|
uchar lutvalues[256];
|
|
|
for (int i = 0; i < 256; i++)
|
|
|
{
|
|
|
- if (i < min_gray || i > max_gray)
|
|
|
+ if (i <= min_gray || i >= max_gray)
|
|
|
{
|
|
|
- lutvalues[i] = i;
|
|
|
- nNumParticle++;
|
|
|
+ lutvalues[i] = 255;
|
|
|
+ /*nNumParticle++;*/
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -380,9 +380,9 @@ void AutoRemove_background_OTS(const cv::Mat& img, cv::Mat& dst, int black_thing
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- /*cv::GaussianBlur(image, temp1, cv::Size(3, 3), 1.0, 1.0);
|
|
|
- pAdaptiveManifoldFilter->filter(temp1, dst_adapt, image);*/
|
|
|
- dst_adapt = image;
|
|
|
+ cv::GaussianBlur(image, temp1, cv::Size(3, 3), 1.0, 1.0);
|
|
|
+ pAdaptiveManifoldFilter->filter(temp1, dst_adapt, image);
|
|
|
+ //dst_adapt = image;
|
|
|
cv::ThresholdTypes img_ThresholdTypes = cv::ThresholdTypes::THRESH_BINARY_INV;
|
|
|
cv::Mat image_Negate;
|
|
|
if (both_black_bright)
|