Shape Match Line

1 개요

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

2 알고리즘 상세 설명

Result
Detect Result
Fig. Shape Match Line

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

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

4 예제 코드

CShapeMatchLine shapeMatchLine;
//////////////////////////////////
// 공통 파라미터 설정
//////////////////////////////////

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

// 선 길이 설정
shapeMatchLine.SetLength(365);
// 해당 도형 학습
shapeMatchLine.Learn();

// 검출 색상 변화 설정
shapeMatchLine.SetTransitionType(CShapeMatchLine::ETransitionType_DarkToBright);
// 검출 기본 각도 설정
shapeMatchLine.SetScaleRange(0.95, 1.05);
// 검출 기본 각도 설정
shapeMatchLine.SetAngleBias(90);
// 도형 검출
shapeMatchLine.Execute();

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

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

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

// 선 길이 설정
shapeMatchLine.SetLength(365);
// 해당 도형 학습
shapeMatchLine.Learn();

// 검출 색상 변화 설정
shapeMatchLine.SetTransitionType(CShapeMatchLine.ETransitionType.DarkToBright);
// 검출 기본 각도 설정
shapeMatchLine.SetScaleRange(0.95, 1.05);
// 검출 기본 각도 설정
shapeMatchLine.SetAngleBias(90);
// 도형 검출
shapeMatchLine.Execute();

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

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

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

# 선 길이 설정
shapeMatchLine.SetLength(365)
# 해당 도형 학습
shapeMatchLine.Learn()

# 검출 색상 변화 설정
shapeMatchLine.SetTransitionType(CShapeMatchLine.ETransitionType.DarkToBright)
# 검출 기본 각도 설정
shapeMatchLine.SetScaleRange(0.95, 1.05)
# 검출 기본 각도 설정
shapeMatchLine.SetAngleBias(90)
# 도형 검출
shapeMatchLine.Execute()

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

for i in range(resultCount):
    matchResult = CShapeMatchLineResult()
    shapeMatchLine.GetResult(i, matchResult)

5 관련 알고리즘

CShapeMatchCircle, CShapeMatchEllipse, CShapeMatchRectangle, CShapeMatchCross, CShapeMatchFigure