图像几何变换
几何变换 在齐次坐标下,改变位置,不改变像素值 图像缩放 1.调用API import cv2 import numpy as np # 图像缩放:你得有缩放的比例吧 img = cv2 . imread ( 'image0.jpg' , 1 ) # 调用API imgInfo = img . shape height = imgInfo [ 0 ] width = imgInfo [ 1 ] dstHeight = int ( height * 0.5 ) dstWidth = int ( width * 0.5 ) dst2 = cv2 . resize ( img , ( dstWidth , dstHeight ) ) #(列数,行数) cv2 . imshow ( 'image' , dst2 ) cv2 . waitKey ( 0 ) import cv2 import numpy as np img = cv2 . imread ( 'image0.jpg' , 1 ) cv2 . imshow ( 'src' , img ) imgInfo = img . shape height = imgInfo [ 0 ] width = imgInfo [ 1 ] matScale = np . float32 ( [ [ 0.5 , 0 , 0 ] , [ 0 , 0.5