Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I display the video feed from a USB camera connected to the Coral Dev Board while controlling it with WSL on Windows 10? #138

Open
loiswen opened this issue Dec 25, 2023 · 0 comments

Comments

@loiswen
Copy link

loiswen commented Dec 25, 2023

Description

Within the WSL environment accessing the Mendel environment on the Coral dev board, when using code python3 test.py access the camera, Code 1 encounters an error and cannot run successfully. Code 2 runs, and the camera indicator lights up, but the video information window does not display.

code1:
`import cv2

capture = cv2.VideoCapture(1)
while capture.isOpened():
retval, image = capture.read()
cv2.imshow("Video", image)
key = cv2.waitKey(1)
if key == 32:
break

capture.release()
cv2.destroyAllWindows()`

error:
`qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/mendel/.local/lib/python3.7/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted`

code2:
`import cv2
import matplotlib.pyplot as plt

capture = cv2.VideoCapture(1)

while capture.isOpened():
retval, image = capture.read()

if retval:
    # 使用 Matplotlib 显示图像
    plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
    plt.show()

key = cv2.waitKey(1)

if key == 32:
    break

capture.release()
cv2.destroyAllWindows()`

Click to expand!

Issue Type

No response

Operating System

No response

Coral Device

No response

Other Devices

No response

Programming Language

No response

Relevant Log Output

code1:
import cv2

capture = cv2.VideoCapture(1)
while capture.isOpened():
    retval, image = capture.read()
    cv2.imshow("Video", image)
    key = cv2.waitKey(1)
    if key == 32:
        break

capture.release()
cv2.destroyAllWindows()

error:
`qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/mendel/.local/lib/python3.7/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted`

code2:
import cv2
import matplotlib.pyplot as plt

capture = cv2.VideoCapture(1)

while capture.isOpened():
    retval, image = capture.read()

    if retval:
        # 使用 Matplotlib 显示图像
        plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
        plt.show()

    key = cv2.waitKey(1)

    if key == 32:
        break

capture.release()
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant