【问题标题】:Detect the time of event from the video file从视频文件中检测事件时间
【发布时间】:2022-06-13 04:50:02
【问题描述】:

我是 OpenCV 新手。我正在尝试从视频文件中检测确切的事件点。我怎样才能做到这一点?这就是我的程序加载视频文件并应用轮廓来定位事件的方式。

ret, frame=cap.read()
frame[frame<=thresholds]=0
print("DEBUG: line 67: ", len(frame))
mask = object_detector.apply(frame)
_, mask  = cv2.threshold(mask,254,255,cv2.THRESH_BINARY)        #mask the backgroubd to the color ratio of 255 for complete black color
contours,_ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
res = cv2.bitwise_and(frame,frame,mask=mask)
for cnt in contours:
    area = cv2.contourArea(cnt)
    if area>100:    #detect for the flashes above 1000pixel
        cv2.drawContours(frame, [cnt], -1, (0,255,0),2) 
key = cv2.waitKey(5)
if key =='27':
    break
cv2.imshow("Frame",frame)
cv2.imshow("Mask",mask)
cv2.imshow("res", res)'''

【问题讨论】:

  • cap.get(cv2.CAP_PROP_POS_MSEC) 如果在阅读框架后思考。但我不知道这在不同的后端有多可靠。
  • 感谢您的回复。它没有帮助我检测事件的时间。我试图准确地检测闪光。我已经在问题中包含了确切的事件。

标签: python opencv


猜你喜欢
  • 2014-01-13
  • 1970-01-01
  • 2016-04-22
  • 2015-01-15
  • 2011-11-07
  • 1970-01-01
  • 1970-01-01
  • 2014-04-12
  • 2011-05-24
相关资源
最近更新 更多