Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 데이터분석
- 스플라인
- 이미지처리
- high-dimensional data analysis
- 모델링
- big data
- 이미지향상
- gray level resolution
- simulation
- data science
- 데이터사이언스
- datascience
- high dimensional data analysis
- 고차원데이터
- 이미지분석
- 이미지스트레칭
- OpenCV
- bitdepth
- Data Analysis
- 이미지대비
- 시뮬레이션
- 이미지콘볼루션
- 이미지변환
- 고차원데이터분석
- OMSA
- 미국온라인석사
- functional data analysis
- 함수형데이터분석
- 이미지프로세싱
- 빅데이터
Archives
- Today
- Total
곤약노트
이미지 변환 (Image Transformation) ⑤이미지 향상 (Image Enchantment) 3종 비교 본문
Data Science/High-Dimensional Data Analytics
이미지 변환 (Image Transformation) ⑤이미지 향상 (Image Enchantment) 3종 비교
곤약처럼 부드럽게, 쫀쫀하게 2025. 7. 8. 09:00Gray Level Transformation은 이미지의 픽셀 값을 수학적 함수로 변환해서 밝기를 조절하거나 대비를 높이는 기법입니다.
이미지를 강조(enhancement)하거나 특정 특징을 부각할 때 자주 사용됩니다.
1. Linear (Negative Image)
\( g(x, y) = (L - 1) - f(x, y) \)
- 밝은 부분은 어둡게, 어두운 부분은 밝게 반전 → 음화 이미지(negative image) 생성
- 흑백 필름 느낌 표현 가능
2. Log Transformation
\( g(x, y) = c \cdot \log(f(x, y) + 1) \)
- 어두운 영역을 강조하고 밝은 영역은 눌러줌
- 영상에서 작은 세부사항을 살리고 싶을 때 사용
3. Power-Law (Gamma) Transformation
\( g(x, y) = c \cdot f(x, y)^{\gamma} \)
- 감마 보정(gamma correction)이라고도 불림
- γ<1: 이미지 밝게
- γ>1: 이미지 어둡게
image_gray = cv2.imread('watermelon.jpg', cv2.IMREAD_GRAYSCALE)
# 1. 음화 이미지 (Negative)
negative = 255 - image_gray
# 2. 로그 변환
c = 255 / np.log(1 + np.max(image_gray))
log_transformed = c * np.log(1 + image_gray.astype(np.float32))
log_transformed = np.uint8(np.clip(log_transformed, 0, 255))
# 3. 감마 보정 (γ < 1 밝게, γ > 1 어둡게)
gamma = 0.5 # 예: 밝게
gamma_corrected = 255 * ((image_gray / 255) ** gamma)
gamma_corrected = np.uint8(np.clip(gamma_corrected, 0, 255))
plt.figure(figsize=(12, 6))
plt.subplot(1, 4, 1)
plt.imshow(image_gray, cmap='gray')
plt.title('Original')
plt.axis('off')
plt.subplot(1, 4, 2)
plt.imshow(negative, cmap='gray')
plt.title('Negative Image')
plt.axis('off')
plt.subplot(1, 4, 3)
plt.imshow(log_transformed, cmap='gray')
plt.title('Log Transform')
plt.axis('off')
plt.subplot(1, 4, 4)
plt.imshow(gamma_corrected, cmap='gray')
plt.title(f'Gamma Correction (γ={gamma})')
plt.axis('off')
plt.tight_layout()
plt.show()

