Skip to content

VC MIPI IMX290: ROI Cropping Errors #184

@HamzaBeder1

Description

@HamzaBeder1

Hello,

The following is my platform information:

  • Device: NVIDIA Jetson Orin Nano Developer Kit
  • JetPack Version: R35.3.1
  • Kernel: 5.10.104-tegra
  • Camera: VC MIPI IMX290 monochrome

I am trying to increase the frame rate of my sensor by performing ROI cropping.

I see from the GitHub that this can be changed using V4L2 controls as long as V4L2 is used and not gstreamer.

When I use the V4L2 controls to adjust the width to 1920x1080 (the same as specified in my device tree), I am able to stream. However, if I adjust to any other resolution, I get errors when streaming:

bsbrl@nvidia:~$ sudo v4l2-ctl -d /dev/video0 --get-fmt-video
Format Video Capture:
        Width/Height      : 1920/1080
        Pixel Format      : 'RG10' (10-bit Bayer RGRG/GBGB)
        Field             : None
        Bytes per Line    : 3840
        Size Image        : 4147200
        Colorspace        : sRGB
        Transfer Function : Default (maps to sRGB)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Full Range)
        Flags             :
bsbrl@nvidia:~$ sudo v4l2-ctl -d /dev/video0 --stream-mmap --stream-count=200
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 99.93 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
bsbrl@nvidia:~$ sudo v4l2-ctl -d /dev/video0 --set-fmt-video=width=1280,height=720
bsbrl@nvidia:~$ sudo v4l2-ctl -d /dev/video0 --get-fmt-video
Format Video Capture:
        Width/Height      : 1280/720
        Pixel Format      : 'RG10' (10-bit Bayer RGRG/GBGB)
        Field             : None
        Bytes per Line    : 2560
        Size Image        : 1843200
        Colorspace        : sRGB
        Transfer Function : Default (maps to sRGB)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Full Range)
        Flags             :
bsbrl@nvidia:~$ sudo v4l2-ctl -d /dev/video0 --stream-mmap --stream-count=20
0 --verbose
VIDIOC_QUERYCAP: ok
                VIDIOC_REQBUFS returned 0 (Success)
                VIDIOC_QUERYBUF returned 0 (Success)
                VIDIOC_QUERYBUF returned 0 (Success)
                VIDIOC_QUERYBUF returned 0 (Success)
                VIDIOC_QUERYBUF returned 0 (Success)
                VIDIOC_QBUF returned 0 (Success)
                VIDIOC_QBUF returned 0 (Success)
                VIDIOC_QBUF returned 0 (Success)
                VIDIOC_QBUF returned 0 (Success)
                VIDIOC_STREAMON returned 0 (Success)
cap dqbuf: 0 seq:      0 bytesused: 1843200 ts: 165.212201 (error, ts-monotonic, ts-src-eof)
cap dqbuf: 1 seq:      1 bytesused: 1843200 ts: 165.222208 delta: 10.007 ms (error, ts-monotonic, ts-src-eof)
cap dqbuf: 2 seq:      2 bytesused: 1843200 ts: 165.232215 delta: 10.007 ms (error, ts-monotonic, ts-src-eof)
cap dqbuf: 3 seq:      3 bytesused: 1843200 ts: 165.242222 delta: 10.007 ms (error, ts-monotonic, ts-src-eof)

I tried changing the resolution in the overlay to HD 1280x720 so that I could do ROI cropping with gstreamer, but the driver configures the sensor to use full HD 1920x1080 after making the change:


bsbrl@nvidia:~$ sudo v4l2-ctl -d /dev/video0 --get-fmt-video
Format Video Capture:
        Width/Height      : 1920/1080
        Pixel Format      : 'RG10' (10-bit Bayer RGRG/GBGB)
        Field             : None
        Bytes per Line    : 3840
        Size Image        : 4147200
        Colorspace        : sRGB
        Transfer Function : Default (maps to sRGB)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Full Range)
        Flags             :

