Commit 8265bbd4 authored by zhaoyunfei's avatar zhaoyunfei

抛洒物 ROI

parent a8155a31
......@@ -96,6 +96,7 @@ DetectAnomaly::DetectAnomaly()
cfgAnomaly.gmm_long_learn_rate = 0.0001;
cfgAnomaly.gmm_short_learn_rate = 0.002;
cfgAnomaly.top_left_x = 759 * cfgAnomaly.input_resize;
// set gloabl var
......@@ -111,14 +112,22 @@ DetectAnomaly::DetectAnomaly()
GMM_SHORT_LEARN_RATE = 0.002;
// INPUT_RESIZE = 0.25;
cfgAnomaly.top_left_x = 759 * cfgAnomaly.input_resize;
cfgAnomaly.top_left_y = 35 * cfgAnomaly.input_resize;
cfgAnomaly.top_right_x = 1581 * cfgAnomaly.input_resize;
cfgAnomaly.top_right_y = 21 * cfgAnomaly.input_resize;
cfgAnomaly.bottom_left_x = 73 * cfgAnomaly.input_resize;
cfgAnomaly.bottom_left_y = 739 * cfgAnomaly.input_resize;
cfgAnomaly.bottom_right_x = 2376 * cfgAnomaly.input_resize;
cfgAnomaly.bottom_right_y = 661 * cfgAnomaly.input_resize;
// cfgAnomaly.top_left_x = 759 * cfgAnomaly.input_resize;
// cfgAnomaly.top_left_y = 35 * cfgAnomaly.input_resize;
// cfgAnomaly.top_right_x = 1581 * cfgAnomaly.input_resize;
// cfgAnomaly.top_right_y = 21 * cfgAnomaly.input_resize;
// cfgAnomaly.bottom_left_x = 73 * cfgAnomaly.input_resize;
// cfgAnomaly.bottom_left_y = 739 * cfgAnomaly.input_resize;
// cfgAnomaly.bottom_right_x = 2376 * cfgAnomaly.input_resize;
// cfgAnomaly.bottom_right_y = 661 * cfgAnomaly.input_resize;
cfgAnomaly.top_left_x = 562 * cfgAnomaly.input_resize;
cfgAnomaly.top_left_y = 58 * cfgAnomaly.input_resize;
cfgAnomaly.top_right_x = 1330 * cfgAnomaly.input_resize;
cfgAnomaly.top_right_y = 45 * cfgAnomaly.input_resize;
cfgAnomaly.bottom_left_x = 65 * cfgAnomaly.input_resize;
cfgAnomaly.bottom_left_y = 734 * cfgAnomaly.input_resize;
cfgAnomaly.bottom_right_x = 1780 * cfgAnomaly.input_resize;
cfgAnomaly.bottom_right_y = 715 * cfgAnomaly.input_resize;
obj_left = false;
arr[0] = 4;
......
......@@ -32,6 +32,18 @@ void ObjLeftDetect::ObjLeftSet(myImage *input, int set_MOG_LearnFrame, int set_m
myImage_2_opencv(mask, objmask);
cv::findContours(objmask,contours,cv::noArray(),cv::RETR_EXTERNAL,cv::CHAIN_APPROX_SIMPLE);
if (contours.size() > 0)
{
for(size_t i = 0; i < contours.size(); i++)
{
if (cv::contourArea(contours[i]) < 10000)
{
contours.erase(contours.begin() + i);
i--;
}
}
}
cv::Mat showpic = cv::Mat::zeros(cv::Size(new_width,new_height),CV_8UC1);
drawContours(showpic, contours, 0, Scalar::all(255));
// cv::imwrite("show.jpg",showpic);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment