Gamma Correction

1 개요

Gamma Correction 알고리즘은 비선형 전달 함수를 사용하여 빛의 강도 신호를 비선형적으로 변형하는 알고리즘 입니다.

2 알고리즘 상세 설명

G={m{(1+ε)(Im)γε}t<Im1sI0ImtG = \begin{cases} m\left\{(1+\varepsilon)(\frac{I}{m})^{\gamma} -\varepsilon \right\} & \text{, } t < \frac{I}{m}\leq 1 \\ s\cdot I & \text{, } 0\leq \frac{I}{m}\leq t \end{cases}

G={m{Im+ε1+ε}1γt<Im1Is0ImtG ' = \begin{cases} m\left\{\frac{\frac{I}{m} + \varepsilon }{1+\varepsilon} \right\}^{\frac{1}{\gamma}} & \text{, } t' < \frac{I}{m}\leq 1 \\ \frac{I}{s} & \text{, } 0\leq \frac{I}{m}\leq t' \end{cases}

Encoding 과 Decoding은 서로 역변환 관계입니다. Encoding의 γ<1\gamma < 1 인 경우 이미지의 밝기가 올라가며, 이는 Decoding의 γ>1\gamma > 1 과 같은 효과를 나타냅니다.

FLImaging® 은 Estimation 기능을 제공하여 최적의 밝기 값을 표현하는 파라미터 값을 산출하여 자동 적용할 수 있습니다.

노이즈 이미지 결과 이미지
Source Image Gamma Correction Result
Fig. Gamma Correction 동작 예시

위의 예시는 예제 이미지를 사용하여 Default 설정으로 동작한 예시입니다.

3 예제 코드

CGammaCorrection gammaCorrection;

CFLImage fliSourceImage;
gammaCorrection.SetSourceImage(fliSourceImage);

gammaCorrection.SetOperationType(CGammaCorrection::EOperationType_Encoding);
gammaCorrection.SetCorrectionValue(CGammaCorrection::ECorrectionValue_Pixel);

gammaCorrection.EnableWithEstimation(true);

gammaCorrection.Execute();
CGammaCorrection gammaCorrection = new CGammaCorrection();

CFLImage fliSourceImage = new CFLImage();
gammaCorrection.SetSourceImage(ref fliSourceImage);

gammaCorrection.SetOperationType(CGammaCorrection.EOperationType.Encoding);
gammaCorrection.SetCorrectionValue(CGammaCorrection.ECorrectionValue.Pixel);

gammaCorrection.EnableWithEstimation(true);

gammaCorrection.Execute();

4 파라미터 설정 및 사용 방법

멤버함수 파라미터 설 명
SetCorrectionValue ECorrectionValue eCorrectionValue IN 보정 대상 설정자
GetCorrectionValue ECorrectionValue eCorrectionValue OUT 보정 대상 접근자

CGammaCorrection::ECorrectionValue_Pixel - RGB 공간 상의 원본 픽셀 값을 보정 처리 합니다.

CGammaCorrection::ECorrectionValue_Luminance - YCbCr 공간 상으로 변환 후 Luminance 값을 보정 처리 합니다.

멤버함수 파라미터 설 명
SetOperationType EOperationType eOperationType IN 연산 타입 설정자
GetOperationType EOperationType eOperationType OUT 연산 타입 접근자

CGammaCorrection::EOperationType_Encoding - Gamma Correction 의 정방향 연산입니다.

CGammaCorrection::EOperationType_Decoding - Gamma Correction 의 역방향 연산입니다.

멤버함수 파라미터 설 명
EnableWithEstimation bool bWithEstimate IN 추정 기능 설정자
IsWithEstimationEnabled bool bWithEstimate OUT 추정 기능 접근자

true - 이미지의 밝기를 보정하기 위한 파라미터 추정을 진행 후 자동 보정합니다.

false - 이미지의 밝기를 보정하기 위한 파라미터 추정과 보정 연산을 나누어 실행합니다.

멤버함수 파라미터 설 명
EnableManualMode bool bManualMode IN 수동 모드 설정자
IsManualModeEnabled bool bManualMode OUT 수동 모드 접근자

true - 이미지의 밝기를 보정하기 위한 파라미터 값을 사용자가 직접 입력하여 보정을 진행합니다.

false - 이미지의 밝기를 보정하기 위한 파라미터 추정 기능을 사용합니다.

멤버함수 파라미터 설 명
SetGamma double f64Gamma IN Gamma 설정자
GetGamma double f64Gamma OUT Gamma 접근자

Gamma 곡선의 커브를 결정하는 파라미터입니다.

f64Gamma - Default Value : 0.6, Recommended Value : 0.3 ~ 3

멤버함수 파라미터 설 명
SetOffset double f64Offset IN Offset 설정자
GetOffset double f64Offset OUT Offset 접근자

Gamma 곡선의 Offset 을 결정하는 파라미터입니다.

f64Offset - Default Value : 0, Recommended Value : 0 ~ 0.5

멤버함수 파라미터 설 명
SetThreshold double f64Threshold IN Threshold 설정자
GetThreshold double f64Threshold OUT Threshold 접근자

Gamma 곡선을 적용할 임계치를 결정하는 파라미터입니다.

f64Threshold - Default Value : 0, Recommended Value : 0 ~ 0.5

멤버함수 파라미터 설 명
GetEstGamma double f64EstGamma OUT 추정 Gamma 접근자
GetEstOffset double f64EstOffset OUT 추정 Offset 접근자
GetEstThreshold double f64EstThreshold OUT 추정 Threshold 접근자

Estimation 기능을 사용할 시 산출된 파라미터 값에 접근하는 함수입니다.