Average webcam

asked 2018-06-11 13:30:00 -0500

Sanglee gravatar image

updated 2020-05-26 07:03:49 -0500

supra56 gravatar image

Hi,

How can I get an average value for previous frames. (let us say the most recent frames for previous 10 minutes). I found the edges and dilated it. I would like to keep the binary values for a certain period of time and show the average value for each pixel. So, if a 10-min-video has a size of 3 * 3 and if all values are 0 for 5 min and then 1 for another 5 min, the frame will show 0.5 for the all 9 pixels.

Any idea? Thank you!

Code:

camera = cv2.VideoCapture(0)
while True:
    (grabbed, frame) = camera.read()
    if not grabbed:
        break
    frame = imutils.resize(frame, width = 400)
    edges = cv2.Canny(frame,100,200)
    dilation = cv2.dilate(edges, np.ones((3,3),np.uint8), iterations=1)
edit retag flag offensive close merge delete

Comments

take a look at Background Subtraction

sturkmen gravatar imagesturkmen ( 2018-06-11 15:51:01 -0500 )edit