diff --git a/.checkobject.py.swp b/.checkobject.py.swp new file mode 100644 index 0000000..969e242 Binary files /dev/null and b/.checkobject.py.swp differ diff --git a/checkobject.py b/checkobject.py index fcb7d1b..d5ae905 100644 --- a/checkobject.py +++ b/checkobject.py @@ -19,7 +19,7 @@ def get_object_location(pfile, mask_path = 'lianhua_1.jpg'): if flag: flag = False print('flag change>>{}>>{}'.format(pfile, nn)) - return '1' + return '0' frame = cv.resize(frame, (512, 640), interpolation=cv.INTER_CUBIC) frame = cv.medianBlur(frame, ksize=3) @@ -29,8 +29,10 @@ def get_object_location(pfile, mask_path = 'lianhua_1.jpg'): fgmask = fgbg.apply(frame_motion) draw1 = cv.threshold(fgmask, 25, 255, cv.THRESH_BINARY)[1] # 二值化 draw1 = cv.dilate(draw1, kernel, iterations=1) - if nn<10: #判断10帧内有入侵动作 + if nn<30: #判断20帧内有入侵动作 flag = check_tings(mask_path, draw1) + if flag == '1': + return '1' T2 = time.time() print('single video >>> {}-->{}-->{}'.format(pfile, nn, (T2 - T1))) return '0' @@ -48,6 +50,7 @@ def check_tings(mask_path, img): iouArea = cv.contourArea(dics[cc[-1]]) # if iouArea>10000 and iouArea<40000: if iouArea>10000 and iouArea<40000: + print('>>>>>>{}'.format(iouArea)) return '1' else: return '0'