The following is the relevant portion of my device tree:

 cam_i2cmux {
                        status = "okay";
                        compatible = "i2c-mux-gpio";
                        #address-cells = <0x01>;
                        #size-cells = <0x00>;
                        mux-gpios = <0x66 0x13 0x00>;
                        i2c-parent = <0x2c4>;

                        i2c@0 {
                                    status = "okay";
                                    reg = <0x00>;
                                    #address-cells = <0x01>;
                                    #size-cells = <0x00>;

                                    vc_mipi@1a {
                                                reg = <0x1a>;
                                                compatible = "nvidia,vc_mipi";
                                                devnode = "video0";
                                                use_sensor_mode_id = "false";
                                                sensor_model = "vc_mipi";
                                                num_lanes = [34 00];
                                                trigger_mode = [30 00];
                                                io_mode = [30 00];
                                                physical_w = "5.568";
                                                physical_h = "3.132";
                                                reset-gpios = <0x5a 0x3e 0x00>;
                                                phandle = <0x48a>;

                                                mode0 {
                                                            num_lanes = [34 00];
                                                            tegra_sinterface = "serial_b";
                                                            embedded_metadata_height = [31 00];
                                                            readout_orientation = [30 00];
                                                            lane_polarity = [36 00];
                                                            active_l = [30 00];
                                                            active_t = [30 00];
                                                            active_w = "1280";
                                                            active_h = "720";
                                                            mode_type = "bayer";
                                                            pixel_phase = "rggb";
                                                            csi_pixel_bit_depth = "10";
                                                            min_gain_val = [30 00];
                                                            max_gain_val = "71000";
                                                            step_gain_val = "300";
                                                            default_gain = [30 00];
                                                            min_exp_time = [31 00];
                                                            max_exp_time = "1000000";
                                                            step_exp_time = [31 00];
                                                            default_exp_time = "10000";
                                                            min_framerate = "100";
                                                            max_framerate = "60000";
                                                            step_framerate = "100";
                                                            default_framerate = "60000";
                                                            gain_factor = "1000";
                                                            exposure_factor = "1000000";
                                                            framerate_factor = "1000";
                                                            inherent_gain = [31 00];
                                                            min_hdr_ratio = [31 00];
                                                            max_hdr_ratio = [31 00];
                                                            line_length = [30 00];
                                                            phy_mode = "DPHY";
                                                            discontinuous_clk = "no";
                                                            mclk_khz = "24000";
                                                            pix_clk_hz = "600000000";
                                                            mclk_multiplier = "0.0";
                                                            cil_settletime = [30 00];
                                                            dpcm_enable = "false";
                                                };

                                                ports {
                                                            #address-cells = <0x01>;
                                                            #size-cells = <0x00>;

                                                            port@0 {
                                                                        reg = <0x00>;

                                                                        endpoint {
                                                                                    port-index = <0x01>;
                                                                                    bus-width = <0x04>;
                                                                                    remote-endpoint = <0x2c5>;
                                                                                    phandle = <0x285>;
                                                                        };
                                                            };
                                                };
                                    };
                        };

                        i2c@1 {
                                    status = "okay";
                                    reg = <0x01>;
                                    #address-cells = <0x01>;
                                    #size-cells = <0x00>;

                                    vc_mipi@1a {
                                                reg = <0x1a>;
                                                compatible = "nvidia,vc_mipi";
                                                devnode = "video1";
                                                use_sensor_mode_id = "false";
                                                sensor_model = "vc_mipi";
                                                num_lanes = [34 00];
                                                trigger_mode = [30 00];
                                                io_mode = [30 00];
                                                physical_w = "5.568";
                                                physical_h = "3.132";
                                                reset-gpios = <0x5a 0xa0 0x00>;
                                                phandle = <0x48b>;

                                                mode0 {
                                                            num_lanes = [34 00];
                                                            tegra_sinterface = "serial_c";
                                                            embedded_metadata_height = [31 00];
                                                            readout_orientation = [30 00];
                                                            lane_polarity = [30 00];
                                                            active_l = [30 00];
                                                            active_t = [30 00];
                                                            active_w = "1280";
                                                            active_h = "720";
                                                            mode_type = "bayer";
                                                            pixel_phase = "rggb";
                                                            csi_pixel_bit_depth = "10";
                                                            min_gain_val = [30 00];
                                                            max_gain_val = "71000";
                                                            step_gain_val = "300";
                                                            default_gain = [30 00];
                                                            min_exp_time = [31 00];
                                                            max_exp_time = "1000000";
                                                            step_exp_time = [31 00];
                                                            default_exp_time = "10000";
                                                            min_framerate = "100";
                                                            max_framerate = "60000";
                                                            step_framerate = "100";
                                                            default_framerate = "60000";
                                                            gain_factor = "1000";
                                                            exposure_factor = "1000000";
                                                            framerate_factor = "1000";
                                                            inherent_gain = [31 00];
                                                            min_hdr_ratio = [31 00];
                                                            max_hdr_ratio = [31 00];
                                                            line_length = [30 00];
                                                            phy_mode = "DPHY";
                                                            discontinuous_clk = "no";
                                                            mclk_khz = "24000";
                                                            pix_clk_hz = "600000000";
                                                            mclk_multiplier = "0.0";
                                                            cil_settletime = [30 00];
                                                            dpcm_enable = "false";
                                                };

                                                ports {
                                                            #address-cells = <0x01>;
                                                            #size-cells = <0x00>;

                                                            port@0 {
                                                                        reg = <0x00>;

                                                                        endpoint {
                                                                                    port-index = <0x02>;
                                                                                    bus-width = <0x04>;
                                                                                    remote-endpoint = <0x2c6>;
                                                                                    phandle = <0x287>;
                                                                        };
                                                            };
                                                };
                                    };
                        };
            };



I was wondering what changes I should make to allow me to adjust the ROI.

Thank you for your time and help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions