Background modeling using univariate Gaussian density function.

2 visualizaciones (últimos 30 días)
Burak Karakus
Burak Karakus el 23 de Dic. de 2021
Comentada: yanqi liu el 27 de Dic. de 2021
I need to expose background model from 10 consequtive frames, not a video. Also, I need to display both mean and standard deviation images. I got stuck because I could not find any similar project for reference. Thanks in advance.

Respuestas (1)

yanqi liu
yanqi liu el 24 de Dic. de 2021
yes,sir,may be use createBackgroundSubtractorMOG2,such as
import cv2 as cv
import numpy as np
vid = cv.VideoCapture("D:/Program Files/Polyspace/R2019a/toolbox/images/imdata/traffic.avi")
mog = cv.createBackgroundSubtractorMOG2()
se = cv.getStructuringElement(cv.MORPH_RECT, (3, 3))
while True:
ret, imi = vid.read()
if ret is True:
fm = mog.apply(imi)
ret, bw = cv.threshold(fm, 220, 255, cv.THRESH_BINARY)
bw = cv.morphologyEx(bw, cv.MORPH_OPEN, se)
bg = mog.getBackgroundImage()
cv.imshow("left_bg&right_frame",np.concatenate((bg, imi), axis=1))
c = cv.waitKey(50)
else:
break
cv.destroyAllWindows()
  2 comentarios
Burak Karakus
Burak Karakus el 24 de Dic. de 2021
Editada: Burak Karakus el 24 de Dic. de 2021
Sir, how could I modify this for consecutive frames as input? Should I use a for loop with createBackgroundSubtractorMOG2 instructor? I want to evaluate density value of each pixel using mean and standard deviation parameters via Gaussian density function? Thank you for your interest.
yanqi liu
yanqi liu el 27 de Dic. de 2021
yes,sir,may be upload your video file to make some analysis. this is use python opencv method to process

Iniciar sesión para comentar.

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by