# Using opencv in Qt

**URL:** https://forum.opencv.org/t/using-opencv-in-qt/4116
**Category:** Uncategorized
**Tags:** qt, build, cmake
**Created:** [July 1, 2021, 9:20pm UTC](https://forum.opencv.org/t/using-opencv-in-qt/4116 "2021-07-01T21:20:36Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Negar7519](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/negar7519/32/3517_2.png) [@Negar7519](https://forum.opencv.org/u/Negar7519)
#### Post date: [July 1, 2021, 9:20pm UTC](https://forum.opencv.org/t/using-opencv-in-qt/4116/1 "2021-07-01T21:20:36Z")

</div>

hi ,  
i am using  
Qt5.12.11 ,  
opencv-4.5.2-vc14\_vc15  
windows10  
I want to write a program to display an image or video from a webcam using Qt and Open CV.  
But I was not able to add Open CV to QT. When I used the following link, I encountered these errors in CMake.

[https://wiki.qt.io/How\_to\_setup\_Qt\_and\_openCV\_on\_Windows](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:

```nohighlight
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)

```

please help me to solve these errors

---

<div class="post-metadata">

### Author: ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)
#### Post date: [July 2, 2021, 6:59am UTC](https://forum.opencv.org/t/using-opencv-in-qt/4116/2 "2021-07-02T06:59:04Z")

</div>

> [@Negar7519](#):
>
> ```auto
> ADE: Download: v0.1.1f.zip
> Try 1 failed
> 
> ```

cmake is trying to download a couple of things, you need a working, SSL enabled internet connection while running it

---

<div class="post-metadata">

### Author: ![Ceopee](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/ceopee/32/531_2.png) [@Ceopee](https://forum.opencv.org/u/Ceopee)
#### Post date: [July 2, 2021, 7:16am UTC](https://forum.opencv.org/t/using-opencv-in-qt/4116/3 "2021-07-02T07:16:30Z")

</div>

I have faced the similar issue before. It was because of the proxy settings of my company. Furthermore, in your [DownloadADE.cmake](https://github.com/opencv/opencv/blob/4.5.2/modules/gapi/cmake/DownloadADE.cmake)  
MD5 value or download path might not be valid . [This thread](https://www.programmersought.com/article/64524356400/) may help. Try to download [ADE source](https://github.com/opencv/ade/tree/v0.1.1) and change the cmake path for this path.

---

<div class="post-metadata">

### Author: ![Negar7519](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/negar7519/32/3517_2.png) [@Negar7519](https://forum.opencv.org/u/Negar7519)
#### Post date: [July 2, 2021, 3:54pm UTC](https://forum.opencv.org/t/using-opencv-in-qt/4116/4 "2021-07-02T15:54:08Z")

</div>

thanks alot,  
can you tell how can i use this command in windows 10?  
~/ADE$ md5sum v0.1.1f.zip

---

<div class="post-metadata">

### Author: ![Negar7519](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/negar7519/32/3517_2.png) [@Negar7519](https://forum.opencv.org/u/Negar7519)
#### Post date: [July 2, 2021, 4:56pm UTC](https://forum.opencv.org/t/using-opencv-in-qt/4116/5 "2021-07-02T16:56:30Z")

</div>

i found that command in windows but i have another question,  
How to enter the zip file address in Windows?i used this:  
“file:C:/Qt/opencv\_cv2/ADE/”  
but in cmake I encountered this error:  
CMake Warning at cmake/OpenCVDownload.cmake:202 (message):  
ADE: Download failed: 3;“URL using bad/illegal format or missing URL”
