当前位置:网站首页>clion+opencv+aruco+cmake配置
clion+opencv+aruco+cmake配置
2022-07-29 05:21:00 【_盐焗鸡】
首先先列下本文使用的软件配置吧:
- clion 2020.0.1 (没钱哇
- opencv 4.5.2
- aruco3.10,别下最新版,有的函数名改变了
- cmake 3.24
- win10
一、配置opencv
opencv我没有这个人讲得好和细致,所以可以直接看他的文章。
https://blog.csdn.net/bby1987/article/details/108985356
但是有一点值得注意,他的CMakeList写的有问题,少了一个引号,这会导致无法编译,我在后面会放出包含两个包的CMakeList。
二、aruco编译
下载链接:https://sourceforge.net/projects/aruco/files/、
配置和opencv的一样,下载,用cmake编译,然后用mingw生成,具体细节看opencv的文档
mingw32-make
或
mingw32-make -j8
//编译
mingw32-make install
//拷贝到install,方便使用
这里不需要配置aruco的环境变量什么的,直接用就行了
三、CMakeList
cmake_minimum_required(VERSION 3.16)#版本大于3.16
project(arucotest)#创建项目,我的项目是arucotest,你到时候改成你自己的项目名称就行
set(CMAKE_CXX_STANDARD 20)#设置Cpp版本
set(OpenCV_DIR "D:\\opencv isn\\opencv-4.5.2\\build_mingw64\\install")#opencv库的地址
#寻找opencv库和aruco库
find_package(OpenCV REQUIRED)
find_package(aruco REQUIRED )
#包含和链接opencvlib
include_directories(${OpenCV_INCLUDE_DIRS})
set(OpenCV_LIBS opencv_core opencv_imgproc opencv_highgui opencv_imgcodecs)
#这一行是
add_executable(arucotest main.cpp)
#链接arucolib
target_link_libraries(arucotest ${OpenCV_LIBS} ${aruco_LIBS})
这个CMakeList是我实践过的,跑过代码,测试代码如下
#include <iostream>
#include "aruco.h"
#include<opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main(){
string imagePath = "D:\\Pictures\\1.JPG";//注意,这里面的imagepath改为你的图片地址
Mat image = imread(imagePath);
resize(image, image, Size(1024, 1024));
namedWindow("TestOpenCV", 0);
imshow("TestOpenCV", image);
waitKey(0);
destroyAllWindows();
return 0;
}
PS:如果有人想学习cmake,我的建议是看看这个视频和GitHub,看了一小时你大概就能自己写cmake了
https://www.bilibili.com/video/BV14h41187FZ?spm_id_from=333.1007.top_right_bar_window_history.content.click&vd_source=1ef56da7b9f25f108ff0dc3ccaf38102
边栏推荐
- 初探fastJson的AutoType
- C # judge whether the user accesses by mobile phone or computer
- [DL] build convolutional neural network for regression prediction (detailed tutorial of data + code)
- Intelligent security of the fifth space ⼤ real competition problem ----------- PNG diagram ⽚ converter
- DCAT batch operation popup and parameter transfer
- Huawei 2020 school recruitment written test programming questions read this article is enough (Part 2)
- The third week of postgraduate freshman training: resnet+resnext
- [clustmaps] visitor statistics
- Reporting service 2016 custom authentication
- Study and research the way of programming
猜你喜欢
【Transformer】AdaViT: Adaptive Vision Transformers for Efficient Image Recognition
day02作业之进程管理
ssm整合
Android studio login registration - source code (connect to MySQL database)
【pycharm】pycharm远程连接服务器
【卷积核设计】Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs
nacos外置数据库的配置与使用
SSM integration
Super simple integration of HMS ml kit to realize parent control
与张小姐的春夏秋冬(3)
随机推荐
【pycharm】pycharm远程连接服务器
[clustmaps] visitor statistics
Anr Optimization: cause oom crash and corresponding solutions
【语义分割】Fully Attentional Network for Semantic Segmentation
[go] use of defer
Nailing alarm script
Exploration of flutter drawing skills: draw arrows together (skill development)
Win10+opencv3.2+vs2015 configuration
Thinkphp6 output QR code image format to solve the conflict with debug
"Shandong University mobile Internet development technology teaching website construction" project training log V
Technology that deeply understands the principle of MMAP and makes big manufacturers love it
Ribbon learning notes II
Reporting Services- Web Service
钉钉告警脚本
How to obtain openid of wechat applet in uni app project
mysql插入百万数据(使用函数和存储过程)
Ribbon学习笔记一
Valuable blog and personal experience collection (continuous update)
Ribbon learning notes 1
Is flutter being quietly abandoned? On the future of flutter