Shape Match Figure

1 개요

이미지 내에서 사용자가 설정한 도형을 검출하는 알고리즘입니다.

2 알고리즘 상세 설명

Result
Detect Result
Fig. Shape Match Figure

도형을 설정하여 특성을 학습합니다.
이후 객체의 색상을 설정하여 학습한 도형의 크기와 형태가 유사한 객체를 검출합니다.

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

4 예제 코드

CShapeMatchFigure shapeMatchFigure;
//////////////////////////////////
// 공통 파라미터 설정
//////////////////////////////////

//////////////////////////////////
// 추가 옵션 설정
//////////////////////////////////

// 도형 설정
CFLRegion flrg;
flrg.PushBack(CFLPoint<double>(100, 0));
flrg.PushBack(CFLPoint<double>(200, 100));
flrg.PushBack(CFLPoint<double>(0, 100));
shapeMatchFigure.SetFigureObject(flrg);
// 해당 도형 학습
shapeMatchFigure.Learn();

// 도형 검출
shapeMatchFigure.Execute();

// 검출 결과를 가져옵니다.
int resultCount = shapeMatchFigure.GetResultCount();

for(int i = 0; i < resultCount; ++i)
{
    CShapeMatchFigureResult matchResult;
    shapeMatchFigure.GetResult(i, matchResult);
}
CShapeMatchFigure shapeMatchFigure = new CShapeMatchFigure();
//////////////////////////////////
// 공통 파라미터 설정
//////////////////////////////////

//////////////////////////////////
// 추가 옵션 설정
//////////////////////////////////

// 도형 설정
CFLRegion flrg = new CFLRegion();
CFLPoint<double> flp = new CFLPoint<double>();
flp.Set(100, 0);
flrg.PushBack(flp);
flp.Set(200, 100);
flrg.PushBack(flp);
flp.Set(0, 100);
flrg.PushBack(flp);
shapeMatchFigure.SetFigureObject(flrg);
// 해당 도형 학습
shapeMatchFigure.Learn();

// 도형 검출
shapeMatchFigure.Execute();

// 검출 결과를 가져옵니다.
long resultCount = shapeMatchFigure.GetResultCount();

for(long i = 0; i < resultCount; ++i)
{
    CShapeMatchFigureResult matchResult = new CShapeMatchFigureResult();
    shapeMatchFigure.GetResult(i, ref matchResult);
}
shapeMatchFigure = CShapeMatchFigure()
######################
# 공통 파라미터 설정
######################

######################
# 추가 옵션 설정
######################

# 도형 설정
flrg = CFLRegion()
flp = CFLPoint[Double]()
flp.Set(100, 0)
flrg.PushBack(flp)
flp.Set(200, 100)
flrg.PushBack(flp)
flp.Set(0, 100)
flrg.PushBack(flp)
shapeMatchFigure.SetFigureObject(flrg)
# 해당 도형 학습
shapeMatchFigure.Learn()

# 도형 검출
shapeMatchFigure.Execute()

# 검출 결과를 가져옵니다.
resultCount = shapeMatchFigure.GetResultCount()

for i in range(resultCount):
    matchResult = CShapeMatchFigureResult()
    shapeMatchFigure.GetResult(i, matchResult)

5 관련 알고리즘

CShapeMatchCircle, CShapeMatchEllipse, CShapeMatchLine, CShapeMatchCross, CShapeMatchRectangle