void cv::morphologyEx(
cv::InputArraysrc,
cv::outputArraydst,
intop,
cv::InputArrayelement,
cv::Pointanchor= cv::Point(-1,-1),
intiterations = 1,
intborderType = cv::BOEDERTY_DEFAULT
const cv::Scalar& borderValue = https://www.it610.com/article/cv::morpholoDefaultBorderValue()
);
#include
#includeusing namespace cv;
using namespace std;
int main()
{
Mat img, dst, kernal;
img = imread("D:\\OpenCV\\images\\lena_gray.jpg");
if (img.empty())
{
cout << "image loading failed..." << endl;
return -1;
} namedWindow("input", WINDOW_AUTOSIZE);
imshow("input", img);
kernal = getStructuringElement(MORPH_RECT, Size(5, 5), Point(-1, -1));
morphologyEx(img, dst, MORPH_BLACKHAT, kernal);
imshow("output_img", dst);
waitKey(0);
return 0;
}
【Opencv入门——通用形态学操作函数morphologyEx()】
推荐阅读
- 人脸识别|【人脸识别系列】| 实现自动化妆
- OpenCV|OpenCV-Python实战(18)——深度学习简介与入门示例
- opencv|图像处理之椒盐噪声的添加与去除
- 人脸识别|【人脸识别系列】| 实现人脸截图保存并编写128维特征向量
- opencv|网络爬虫入门练习
- OpenCV|【OpenCV 完整例程】89. 带阻滤波器的传递函数
- OpenCV|【OpenCV 完整例程】90. 频率域陷波滤波器
- OpenCV|【OpenCV 完整例程】22. 图像添加非中文文字
- OpenCV|【OpenCV 完整例程】91. 高斯噪声、瑞利噪声、爱尔兰噪声
- opencv|python+opencv车道线,实线虚线的检测