This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from PIL import Image | |
| # --- 基础数学工具 --- | |
| def normalize(v): | |
| norm = np.linalg.norm(v) | |
| return v / norm if norm > 0 else v | |
| def look_at(eye, target, up): | |
| z_axis = normalize(eye - target) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from PIL import Image | |
| from os import listdir | |
| import math | |
| pics = listdir('./pic') | |
| final_width = None | |
| for pic in pics: | |
| i = Image.open(f'./pic/{pic}') |