1
$\begingroup$

I have a Python OpenCV computer vision script that runs object detection on videos and webcams. Currently, I'm simulating a scene in Blender, rendering to an mp4 and then opening it separately in Python. This creates a really long cycle time because the Blender render takes about 10-20 minutes for each small change.

Ideally, I would want the camera in Blender to output to a virtual webcam on my computer that OpenCV could then read from, live. I think it would be possible since they are both Python. Is this possible? I also recognize that having a live rendered feed would probably require eevee over cycles.

$\endgroup$
1
  • $\begingroup$ As far as I know, no. It's possible to add hooks to frame change events and use those hooks to output a screen capture to a network socket, but the screen captures take longer than a frame time at 24fps. I don't know if hooks exist based on moving the scene point of view, but I believe not. $\endgroup$ Dec 27, 2021 at 15:40

1 Answer 1

-1
$\begingroup$

I found only one existing way:

  1. First you need allow Terminal to access to your Camera (*1)
  2. Run Blender from Terminal shell /Applications/Blender.app/Contents/MacOS/Blender

Check your permisses in System Properties > Privacy and policy > Camera enter image description here

*1 : create simply code sample code name it as sample.py and run it in your terminal python ./sample.py -> allow Camera access.

and thats it!

$\endgroup$
2
  • $\begingroup$ I think this might be a misunderstanding, I think this would allow Blender to use the webcam? What I want is the camera from Blender to output to a webcam that Python could read using opencv's cv2.VideoCapture() $\endgroup$
    – kevinlinxc
    Jan 21, 2023 at 21:31
  • $\begingroup$ Yes Sorry, I posted this response to other problem! My apologies $\endgroup$ Jan 23, 2023 at 10:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .