Popcount

1 개요

이미지 채널 값의 이진표현에 존재하는 '1' 비트의 수를 반환하는 알고리즘입니다.

2 알고리즘 상세 설명

Source 이미지 픽셀 각 채널 값의 Popcount 를 계산하여 출력합니다.

ydst,n=Popcount(xsrc,n)\textbf{y}_{dst,n} = \text{Popcount}(x_{src,n})

Source Value Destination Value
Source Image Destination Image
Fig. Source and Destination values of Popcount. (Clamping)

9-15 bit 이미지의 경우 depth 를 벗어난 상위 비트는 연산에 참여하지 않습니다.

3 예제 코드

COperationPopcount popcnt;

CFLImage fliSourceImage;
CFLImage fliDestinationImage;

popcnt.SetSourceImage(fliSourceImage);
popcnt.SetDestinationImage(fliDestinationImage);

popcnt.Execute();
COperationPopcount popcnt = new COperationPopcount();

CFLImage fliSourceImage = new CFLImage();
CFLImage fliDestinationImage = new CFLImage();

popcnt.SetSourceImage(ref fliSourceImage);
popcnt.SetDestinationImage(ref fliDestinationImage);

popcnt.Execute();

4 기타 사항

Supported Feature

Supported Format

Overflow Method

Destination 타입에 의해 출력 범위가 제한되는 경우, 설정된 overflow method 에 의해 처리됩니다. 기본 값은 Clamping 입니다.

5 관련 알고리즘

Leading Ones Leading Zeros Trailing Ones Trailing Zeros