python3代码如下,
import os
import sys
import time
import sys
from PIL import Image
def resize_image(input_image_path, output_image_path):
original_image = Image.open(input_image_path)
width, height = original_image.size
new_size = (width // 2, height // 2)
resized_image = original_image.resize(new_size)
resized_image.save(output_image_path)
return
if __name__ == "__main__":
start_t = time.time()
resize_image("img1.png", "img2.png")
end_t = time.time()
print(f"used time: {(end_t - start_t) / 60.0} minutes!")
图像尺寸缩小一半,相机参数 f x , f y , c x , c y f_x,f_y,c_x,c_y fx,fy,cx,cy都缩小一半,畸变参数无影响。