基于python的opencv学习——copyMakeBorder()函数 20
#-*-coding:utf-8-*-importcv2ascvif__name__=='__main__':src=cv.imread(r"C:\Users\11153...
# -*- coding:utf-8 -*-
import cv2 as cv
if __name__ == '__main__':
src = cv.imread(r"C:\Users\11153\Pictures\Camera Roll\1.jpg", cv.IMREAD_ANYCOLOR)
reflect = cv.copyMakeBorder(src, 100, 100, 100, 100, cv.BORDER_REFLECT)
reflect101 = cv.copyMakeBorder(src, 100, 100, 100, 100, cv.BORDER_REFLECT101)
replicate = cv.copyMakeBorder(src, 100, 100, 100, 100, cv.BORDER_REPLICATE)
constant = cv.copyMakeBorder(src, 100, 100, 100, 100, cv.BORDER_CONSTANT, value=0)
cv.imshow("reflect101", reflect101)
cv.imshow("replicate", replicate)
cv.imshow("constant", constant)
cv.imshow("constant", constant)
cv.waitKey(0)
cv.destroyAllWindows()
以上是我敲的代码,想比较一下不同模式下的边界扩充有什么区别,结果点运行,图片一直没弹出来。是哪里有错吗?求大神指教~~~ 展开
import cv2 as cv
if __name__ == '__main__':
src = cv.imread(r"C:\Users\11153\Pictures\Camera Roll\1.jpg", cv.IMREAD_ANYCOLOR)
reflect = cv.copyMakeBorder(src, 100, 100, 100, 100, cv.BORDER_REFLECT)
reflect101 = cv.copyMakeBorder(src, 100, 100, 100, 100, cv.BORDER_REFLECT101)
replicate = cv.copyMakeBorder(src, 100, 100, 100, 100, cv.BORDER_REPLICATE)
constant = cv.copyMakeBorder(src, 100, 100, 100, 100, cv.BORDER_CONSTANT, value=0)
cv.imshow("reflect101", reflect101)
cv.imshow("replicate", replicate)
cv.imshow("constant", constant)
cv.imshow("constant", constant)
cv.waitKey(0)
cv.destroyAllWindows()
以上是我敲的代码,想比较一下不同模式下的边界扩充有什么区别,结果点运行,图片一直没弹出来。是哪里有错吗?求大神指教~~~ 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询