Openvino: Problem when trying to load CPU plugin in Qt - c++

After installing and successfully run the OpenVino demos in my PC I start implementing a basic application in Qt with this library. I made the linking as Intel's documentation describes and the application successfully compiled.
auto plugin = PluginDispatcher({L""}).getPluginByDevice("CPU");
auto netBuilder = new CNNNetReader();
netBuilder->ReadNetwork("../TestModel/squeezenet1.1.xml");
netBuilder->ReadWeights("../TestModel/squeezenet1.1.bin");
auto network = netBuilder->getNetwork();
netBuilder->getNetwork().setBatchSize(1);
The application pops an exception when debugger reach getPluginByDevice call (getSuitablePlugin method from ie_plugin_dispacher.hpp (line 73)).
I am using MSVC2017 64bit with Qt 5.11.1 in a Windows 10 machine. The .pro file library call is:
#OpenVino
INCLUDEPATH += $$PWD/inference_engine/include
LIBS += -L$$PWD/inference_engine/lib/intel64/Release
LIBS += -linference_engine -llibiomp5md
Is anyone experienced the same or has an idea what's going on?
Thanks in advance,
Thanasis

The release libraries were causing the problem. When I switched to the debug ones (inference_engined.lib insted of inference_engine.lib) the application run successfully.
EDIT
I paste the code from .pro file in case someone face the same problem.
#OpenVino
INCLUDEPATH += $$PWD/inference_engine/include
CONFIG(release, debug|release):BuildVar=release
CONFIG(debug, debug|release):BuildVar=debug
equals(BuildVar,debug) {
message(Debug Mode)
LIBS += -L$$PWD/inference_engine/lib/intel64/Debug
LIBS += -linference_engined
}
equals(BuildVar,release) {
message(Release Mode)
LIBS += -L$$PWD/inference_engine/lib/intel64/Release
LIBS += -linference_engine
}

Related

How to solve "Cannot read /qtsqldrivers-config.pri:" while building sql drivers for Qt5 for mac users

this is my mysql.pro file
TARGET = qsqlmysql
HEADERS += $$PWD/qsql_mysql_p.h
SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
QMAKE_USE += mysql
OTHER_FILES += mysql.json
PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
include(../qsqldriverbase.pri)
INCLUDEPATH += "/usr/local/Cellar/mysql-client/8.0.21/include"
QMAKE_LIBDIR += "/usr/local/Cellar/mysql-client/8.0.21/lib"
The Error
Cannot read /qtsqldrivers-config.pri: No such file or directory
/Users/Lauben/Qt/5.15.0/clang_64/mkspecs/features/qt_plugin.prf:59: Cannot write file /mkspecs/modules-inst/qt_plugin_qsqlmysql.pri: Cannot create parent directory
13:01:35: The process "/Users/Lauben/Qt/5.15.0/clang_64/bin/qmake" exited with code 3.
Error while building/deploying project mysql (kit: Desktop Qt 5.15.0 clang 64bit)
When executing step "qmake"
clang_64 file
Clang screenshot

How to enable making objects from QSctpSocket?

I am attempting to use QSctpServer & QSctpSocket, but I can't make an object from none of these classes.
What is the problem?
OS: Ubuntu 16.04
Qt version: 5.12.3
I also visited Qt stream control transmission protocol (sctp) but confused about what exactly should I do!
.pro is as follows:
QT += core
QT += network
TARGET = TcpServer
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
Compile Qt by enabling -sctp flag solved the problem. After goring to Qt source folder did the following:
./configure -sctp
make
make install

OpenSplice with Qt5 Execution Error Creation failed: invalid handle

I'm trying to run the tutorial example of OpenSplice using Qt5. I successfully built the program but when I run it I get the following error :
Error in DDS::DomainParticipantFactory::create_participant: Creation
failed: invalid handle
After many debugging steps I came to the conclusion that my executable doesn't link to my ospl ! I figured that out because when it crashes no ospl-error.log is generated.
I sourced the release file correctly . ./release.com and launched my qtcreator from the same terminal so all the environment variables are correctly set (especially OSPL_URI and OSPL_HOME)
Does anyone have any idea on how to fix this ?
I finally managed to solve this problem and thought of sharing the answer.
The problem was that I was including all the DDS libs in my .pro I was including the following libs :
unix:!macx: LIBS += -L$$PWD/../../PrismTech/Vortex_v2/Device/VortexOpenSplice/6.7.1/HDE/x86_64.linux/lib/ -lcmagent -lcmjni -lcmsoap -lcmxml -ldbmsconnect -ldcpsc99 -ldcpsccpp -ldcpsgapi -ldcpsisocpp -ldcpsisocpp2 -ldcpssac -ldcpssacpp -ldcpssaj -lddsconf -lddsconfparser -lddsdatabase -lddshts -lddsi2 -lddsi2e -lddskernel -lddsos -lddsosnet -lddsrmi -lddsrrstorage -lddsserialization -lddsuser -lddsutil -ldurability -lfacecpp -lleveldb-ospl -llzf-ospl -lnetworking -lnwbridge -lrlm913 -lrnr -lsigar-amd64-linux -lsnappy-ospl -lsnetworking -lspliced -lsqlite3-ospl -lstreamsccpp -lstreamsisocpp -lstreamssacpp
INCLUDEPATH += $$PWD/../../PrismTech/Vortex_v2/Device/VortexOpenSplice/6.7.1/HDE/x86_64.linux/include
DEPENDPATH += $$PWD/../../PrismTech/Vortex_v2/Device/VortexOpenSplice/6.7.1/HDE/x86_64.linux/include
I am now using a minimal set of libs that the program requires and now it runs perfectly. Here is what I am using now:
unix:!macx: LIBS += -L$$PWD/../PrismTech/Vortex_v2/Device/VortexOpenSplice/6.7.1/HDE/x86_64.linux/lib/ -lddskernel -ldcpsisocpp
INCLUDEPATH += $$PWD/../PrismTech/Vortex_v2/Device/VortexOpenSplice/6.7.1/HDE/x86_64.linux/include
DEPENDPATH += $$PWD/../PrismTech/Vortex_v2/Device/VortexOpenSplice/6.7.1/HDE/x86_64.linux/include
Actually the error is caused by -ldcpsccpp and -lddshts. By removing those libs the application works perfectly.

