Must be able to identify until the match point this way because the picture is too small give up after just tried
Pray god give some ideas
CodePudding user response:
To determine whether there are pedestrians should be relatively simple, the two image subtraction, if determine whether the same pedestrians is not easyCodePudding user response:
What color do what characteristics calculation, whatCodePudding user response:
Do you want to do is face recognition + motion detection?CodePudding user response:
Fyi:# "Object Tracking using OpenCV (c + +/Python)"
The import cv2
The import sys
(major_ver minor_ver, subminor_ver)=(cv2. __version__). The split ('. ')
If __name__=="__main__ ':
# Set up the tracker.
Home # MIL, you can also use the
Tracker_types=[' BOOSTING ', 'MIL', 'KCF', 'TLD', 'MEDIANFLOW', 'GOTURN', 'MOSSE]
Tracker_type=tracker_types [2]
If the int (minor_ver) & lt; 3:
The tracker=cv2. Tracker_create (tracker_type)
The else:
If tracker_type=='BOOSTING:
The tracker=cv2. TrackerBoosting_create ()
If tracker_type=='MIL:
The tracker=cv2. TrackerMIL_create ()
If tracker_type=='KCF:
The tracker=cv2. TrackerKCF_create ()
If tracker_type=='TLD:
The tracker=cv2. TrackerTLD_create ()
If tracker_type=='MEDIANFLOW:
The tracker=cv2. TrackerMedianFlow_create ()
If tracker_type=='GOTURN:
The tracker=cv2. TrackerGOTURN_create ()
If tracker_type=='MOSSE:
The tracker=cv2. TrackerMOSSE_create ()
# Read video
Video=cv2. VideoCapture (" stage. Mp4 ")
# Exit if video not the opened.
If not video. IsOpened () :
Print (" Could not open the video ")
Sys. The exit ()
For the f in the range 25 * (10) :
Ok, frame=video. The read ()
If not ok:
Print (' always read a video file ')
Sys. The exit ()
# Uncomment the line below to select a company's bounding box
Bbox=cv2. SelectROI (frame, False)
Cv2. DestroyWindow (' ROI selector ')
Print (" selectROI: "+ STR (bbox))
If bbox==(0,0,0,0) :
# Define an default bounding box
Bbox=(700, 255, 192, 473)
Print (" You canceled selection. Use the default "+ STR (bbox))
# the Initialize the tracker with the first frame and bounding box
Ok=tracker. The init (frame, bbox)
Print (ok)
While True:
# Read a new frame
Ok, frame=video. The read ()
If not ok:
Break
# Start timer
The timer=cv2. GetTickCount ()
# the Update tracker
Ok, bbox=tracker. Update (frame)
# Calculate Frames per second (FPS)
FPS=cv2. GetTickFrequency ()/(cv2. The getTickCount () - timer);
# the Draw bounding box
If ok:
# Tracking success
P1=(int (bbox [0]), int (bbox [1]))
P2=(int (bbox bbox [0] + [2]), int (bbox bbox [1] + [3]))
Cv2. A rectangle (frame, p1, p2, (0, 255), 2, 1)
The else:
# Tracking failure
Cv2. PutText (frame, "Tracking failure detected", (100), cv2. FONT_HERSHEY_SIMPLEX, 0.75, (0,0,255), 2)
# Display the tracker type on frame
Cv2. PutText (frame, tracker_type + "Tracker," (100), cv2. FONT_HERSHEY_SIMPLEX, 0.75, (50170, 50), 2);
# Display FPS on frame
Cv2. PutText (frame, "FPS:" + STR (int (FPS)), (100, 50), cv2. FONT_HERSHEY_SIMPLEX, 0.75, (50170, 50), 2);
# the Display result
Cv2. Imshow (" Tracking ", frame)
# Exit if ESC pressed
K=cv2. WaitKey (1) & amp; 0 XFF
If k==27:
Break
If k==32:
Bbox1=cv2. SelectROI (frame, False)
Cv2. DestroyWindow (' ROI selector ')
Print (" selectROI: "+ STR (bbox1))
If bbox1==(0,0,0,0) :
Print (" You canceled selection. Use the old "+ STR (bbox))
The else:
Bbox=bbox1
Print (" new selectROI: "+ STR (bbox))
Del tracker
The tracker=cv2. TrackerKCF_create ()
Ok=tracker. The init (frame, bbox)
Print (ok)
Cv2. DestroyWindow (' Tracking ')
CodePudding user response:
Use opencv is very simple, just above, use C calls, hundreds of lines of codeCodePudding user response:
"OpenCV computer visual programming strategy (3rd edition)" in chapter 13 tracking moving targetsCodePudding user response: