update
This commit is contained in:
BIN
.checkobject.py.swp
Normal file
BIN
.checkobject.py.swp
Normal file
Binary file not shown.
@ -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'
|
||||
|
Reference in New Issue
Block a user