Is there a way to subtract two images in python opencv2? 1) Image 1: any image (for example: the image of the house) (static image) 2) Image 2: the same image with the object (there is a person in the house ...) (static image + dynamic objects) 3) Image 3 = Image 2 - Image 1If we subtract Image2 from Image1, then Image3 should give Object (person).Please give any example.Thanks.
, , .
image1 = imread("/path/to/image1") image2 = imread("/path/to/image2") image3 = image1 - image2
(http://docs.opencv.org/master/db/d5c/tutorial_py_bg_subtraction.html#gsc.tab=0)
cv2.subtract(img1, img2) , cv2 .
cv2.subtract , 0-255, , , unit8 int32 int64. unint8 0-255,
image1= np.int32(image1) image2= np.int32(image2) image3 = image1 - image2
Source: https://habr.com/ru/post/1524239/More articles:Is there a vim plugin for highlighting semantics / syntax? - vimСоздайте все уникальные комбинации предметов - javaIs there a way to implement and use the "NOT null coalescing" operator? - c #SQL loader date format - dateSave base64 string as image using phone saver? - javascriptImageView масштабируется до фиксированной высоты, но избыточная ширина урожая - androidПроверьте, действительно ли работает буфер перехода (не локальные переходы) - c++Further localize memory leak with memwatch - node.jsHow to protect the source code of a chrome-packaged application? - javascriptWhat does the regular expression (\ d {3}) (? = \ D) mean? - ruby | fooobar.comAll Articles