Template Match(템플릿매칭) 소개 및 Source(소스)
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
해당 자료는 10페이지 까지만 미리보기를 제공합니다.
10페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

Template Match(템플릿매칭) 소개 및 Source(소스)에 대한 보고서 자료입니다.

목차

1. Template match 설명
2. Template match 상세 step 설명
3. Template match test 프로그램 설명
4. Template match 결과 설명

<첨부 파일 Template match test 프로그램 source>
- 설명 자료 : Template Matching.docx
- visual studio 2010 solution file : TestImageProcess.sln



▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒


[Debug]
  cximaged.dll
  cximaged.lib
  MFC42D.DLL
  msvcrtd.dll

[Release]
  cximaged.dll
  cximaged.lib
  MFC42D.DLL
  msvcrtd.dll

[TestImageProcess]
  [CxImage]
  [res]
  DlgTestImageProcess.cpp
  DlgTestImageProcess.h
  ReadMe.txt
  resource.h
  stdafx.cpp
  stdafx.h
  targetver.h
  TemplateMatch.cpp
  TemplateMatch.h
  TestImageProcess.aps
  TestImageProcess.cpp
  TestImageProcess.h
  TestImageProcess.rc
  TestImageProcess.vcxproj
  TestImageProcess.vcxproj.filters
  TestImageProcess.vcxproj.user
  vc100.pdb

ImageOriginal.bmp
Test.bmp
TestImageProcess.sln
TestImageProcess.suo



6.52MB
파일 46, 폴더 5


Template Matching.docx…………………………………………2p

본문내용

Template Matching

- Template Matching은 Pattern Recognition중 한 가지 기법이다.
- Target Image에서 Template Image와 유사한 부분이 어디에 위치했는지를 알려준다.
- Template Image와의 유사도를 계산할 때는 correlation을 이용한다. Correlation은 상관계수의
의미로 얼마나 연관성이 있느냐의 정도를 의미한다.
- Correlation을 계산하는 식은 아래와 같다.


- 전체 이미지에서 correlation을 계산하는 방법은 아래와 같다.

 ≪ 그 림 ≫


▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒




TemplateMatch.cpp


#include \\"StdAfx.h\\"
#include \\"TemplateMatch.h\\"

#include \\"CxImage/ximage.h\\"
#pragma comment(lib, \\"../Debug/cximaged.lib\\")

CTemplateMatch::CTemplateMatch(void)
{
    
}

CTemplateMatch::~CTemplateMatch(void)
{

}

CPoint CTemplateMatch::TemplateMatch(unsigned char* pSrc, unsigned char* pTemplate,
    int nX, int nY,
    int nTemplateX, int nTemplateY)
{
    CPoint pointRet;
    pointRet.x = -1;
    pointRet.y = -1;

    if(pSrc == NULL || pTemplate == NULL)
        return pointRet;

    if(nX <= 0 || nY <= 0)
        return pointRet;

    if(nTemplateX <= 0 || nTemplateY <= 0)
        return pointRet;

    float retCorrelation = 0.0; // -1.0 <= correlation <= 1.0;

    // get x\'
    float avgTemplate = 0.0;
    for(int iSubRow = 0; iSubRow < nTemplateY ; iSubRow++)
    {
        for(int iSubCol = 0; iSubCol < nTemplateX ; iSubCol++)
        {
            int iPos = 0;
            iPos = (iSubRow * nTemplateX) + iSubCol;
            avgTemplate += pTemplate[iPos];
        }
    }
    avgTemplate /= (nTemplateX*nTemplateY);

    // create correlation array(for debug)
    float* pCorrelation = NULL;
    pCorrelation = new float[nX * nY];
    memset(pCorrelation, 0x00, sizeof(float) * nX * nY);
        
    // 1) Get Correlation
    int nMaxPos = 0;
    float nMaxValue = -1.0;
    int nRow = nY - (nTemplateY - 1);
    int nCol = nX - (nTemplateX - 1);    

    for(int iRow = 0; iRow < nRow ; iRow++)
    {
        for(int iCol = 0; iCol < nCol ; iCol++)
        {
            // get y\'
            float avgOriginal = 0.0;
            int nSubRow = iRow + nTemplateY;
            int nSubCol = iCol + nTemplateX;
            for(int iSubRow = iRow; iSubRow < nSubRow ; iSubRow++)
            {                
                for(int iSubCol = iCol; iSubCol < nSubCol ; iSubCol++)
                {
                    int iPos = 0;
                    iPos = (iSubRow * nX) + iSubCol;
                    avgOriginal += pSrc[iPos];
                }
            }
  • 가격3,300
  • 페이지수48페이지
  • 등록일2013.12.19
  • 저작시기2013.12
  • 파일형식압축파일(zip)
  • 자료번호#898384
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니