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。
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)
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:
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