DevinBayly / thermal_imaging

access the log plotter here https://devinbayly.github.io/thermal_imaging/
https://devinbayly.github.io/thermal_imaging/
0 stars 0 forks source link

opencv background subtraction #4

Open DevinBayly opened 2 years ago

DevinBayly commented 2 years ago

https://opencv24-python-tutorials.readthedocs.io/en/latest/py_tutorials/py_video/py_bg_subtraction/py_bg_subtraction.html

DevinBayly commented 2 years ago

all about the moving foreground being removed from the static background

algorithms

backgroundsubtractorMOG

gaussian mixture segmentation algo based on this “An improved adaptive background mixture model for real-time tracking with shadow detection” by P. KadewTraKuPong and R. Bowden in 2001.

idea is every pixel is represented by k gaussians and the weights of those gaussians is related to whether the pixel stays mostly the same for a long period of time.

code snippet

import numpy as np
import cv2

cap = cv2.VideoCapture('vtest.avi')

fgbg = cv2.createBackgroundSubtractorMOG()

while(1):
    ret, frame = cap.read()

    fgmask = fgbg.apply(frame)

    cv2.imshow('frame',fgmask)
    k = cv2.waitKey(30) & 0xff
    if k == 27:
        break

cap.release()
cv2.destroyAllWindows()

results

image

It appears that probably the most effective one of these is the first?

DevinBayly commented 2 years ago

just creating a notebook to try to estimate which of these tends to do better at least visually