About nvidia jetson nx 16g using adv7280m capture image Error

Why am I using adv7280m on NVIDIA Jetson nx 8g, use the command :

v4l2 ctl – set fmt video=width=720, height=576, pixel format=UYVY – stream mmap – stream count=1-- set ctrl bypass_ Mode=0- d/dev/video1-- stream to=ADV7280. yuv

After obtaining 720 * 576 images, it was 704 * 576. After switching to NVIDIA Jetson nx 16g, the obtained image was 768 * 576, It’s green after 704 pixels. Has anyone encountered this problem before? I need help please。

Can revise the adv7280 report the size to 704 to confirm?

Uploading: image.jpg…
Do you mean in the driver or in the device tree?

Suppose it could be in driver.
Confirm with v4l2-ctl --list-formats-ext for your modification.

Sorry for my late reply,thank you for your reply,This is the result of my running the command, but the resolution seems to be determined by the driver code

ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: ‘UYVY’
Name : UYVY 4:2:2
Size: Discrete 720x576
Interval: Discrete 0.040s (25.000 fps)

    Index       : 1
    Type        : Video Capture
    Pixel Format: 'NV16'
    Name        : Y/CbCr 4:2:2
            Size: Discrete 720x576
                    Interval: Discrete 0.040s (25.000 fps)

    Index       : 2
    Type        : Video Capture
    Pixel Format: 'UYVY'
    Name        : UYVY 4:2:2
            Size: Discrete 720x576
                    Interval: Discrete 0.040s (25.000 fps)

Right, you need find out to override it to 704 to try

Okay, I tried to modify the driver to change the resolution to 704x576, but after making the changes, my camera no longer has any images. Do I need to change it to 704x576 in the device tree? Here is my device tree code:

mode0 { /* IMX219_MODE */

mclk_khz = “24000”;
num_lanes = “1”;
tegra_sinterface = “serial_c”;
phy_mode = “DPHY”;
discontinuous_clk = “yes”;
dpcm_enable = “false”;
cil_settletime = “0”;

  			active_w = "720";
  			active_h = "576";
  			
  			//pixel_t = "bayer_rggb";
  			
  			//mode_type = "bayer";
  			//pixel_phase = "rggb";
  			//pixel_phase = "bggr";
  			//csi_pixel_bit_depth = "10";

  			mode_type = "yuv";
  			pixel_phase = "uyvy";
  			//pixel_phase = "yuyv";
  			csi_pixel_bit_depth = "16";
  			//dynamic_pixel_bit_depth = "16";

  			readout_orientation = "0";
  			line_length = "2640";
  			inherent_gain = "1";
  			mclk_multiplier = "9.33";
  			//pix_clk_hz = "74250000";

  			//pix_clk_hz = "182400000";
  			pix_clk_hz = "74250000";


  			gain_factor = "16";
  			framerate_factor = "1000000";
  			exposure_factor = "1000000";
  			min_gain_val = "16"; /* 1.00x */
  			max_gain_val = "170"; /* 10.66x */
  			step_gain_val = "1";
  			default_gain = "16"; /* 1.00x */
  			min_hdr_ratio = "1";
  			max_hdr_ratio = "1";

  			min_framerate = "2000000"; /* 2.0 fps */
  			max_framerate = "40000000"; /* 30.0 fps */
  			step_framerate = "1";
  			default_framerate = "16000000"; /* 30.0 fps */
  			min_exp_time = "13"; /* us */
  			max_exp_time = "683709"; /* us */
  			step_exp_time = "1";
  			default_exp_time = "2495"; /* us */

  			//embedded_metadata_height = "2";
  			embedded_metadata_height = "0";
  		};

Did you modify the driver report the size as 704x576 but ADV7280 still output 720x576?

Does v4l2-ctl show the size as your modification?

Yes, and at the same time, this issue caused me to use OpenCV to capture images incorrectly.

I used OpenCV to capture images with a resolution of 720x576, but like the image I posted above,

it actually requires 768x576 pixels to support it, so the captured image with a 720x576 pixel display is garbled

I don’t understand why OpenCV must require 768x576?

I don’t understand either.

This is an image I captured with a resolution of 720x576,

and it can only be displayed normally at a resolution of 768x576.

Why!Why!Why!my god!very very strange !

Previously, the image captured on nx 8g was 704x576,

which can still display normally at a resolution of 720x576.

After switching to nx 16g, I don’t understand why a 768x576 resolution image was produced,

which is why this situation occurred

That doesn’t make sense. Suppose shouldn’t have different for 8G with 16G
Does the same BSP version?

Sorry for replying to you now,they are not the same version. Previously, nx 8g used Jetpack 4.5.1, but now nx 16g it is Jetpack 4.6.3,

Now I have a temporary solution.

If someone encounters the same problem as me,

they can refer to it.

Of course, this method cannot completely solve the problem,

code:

cv::Mat frame;
const int srcWidth  = 720;
const int srcHeight = 576;
const int dstWidth  = 768;
const int dstHeight = 576;

uint8_t* srcBuffer = new uint8_t[srcWidth * srcHeight * 3];

while (true) 
{
    cv::Mat uyvyImage(dstHeight, dstWidth, CV_8UC3, srcBuffer);
   
    cap >> frame;
  
    memcpy(srcBuffer, frame.data, srcWidth * srcHeight * 3);

    if (frame.empty()) {
        std::cout << "xxxxxxxxx" << std::endl;
        continue;;
    }
 
    cv::imshow("Camera", uyvyImage);

    cv::imshow("Camera2", frame);
    cv::waitKey(1);
   
    if (cv::waitKey(1) == 27) {
        break;
    }
}

delete[] srcBuffer;

However, due to inconsistent array sizes, the converted image can only display a portion. If anyone has a better solution, please leave a message below. Thank you very much

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