π§ κΈ°λ₯ μκ°
-
νμ₯ μ΄λ―Έμ§ νμ§μ νμΈνκ³ κ°μ ν μ μλ€.
-
λ€μν μ μ²λ¦¬ κΈ°λ²μ μ μ©ν μ μλ€.
-
μ¬λΌμ΄λμ λ²νΌμΌλ‘ νλΌλ―Έν°λ₯Ό μ‘°μ ν μ μλ€.
π κΈ°λ₯ μμ½ (λͺ©μ°¨)
λΆλ₯ | μ μ²λ¦¬ μ’ λ₯ |
---|---|
π― μ κ·ν κ³μ΄ | Normalize, Standardize |
π ν¬κΈ°/νν μ 리 | Resize, Crop, Padding |
π μ¦κ° (Augmentation) | Flip, Rotate, Brightness, Noise |
π μ±λ/μ λ³κ²½ | Grayscale, RGB to HSV |
π νν κ°μ‘° | Histogram Equalization, CLAHE |
π λ Έμ΄μ¦ μ κ±° | Gaussian Blur, Median Blur |
π― μμ μ‘°μ | ROI Crop, Masking |
π κ³΅κ° λλ©μΈ μ²λ¦¬ | Edge Detection, Dilation |
π¨ μ£Όμ κΈ°λ₯ μ½λ μμ
β 1. Padding
def apply_padding(padding_type):
if padding_type == 'Zero Padding':
padded = cv2.copyMakeBorder(img_gray, 50, 50, 50, 50, cv2.BORDER_CONSTANT, value=[0, 0, 0])
elif padding_type == 'Edge Padding':
padded = cv2.copyMakeBorder(img_gray, 50, 50, 50, 50, cv2.BORDER_REPLICATE)
# ...
plt.imshow(padded, cmap='gray')
plt.title(padding_type)
plt.axis('off')
plt.show()
λΌλμ€ λ²νΌμΌλ‘ ν¨λ© νμ
μ μ νν μ μλ€.
νμ
: Zero Padding, Edge Padding, Reflect Padding, Constant Padding
β 2. μ ν μ°μ° (λ°κΈ° λ°°μ¨ μ‘°μ )
def update_brightness(factor):
img_modified = np.clip(img_gray_crop * factor, 0, 255).astype('uint8')
plt.imshow(img_modified, cmap='gray')
plt.title(f'Intensity x {factor:.2f}')
plt.axis('off')
plt.show()
π μ€ν¬λ‘€λ°λ‘ λ°κΈ° μ‘°μ μ΄ κ°λ₯νλ€ (0.1 ~ 2.0)
β 3. Gaussian Blur
def apply_blur(method, ksize):
if method == 'Gaussian Blur':
blurred = cv2.GaussianBlur(img_gray, (ksize, ksize), 0)
plt.imshow(blurred, cmap='gray')
plt.title(f'{method} (kernel={ksize})')
plt.axis('off')
plt.show()
ποΈ μ»€λ ν¬κΈ° μ¬λΌμ΄λλ‘ λΈλ¬ κ°λ μ‘°μ μ΄ κ°λ₯νλ€
β 4. Normalize
img_gray_copy = img_gray.astype(np.float32) / 255.0
img_normalized = (img_gray_copy - np.min(img_gray_copy)) / (np.max(img_gray_copy) - np.min(img_gray_copy))
plt.imshow(img_normalized, cmap='gray')
plt.title("Normalized Image")
plt.axis('off')
plt.show()
π ν½μ κ°μ 0~1 λ²μλ‘ μ‘°μ νλ€ λ₯λ¬λ μ μ²λ¦¬μμ νμ΅ μμ νλ₯Ό μν΄ μ¬μ©λλ€
π§ μ£Όμ νΉμ§
β Colab νκ²½μμ μ€νλμ΄ νμ₯ PC μ¬μμ κ΄κ³μμ΄ μ΄λ―Έμ§ νΈμ§μ΄ κ°λ₯
β Google Driveμ μ°λλμ΄ λμ©λ μ΄λ―Έμ§ λ°μ΄ν°λ μ½κ² νμ© κ°λ₯
β μμΆνμΌμ μ§μ μ½μ΄μ μ λ‘λ μκ°κ³Ό μ©λ μ ν λ¬Έμ λ₯Ό μ΅μν
π μ½λ λ§ν¬
π Colab Full μ½λ
ν΄λΉ λ
ΈνΈλΆμμλ λ€μν μ μ²λ¦¬ κΈ°λ²μ μ§μ μ μ©ν΄ λ³΄κ³ ,
μ¬λΌμ΄λλ λ²νΌ μμ ―μ ν΅ν΄ νλΌλ―Έν°λ₯Ό μ‘°μ νλ©° μκ°μ μΌλ‘ κ²°κ³Όλ₯Ό νμΈν μ μμ΅λλ€.


C
Contents