Shape Match Rectangle

1 개요

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

2 알고리즘 상세 설명

Result
Detect Result
Fig. Shape Match Rectangle

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

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

4 예제 코드

CShapeMatchRectangle shapeMatchRectangle;
//////////////////////////////////
// 공통 파라미터 설정
//////////////////////////////////

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

// 사각형 크기 설정
shapeMatchRectangle.SetSize(60, 365);
// 각도 설정
shapeMatchRectangle.SetAngle(0);
// 해당 도형 학습
shapeMatchRectangle.Learn();

// 크기 범위 설정
shapeMatchRectangle.SetScaleRange(0.95, 1.05);
// 도형 검출
shapeMatchRectangle.Execute();

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

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

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

// 사각형 크기 설정
shapeMatchRectangle.SetSize(60, 365);
// 각도 설정
shapeMatchRectangle.SetAngle(0);
// 해당 도형 학습
shapeMatchRectangle.Learn();

// 크기 범위 설정
shapeMatchRectangle.SetScaleRange(0.95, 1.05);
// 도형 검출
shapeMatchRectangle.Execute();

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

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

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

# 사각형 크기 설정
shapeMatchRectangle.SetSize(60, 365)
# 각도 설정
shapeMatchRectangle.SetAngle(0)
# 해당 도형 학습
shapeMatchRectangle.Learn()

# 크기 범위 설정
shapeMatchRectangle.SetScaleRange(0.95, 1.05)
# 도형 검출
shapeMatchRectangle.Execute()

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

for i in range(resultCount):
    matchResult = CShapeMatchRectangleResult()
    shapeMatchRectangle.GetResult(i, matchResult)

5 관련 알고리즘

CShapeMatchCircle, CShapeMatchEllipse, CShapeMatchLine, CShapeMatchCross, CShapeMatchFigure