opencv图像基本操作
来源:互联网 发布:怎么样开淘宝店赚钱 编辑:程序博客网 时间:2024/04/26 11:50
#include<iostream>
#include<opencv2\opencv.hpp>
#include<opencv2\highgui\highgui.hpp>
#include<opencv2\imgproc\imgproc.hpp>
using namespace std;
using namespace cv;
int main() {
Mat img = imread("F:\\img\\feature01.jpg");
if (img.empty()) {
cout << "error:img open failed !" << endl;
return -1;
}
Mat ele = getStructuringElement(cv::MORPH_RECT, Size(10, 10));//返回值为指定形状和尺寸的矩阵
Mat des01;
erode(img, des01, ele);
Mat des02;
blur(img, des02, Size(5, 5));
imshow("blur", des02);
//进行canny边缘检测
Mat des03, gray, edge;
des03.create(img.size(), img.type());
cvtColor(img, gray, CV_BGR2GRAY);/*转为灰度图像*/
blur(gray, edge, Size(5, 5));
Canny(edge, edge, 3, 9, 3);
imshow("canny", edge);
//读取视频图像
VideoCapture cap("F:\\img\\v.avi");//调用摄像头:cap(0)
Mat frame;
while (1){
cap >> frame;
imshow("frame", frame);
waitKey(20);
return 0;
}
#include<opencv2\opencv.hpp>
#include<opencv2\highgui\highgui.hpp>
#include<opencv2\imgproc\imgproc.hpp>
using namespace std;
using namespace cv;
int main() {
Mat img = imread("F:\\img\\feature01.jpg");
if (img.empty()) {
cout << "error:img open failed !" << endl;
return -1;
}
imshow("img", img);
Mat ele = getStructuringElement(cv::MORPH_RECT, Size(10, 10));//返回值为指定形状和尺寸的矩阵
Mat des01;
erode(img, des01, ele);
imshow("erode", des01);
Mat des02;
blur(img, des02, Size(5, 5));
imshow("blur", des02);
//进行canny边缘检测
Mat des03, gray, edge;
des03.create(img.size(), img.type());
cvtColor(img, gray, CV_BGR2GRAY);/*转为灰度图像*/
blur(gray, edge, Size(5, 5));
Canny(edge, edge, 3, 9, 3);
imshow("canny", edge);
//读取视频图像
VideoCapture cap("F:\\img\\v.avi");//调用摄像头:cap(0)
Mat frame;
while (1){
cap >> frame;
imshow("frame", frame);
waitKey(20);
}
return 0;
}
1 0
- opencv基本图像操作
- opencv图像基本操作
- opencv-图像基本操作
- OpenCV-图像基本操作
- opencv图像处理基本操作
- OpenCV之图像基本操作
- OPencv图像处理基本操作
- opencv图像基本操作算法
- OpenCV-图像的基本操作
- opencv图像处理基本操作
- opencv(9)---图像基本操作
- opencv(c++)-图像基本操作
- opencv-图像处理1 图像基本操作
- OpenCV随笔002-图像的基本操作
- OpenCV(四)图像的基本操作
- python+opencv实操-图像基本操作
- 图像处理matlab+OpenCV基本操作
- opencv基本操作 图像的卷积
- github 更新被拒绝,因为您当前分支的最新提交落后于其对应的远程分支
- 机器学习模型评价指标及R实现
- 剑指offer(五十一)之把二叉树打印成多行
- Shell脚本中计算字符串长度的5种方法
- Bash Shell字符串操作小结
- opencv图像基本操作
- 深入探索c++虚继承
- 农村土地确权之成果展示 —— 调查信息公示表
- Linux磁盘与文件系统管理
- openwrt中继
- 端点检测
- RxJava学习入门
- 一致性哈希---初学者
- optistruct模式重复