I have a question about what the program does.
I would like to make a difference between the background image and another image.
This siteI created a background subtraction program with reference to.
bg_diff_path ='./diff.jpg'I'm not sure how to handle this, but if anyone can understand it, could you please tell me?
fgmaskI somehow understood how to get the foreground of each image ...
import cv2 import numpy as np import matplotlib.pyplot as plt % matplotlib inline img1 = cv2.imread ("reth-morclose-09393.jpg", 0) img2 = cv2.imread ("reth-morclose-09944.jpg", 0) fgbg = cv2.bgsegm.createBackgroundSubtractorMOG () fgmask = fgbg.apply (img1) fgmask = fgbg.apply (img2) bg_diff_path ='./diff.jpg' cv2.imwrite (bg_diff_path, fgmask)
Answer # 1
I want to do it
Program processing content
No one can explain it because only you can know it.
(What do you want to do with the acquired foreground image?)
If you want to know how to use BackgroundSubtractorMOG,
There is a story about using this in the OpenCV tutorial, so why not read it?
The content of the question is
I'm not sure how to handle bg_diff_path ='./diff.jpg'
It became a story, but
Immediately after that, it becomes an argument of imwrite, so I think it is nothing but the image storage path.
("./" Is a description of the current position, so it will be saved as "diff.jpg" in the current directory.)
- about processing to exclude the character string group specified from list in python
- python 3x - i'm not sure about asynchronous processing (asyncio)
- python 3x - please teach about the exchange of information with qthead
- python 3x - about the contents of python error code
- python - about multiple processing and loop processing in discordpy
- python - processing when the result of adding the contents of the list of numbers becomes a specific value
- python 3x - please tell me about runtimeerror
- please tell me about the role of python tag = "mychr"
- python about iterative processing with specified numbers
- (tensorflow) please give a brief explanation of the contents of the model
- about image output of python
- python - about downloading youtube videos by youtube-dl
- python 3x - processing to jump to the link destination using chrome driver in python
- python - about x-axis adjustment in matplotlib
- python - about "" "of" "" select === = "" "
- python - about the optimum angle of rotation matrix
- python, about the fire spread step of forest fire simulation
- python - (tensorflow) please teach me how to connect labels and indexes
- python - about hamiltonian neural networks