HaruthaiAi commited on
Commit
8ff869c
·
verified ·
1 Parent(s): 28f180e

Upload VanGogh_OldMan_Xray_18Techniques_AIAnalysis_2025.jpg

Browse files

**Figure:**
X-ray of *Portrait of an Old Man with a Beard* (1885) processed with 18 AI techniques.
Each panel was generated from the original X-ray using Google Colab and Python-based filters (OpenCV, NumPy, SciPy).
The full source code is provided below for transparency and reproducibility.

<Insert code block here>

# ✅ Install required libraries (only once)
!pip install opencv-python matplotlib numpy scipy --quiet

# ✅ Import libraries
import cv2
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage
from google.colab import files

# ✅ Upload image (X-ray image file)
uploaded = files.upload()
filename = list(uploaded.keys())[0]
img = cv2.imread(filename, cv2.IMREAD_GRAYSCALE)

# ✅ Define the 18 Technique Analysis Function
def analyze_18_techniques(image):
fig, axes = plt.subplots(6, 3, figsize=(18, 36))
fig.suptitle('18 Supreme Techniques – X-ray Brushstroke Analysis', fontsize=20)
axes = axes.ravel()

# Technique 1: Original
axes[0].imshow(image, cmap='gray'); axes[0].set_title('Original X-ray')

# Technique 2: Sobel X
sobelx = cv2.Sobel(image, cv2.CV_64F, 1, 0, ksize=5)
axes[1].imshow(sobelx, cmap='gray'); axes[1].set_title('Sobel X')

# Technique 3: Sobel Y
sobely = cv2.Sobel(image, cv2.CV_64F, 0, 1, ksize=5)
axes[2].imshow(sobely, cmap='gray'); axes[2].set_title('Sobel Y')

# Technique 4: Laplacian
laplacian = cv2.Laplacian(image, cv2.CV_64F)
axes[3].imshow(laplacian, cmap='gray'); axes[3].set_title('Laplacian')

# Technique 5: Gaussian Blur
gaussian = cv2.GaussianBlur(image, (11,11), 0)
axes[4].imshow(gaussian, cmap='gray'); axes[4].set_title('Gaussian Blur')

# Technique 6: Median Blur
median = cv2.medianBlur(image, 9)
axes[5].imshow(median, cmap='gray'); axes[5].set_title('Median Blur')

# Technique 7: CLAHE
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))
cl1 = clahe.apply(image)
axes[6].imshow(cl1, cmap='gray'); axes[6].set_title('CLAHE Enhancement')

# Technique 8: Canny Edge
edges = cv2.Canny(image, 100, 200)
axes[7].imshow(edges, cmap='gray'); axes[7].set_title('Canny Edge')

# Technique 9: FFT (Fourier Transform)
f = np.fft.fft2(image)
fshift = np.fft.fftshift(f)
magnitude = 20*np.log(np.abs(fshift) + 1)
axes[8].imshow(magnitude, cmap='inferno'); axes[8].set_title('Fourier Transform')

# Technique 10: Histogram Equalization
hist_eq = cv2.equalizeHist(image)
axes[9].imshow(hist_eq, cmap='gray'); axes[9].set_title('Histogram Equalization')

# Technique 11: Morphological Gradient
gradient = cv2.morphologyEx(image, cv2.MORPH_GRADIENT, np.ones((5, 5), np.uint8))
axes[10].imshow(gradient, cmap='gray'); axes[10].set_title('Texture Gradient')

# Technique 12: Erosion
erosion = cv2.erode(image, np.ones((3, 3), np.uint8), iterations=1)
axes[11].imshow(erosion, cmap='gray'); axes[11].set_title('Erosion')

# Technique 13: Dilation
dilation = cv2.dilate(image, np.ones((3, 3), np.uint8), iterations=1)
axes[12].imshow(dilation, cmap='gray'); axes[12].set_title('Dilation')

# Technique 14: Gabor Filter
gabor = cv2.getGaborKernel((21, 21), 8.0, np.pi/4, 10.0, 0.5, 0, ktype=cv2.CV_32F)
filtered = cv2.filter2D(image, cv2.CV_8UC3, gabor)
axes[13].imshow(filtered, cmap='gray'); axes[13].set_title('Gabor Filter 45°')

# Technique 15: Binary Threshold
_, thresh = cv2.threshold(image, 127, 255, cv2.THRESH_BINARY)
axes[14].imshow(thresh, cmap='gray'); axes[14].set_title('Binary Threshold')

# Technique 16: Contour Detection
contours, _ = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
contour_img = np.zeros_like(image)
cv2.drawContours(contour_img, contours, -1, 255, 1)
axes[15].imshow(contour_img, cmap='gray'); axes[15].set_title('Contour Map')

# Technique 17: Combined Sobel Magnitude
sobel_comb = np.sqrt(sobelx**2 + sobely**2)
axes[16].imshow(sobel_comb, cmap='hot'); axes[16].set_title('Sobel Combined Magnitude')

# Technique 18: Laplacian of Gaussian
lap_gauss = cv2.Laplacian(gaussian, cv2.CV_64F)
axes[17].imshow(lap_gauss, cmap='gray'); axes[17].set_title('Laplacian of Gaussian')

for ax in axes:
ax.axis('off')

plt.tight_layout()
plt.show()

# ✅ Run the analysis
analyze_18_techniques(img)

VanGogh_OldMan_Xray_18Techniques_AIAnalysis_2025.jpg ADDED

Git LFS Details

  • SHA256: b8ecc39c209c8d49c55c2082135121b3c1a61ceaf65edc2cd2873ecd2afd55ac
  • Pointer size: 131 Bytes
  • Size of remote file: 201 kB