diff --git a/src/alg_sec.cpp b/src/alg_sec.cpp index 7fb1390e..73ecad93 100644 --- a/src/alg_sec.cpp +++ b/src/alg_sec.cpp @@ -41,7 +41,7 @@ using namespace cv; static void algsec_img_show(ctx_cam *cam, Mat &mat_src , std::vector &src_pos, std::vector &src_weights - , std::string algmethod, ctx_algsec_model &algmdl) + , ctx_algsec_model &algmdl) { std::vector fltr_pos; @@ -52,10 +52,6 @@ static void algsec_img_show(ctx_cam *cam, Mat &mat_src std::vector param(2); char wstr[10]; - (void)algmethod; - testdir = cam->conf->target_dir; - //imwrite(testdir + "/src_" + algmethod + ".jpg", mat_src); - algmdl.isdetected = false; for (indx0=0; indx0stream.secondary.cnct_count >0) || - (cam->imgs.size_secondary == 0)) { + (cam->imgs.size_secondary == 0) || + (cam->motapp->log_level >= DBG)) { + + if (cam->motapp->log_level >= DBG) { + imwrite(cam->conf->target_dir + "/src_" + algmdl.method + ".jpg", mat_src); + } + + if (algmdl.isdetected) { + for (indx0=0; indx0motapp->log_level >= DBG) { + imwrite(cam->conf->target_dir + "/detect_" + algmdl.method + ".jpg", mat_src); + } + } + param[0] = cv::IMWRITE_JPEG_QUALITY; param[1] = 75; cv::imencode(".jpg", mat_src, buff, param); @@ -210,7 +214,7 @@ static void algsec_detect_hog(ctx_cam *cam, ctx_algsec_model &algmdl) ,algmdl.threshold_model ,false); - algsec_img_show(cam, mat_dst, detect_pos, detect_weights, "hog",algmdl); + algsec_img_show(cam, mat_dst, detect_pos, detect_weights, algmdl); } catch ( cv::Exception& e ) { const char* err_msg = e.what(); @@ -259,7 +263,7 @@ static void algsec_detect_haar(ctx_cam *cam, ctx_algsec_model &algmdl) , Size(algmdl.haar_minsize,algmdl.haar_minsize) , Size(algmdl.haar_maxsize,algmdl.haar_maxsize), true); - algsec_img_show(cam, mat_dst, detect_pos, detect_weights, "haar", algmdl); + algsec_img_show(cam, mat_dst, detect_pos, detect_weights, algmdl); } catch ( cv::Exception& e ) { const char* err_msg = e.what();