Can jetson.utils.videoSource pick a different camera mode?

Hi
I am using Jetson Nano with a raspberry Pi Camera and jetson.utils.videoSource and specifying
param_videoSource.append(“–input-width=640”)
param_videoSource.append(f"–input-height=480")
but videoSource always picks camera mode 5

GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3264 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 3264 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 1640 x 1232 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 5 
   Output Stream W = 1280 H = 720 
   seconds to Run    = 0 
   Frame Rate = 120.000005

The problem is that 1280x720 is a 16:9 aspect ratio but my segnet model was trained on 640x480, a 4:3 ratio
videoSource will resize but doesn’t take the ratio into account. So all the images are distorted

The easiest solution would be to get the camera to choose a better mode eg mode 3 is 1640 x 1232 4:3
this could previously be achieved easily by supplying both the capture dimensions and display dimensions on the G_gstreamer_pipeline_string
I was using this function.

    return (
        "nvarguscamerasrc tnr-strength=1 ! "
            "video/x-raw(memory:NVMM), width=(int)%d, height=(int)%d, "
            "format=(string)NV12, 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 drop=True"
        % (
            capture_width,
            capture_height,
            framerate,
            flip_method,
            display_width,
            display_height,
        )
    )

Can this be done now with videoSource ? Its help doesn’t mention this.
Thanks
JC

Using sensor-mode=x like sensor-id to select sensor mode.

There isn’t a videoSource API for this, so you would need to manually add the sensor-mode parameter to the GStreamer pipeline that it constructs here: https://github.com/dusty-nv/jetson-utils/blob/56d57f6713a5afe9029ab768ec5d13c285a52dfb/camera/gstCamera.cpp#L145

Thanks @dusty_nv, I will investigate that

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