How to configure a fresh installation of qtcreator?

I'm trying to configue QtCreator with no success. I want to open an existing project. When I try to compile and run it, I get only empty black console. It looks like it compiles fine but no output.
I've installed this 32bit version:
Qt 5.2.0 for Windows 32-bit (MinGW 4.8, OpenGL, 689 MB) (Info)
When I start a new project, QtCreator wants me to run cmake. When It's done, it works fine. I can also build HelloWorld with "g++ main.cpp"
Can anyone tell me what should I do step by step? I ran out of strength. I don't know why it doesn't work.
I think it is not very important, but I'm using Win7 64bit. First, I tried to install 64bit QtCreator:
Qt 5.2.0 for Windows 64-bit (VS 2012, OpenGL, 589 MB) (Info)
But I had some problems with compilers. It looked like I didn't have them installed. I also tried an online installer and now this 32bit version. Always same result.
EDIT:
I found out something. This works:
ComputerGraphics.pro
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
INCLUDEPATH += C:/Users/user/Desktop/projekty/PocitacovaGrafika2/opencv/include
LIBS += -LC:\\Users\user\\Desktop\\projekty\\PocitacovaGrafika2\\opencv\\bin \
libopencv_core246d \
libopencv_highgui246d \
libopencv_imgproc246d \
SOURCES += main.cpp \
and main.cpp
#include <iostream>
int main(){
std::cout << "Hello";
return 0;
}
This even doesn't print Hello (.pro is the same as previously):
#include <iostream>
int main(){
std::cout << "Hello";
IplImage* img = cvLoad("Desert.jpg",1);
cvShowImage("img",img);
cvWaitKey(0);
return 0;
}
In debug, it complains:
The gdb process terminated unexpectedly (code 0)
During startup program exited with code 0xc0000135.
My solution:
1)
I've gone through my own tutorial on how to compile opencv for qt-creator with cmake here:
How to link opencv in QtCreator and use Qt library
(but using the latest opencv 2.4.8)
2)
I created a folder opencv on desktop.
I went into newly created opencv_bin/install and copied a folder include into the opencv on the desktop.
I continued into directory: install/x64/mingw and copied both bin and lib into opencv on the desktop.
3)
I moved the desktop/opencv directory into a working directory of my project.
i.e cut: desktop/opencv; paste: somepath/myQtProject/
4)
My .pro contains a reference like this:
INCLUDEPATH += C:/Users/user/Desktop/projekty/PocitacovaGrafika2/opencv/include
LIBS += -LC:\\Users\\user\\Desktop\\projekty\\PocitacovaGrafika2\\opencv\\bin \
libopencv_core248d \
libopencv_highgui248d \
libopencv_imgproc248d \
And in the main.cpp just #include "opencv2/opencv.hpp"
PS: I hope this will also help somebody else.

"Can't load OpenGL extension [glBindBuffer] in function IntGetProcAddress" exception of OpenCV in Qt

I downloaded OpenCV 2.4.6 from the opencv website. To avoid the problem I mentioned before, I decided to compile the OpenCV library. After CMake and Mingw32-make, the compile succeeded. However, a simple test program crashes when tring to show a jpeg image. Here is my .pro and main.cpp file:
.pro:
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
#INCLUDEPATH += D:/opencv2.4.6/build/include
INCLUDEPATH += D:/opencv2.4.6/release/install/include
LIBS += -LD:/opencv2.4.6/release/install/bin \
-lopencv_core246 \
-lopencv_highgui246 \
-lopencv_imgproc246 \
-lopencv_features2d246 \
-lopencv_calib3d246
main.cpp:
int main() {
Mat input = imread("Z:/1.jpg");
cv::imshow("1.jpg",input);
}
Here is the problem:
OpenCV Error: OpenGL API call (Can't load OpenGL extension [glBindBuffer]) in In
tGetProcAddress, file ..\..\..\modules\core\src\gl_core_3_1.cpp, line 141
terminate called after throwing an instance of 'cv::Exception'
what(): ..\..\..\modules\core\src\gl_core_3_1.cpp:141: error: (-219) Can't lo
ad OpenGL extension [glBindBuffer] in function IntGetProcAddress
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
I've never encountered such problem before. It's kind of weird. What should I do to get rid of this problem?
After trying to compile OpenCV, it seems that the WITH_OPENGL should be unchecked. Now the program runs normally.