0

Sorry if my english isn't perfect, my first language is french.

In my program i tried to send a Mat variable with a signal. When i do, i got this error:

QObject::connect: Cannot queue arguments of type 'Mat'
(Make sure 'Mat' is registered using qRegisterMetaType().)

I already had this issue in a older project and i found the solution in this topic.

How to send a Qt signal containing a cv::Mat?

the solution is to add this line in my main :
qRegisterMetaType<Mat>("Mat");

but when i execute my program on my raspberry Pi with this line, i got this error:

./(myprojet): relocation error: ./(myprojet): symbol _ZN9QMetaType22registerNormalizedTypeERK10QByteArrayPFvPvEPFS3_S3_PKvEi6QFlagsINS_8TypeFlagEEPK11QMetaObject, version Qt_5 not defined in file libQt5Core.so.5 with link time reference

and the program crashed. If i remove the line i have the very first error.

there is my code of where i use the problematic line.

#include "partage.h"
#include "mainwindow.h"
#include <QApplication>
#include <cvimagewidget.h>
#include <ctime>
#include <iostream>
#include <QThread>
#include "cameraprocess.h"
//#include <unistd.h>
#include "raspicam/raspicam_cv.h"
#include "opencv/highgui.h"
#include "opencv/cv.h"


using namespace cv;
using namespace std;

Partage infoCommun;
Q_DECLARE_METATYPE(Mat)
//Q_DECLARE_METATYPE(Mat); also try this but not work
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    qRegisterMetaType<Mat>("Mat");

    CVImageWidget* imageWidget = new CVImageWidget();
    QThread* camThread= new QThread;
    CameraProcess* process_1= new CameraProcess;

    infoCommun.data.camPross=process_1;
    infoCommun.data.camThread=camThread;
    infoCommun.data.imgWidget=imageWidget;

    w.connectThread(camThread,&a,process_1);
    camThread->start();
    w.setFocusPolicy(Qt::ClickFocus);
    Mat img=imread("lena2.jpeg",CV_LOAD_IMAGE_COLOR);
    imageWidget->showImage(img);
    /*CVImageWidget* imageWidget = new CVImageWidget();
    Mat img=imread("lena2.jpeg",CV_LOAD_IMAGE_COLOR);
    imageWidget->showImage(img);*/

    w.setCentralWidget(imageWidget);
    w.show();

    return a.exec();
}

EDIT:

I have found why the code can be compile without error and at execution they have it.This is because when i setting my cross-compile, I had a huge problem with qt on my raspberry pi.to solved it, i have need to reinstall a new image of raspberry Pi. But i have some difficulties to regenerate my qmake.exe whit this new image so i use the older qmake and it work perfectly because they have some librairies in common. So the error is a compatibility error. To fixed it i tried to copied .so that i use to compiled with qt inside my rasberry pi. I got this when i try to execute my program.

This application failed to start because it could not find or load the Qt platform plugin "eglfs" in "".

Reinstalling the application may fix this problem. Aborted

to find where the plugin is i enter the following command in Terminal.

export QT_DEBUG_PLUGINS=1

the new result is that have a new line QFactoryLoader::QFactoryLoader() checking directory path "/home/Projet/ProjetPololu/platforms" ...

platforms path is /usr/lib/arm-linux-gnueabihf/qt5/plugins/ so i don't know why it search here... but i place platforms of my raspberry pi in my project folder by curiosity and that's what i get:

QFactoryLoader::QFactoryLoader() checking directory path "/home/Projet/ProjetPololu/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/home/Projet/ProjetPololu/platforms/libqeglfs.so"
Found metadata in lib /home/Projet/ProjetPololu/platforms/libqeglfs.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
    "MetaData": {
        "Keys": [
            "eglfs"
        ]
    },
    "className": "QEglFSIntegrationPlugin",
    "debug": false,
    "version": 328450
}


Got keys from plugin meta data ()
QFactoryLoader::QFactoryLoader() looking at "/home/Projet/ProjetPololu/platforms/libqkms.so"
Found metadata in lib /home/Projet/ProjetPololu/platforms/libqkms.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
    "MetaData": {
        "Keys": [
            "kms"
        ]
    },
    "className": "QKmsIntegrationPlugin",
    "debug": false,
    "version": 328450
}


Got keys from plugin meta data ()
QFactoryLoader::QFactoryLoader() looking at "/home/Projet/ProjetPololu/platforms/libqlinuxfb.so"
Found metadata in lib /home/Projet/ProjetPololu/platforms/libqlinuxfb.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
    "MetaData": {
        "Keys": [
            "linuxfb"
        ]
    },
    "className": "QLinuxFbIntegrationPlugin",
    "debug": false,
    "version": 328450
}


Got keys from plugin meta data ()
QFactoryLoader::QFactoryLoader() looking at "/home/Projet/ProjetPololu/platforms/libqminimal.so"
Found metadata in lib /home/Projet/ProjetPololu/platforms/libqminimal.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
    "MetaData": {
        "Keys": [
            "minimal"
        ]
    },
    "className": "QMinimalIntegrationPlugin",
    "debug": false,
    "version": 328450
}


Got keys from plugin meta data ()
QFactoryLoader::QFactoryLoader() looking at "/home/Projet/ProjetPololu/platforms/libqminimalegl.so"
Found metadata in lib /home/Projet/ProjetPololu/platforms/libqminimalegl.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
    "MetaData": {
        "Keys": [
            "minimalegl"
        ]
    },
    "className": "QMinimalEglIntegrationPlugin",
    "debug": false,
    "version": 328450
}


Got keys from plugin meta data ()
QFactoryLoader::QFactoryLoader() looking at "/home/Projet/ProjetPololu/platforms/libqoffscreen.so"
Found metadata in lib /home/Projet/ProjetPololu/platforms/libqoffscreen.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
    "MetaData": {
        "Keys": [
            "offscreen"
        ]
    },
    "className": "QOffscreenIntegrationPlugin",
    "debug": false,
    "version": 328450
}


Got keys from plugin meta data ()
QFactoryLoader::QFactoryLoader() looking at "/home/Projet/ProjetPololu/platforms/libqxcb.so"
Found metadata in lib /home/Projet/ProjetPololu/platforms/libqxcb.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2",
    "MetaData": {
        "Keys": [
            "xcb"
        ]
    },
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 328450
}


Got keys from plugin meta data ()
This application failed to start because it could not find or load the Qt platform plugin "eglfs"
in "".

Reinstalling the application may fix this problem.
Aborted

and if i try to replace by the platforms in my toolchain i got the same result

if you can tell me why it's happening or have a alternative to fix the first issue. it will be appreciated. thank for reading.

Community
  • 1
  • 1

0 Answers0