Looking at your code, I can identify several issues that need to be addressed for proper camera access on your Verdin iMX8M Plus with BSP 7.
Code Issues
1. Incorrect Constant Reference
Your code has this line:
capture.open(pipeline,cv2.CAP_GSTREAMER);
This should be:
capture.open(pipeline, cv::CAP_GSTREAMER);
You’re mixing Python (cv2) and C++ (cv) namespace conventions.
2. Camera Device Detection
Based on the Toradex documentation, you need to first identify the correct video device. The documentation shows how to check available video devices(1):
root@apalis-imx6:~# v4l2-ctl --list-devices
The documentation provides an example output showing different video devices available(1):
DISP3 BG ():
/dev/video16
/dev/video17
HD Pro Webcam C920 (usb-ci_hdrc.1-1.1.3):
/dev/video3
Failed to open /dev/video0: Resource temporarily unavailable
This shows that /dev/video0 may not be available, which explains your “No such file or directory” error.
3. Proper Camera Initialization
The OpenCV documentation for Toradex shows this camera initialization approach(1):
try {
capture.open("v4l2:///dev/video3");
capture.set(CV_CAP_PROP_FRAME_WIDTH, 640);
capture.set(CV_CAP_PROP_FRAME_HEIGHT, 480);
}
catch (cv::Exception &e)
{
const char *err_msg = e.what();
cout << "Exception caught: " << err_msg << endl;
}
Troubleshooting Steps
Step 1: Check Available Video Devices
Run this command to see what video devices are actually available:
v4l2-ctl --list-devices
Step 2: Test Camera Access
Before running your OpenCV code, test if the camera works with GStreamer directly:
gst-launch-1.0 v4l2src device=/dev/video2 ! videoconvert ! waylandsink
(Replace /dev/video2 with the actual device from your v4l2-ctl output)
Step 3: Use Correct Video Device
Update your code to use the correct video device number found in Step 1.
Known Issues with BSP 7
Based on community reports, there are known camera interface issues with BSP 7, particularly with MIPI-CSI cameras(2). Users have reported that VPU encoding functionality was broken in BSP 7 but was fixed in version 7.3.0(2).
The community discussions show that some users had to revert to BSP 6 or use specific BSP 7.0.0 builds to get camera functionality working properly(3).
Recommended Next Steps
- Verify your video device: Use
v4l2-ctl --list-devicesto find the correct device - Fix the namespace issue: Change
cv2.CAP_GSTREAMERtocv::CAP_GSTREAMER - Test with simple pipeline: Try the basic v4l2src pipeline first
- Consider BSP version: If issues persist, you may need to use a different BSP 7 version or revert to BSP 6
The camera interface problems you’re experiencing are well-documented issues with certain BSP 7 versions, and the solution often involves using the correct video device and ensuring your BSP version supports your specific camera hardware properly.
Best regards, Toradex AI Assistant.
If I answered your question, please tick the “Solution” checkbox.
For follow-up questions to me, please use @ToradexAI in your post.