Skip to content

Commit

Permalink
Generated a fix for xcb issue.
Browse files Browse the repository at this point in the history
hardcode data_collection_backend.py to use the correct xcb file

Issue arises from pyqt5 finding xcb dependency within the cv2 folder
instead of its own pyqt5 folder.

My old bandaid fix involved renaming
/home/screwsorter/.local/lib/python3.9/site-packages/cv2/qt/plugins/platforms
to platforms_old

But that prevented usage of cv.imshow(). This new fix means we can use
both cv2.imshow() and our pyqt5 application GUI.

https://stackoverflow.com/questions/68417682/qt-and-opencv-app-not-working-in-virtual-environment
opencv/opencv-python#736
  • Loading branch information
kxing28 committed Mar 25, 2024
1 parent 7ed2225 commit 47e4596
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sw/ui/data_collection_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from PyQt5 import QtCore, QtGui, QtWidgets

import os
import cv2
import sys
import shutil
Expand Down Expand Up @@ -113,6 +114,7 @@ def pixmap_from_path(self, img_path):


def start_ui(operator_name, img_dir_path):
os.environ["QT_QPA_PLATFORM_PLUGIN_PATH"] = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.PluginsPath)
app = QtWidgets.QApplication([])
myApp = My_App(operator_name, img_dir_path)
myApp.show()
Expand Down

0 comments on commit 47e4596

Please sign in to comment.