Active Contour
1 개요
Active Contour 알고리즘을 활용하여 감지된 경계를 따라 Figure 가 Contour 를 형성하도록 유도하는 알고리즘입니다.
2 알고리즘 상세 설명
이 알고리즘의 Sorce ROI 로 Circle 또는 Region 을 지정할 수 있으며, Sorce ROI 영역 내부의 Edge 를 감지하고 이에 대한 Distance Image 를 기반으로 Contour 내의 포인트들을 이동합니다.
수행 이후 포인트의 수가 과하다면, Contour Figure 에 Transform - Reduce 기능을 사용하여 디테일을 살리면서도 Contour Figure 의 포인트 수를 줄일 수 있습니다.
Source Image | Destination Image |
---|---|
![]() |
![]() |
Execute 시 입력한 점의 수를 만족하도록 Sorce ROI 에서 파생된 Contour Figure 가 생성 되며, Distance Image 또한 연산됩니다.
Source ROI | Contour Figure |
---|---|
![]() |
![]() |
Fit 동작은 각 점마다 인근 3x3 픽셀의 Distance Image 값과 Fit Margin 을 참고하여 가장 적합한 지점으로의 이동을 수행합니다.
Spacing 동작은 Contour Figure 를 이루는 점 간 거리를 평활화 합니다. 기준점이 매번 임의로 결정되어 안정적으로 동작하며, 선분의 길이 뿐 아니라 기울기의 변화량이 평활화 되는 효과가 있습니다. Spacing 이 과도하게 수행되는 경우, 이미지의 Edge 를 통과할 수 있으므로, 이를 방지하기 위해 일차적으로는 5-10 정도의 여유로운 Fit Margin 을 사용하는 것을 추천합니다.
3 파라미터 설정 및 사용 방법
동작을 위한 최소한의 기본 설정 파라미터는 아래와 같습니다.
-
const CResult SetPointCount(int32_t i32PointCount)
Contour Figure 를 구성할 점의 수를 지정합니다. Region 인 경우 Source ROI 를 구성하는 점의 수 보다 많아야 하며, Circle 인 경우는 3 개 이상이 요구됩니다.i32PointCount
: Contour Figure 를 구성할 점의 수
-
const CResult SetMaxLength(int32_t i32MaxLength)
Hysteresis Threshold 의 파라미터. 강한 강도의 픽셀과 연결된 중간 강도의 픽셀이 유지되는 최대 거리인 Max Length 값을 설정합니다.i32MaxLength
: Max Length 값
-
const CResult SetLowThreshold(double f64LowThreshold)
Hysteresis Threshold 의 파라미터. 중간 강도의 엣지와 약한 강도의 엣지를 구분짓는 낮은 임계값을 설정합니다.f64LowThreshold
: 낮은 임계값
-
const CResult SetHighThreshold(double f64HighThreshold)
Hysteresis Threshold 의 파라미터. 강한 강도의 엣지와 중간 강도의 엣지를 구분짓는 높은 임계값을 설정합니다.f64HighThreshold
: 높은 임계값
-
const CResult SetFitMargin(int32_t i32FitMargin)
Fit 동작 시 Edge 와의 목표 여유 거리를 설정합니다.i32FitMargin
: Fit 동작 시 Edge 와의 목표 여유 거리
4 예제 코드
CActiveContour ac;
CFLImage fliSourceImage;
CFLImage fliDestinationImage;
CFLRegion* pFlfSourceROI = CFigureUtilities::ConvertFigureStringToObject(L"RG[..]");
ac.SetSourceImage(fliSourceImage);
ac.SetSourceROI(pFlfSourceROI);
ac.SetDestinationImage(fliDestinationImage);
ac.SetPointCount(3000);
ac.SetMaxLength(3);
ac.SetLowThreshold(20);
ac.SetHighThreshold(50);
ac.SetFitMargin(5);
ac.Execute();
for(int32_t i32Iteration = 0; i32Iteration < 20; ++i32Iteration)
{
ac.Fit();
ac.Fit();
ac.Fit();
ac.Fit();
ac.Fit();
ac.Fit();
ac.Fit();
ac.Fit();
ac.Fit();
ac.Fit();
ac.Spacing();
ac.Spacing();
ac.Spacing();
ac.Spacing();
ac.Spacing();
CFLRegion* pFlfContourFigure = ac.GetContourFigure();
}
delete pFlfSourceROI;
5 기타 사항
Supported Feature
- Image
- Source Image
- Destination Image
- ROI
- Source ROI
Supported Format
- Source
- Channel
- 1-10
- Combined, Separated
- Value Type & Depth
- Signed: 8, 9-16, 32
- Unsigned: 8, 9-16, 32
- Floating: 32, 64
- Channel
- Destination
- Channel
- 1
- Value Type & Depth
- Unsigned: 8
- Channel
6 관련 알고리즘
Non Maximum Suppression, NMS
Hysteresis Threshold
Distance Transform