Code: Select all
poly = [(0, 0), (5, 0), (5, 10), (0, 10)]
rotate_angle = 90
target_polygon = np.array([rotate_point(point, rotate_angle) for point in poly])
pv_module_img = plt.imread("..\\module_img.png")
pv_module_img_uint8 = (pv_module_img * 255).astype(np.uint8)
pv_module_img_reshaped = np.squeeze(pv_module_img_uint8)
rotated = Image.fromarray(pv_module_img_reshaped).rotate(rotate_angle)
fig, ax = plt.subplots(figsize=(8, 6))
extent = set_pv_modules_envelope(target_polygon)
patch = mp.Polygon(target_polygon, closed=True)
ax.add_patch(patch)
ax.imshow(
rotated,
extent=extent,
clip_path=patch,
clip_on=True,
zorder=3
)
plt.axis("scaled")
plt.axis("off")
plt.show()
< /p>
und für 45 Grad empfange ich Folgendes: < /p>
Dies ist das Originalbild. = "https://i.static.net/epuhgazp.png"/>