Advertisement

OpenCV-python第2篇——图像基础处理

阅读量:

image processing图像处理

文章结构概览

  • 图像处理
    • 1 图像变换
      • 1.1 平移

      • 1.2 旋转

      • 1.3 缩放

      • 1.4 翻转

      • 1.5 裁切

      • 2 图像算术运算

      • 3 按位操作

      • 4 遮罩处理

      • 5 通道分离与合并

      • 6 色彩空间转换

1 image transfomations图像变换

1.1 translation平移

复制代码
    # 格式为[1,0,tx]和[0,1,ty],其中tx和ty分别为横向和纵向,正数表示向下和向右
    # 负数表示向上和向左
    M = np.float32([[1, 0, 25], [0, 1, 50]])
    shifted = cv2.warpAffine(image, M, (image.shape[1], image.shape
    [0]))
    cv2.imshow("Shifted Down and Right", shifted)
    
    
      
      
      
      
      
      
    

将该过程封装为函数的实现方式

复制代码
    # 子函数的写法

全部评论 (0)

还没有任何评论哟~