Je travaille avec Python 2.7 et OpenCV 3.1 Je veux exécuter un code pour le suivi d'objets par ceci:Comment ajouter « Tracker » en python OpenCV 2.7
import cv2
import sys
if __name__ == '__main__' :
# Set up tracker.
# Instead of MIL, you can also use
# BOOSTING, KCF, TLD, MEDIANFLOW or GOTURN
tracker = cv2.Tracker_create("MIL")
# Read video
video = cv2.VideoCapture("videos/chaplin.mp4")
# Exit if video not opened.
if not video.isOpened():
print "Could not open video"
sys.exit()
# Read first frame.
ok, frame = video.read()
if not ok:
print 'Cannot read video file'
sys.exit()
# Define an initial bounding box
bbox = (287, 23, 86, 320)
# Uncomment the line below to select a different bounding box
# bbox = cv2.selectROI(frame, False)
# Initialize tracker with first frame and bounding box
ok = tracker.init(frame, bbox)
mais quand je le lance, je face avec cette erreur:
AttributeError: 'module' object has no attribute 'Tracker_create'
Voici le code source: http://www.learnopencv.com/object-tracking-using-opencv-cpp-python/ Je cherche des solutions, mais je ne peux pas trouver quelque chose d'utile ... que puis-je faire pour ajouter e est le module de ma bibliothèque opencv?
merci ... c'est génial ... mais j'en ai besoin dans Windows plutôt que Ubuntu savez-vous comment puis-je le faire dans Windows 8? – Elahe
@Elahe J'ai ajouté un lien vers le tutoriel de stackoverflow qui décrit la compilation sous Windows. – kyjanond