当前位置:网站首页>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
边栏推荐
- Use of file upload (2) -- upload to Alibaba cloud OSS file server
- 数组的基础使用--遍历循环数组求出数组最大值,最小值以及最大值下标,最小值下标
- Huawei 2020 school recruitment written test programming questions read this article is enough (Part 2)
- 与张小姐的春夏秋冬(1)
- Technology that deeply understands the principle of MMAP and makes big manufacturers love it
- SQL repair duplicate data
- Study and research the way of programming
- 【网络设计】ConvNeXt:A ConvNet for the 2020s
- 钉钉告警脚本
- nacos外置数据库的配置与使用
猜你喜欢

通过简单的脚本在Linux环境实现Mysql数据库的定时备份(Mysqldump命令备份)

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

C # judge whether the user accesses by mobile phone or computer

Research on the implementation principle of reentrantlock in concurrent programming learning notes

ANR优化:导致 OOM 崩溃及相对应的解决方案

Reporting Services- Web Service

Research and implementation of flash loan DAPP

Reporting service 2016 custom authentication

Semaphore (semaphore) for learning notes of concurrent programming

这些你一定要知道的进程知识
随机推荐
[go] use of defer
mysql 的show profiles 使用。
并发编程学习笔记 之 Lock锁及其实现类ReentrantLock、ReentrantReadWriteLock和StampedLock的基本用法
[ml] PMML of machine learning model -- Overview
Detailed explanation of tool classes countdownlatch and cyclicbarrier of concurrent programming learning notes
Flutter正在被悄悄放弃?浅析Flutter的未来
[CV] what are the specific numbers of convolution kernels (filters) 3*3, 5*5, 7*7 and 11*11?
并发编程学习笔记 之 原子操作类AtomicReference、AtomicStampedReference详解
Markdown语法
【CV】请问卷积核(滤波器)3*3、5*5、7*7、11*11 都是具体什么数?
Exploration of flutter drawing skills: draw arrows together (skill development)
【bug】XLRDError: Excel xlsx file; not supported
File permissions of day02 operation
30 knowledge points that must be mastered in quantitative development [what is individual data]?
Markdown syntax
Android Studio 实现登录注册-源代码 (连接MySql数据库)
【Clustrmaps】访客统计
主流实时流处理计算框架Flink初体验。
[DL] build convolutional neural network for regression prediction (detailed tutorial of data + code)
Huawei 2020 school recruitment written test programming questions read this article is enough (Part 2)