Opencv3|Opencv3 形态学操作
#include
#include
using namespace std;
using namespace cv;
//形态学操作
int Demo_Morphology()
{
char win1[] = "window1";
char win2[] = "window2";
Mat img1, img2;
img1 = imread("D://images//4//13.jpg");
if (img1.empty())
{
cout << "could not load img..."<< endl;
return 0;
}
imshow(win1,img1);
Mat kernel_close = getStructuringElement(MORPH_RECT,Size(35,35),Point(-1,-1));
Mat kernel_GRADIENT = getStructuringElement(MORPH_RECT, Size(15, 15), Point(-1, -1));
Mat kernel_top_hat = getStructuringElement(MORPH_RECT, Size(53, 53), Point(-1, -1));
Mat kernel_black_hat = getStructuringElement(MORPH_RECT, Size(11, 11), Point(-1, -1));
//
//morphologyEx(img1,img2,CV_MOP_CLOSE,kernel_close);
//梯度
//morphologyEx(img2, img2, CV_MOP_GRADIENT, kernel_GRADIENT);
//开操作-顶帽
//morphologyEx(img1, img2, CV_MOP_TOPHAT, kernel_top_hat);
//闭操作-黑帽
morphologyEx(img1, img2, CV_MOP_BLACKHAT, kernel_black_hat);
imshow(win2, img2);
return 0;
}
int main()
{
Demo_Morphology();
waitKey(0);
return 0;
}
文章图片
文章图片
【Opencv3|Opencv3 形态学操作】转载于:https://www.cnblogs.com/herd/p/9734170.html
推荐阅读
- 2.6|2.6 Photoshop操作步骤的撤消和重做 [Ps教程]
- MongoDB,Wondows下免安装版|MongoDB,Wondows下免安装版 (简化版操作)
- 在线版的迅捷思维导图怎么操作()
- 操作系统|[译]从内部了解现代浏览器(1)
- 数据库总结语句
- JS常见数组操作补充
- 7、前端--jQuery简介、基本选择器、基本筛选器、属性选择器、表单选择器、筛选器方法、节点操作、绑定事件
- 炒股知识(超级短线操作的秘籍|炒股知识:超级短线操作的秘籍 玩转股市)
- 1.2序列通用操作
- MySQL数据库的基本操作