OpenCV圖像腐蝕操作
-
- 程式說明
- 代碼
- 運作結果
- 新手圖檔位址注意事項
程式說明
// 程式描述:簡單的OpenCV圖像腐蝕操作
// 作業系統: Windows 10 64bit
// 開發語言:C++
// IDE 版 本:Visual Studio 2019
// OpenCV版本: 4.20
代碼
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
int main()
{
//載入原圖
Mat srcImage = imread("20.jpg");
//顯示原圖
imshow("【原圖】腐蝕操作", srcImage);
//進行腐蝕操作
Mat element = getStructuringElement(MORPH_RECT, Size(15, 15));
Mat dstImage;
erode(srcImage, dstImage, element);
//顯示效果圖
imshow("【效果圖】腐蝕操作", dstImage);
waitKey(0);
return 0;
}
運作結果
新手圖檔位址注意事項
參考連結.
https://editor.csdn.net/md/?articleId=113690998