Opencv入门——通用形态学操作函数morphologyEx()

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()】

    推荐阅读