This commit is contained in:
千住柱間 2025-04-22 11:29:52 -04:00
commit 2276e0ab2a
Signed by: hashirama
GPG key ID: 53E62470A86BC185

View file

@ -130,9 +130,9 @@ def preprocess_image(image_path):
gray = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE) gray = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)
resampled = bicubic(gray) resampled = bicubic(gray)
# Convert grayscale to 3-channel RGB by duplicating the gray channel # Convert grayscale to 3-channel RGB by duplicating the gray channel
img1 = contrast_stretch(adjust_gamma(cv2.cvtColor(resampled, cv2.COLOR_GRAY2RGB),gamma=1,alpha=1.4,beta=-5)) # perfect tunning img1 = contrast_stretch(adjust_gamma(cv2.cvtColor(resampled, cv2.COLOR_GRAY2RGB),gamma=0.3,alpha=1.6,beta=-5)) # perfect tunning
img = cv2.fastNlMeansDenoising(img1, None, 20, 10, 20) img = cv2.fastNlMeansDenoising(img1, None, 30, 10, 20)
plt.imshow(img) plt.imshow(img)
plt.axis("off") plt.axis("off")