|
|
import cv2
|
|
|
import numpy as np
|
|
|
import os
|
|
|
|
|
|
|
|
|
img = np.full((512, 512, 3), 200, dtype=np.uint8)
|
|
|
|
|
|
|
|
|
cv2.rectangle(img, (100, 200), (400, 400), (100, 100, 100), -1)
|
|
|
cv2.putText(img, "PromptIR Test", (120, 300), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)
|
|
|
|
|
|
|
|
|
for i in range(300):
|
|
|
x = np.random.randint(0, 512)
|
|
|
y = np.random.randint(0, 512)
|
|
|
length = np.random.randint(10, 30)
|
|
|
cv2.line(img, (x, y), (x+5, y+length), (180, 180, 180), 1)
|
|
|
|
|
|
|
|
|
os.makedirs("test/demo", exist_ok=True)
|
|
|
input_path = "test/demo/rainy.png"
|
|
|
cv2.imwrite(input_path, img)
|
|
|
print(f"✅ 下雨图已生成: {input_path}") |