Question
# -*- coding: utf-8 -*- #import opencv import cv2 video = cv2.VideoCapture('Walk1.mpg') index=1 # extract frames and saved into the current folder if video.isOpened(): evl
# -*- coding: utf-8 -*-
#import opencv
import cv2
video = cv2.VideoCapture('Walk1.mpg')
index=1
# extract frames and saved into the current folder
if video.isOpened():
evl , frame = video.read()
else:
evl = False
while evl:
evl, frame = video.read()
cv2.imwrite(str(index) + '.jpg',frame)
index = index + 1
cv2.waitKey(1)
video.release()
Step 1: read all frames (612 frames in total) (this step has been already done in the preliminary code)
Step 2: for each pixel position, calculate standard deviation along 612 frames
Step 3: set a threshold for standard deviation (the mathematical formulation of the standard deviation is in https://en.wikipedia.org/wiki/Standard_deviation)
Step 4: based on threshold, extract the moving objects (remove static background pixels) and draw a rectangle onto the moving objects, save all frames.
Step 5: rebuild 612 frames to a video, in which moving objects are tracked.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started