Error: undefined reference to `cvReleaseImage' (opencv + Qt)
-
Hi
Could you try with python 2.7 instead?It seems to complain about the 3.7 version
CMake's 'find_host_package(PythonInterp 2.7)' found wrong Python version:
Could NOT find Python2 (missing: Python2_EXECUTABLE Interpreter)
Wrong major version for the interpreter "C:/Users/test/AppData/Local/Programs/Python/Python37/python.exe" -
I installed Python 2.7, checked that it was installed with the python -v command in cmd, then according to this link
//...........................................................................................
https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows
//...........................................................................................
In cmake, I selected the source and destination, but after clicking the configure button, I encountered these errors:
//...........................................................................................
{
Performing Test HAVE_CXX_WNO_ENUM_COMPARE_SWITCH - Failed
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
ADE: Download: v0.1.1f.zip
Try 1 failed
CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
ADE: Download failed: 35;"SSL connect error"For details please refer to the download log file:
C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt
Call Stack (most recent call first):
modules/gapi/cmake/DownloadADE.cmake:5 (ocv_download)
modules/gapi/cmake/init.cmake:19 (include)
cmake/OpenCVModule.cmake:298 (include)
cmake/OpenCVModule.cmake:361 (_add_modules_1)
modules/CMakeLists.txt:7 (ocv_glob_modules)OpenCV Python: during development append to PYTHONPATH: C:/Qt/opencv_cv2/opencv/Release/python_loader
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
FFMPEG: Download: opencv_videoio_ffmpeg.dll
Try 1 failed
CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
FFMPEG: Download failed: 35;"SSL connect error"For details please refer to the download log file:
C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt
Call Stack (most recent call first):
3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)
modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)
modules/videoio/cmake/init.cmake:7 (include)
modules/videoio/cmake/init.cmake:18 (add_backend)
cmake/OpenCVModule.cmake:298 (include)
cmake/OpenCVModule.cmake:361 (_add_modules_1)
modules/CMakeLists.txt:7 (ocv_glob_modules)FFMPEG: Download: opencv_videoio_ffmpeg_64.dll
Try 1 failed
CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
FFMPEG: Download failed: 35;"SSL connect error"For details please refer to the download log file:
C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt
Call Stack (most recent call first):
3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)
modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)
modules/videoio/cmake/init.cmake:7 (include)
modules/videoio/cmake/init.cmake:18 (add_backend)
cmake/OpenCVModule.cmake:298 (include)
cmake/OpenCVModule.cmake:361 (_add_modules_1)
modules/CMakeLists.txt:7 (ocv_glob_modules)FFMPEG: Download: ffmpeg_version.cmake
Try 1 failed
CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
FFMPEG: Download failed: 35;"SSL connect error"For details please refer to the download log file:
C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt
Call Stack (most recent call first):
3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)
modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)
modules/videoio/cmake/init.cmake:7 (include)
modules/videoio/cmake/init.cmake:18 (add_backend)
cmake/OpenCVModule.cmake:298 (include)
cmake/OpenCVModule.cmake:361 (_add_modules_1)
modules/CMakeLists.txt:7 (ocv_glob_modules)}
-
@Negar_mg I don't know how. This is an OpenCV issue and has nothing to do with Qt. Please ask in an OpenCV forum.
You should at least consider doing what the error output suggests:
"For details please refer to the download log file:C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt"
It looks like it can't download some dependencies. -
Yes. I know that it cannot download a link, but i have no idea how to fix it. Could you please give me a hint
«Error»
{
ADE: Download: v0.1.1f.zip
Try 1 failed
CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
ADE: Download failed: 35;"SSL connect error"For details please refer to the download log file:
C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt
Call Stack (most recent call first):
modules/gapi/cmake/DownloadADE.cmake:5 (ocv_download)
modules/gapi/cmake/init.cmake:19 (include)
cmake/OpenCVModule.cmake:298 (include)
cmake/OpenCVModule.cmake:361 (_add_modules_1)
modules/CMakeLists.txt:7 (ocv_glob_modules)}
-
Yes. I know that it cannot download a link, but i have no idea how to fix it. Could you please give me a hint
«Error»
{
ADE: Download: v0.1.1f.zip
Try 1 failed
CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
ADE: Download failed: 35;"SSL connect error"For details please refer to the download log file:
C:/Qt/opencv_cv2/opencv/Release/CMakeDownloadLog.txt
Call Stack (most recent call first):
modules/gapi/cmake/DownloadADE.cmake:5 (ocv_download)
modules/gapi/cmake/init.cmake:19 (include)
cmake/OpenCVModule.cmake:298 (include)
cmake/OpenCVModule.cmake:361 (_add_modules_1)
modules/CMakeLists.txt:7 (ocv_glob_modules)}
-
@RodMckay said in Error: undefined reference to `cvReleaseImage' (opencv + Qt):
I try to write a simple image viewer program by using opencv int Qt5.1
the problem is that Qt5.1 shows me the error in runtime , where am I wrong ?
.pro
@
#-------------------------------------------------Project created by QtCreator 2013-09-11T03:55:37
#-------------------------------------------------
QT += core
QT -= gui
TARGET = camera_onConsole
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += D:\opencv\build\include
LIBS += -lopencv_highgui246
-lopencv_imgproc246
-lopencv_objdetect246
SOURCES += main.cpp
@
.cpp
@
#include <QCoreApplication>
#include "opencv/cv.h"
#include "opencv/highgui.h"
#include <opencv/cxcore.h>
int main(int argc, char argv[])
{
QCoreApplication a(argc, argv);
IplImage img = cvLoadImage("D:/image.jpg");
cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
cvShowImage("Example1", img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow( "Example1" );
return a.exec();}
@
is there anyone who knows solution of this ? thanks for repliesThe error in the runtime could be due to various reasons, and it would be helpful if you could provide more information about the specific error message or behavior that you are encountering.
However, based on the code that you have provided, there are a few issues that might be causing the problem:
The Qt project file (.pro) is missing the inclusion of the "widgets" module, which is required for creating GUI applications. You can add it by modifying the "QT" line in your .pro file to:
QT += core widgets
The OpenCV library that you are linking to is version 2.4.6, which might not be compatible with the version of Qt that you are using (Qt 5.1). You could try linking to a more recent version of OpenCV (e.g., 4.x), or using an older version of Qt that is compatible with OpenCV 2.4.6.
The use of the "IplImage" data type is deprecated in newer versions of OpenCV, and you might encounter compatibility issues when using it with Qt. You could try using the newer "cv::Mat" data type instead, which is recommended for working with images in OpenCV.
Here is a modified version of your code that addresses these issues:
.pro
@
#-------------------------------------------------Project created by QtCreator 2013-09-11T03:55:37
#-------------------------------------------------QT += core widgets
TARGET = camera_onConsole
CONFIG += console
CONFIG -= app_bundleTEMPLATE = app
INCLUDEPATH += D:\opencv\build\include
LIBS += -lopencv_highgui
-lopencv_imgproc
-lopencv_objdetectSOURCES += main.cpp
@
.cpp
@
#include <QCoreApplication>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);cv::Mat img = cv::imread("D:/image.jpg"); cv::namedWindow("Example1", cv::WINDOW_AUTOSIZE); cv::imshow("Example1", img); cv::waitKey(0); cv::destroyWindow("Example1"); return a.exec();
}
@
Note that this code uses the newer "cv::Mat" data type instead of "IplImage", and also uses the updated function names for creating and destroying windows in OpenCV.
-
S SGaist moved this topic from Qt in Education on