3

I need to edit frames of computer webcam during a live streaming (google.meet, Skype, FaceTime..).

I tried using OpenCV, but I don't know how to redirect the output to replace original frames of the camera or render output to the camera path.

import cv2

video = cv2.VideoCapture(0)
if not video.isOpened():
    raise Exception('Video is not opened!')

while True:
    ret, frame = video.read() # Capture frame-by-frame
    
    # here edits like blur...
    blurred_frame = cv2.blur(frame, (10, 10))
    cv2.imshow('Video', blurred_frame) # Display the resulting frame

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# release the capture
video.release()
cv2.destroyAllWindows()

Someone can help me solving this problem?

I'm running on macOS Catalina, with Python 3.7.4

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
M. T.
  • 396
  • 6
  • 24
  • Your question is lacking details. How do you want to modify it exactly? – Mark Setchell Oct 02 '20 at 18:49
  • @MarkSetchell I edited the code, maybe you understand better. I need to redirect output of cv2 to webcam. Here there is an example https://stackoverflow.com/questions/21446292/using-opencv-output-as-webcam but only works on Linux... – M. T. Oct 02 '20 at 18:57
  • You want to send images to a camera? Normally cameras only transmit images. – Mark Setchell Oct 02 '20 at 18:59
  • I write it to you in the easiest way to understand. I need to add a filter to the images I transmit with the webcam from the computer to a live streaming system. – M. T. Oct 02 '20 at 19:02
  • @M.T. "Only works for Linux"? The second answer there seems to work for both. – user202729 Oct 03 '20 at 08:32
  • no It doesn't work properly – M. T. Oct 04 '20 at 08:22
  • voting to close as seeking recommendations. -- recommendation: https://pypi.org/project/pyvirtualcam/ requires no workarounds involving OBS or anything – Christoph Rackwitz Jul 18 '22 at 18:45

1 Answers1

-1

Just display the frames in a window and use open broadcaster studio (obs) app to capture that window and use obs's virtual camera in zoom

  • https://pypi.org/project/pyvirtualcam/ is a better idea – Christoph Rackwitz Jul 18 '22 at 18:45
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 20 '22 at 08:56