19 lines
548 B
Python
19 lines
548 B
Python
import matplotlib.pyplot as plt
|
|
import os
|
|
from PIL import Image
|
|
|
|
# 可视化函数
|
|
def visualize_pieces(output_dir, rows=10, cols=10):
|
|
fig, axes = plt.subplots(rows, cols, figsize=(10, 10))
|
|
for row in range(rows):
|
|
for col in range(cols):
|
|
piece_path = os.path.join(output_dir, f"piece_{row}_{col}.png")
|
|
piece = Image.open(piece_path)
|
|
axes[row, col].imshow(piece)
|
|
axes[row, col].axis('off')
|
|
plt.tight_layout()
|
|
plt.show()
|
|
|
|
# 可视化拼图效果
|
|
visualize_pieces("output_gigs")
|