PDA

View Full Version : Trying to use OpenCV



danilodsp
10th August 2011, 09:07
Hello,

I am trying to use OpenCV for the first time. I'm not getting.

I'm following in the steps of the forum comments here.

My .pro:

QT += core

QT -= gui

TARGET = vision
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

INCLUDEPATH += E:/OpenCV2.3/opencv/modules/core/include \
E:/OpenCV2.3/opencv/modules/highgui/include

LIBS += -L"E:/OpenCV2.3/build/x64/mingw/bin"
LIBS += -lopencv_core230 -lopencv_highgui230

My main.cpp:

#include <QtCore/QCoreApplication>

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>

int main(int argc, char *argv[])
{
cv::Mat image = cv::imread("C:\teste.jpg");
cv::namedWindow("My Image");
cv::imshow("My Image", image);
cv::waitKey(-1);
return 0;
}

The following error occurs when you make the release:
E:/OpenCV2.3/build/x64/mingw/bin/libopencv_core230.dll: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make[1]: *** [debug\vision.exe] Error 1
make[1]: Leaving directory `C:/Users/Danilo Pena/Meus Programas Qt/CV/vision'
make: *** [debug] Error 2

always this occurs:
E:/OpenCV2.3/build/x64/mingw/bin/libopencv_core230.dll: file not recognized: File format not recognized

My OpenCV installed on:
E:/OpenCV2.3/


Thanks.

Added after 1 22 minutes:

I had forgotten to make mingw32-make.
Error continues.

My .pro:

QT += core

QT -= gui

TARGET = vision
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

INCLUDEPATH += E:/OpenCV2.3/opencv/modules/core/include \
E:/OpenCV2.3/opencv/modules/highgui/include

LIBS += "E:\OpenCV2.3\build\lib\libopencv_core230.dll.a" \
LIBS "E:\OpenCV2.3\build\lib\libopencv_highgui230.dll.a"

New erro:

:: error: LIBS: No such file or directory

Dong Back Kim
11th August 2011, 01:22
I have few questions to answer your question. =)

- is it 64bit or 32bit OS? Do you have correct version of libraries (i.e. mingw, Qt and OpenCV are based on the same bit system)
- Can you really find E:\OpenCV2.3\build\lib\libopencv_core230.dll.a and E:\OpenCV2.3\build\lib\libopencv_highgui230.dll.a?
- Line 17 "LIBS "E:\OpenCV2.3\build\lib\libopencv_highgui230.dll.a", I think you should remove "LIBS" in the beginning. It's syntax error

danilodsp
11th August 2011, 05:14
Thanks!


I have few questions to answer your question. =)

- is it 64bit or 32bit OS? Do you have correct version of libraries (i.e. mingw, Qt and OpenCV are based on the same bit system)
- Can you really find E:\OpenCV2.3\build\lib\libopencv_core230.dll.a and E:\OpenCV2.3\build\lib\libopencv_highgui230.dll.a?
- Line 17 "LIBS "E:\OpenCV2.3\build\lib\libopencv_highgui230.dll.a", I think you should remove "LIBS" in the beginning. It's syntax error

1. Yes, my system it's ok, 64bits.
2. Yes.
3. I corrected, is now working.

New problem,

The program window does not open:
Starting C:\Users\Danilo Pena\Meus Programas Qt\CV\visao-build-desktop\release\visao.exe...
C:\Users\Danilo Pena\Meus Programas Qt\CV\visao-build-desktop\release\visao.exe exited with code -1073741511

It only works if I remove part of the code opencv.

danilodsp
11th August 2011, 19:09
I'm using Qt4, OpenCV2.3 and gcc4.3.3 on Windows.

I do not know the meaning of:
exited with code -1073741511

stampede
11th August 2011, 19:31
I do not know the meaning of:
exited with code -1073741511
Download Err.exe (http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=985)


Err.exe -1073741511
# for decimal -1073741511 / hex 0xc0000139 :
STATUS_ENTRYPOINT_NOT_FOUND ntstatus.h
# {Entry Point Not Found}
# The procedure entry point %hs could not be located in the
# dynamic link library %hs.

Try putting the linked libraries (exactly those!) in your app.exe directory, now it looks like wrong version of library is used when you launch the app.

danilodsp
11th August 2011, 20:17
Hi stampede,

I saw this in another comment. I put the dll in the folder of the release and does not work.

My include:

#include <QMainWindow>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

Error also occurs when I make "qmake && make":
(...)
c:\Qt\2010.05\qt\lib/libqtmaind.a(qtmain_win.o):qtmain_win.cpp:(.eh_fra me+0x12):
undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
make[1]: *** [debug\compv.exe] Error 1
make[1]: Leaving directory `C:/Users/Danilo Pena/Meus Programas Qt/Computer Visi
on/compv'
make: *** [debug] Error 2

marco_855
18th August 2011, 08:41
Did you manage to resolve the issue?
I have the same problem.
Do I need to recompile the OpenCV with qt and use my own reproduced dlls?