UNSOLVED VEYE IMX 327S video streaming on pi zero with opencv
We are looking to use some image manipulation with opencv to write some text onto the image and display on hdmi as part of a system that accepts a numpy array for displaying on a headless pi zero. So it requires this camera to be streaming real time, at preferably 60fps, but 30fps is fine.
For this to work we need a fast video stream display with the IMX327S. I looked at the opencv example which says "displaying a YUV stream with opencv" however the frame rate is very slow. It's only getting a frame probably every 3 seconds.
Here is the code that I have used.
camera = Dcam.mipi_camera() print("Open camera...") camera.init_camera() while LiveCamera.running: height = int(align_up(1080, 16)) width = int(align_up(1920, 32)) if LiveCamera.first is False: LiveCamera.first = True print("-----live------") print("height:" + str(height)) print("width:" + str(width)) print("frame is read") print("------------------") frame = camera.capture(encoding='i420') #3133440 image = frame.as_array.reshape(int(height*1.5), width) image = cv2.cvtColor(image, cv2.COLOR_YUV2BGR_I420) dst = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) LiveCamera.frame = dst camera.release_buffer(frame) del frame sleep(0)
If the camera could be used with the picamera library, that would be ideal, though i didn't find any information for setting it up with picamera.
Or if there is a way to place overlays on the imx327S this would be a solution as well
Sometimes the camera loads at start up, other times it reports a select time out and segmentation fault. We are running an additional camera with the system and unsure at this stage if it is a result of this other camera. will do more testing on it.
- Caputre function
capture function is very slow，suitable for low frame rate capture needs. In this function, the mipi receive channel is reinitialized, a frame is fetched from the stream, then the mipi receive channel is closed, data format conversion (cpu operation) is performed, and then returned.
If you need to preview, we recommend using the preview function. Or refer to veye_raspcam's C code. This function will bind the data input channel to the display channel at the mmal level.
- Text overlay
Pls refer to this topic:
- Caputre function
Is there source code for raspivid?
@veye_xumm This is new territory for me...
Libcairo says it works on x window systems. Is it possible to use libcairo on pi zero headless?
Sorry, I'm not sure.