当前位置:网站首页>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
边栏推荐
- Process management of day02 operation
- [DL] introduction and understanding of tensor
- 钉钉告警脚本
- 【Transformer】ATS: Adaptive Token Sampling For Efficient Vision Transformers
- [pycharm] pycharm remote connection server
- Detailed explanation of MySQL statistical function count
- anaconda中移除旧环境、增加新环境、查看环境、安装库、清理缓存等操作命令
- 【语义分割】Mapillary 数据集简介
- The third week of postgraduate freshman training: resnet+resnext
- Detailed explanation of tool classes countdownlatch and cyclicbarrier of concurrent programming learning notes
猜你喜欢

Ffmpeg creation GIF expression pack tutorial is coming! Say thank you, brother black fly?

【图像分类】如何使用 mmclassification 训练自己的分类模型

【Transformer】ACMix:On the Integration of Self-Attention and Convolution

Ribbon学习笔记二

mysql在查询字符串类型的时候带单引号和不带的区别和原因

Machine learning makes character recognition easier: kotlin+mvvm+ Huawei ml Kit

Semaphore (semaphore) for learning notes of concurrent programming

File文件上传的使用(2)--上传到阿里云Oss文件服务器

Anr Optimization: cause oom crash and corresponding solutions

【go】defer的使用
随机推荐
在uni-app项目中,如何实现微信小程序openid的获取
These process knowledge you must know
有价值的博客、面经收集(持续更新)
Flink, the mainstream real-time stream processing computing framework, is the first experience.
个人学习网站
Nailing alarm script
Spring, summer, autumn and winter with Miss Zhang (1)
MySql统计函数COUNT详解
【Transformer】SegFormer:Simple and Efficient Design for Semantic Segmentation with Transformers
Research and implementation of flash loan DAPP
Technology that deeply understands the principle of MMAP and makes big manufacturers love it
Training log 6 of the project "construction of Shandong University mobile Internet development technology teaching website"
anaconda中移除旧环境、增加新环境、查看环境、安装库、清理缓存等操作命令
【Attention】Visual Attention Network
通过简单的脚本在Linux环境实现Mysql数据库的定时备份(Mysqldump命令备份)
Nifi changed UTC time to CST time
【ML】机器学习模型之PMML--概述
并发编程学习笔记 之 Lock锁及其实现类ReentrantLock、ReentrantReadWriteLock和StampedLock的基本用法
Ribbon learning notes II
mysql 的show profiles 使用。