MIPI CSI camera memory error message

I want to use MIPI Camera read image do YOLO image recognition and use ROS2 publish/subscrlibe information, but the following error message often appears.


(test:6922): GStreamer-WARNING **: 07:50:09.916: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvarguscamerasrc.so': /lib/aarch64-linux-gnu/libGLdispatch.so.0: cannot allocate memory in static TLS block

(test:6922): GStreamer-WARNING **: 07:50:09.929: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvidconv.so': /lib/aarch64-linux-gnu/libGLdispatch.so.0: cannot allocate memory in static TLS block
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (713) open OpenCV | GStreamer warning: Error opening bin: no element "nvarguscamerasrc"
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
ERROR Info: 'NoneType' object has no attribute 'shape'
ERROR Info: 'NoneType' object has no attribute 'shape'

This is how I read the image

def gstreamer_pipeline(
    sensor_id=0,
    capture_width=para.FHD_Width,
    capture_height=para.FHD_Height,
    display_width=para.FHD_Width,
    display_height=para.FHD_Height,
    framerate=30,
    flip_method=0,
):
    return (
        "nvarguscamerasrc sensor-id=%d !"
        "video/x-raw(memory:NVMM), width=(int)%d, height=(int)%d, framerate=(fraction)%d/1 ! "
        "nvvidconv flip-method=%d ! "
        "video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! "
        "videoconvert ! "
        "video/x-raw, format=(string)BGR ! appsink"
        % (
            sensor_id,
            capture_width,
            capture_height,
            framerate,
            flip_method,
            display_width,
            display_height,
        )
    )
class YOLO():
    def __init__(self, opt):
        self.cap = cv2.VideoCapture(gstreamer_pipeline(flip_method=0), cv2.CAP_GSTREAMER)

    def loadimg(self):
        imgs = [None] * 1
        ret, imgs[0] = self.cap.read()
        
        if not ret:
            grabbed = self.cap.grab()
            if grabbed:
                ret, imgs[0] = self.cap.retrieve()
                if not ret:
                    return False 

Check below topic.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.