[RFSoC 4x2] issue with the notebook display_port_introduction

Hi Everyone,

I want to execute the provided notebook of the display port for the RFSoC 4x2:
(RFSoC-PYNQ/boards/RFSoC4x2/notebooks/common/display_port_introduction.ipynb at master · Xilinx/RFSoC-PYNQ · GitHub)

But I have an error with cv2.VideoCapture(0).

Did someone also meet this error?

It might be related to that issue:

(python - OpenCv error can't open camera through video capture - Stack Overflow)

Thank you in advance for your help

Do you have a camera connected and is it recognized?
Try running:
ls /dev/video*

If the camera is recognized, but has a different index, you can modify the code.


I ran ls /dev/video*, I got /dev/video0 and /dev/video1. I ran lsusb, and my webcam was correctly detected:

My webcam is a Microsoft LifeCamHD-3000:
(Microsoft LifeCam HD-3000 review | Digital Camera World)

Its datasheet can be downloaded here: (https://download.microsoft.com/documents/uk/hardware/TDS_LifeCamHD-3000_1103A.pdf)

What did you mean by “If the camera is recognized, but has a different index, you can modify the code.” If it is about the index 0, 1 or -1 of cv2.VideoCapture, I changed it but I still got the issue.

Is pynq support the correct entity to ask for a possible modification of the jupyter notebook available online? Or would I have to contact another entity?


Hi @matthew,

Can you try passing some flags to OpenCV when opening the camera. Try both index 0 and 1

index = 0
index += cv2.CAP_V4L2
capture = cv2.VideoCapture(index)

Alternatively, you can try with different flag

flag = cv2.CAP_DSHOW # or cv2.CAP_MSMF
index = 0
capture = cv2.VideoCapture(index, flag)

Can you also report ?

ls -la /dev/video*


1 Like


This part of the notebook is working with capture = cv2.VideoCapture(0, cv2.CAP_V4L2).

ls -la /dev/video* is displaying:
ls la

I have another problem at the end of the notebook. I want to send the capture of the webcam on the minidisplay port.
The end of the notebook is executing, but nothing is displayed on a screen connected to the minidisplay port.
I did a print(frame), and the frame was empty:

The screen is correctly connected to the minidisplay port because the start of the notebook is working: I have a blue alternation on the screen. My webcam was also tested and validated from the notebook usb_webcam:
(RFSoC-PYNQ/boards/RFSoC4x2/notebooks/common/usb_webcam.ipynb at master · Xilinx/RFSoC-PYNQ · GitHub)

Does someone have this issue too, or can reproduce it?


Looks like the camera capture is empty. Did you try with index 1?

Can you try capture = cv2.VideoCapture(0+ cv2.CAP_V4L2)?

I tried capture = cv2.VideoCapture(0+ cv2.CAP_V4L2), but the frame was still empty. Same thing with an index of 1.

I think that the error is in capture.read(frame), because in the notebook usb_webcam, another method was used to fill the frame, and worked: ret, frame = capture.read()

Can you check this possibility, please?


In the failing notebook can you try?

for _ in range(number_frames):
    frame = displayport.newframe()
    ret, img = capture.read()
    frame[:] = img

I tried that ret, img = capture.read() and frame[:] = img and it worked: my stream was displayed on my screen. Thank you for the indication.
I just had to modify the resolution of capture.set, because capture.set(3,1280) showed me a lower resolution. But that is a cv2 strange issue.

To sum up this request, is it possible to modify the notebook in two ways: change
capture = cv2.VideoCapture(0) into capture = cv2.VideoCapture(0, cv2.CAP_V4L2) and change
ret, img = capture.read()
frame[:] = img

I thank everyone who helped with these issues once again.

1 Like

I encourage you to do a PR with these changes. :grinning:

To who should I do a personal request? To the responsible of the github of the Jupyter notebook?

I just don’t understand if this Pynq support forum is managed by AMD, and to who adress these jupyter issues

It is managed by the PYNQ team. These issues belong to the forum, but since there is a solution, I appreciate if you could contribute it back to the repo with a PR,

What is a PR? Is it a Partial Reconfiguration? I am sorry, I do not know how to do it.

From what I see online, a PR is related to the bitstream. But the issues are not with the bitstream, the PL. The issues are with the jupyter notebook, the PS.

Pull Request in GitHub with the changes that fixes the issue.

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