cv2

OpenCV AttributeError module 'cv2.cv2' has no attribute 'Tracker_create'

我怕爱的太早我们不能终老 提交于 2020-12-08 07:09:45
问题 I have tried to run this code but get an Attribute Error. Any help would be greatly appreciated. import cv2 import sys (major_ver, minor_ver, subminor_ver) = (cv2.__version__).split('.') if __name__ == '__main__': # Set up tracker. # Instead of MIL, you can also use tracker_types = ['BOOSTING', 'MIL','KCF', 'TLD', 'MEDIANFLOW', 'CSRT', 'MOSSE'] tracker_type = tracker_types[5] if int(minor_ver) < 3: tracker = cv2.cv2.Tracker_create(tracker_type) else: if tracker_type == 'BOOSTING': tracker =

OpenCV AttributeError module 'cv2.cv2' has no attribute 'Tracker_create'

旧街凉风 提交于 2020-12-08 07:09:40
问题 I have tried to run this code but get an Attribute Error. Any help would be greatly appreciated. import cv2 import sys (major_ver, minor_ver, subminor_ver) = (cv2.__version__).split('.') if __name__ == '__main__': # Set up tracker. # Instead of MIL, you can also use tracker_types = ['BOOSTING', 'MIL','KCF', 'TLD', 'MEDIANFLOW', 'CSRT', 'MOSSE'] tracker_type = tracker_types[5] if int(minor_ver) < 3: tracker = cv2.cv2.Tracker_create(tracker_type) else: if tracker_type == 'BOOSTING': tracker =

What is the opposite of cv2.VideoWriter_fourcc?

拈花ヽ惹草 提交于 2020-12-08 06:47:26
问题 The function cv2.VideoWriter_fourcc converts from a string (four chars) to an int. For example, cv2.VideoWriter_fourcc(*'MJPG') gives an int for codec MJPG (whatever that is). Does cv2 provide the opposite function? I'd like to display the value as a string. I'd like to get a string from a fourcc int value. I could write the conversion myself, but I'd use something from cv2 if it exists. 回答1: I don't think cv2 has that conversion. Here is how to convert from fourcc numerical code to fourcc

Python check for corrupted video file (catch OpenCV error)

允我心安 提交于 2020-12-08 06:02:47
问题 I'm searching for a way to check if a video file is corrupted. I'm using cv2 (OpenCV for python) to load the video. If the video file is corrupt, I would like to skip the file and move on to the next one. I found this stackoverflow question and therefore tried this: try: vid = cv2.VideoCapture(corrupt_video_file) except cv2.error as e: print(e) except: print('error') but I still receive the following error: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x1b2d000] moov atom not found Unable to stop the stream: