首页 > 系统相关 >Windows11搭建Qt 6.4.2 for Android+OpenCV4.7.0开发环境

Windows11搭建Qt 6.4.2 for Android+OpenCV4.7.0开发环境

时间:2023-04-04 21:33:51浏览次数:46  
标签:3RDPARTY Qt OpenCV4.7 Windows11 libopencv OPENCV ANDROID STATICLIBS NATIVE

1.下载opencv-4.7.0-android-sdk.zip,下载地址:https://opencv.org/releases/,解压后,如下图:

 

 2.编辑opecv_android.pri,内容如下(可使用命令行命令-dir *.a/ON/B>v8a.txt):

message('Linux/Andoird is running!')
#data.files += images/*.*
#data.files += dnn/*.prototxt
#data.files += dnn/*.caffemodel
#data.path = /assets/dnn
#INSTALLS += data

# 0.指定应用程序二进制接口(Application Binary Interface)
ANDROID_CPU = arm64-v8a

# 1.定义 OPENCV_ANDROID 目录。
OPENCV_ANDROID = D:/MyProjects/Android/OpenCV/OpenCV-android-sdk/sdk/native

# 2.用来描述构建项目时应该搜索的 include 目录。
INCLUDEPATH += \
$$OPENCV_ANDROID/jni/include \
$$OPENCV_ANDROID/jni/include/opencv2 \

# 3.用来描述项目引用的库文件列表。
LIBS += $$OPENCV_ANDROID/libs/$$ANDROID_CPU/libopencv_java4.so

# OpenCV-android-sdk\sdk\native\staticlibs\$$ANDROID_CPU(15)
NATIVE_STATICLIBS = $$OPENCV_ANDROID/staticlibs/$$ANDROID_CPU
LIBS += \
$$NATIVE_STATICLIBS/libopencv_calib3d.a \
$$NATIVE_STATICLIBS/libopencv_core.a \
$$NATIVE_STATICLIBS/libopencv_dnn.a \
$$NATIVE_STATICLIBS/libopencv_features2d.a \
$$NATIVE_STATICLIBS/libopencv_flann.a \
$$NATIVE_STATICLIBS/libopencv_gapi.a \
$$NATIVE_STATICLIBS/libopencv_highgui.a \
$$NATIVE_STATICLIBS/libopencv_imgcodecs.a \
$$NATIVE_STATICLIBS/libopencv_imgproc.a \
$$NATIVE_STATICLIBS/libopencv_ml.a \
$$NATIVE_STATICLIBS/libopencv_objdetect.a \
$$NATIVE_STATICLIBS/libopencv_photo.a \
$$NATIVE_STATICLIBS/libopencv_stitching.a \
$$NATIVE_STATICLIBS/libopencv_video.a \
$$NATIVE_STATICLIBS/libopencv_videoio.a

# OpenCV-android-sdk\sdk\native\3rdparty\libs\$$ANDROID_CPU(13)
NATIVE_3RDPARTY = $$OPENCV_ANDROID/3rdparty/libs/$$ANDROID_CPU
LIBS += \
$$NATIVE_3RDPARTY/libade.a \
$$NATIVE_3RDPARTY/libcpufeatures.a \
$$NATIVE_3RDPARTY/libIlmImf.a \
$$NATIVE_3RDPARTY/libittnotify.a \
$$NATIVE_3RDPARTY/liblibjpeg-turbo.a \
$$NATIVE_3RDPARTY/liblibopenjp2.a \
$$NATIVE_3RDPARTY/liblibpng.a \
$$NATIVE_3RDPARTY/liblibprotobuf.a \
$$NATIVE_3RDPARTY/liblibtiff.a \
$$NATIVE_3RDPARTY/liblibwebp.a \
$$NATIVE_3RDPARTY/libquirc.a \
$$NATIVE_3RDPARTY/libtbb.a \
$$NATIVE_3RDPARTY/libtegra_hal.a

contains(ANDROID_TARGET_ARCH, $$ANDROID_CPU) {
ANDROID_EXTRA_LIBS = \
$$OPENCV_ANDROID/libs/$$ANDROID_CPU/libopencv_java4.so
}

3.在项目文件.pro中引入.pri文件

#Linux/Andoird操作系统
unix: !mac {
OPENCV = $$(OPENCV_QT)
isEmpty(OPENCV) {
error(OPENCV_QT does not exist!!!)
}
include($$(OPENCV_QT)opencv_android.pri)
}

#macOS操作系统
unix: mac {
message('macOS is running!')
INCLUDEPATH += /path/to/opencv/include/opencv4
LIBS += -L/path/to/opencv/lib -lopencv_world
}

