Inpainting Texture
1 개요
Texture Propagation과 Structure Propagation을 이용하여 인페인팅을 수행하는 알고리즘입니다.
2 알고리즘 상세 설명
이미지의 손상, 열화 또는 누락된 픽셀을 주변 픽셀로 채워 전체 이미지를 표시하는 인페인팅을 수행합니다.
알고리즘 동작 결과 | |
---|---|
![]() |
![]() |
Painting Region 으로 지정된 영역에 대해 인페인팅을 수행합니다. Painting Region 은 항상 지정되어 있어야 합니다.
Inpainting 은 Texture Propagation, Structure Propagation 두 가지 방식으로 동작합니다.
Texture Propagation 은 Painting Region 바깥에서부터 안쪽으로 채우는 방식이고, Structure Propagation 은 Structure Curve 를 따라 채우는 방식입니다.
Inpainting Mode 를 Default 로 설정 시 Structure Curve 가 존재할 경우 Structure Propagation 후 Texture Propagation 을 진행하고, Structure Curve 가 존재하지 않을 경우 Texture Propagation 을 진행합니다.
Inpainting Mode 를 Structure Propagation 로 설정 시 Structure Propagation 만 진행합니다.
3 파라미터 설정 및 사용 방법
멤버함수 | 파라미터 | 설 명 | ||
---|---|---|---|---|
SetInpaintingMode | EInpaintingMode | eInpaintingMode | IN | 인페인팅 모드 |
인페인팅 모드를 설정합니다.
Default 로 설정 시 Structure Curve 가 존재할 경우 Structure Propagation 후 Texture Propagation 을 진행하고, Structure Curve 가 존재하지 않을 경우 Texture Propagation 을 진행합니다.
Structure Propagation 로 설정 시 Structure Propagation 만 진행합니다.
eInpaintingMode
- Default Value: EInpaintingMode_Default, Recommended Value: EInpaintingMode_Default
멤버함수 | 파라미터 | 설 명 | ||
---|---|---|---|---|
SetPaintingRegion | Foundation::CFLFigureArray | flfaPaintingRegion | IN | 인페인팅 영역 |
인페인팅 영역을 설정합니다.
멤버함수 | 파라미터 | 설 명 | ||
---|---|---|---|---|
SetStructureCurve | Foundation::CFLFigureArray | flfaStructureCurve | IN | Structure Curve |
Structure Curve를 설정합니다. Structure 의 방향 정보를 가이드 해줄 수 있습니다. 지원하는 Figure Type 으로는 Line, CubicSpline 이 있습니다.
멤버함수 | 파라미터 | 설 명 | ||
---|---|---|---|---|
SetMaskSize | int64_t | i64Mask | IN | 인페인팅 마스크 크기 |
Patching 을 진행할 마스크의 크기를 설정합니다. 3보다 크거나 같은 홀수로만 설정 가능합니다.
i64Mask
- Default Value: 25
멤버함수 | 파라미터 | 설 명 | ||
---|---|---|---|---|
SetSearchSize | int64_t | i64SearchSize | IN | 검색 윈도우 크기 |
Patching의 Source가 되는 마스크를 찾기 위한 검색 영역의 크기를 설정합니다. -1 로 설정할 겨우 자동으로 검색 윈도우 크기를 설정합니다.
i64SearchSize
- Default Value: -1
멤버함수 | 파라미터 | 설 명 | ||
---|---|---|---|---|
SetSearchStepSize | int64_t | i64SearchStepSize | IN | Search Step 크기 |
Search Step 크기를 설정합니다. -1 로 설정 시 자동으로 Search Step 크기를 설정합니다.
i64SearchStepSize
- Default Value: 1
멤버함수 | 파라미터 | 설 명 | ||
---|---|---|---|---|
SetAnisotropy | double | f64Anisotropy | IN | 매치를 위한 Gradient Value 곱 계수 |
매치를 위한 Gradient Value 곱 계수를 설정합니다.
f64Anisotropy
- Default Value: 1
4 예제 코드
CInpaintingTexture InpaintingTexture;
CFLImage fliSourceImage;
InpaintingTexture.SetSourceImage(fliSourceImage);
CFLImage fliDestinationImage;
InpaintingTexture.SetDestinationImage(fliDestinationImage);
InpaintingTexture.SetPaintingRegion(pFlpaPaintingRegion);
InpaintingTexture.SetInpaintingMode(CInpaintingTexture::EInpaintingMode_Default);
InpaintingTexture.SetMaskSize(25);
InpaintingTexture.SetSearchSize(-1);
InpaintingTexture.SetSearchStepSize(-1);
InpaintingTexture.SetAnisotropy(1.000000);
InpaintingTexture.Execute();