Reduce Dimension Count 2D to 1D

1 개요

원본 이미지 차원을 축소하는 알고리즘입니다. 축소된 차원의 0이 아닌 값의 개수를 결과로 출력합니다.

2 알고리즘 상세 설명

IDst(x,0)=yHeightf(x,y)I_{Dst}(x, 0) = \sum_{y \in Height} f(x, y)

IDst(0,y)=xWidthf(x,y)I_{Dst}(0, y) = \sum_{x \in Width} f(x, y)

f(x,y)={1if  ISrc(x,y)0,0if  ISrc(x,y)=0.f(x, y) = \begin{cases} 1 & \text{if} \; I_{Src}(x, y) \neq 0, \\ 0 & \text{if} \; I_{Src}(x, y) = 0. \end{cases}

이미지의 x 또는 y 차원을 0이 아닌 값의 개수를 기반으로 축소시킵니다.

Source Image Reduce X Dimension Destination Image Reduce Y Dimension Destination Image
Source Image Reduce X Dimension Destination Image Reduce Y Dimension Destination Image
Fig. Reduce Dimension Count 2D to 1D 동작 예시

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

멤버함수 파라미터 설 명
SetReductionDimension CReduceDimensionCount2Dto1D::EReductionDimension eReductionDimension IN 축소 차원을 설정합니다.
SetOverflowMethod EOverflowMethod eOverflowMethod IN 오버플로우 처리 방식을 설정합니다.

4 예제

CFLImage fliSourceImage;
CFLImage fliDestinationImage;

CReduceDimensionCount2Dto1D reduceDimensionCount2Dto1D;
reduceDimensionCount2Dto1D.SetSourceImage(fliSourceImage);
reduceDimensionCount2Dto1D.SetDestinationImage(fliDestinationImage);

reduceDimensionCount2Dto1D.SetOverflowMethod(EOverflowMethod_Clamping);

// x 차원 축소
reduceDimensionCount2Dto1D.SetReduceDimension(CReduceDimensionCount2Dto1D::EReduceDimension_X);
reduceDimensionCount2Dto1D.Execute();

// y 차원 축소
reduceDimensionCount2Dto1D.SetReduceDimension(CReduceDimensionCount2Dto1D::EReduceDimension_Y);
reduceDimensionCount2Dto1D.Execute();
CReduceDimensionCount2Dto1D reduceDimensionCount2Dto1D = new CReduceDimensionCount2Dto1D();

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

CFLImage fliDestinationImage = new CFLImage();
reduceDimensionCount2Dto1D.SetDestinationImage(ref fliDestinationImage);

reduceDimensionCount2Dto1D.SetOverflowMethod(EOverflowMethod.Clamping);

// x 차원 축소
reduceDimensionCount2Dto1D.SetReduceDimension(CReduceDimensionCount2Dto1D.EReduceDimension.X);
reduceDimensionCount2Dto1D.Execute();

// y 차원 축소
reduceDimensionCount2Dto1D.SetReduceDimension(CReduceDimensionCount2Dto1D.EReduceDimension.Y);
reduceDimensionCount2Dto1D.Execute();