1

So what I have is two images extracted from video of cold-drink cans. In the first image all the 5 cans are present:

Image1

And in the second image one is missing:

Image2

So what I want is to find out which of the can was picked out of 5. I tried applying the cv2.subtract but it doesnt seem to give me the desired result.

How can I achieve what I am trying to achieve using opencv python? I'm using Python 3.5 and opencv 3.1. Any help is appreciated. This the code:

import numpy as np
import cv2
import os
import sys

img1=cv2.imread("IMG_3.jpg")
img2=cv2.imread("IMG_4.jpg")

r_img=cv2.subtract(img1, img2)

cv2.namedWindow("output", cv2.WINDOW_NORMAL)
cv2.resizeWindow("output", 400, 300)
cv2.imshow("output", r_img)

cv2.waitKey(0)

cv2.destroyAllWindows()

And this is the output image

Shanam
  • 11
  • 2

0 Answers0