#Windows操作系统(...,win8,win10...)的桌面应用程序
win32 {
OPENCV = $$(OPENCV_QT)
isEmpty(OPENCV) {
error(OPENCV_QT does not exist!!!)
}
include($$(OPENCV_QT)opencv_win32.pri)
}

4.正确配置后,.so库会添加到项目中:

 

 5.参考网址:

http://www.taodudu.cc/news/show-4624975.html

https://blog.csdn.net/cqltbe131421/article/details/125011541

标签:3RDPARTY,Qt,OpenCV4.7,Windows11,libopencv,OPENCV,ANDROID,STATICLIBS,NATIVE
From: https://www.cnblogs.com/zdt168/p/17287988.html

相关文章

  • Qt6编译MySQL驱动最简单方法
    最近qt发布最新lts版本qt6.5,就想下来试试新功能。qt版本6.5.0,安装目录E:\Qt\6.5.0mysql版本8.0,安装目录C:\MySQL_Server_8.0,或者直接下连接器解压也可以:MySQL::DownloadMySQLConnector/C(ArchivedVersions)需要额外安装qt的sources源组件,忘了也没关系,在cmd下进入包含Main......
  • Qt控件类型缩写
    控件缩写规范:QLabellblQPushButtonbtnQToolButtontbnQRadioButtonrbnQGroupBoxgbQToolBoxtbQWidgetwdQDialogdlgQScrollBarscbQLayoutlyQListViewlsvQTableViewtbvQTreeVi......
  • QT中文字符显示问题
    解决方案有两个(1)使用QString::fromLocal8Bit(constQByteArray&str)(2)直接在头文件加上#pragmaexecution_character_set("utf-8")此外将int类型转为QString的方式不是QString(num),这样转换在qDebug会输出unicode。正确方式为QString::number(num)......
  • PyQt5 - 1
    一、安装pipinstallPyQt5-ihttps://mirrors.aliyun.com/pypi/simple/出现错误安装下面的工具库:ERROR:FailedbuildingwheelforPyQt5-sipwgethttps://aka.ms/vs/17/release/vs_BuildTools.exe一、基本程序结构(一)导入相关模块(二)创建应用程序(三)控件的操作(四)执......
  • windows11的vmware启动报错
    一直正常的vmware今日启动报错:“UNEXPECTEDINCONSISTENCY;RUNfsckMANUALLY”.在initramfs后输入"fsck-y/dev/sda1"按回车,等检查结束后结可以继续了。注意:后面的硬盘路径要和报错的一致。......
  • QT信号槽
    目录基础使用connect函数的第五个参数注意问题连接失败跨线程使用设计模式思考基础使用信号和槽机制是Qt的核心机制,可以让编程人员将互不相关的对象绑定在一起,实现对象之间的通信。所有从QObject或其子类(例如Qwidget)派生的类都能够包含信号和槽。因为信号与槽的连......
  • MQTT再学习 -- 安装MQTT客户端及测试
    上一篇文章我们已经讲了MQTT服务器的搭建,参看:MQTT再学习--搭建MQTT服务器及测试接下来我们看一下MQTT客户端。一、客户端下载首先,客户端也有多种,我们需要面临选择了。参看:基于mqtt的消息推送(三)客户端实现现有客户端sdk分析,基本分为两大类:一类移植自C类库,如Mosquitto,一类是用o......
  • MQTT再学习 -- 漫谈MQTT协议
    MQTT服务器搭建我们已经完成了,现在回过头来看协议。参看:MQTT官网参看:MQTT_V3.1_Protocol_Specific参看:MQTT协议中文版参看:MQTT协议中文版上面这几篇文章,已经说明了一切。下面着重讲一下MQTT的消息格式和主要特征。一、什么是MQTT首先你要知道什么是MQTT。额,这个很重要。官网是......
  • kubernetes rabbimq3.11.11集群之mqtt插件
    1.概述本文是总结给予k8s的rabbitmq3.11.11集群的mqtt搭建rabbitmq集群搭建详见前一篇文章:kubernetes集群部署rabbimq3.11.112.自动创建mqtt账号密码wrapper-entrypoint.sh#!/usr/bin/envbash(sleep20;\admin_user=bbbbbb;\admin_passwd=111111;\rabbitmq......
  • 关于Qt 信号和槽的连接方式
    当一个信号连接多个槽时,信号发送时会,所有槽都会被调用。而断开连接则会从连接中删除指定的信号与槽的对应关系,该槽函数将不再接收来自信号的任何消息,直到它重新连接到信号。当一个connect()方法以QQueuedConnection连接不同线程的信号和槽时,如果线程被disconnect,则信号和槽......