一:ROI
ROI就是region of interest,感兴趣的区域,有时候需要去看看某个特定的区域
#!/usr/bin/python
# -*- coding: <encoding name> -*-
import cv2
# 展示图像,封装成函数
def cv_show_image(name, img):
cv2.imshow(name, img)
cv2.waitKey(0) # 等待时间,单位是毫秒,0代表任意键终止
cv2.destroyAllWindows()
# 读取彩色图像
img = cv2.imread('images/naruto.jpg')
part = img[0:300, 80:300]
cv_show_image('naruto', part)
part = img[200:500, 280:500]
cv_show_image('naruto', part)
# # 分割图像的三个通道
b, g, r = cv2.split(img)
print(b.shape)
print(g.shape)
print(r.shape

本文深入探讨了图像处理中的ROI(感兴趣区域)概念,并展示了如何通过Python的OpenCV库选取和显示ROI。同时,文章详细解释了图像填充的不同方法,包括复制边界、反射填充、包裹填充等,利用`cv2.copyMakeBorder`函数实现各种填充效果。通过实例代码,读者可以更好地理解和应用这些技术。
最低0.47元/天 解锁文章
1658

被折叠的 条评论
为什么被折叠?



