-
Sorry to bother everyone but I might be a bit incompetent when it comes to Python. Typically I work with programs like TD which uses python scripts, or more old school C++ projects that are built using VS or Unreal Engine. Basically I am trying to install this project and hopefully get it to work with a webcamera but I have almost no idea what I am doing. I'll outline the current mess below in some bullet points.
I'm pretty sure whatever I am doing at this point is probably the wrong approach so I was hoping someone could set me straight. I see people talking about Conda/Anaconda but I was not able to figure out how to use this properly either, most of this container/temporary environment stuff is a bit out of my league at the moment. I'm happy to use this stuff but I honestly can't find a good starting point to get my head around it. If anyone can offer up either a clear set of instructions for a Windows user trying to get this to work with a webcam, or possibly event just some tutorial videos that would provide the background knowledge to get this working I would really appreciate it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @CosmicBen, I just updated main branch to fix some issues related to the webcam input. There are few problems related to pyvirtualcam, so relaying output to the virtual camera is still not working, but it'll show the result with For the installation, you just need to install once with the below command. If there's no error, then you're good to go. pip install --extra-index-url https://download.pytorch.org/whl/cu118 transparent-background You also mentioned that import cv2
import numpy as np
from PIL import Image
from transparent_background import Remover
# Load model
remover = Remover(mode='fast', device='cpu') For the webcam input, just change the cap = cv2.VideoCapture(0)
while cap.isOpened():
ret, frame = cap.read() # read video
if ret is False:
break
if cv2.waitKey(1) & 0xFF == 27:
break
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
img = Image.fromarray(frame).convert('RGB')
out = remover.process(img, type='blur')
cv2.imshow('output', cv2.cvtColor(np.array(out), cv2.COLOR_BGR2RGB))
cap.release()
writer.release() You can choose Lastly, I noticed that |
Beta Was this translation helpful? Give feedback.
Hi @CosmicBen, I just updated main branch to fix some issues related to the webcam input. There are few problems related to pyvirtualcam, so relaying output to the virtual camera is still not working, but it'll show the result with
cv2.imshow
now.For the installation, you just need to install once with the below command. If there's no error, then you're good to go.
You also mentioned that
This command failed with a pytorch cuda error.
It seems like you don't have any CUDA devices on your machine. Try using withcpu
but it will be extremely slow withbase
model, so I recommend usingfast
model. Als…