Background Subtraction OpenCv Python
Background Subtraction Background Subtraction is a method in image processing in which we subtract the background to detect the object or more specifically changes in the environment. We will create a python code with simple mathematical operations to create background subtraction. The way background subtraction work is we directly subtract background image from input image and then we binarize the image and after some operations like gaussian blur and erosion we get the object. Take 2 images, one background image and one with the object. The idea here is we are working with stable non movable camera. This type of camera are generally used for security. Read the images in python using cv2.imread command then resize the images to desired size(resizing is always very helpful). background = cv2.imread( 'background.jpg' ) image = cv2.imread( 'testforground.jpg' ) shape = ( 200 , 200 ) bg = cv2.resize(background, shape) Convert t...