Sakar Ghimire

1 min read 178 views

Image Subtraction

Image Subtraction_image

Image subtraction is the process where value of pixels of an image is subtracted from another image. This results in an image that generally points out the differences between the two images. 

During Image Subtraction, we can either subtract one image from another or we can also subtract a constant value from one image. Image Subtraction is generally used to 

  • Detecting changes in an image 
  • Levelling uneven sections of an image 

By using image subtraction, we can tell if something in the image has moved. Image Subtraction or Background Subtraction is one of the most widely used technique in traditional object tracking, where we subtract the current frame with moving entities from the original frame to get the blobs for moving objects. These blobs can later be used to track the objects movement using some linear filter such as Kalman Filter. 

As an example, we can subtract this image:

From this image:

And the result will be this image:

Below is some Python Code for implementing Image Subtraction. Here, we subtract an image (numpy array with dimension a*b*c) from another image (numpy array with same dimension).