This commit is contained in:
2022-11-28 17:43:34 +08:00
parent ce1e0350f3
commit 0137354db8
2 changed files with 7 additions and 11 deletions

View File

@ -64,7 +64,7 @@ def analysis_video(model, video_path, result_path, uuid_barcode, maskpath=None,
if not ret:break
frame_show = frame
nn += 1
if flag: #MOG2过滤为入侵画面
if flag: #过滤为入侵画面
if nn%2==0 or nn%3==0:continue #跳帧
flag = img_filter(frame, oriimg, fgbg, nn)
if flag: continue
@ -92,10 +92,9 @@ def analysis_video(model, video_path, result_path, uuid_barcode, maskpath=None,
flag, nu, Result = detect(match, affd, net, result, transform, ms, search_r, nn, nu, Result)
if flag: break
Addimg_content(uuid_barcode, frame_show)#图片上传
#if not Result=='03':
if result is not None:
coordinate = str(coordination[0])+'_'+str(coordination[1])+'_'+str(coordination[2])+'_'+str(coordination[3])
cv2.imwrite(os.sep.join([cfg.Ocrimg, uuid_barcode+'_'+str(nu)+'_'+coordinate+'.jpg']), frame_show) #give ocr img
cv2.imwrite(os.sep.join([cfg.Ocrimg, uuid_barcode+'_'+str(nu)+'_'+coordinate+'.jpg']), frame) #give ocr img
else:
cv2.imwrite(os.sep.join([cfg.Ocrimg, uuid_barcode+'_'+str(nu)+'_0_0_0_0'+'.jpg']), frame_show) #give ocr img
return Result
@ -111,13 +110,10 @@ def detect(match, affd, net, result, transform, ms, search_r, nn, nu, Result):
Result += str(res)+','
else:
Result += str(res)+','
if res<cfg.THRESHOLD:
#Result ='04'
flag = True
nu += 1
if nu>cfg.NUM_RAFT:
#Result = '02'
flag = True
if nn>100 and nu>2:
flag = True