Getting camera image directly


#1

How do you get get the camera image directly into a numpy array rather than having a window displaying it?


#2

You can use offscreen window mode to avoid having a window show up.

You can attach a texture to the window using base.win.addRenderTexture, and then you can use RTMCopyRam mode (which copies the result of the render to RAM every frame) or RTMTriggeredCopyRam (which will copy it every time after you call base.win.triggerCopy().)

Then, you can extract the RAM image of this texture using tex.getRamImage() or tex.getRamImageAs("RGBA") in order to obtain it as something you can then convert easily into a numpy array.

Let us know if you need specific help with any of the steps!