Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Opencv Compiling error in Raspberry Pi3



  • Hi,
    Im using raspberry pi 3 with rasbian OS, Installed QT Creator 4.8.2 and OpenCv. When i have create console application by using Opencv lib., its working fine. all the things are going well.

    But when im going to use widget application with Opencv getting below errors.

    (project_ousl_v_1:979): GLib-GObject-WARNING **: 23:28:47.999: cannot register existing type 'GtkWidget'

    (project_ousl_v_1:979): GLib-GObject-CRITICAL **: 23:28:47.999: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

    (project_ousl_v_1:979): GLib-GObject-WARNING **: 23:28:47.999: cannot register existing type 'GtkBuildable'

    (project_ousl_v_1:979): GLib-GObject-CRITICAL **: 23:28:47.999: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed

    (project_ousl_v_1:979): GLib-CRITICAL **: 23:28:47.999: g_once_init_leave: assertion 'result != 0' failed

    (project_ousl_v_1:979): GLib-GObject-CRITICAL **: 23:28:47.999: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

    (project_ousl_v_1:979): GLib-GObject-CRITICAL **: 23:28:47.999: g_type_register_static: assertion 'parent_type > 0' failed

    When i remove the INCLUDEPATH and LIBS path from the .pro file its working fine, but then i cannot use opencv lib for my application.

    This is the way i used to link opencv Lib file in .pro file

    INCLUDEPATH +=/usr/local/include/opencv4
    LIBS += -L/usr/local/lib -lopencv_core -lopencv_imgcodecs -lopencv_highgui

    Please advise.
    Thanks


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you mixing OpenCV highgui and Qt widgets ?



  • @SGaist Thanks for quick feedback. What do you mean by mixing openCv highgui and Qt widgets? Sorry im new to opencv


  • Lifetime Qt Champion

    Are you using any code from the OpenCV highgui library within your Qt application ? And does that application use the Qt widgets module ?



  • @SGaist Not yet, but after your comment i have updated the path lib as LIBS += -L/usr/local/lib -lopencv_core -lopencv_imgcodecs

    which is basically remove the "-lopencv_highgui" section from the LIBS. then it is compiled without having any error. But when i develop the application using opencv lib will there issues in future?


  • Lifetime Qt Champion

    Not to my knowledge, the issue at hand here is that it seems that OpenCV was built using its GTK backend which clashes with Qt. If you do not use highgui then you should be fine. Otherwise, you should rebuild OpenCV with Qt as backend.



  • @SGaist Thank you so much for your quick response. I have struggled with this issue for more than two days, but within your one comment it is almost resolved.


  • Lifetime Qt Champion

    You're welcome !

    Since you have this working now please mark the thread as solved using the "Topic Tools" button or the three doted button beside the answer you deem correct so that other forum users may know a solution has been found :-)



  • @SGaist done... :-)


Log in to reply