macOS下安装openCV+Xcode配置
2024-09-05 18:40:45
macOS下安装openCV+Xcode配置
打开终端
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install wget
brew install cmake
brew install opencv
这样openCV就下载好了
比较麻烦的是在xcode中的配置
新建项目
①在Header Search Paths中添加路径/usr/local/include/opencv4
②在Library Search Paths中添加路径/usr/local/lib
在项目新建一个group,把/usr/local/lib和/usr/local/cellar/opencv/4.0.1/lib目录(隐藏的路径,在访达里按shift+command+g搜索这个路径就可以找到了)里的所有.dylib文件copy到新建的这个group里。
测试代码
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cvaux.hpp>
#include <fstream>
using namespace std;
using namespace cv; int main(int argc, const char * argv[]) {
// insert code here...
Mat image;
image=imread("/Users/war/Desktop/test.jpg",);//将其中的路径改成自己的即可
namedWindow("Display Image",WINDOW_AUTOSIZE);
imshow("Display Image", image);
waitKey();
return ; }
最新文章
- (转载)GDI+双缓冲
- Inter Core CPU 型号的尾字母含义
- js获取url信息
- 全面分析 Spring 的编程式事务管理及声明式事务管理
- ArcGIS Engine环境下创建自定义的ArcToolbox Geoprocessing工具
- java.lang.RuntimeException: Fail to connect to camera service问题
- BZOJ1001 狼抓兔子(裸网络流)
- acl 是一个跨平台的网络通信库及服务器编程框架
- C++builder 图像字符流的存储和加载
- freemarker基本知识总结
- JSP(一)
- 【Codeforces 837D】Round Subset
- Linux下 开启防火墙端口
- Vue 知识整理—02-起步
- initWithFrame方法的使用
- ionic3 Injectable 引入NavController
- 【jenkins git】Failed to connect to repository:Error performing command:git.exe ls-remote-h
- 再会Java
- Android-WebView加载网络图片&;网页
- eclipse 重装了tomcat后配置路径