zptang1210 / QtImageBrowser

0 stars 0 forks source link

ImageBrowser.py not running on Ubuntu #1

Open Sino0904 opened 3 years ago

Sino0904 commented 3 years ago

Hi Zhipeng,

After installing all the dependencies and cloning the rpo, I tried running the ImageBrower.py, and I got the following error:

QObject::moveToThread: Current thread (0x55fef5d03f00) is not the object's thread (0x55fef6316560). Cannot move to target thread (0x55fef5d03f00)

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/ashishsingh/anaconda3/envs/pytorch_1.9/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, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.

Aborted (core dumped)

Do you know why this error might be coming? I am using Ubuntu 20.04 lts

Thanks!

Sino0904 commented 3 years ago

okay. So in my case, there was an issue because of opencv. The solution was to add the following lines after import cv2:

import os os.environ.pop("QT_QPA_PLATFORM_PLUGIN_PATH")

reference: https://stackoverflow.com/a/67863156

zptang1210 commented 3 years ago

Thanks for finding out the reason causing this problem. One way to temporarily work around is to disable video loading function completely so that Linux users can use all other functions for now. Just go to configs/availTypesConfig.py replace the content by the following code:

from models.ImageCollectionPPMModel import ImageCollectionPPMModel
from models.ImageCollectionFolderModel import ImageCollectionFolderModel

availTypes = ('folder', 'ppm')
modelClassDict = {'folder': ImageCollectionFolderModel,'ppm': ImageCollectionPPMModel}
modelNameDict = {modelCls: name for name, modelCls in modelClassDict.items()}

However, Linux user may still cannot use trackers for now because selectROI module uses opencv's GUI module. I will try to find out a way to fix this issue asap.