图像处理-图像边缘处理
生活随笔
收集整理的这篇文章主要介绍了
图像处理-图像边缘处理
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
(考完六级补上)
1、Sobel算子
2、Laplacian算子
3、Canny算子
edge = cv2.Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient ]]])- 参数一:需要处理的图像
- 参数二:最小阈值MinThresh
- 参数三:最大阈值MaxThresh
介于MinThresh与MaxThresh之间的被识别为边界
4、运行结果
4.1 sobel
4.2 Laplacian
5、完整代码
def EdgeProcess(image):Result1_x = cv.Sobel(image,ddepth=-1,dx=1,dy=0)Result1_y = cv.Sobel(image,ddepth=-1,dx=0,dy=1)#x方向一阶边缘SobelResult_x = cv.convertScaleAbs(Result1_x)#y方向一阶边缘SobelResult_y = cv.convertScaleAbs(Result1_y)#整幅图像一阶边缘SobelResult_xy = cv.bitwise_or(SobelResult_x,SobelResult_y)#SobelResult_xy 是三通道图像SobelResult_Result = cv.hconcat((SobelResult_x,SobelResult_y,SobelResult_xy))cv.imshow("SobelResult",SobelResult_Result)cv.waitKey()#拉普拉斯算子Result2 = cv.Laplacian(image,ddepth=-1,ksize=3)LaplacianResult = cv.convertScaleAbs(Result2)cv.imshow("Laplacian",LaplacianResult)cv.waitKey()return;总结
以上是生活随笔为你收集整理的图像处理-图像边缘处理的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 普林斯顿10分钟剧本创作比赛
- 下一篇: 5G纯干货|毫米波概述与优缺点