December 6, 2011

Pavel Mazniker Pavel Mazniker
Lab Rat
175 posts

[SOLVED]Linking to OpenCV 2.3.1 using OpenCV-2.3.0-win-superpack.exe built dlls in Qt project on Windows

 

Hello,
Let me describe next situation and exchange experience/ask for help:

I use :

IplImage *im;
CvSize cvsz;
CvVideoWriter *writer;
cvCreateVideoWriter ( ), cvReleaseVideoWriter ( ) functions

for that I’ve installed ( actually unpacked ) latest OpenCV pack with prebuilt .dll for x86 for mingw :

http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.3.1/

( superpack )

I’ve unpacked the superpack to D:/opencv directory.
Next lines’ve been added to .pro file :

  1. LIBS += D:\opencv\opencv\build\x86\mingw\bin\*.dll
  2.  
  3. INCLUDEPATH += D:\opencv\opencv\include \
  4.                D:\opencv\opencv\include\opencv \
  5.                D:\opencv\opencv\include\opencv2

and next header includes :

  1. #include "D:\opencv\opencv\include\opencv\cv.h"
  2. #include "D:\opencv\opencv\include\opencv\highgui.h"
  3. #include "D:\opencv\opencv\include\opencv\cvaux.h"

The project is succ. built on Windows XP but when I run it from the directory with the opencv’s .dlls I get next error :

Entry point not found : “The procedure entry point_ZNSt9exceptionD2Ev could not be located in the dynamic link library”

Does anybody know why such a problem ? How to fix/repair ?

As I understood from previous disccussions on the same topic :

http://www.qtcentre.org/threads/32393-OpenCV-2.1-Qt-4.6-on-WindowsXP

http://www.barbato.us/2011/03/18/using-opencv2-within-qtcreator-in-windows-2/

http://knowtheabc.wordpress.com/2011/02/25/windows-opencv-and-qt-creator/

http://forums.codeblocks.org/index.php/topic,15466.0/prev_next,prev.html#new

the problem is that opencv sources should be built using CMake for further specific compile system MinGW or MSVisual studio. But the superpack version already contains prebuilt for MinGW that can be used ,right ?
Also whether SSE / SSE2 options are needed to take into considerations ?

Perhpas I’ll find later the solution but nevertheless I ask also here to share and perhaps to find elegant way together.Thanks for possible clear help to workout/find out simple clear elegant solution in order to use OpenCV in Qt projects.

3 replies

December 7, 2011

Latexi95 Latexi95
Lab Rat
9 posts

If you add some path to INCLUDEPATH, you won’t have to use full path in #include.

  1. #include <opencv\cv.h>
  2. #include <opencv\highgui.h>
  3. #include <opencv\cvaux.h>

“The procedure entry point” error usually occurs when you have wrong dll file. Did you accidentally copy VS’s dll files (not MinGW’s) to your executable’s directory?

December 8, 2011

Pavel Mazniker Pavel Mazniker
Lab Rat
175 posts

Hi.
Thanks Latexi95 – you are right concerns includes and dll’.
Now I’ve solved the problem by generating the opencv needed dll’s by building for my platform using cmake + mingw and running with that built by cmake + mingw dlls.
Cheers.

May 14, 2012

dexter6690 dexter6690
Lab Rat
1 posts

Hi
I need a help. I am trying to integrate the opencv2.3 with qt in ubuntu 11.04 but I got one error.
The following is the Application output:

“Starting /home/krishanu/Hello-build-desktop/Hello…
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /home/krishanu/OpenCV-2.3.0/modules/core/src/array.cpp, line 2482
terminate called after throwing an instance of ‘cv::Exception’ what(): /home/krishanu/OpenCV-2.3.0/modules/core/src/array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat

The program has unexpectedly finished.
/home/krishanu/Hello-build-desktop/Hello exited with code 0”

This is my source code:
#include “opencv2/core/core.hpp”
#include “opencv2/imgproc/imgproc.hpp”
#include “opencv2/highgui/highgui.hpp”

int main()
{ cv::Mat imag; imag= cv::imread(“fruits.jpg”); cv::namedWindow(“MyImage”); cv::imshow(“Myimage”,imag); cvWaitKey(5000); return 1;
}

This is my.pro file
#————————————————————————-
#

  1. Project created by QtCreator 2012-05-14T18:08:31

# #————————————————————————-

QT += core

QT -= gui

TARGET = Hello
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp
INCLUDEPATH +=/usr/include/opencv
LIBS+=-lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
It would be of great help if someone would could help me.Thanks in advance.

 
  ‹‹ add -fpermissive at the compiler      Should mailto: links work in Qt Assistant? ››

You must log in to post a reply. Not a member yet? Register here!