亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? easy pattern matchingdlg.cpp

?? EasyPattern Matching
?? CPP
字號(hào):
// Easy Pattern MatchingDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Easy Pattern Matching.h"
#include "Easy Pattern MatchingDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


//---------------------------------------------------------------------------
//  IMAQ:  GetImageDirectory sets up a logical default directory.  If you
//  move your executable, you will want to change this function.
//---------------------------------------------------------------------------
static const char* GetImageDirectory() {
    static char dir[512];
    if (*dir)
        return dir;
    GetModuleFileName(NULL, dir, 512);
    char* endOfPath = strrchr(dir, '\\') + 1;
    strcpy(endOfPath, "..\\Images");
    return dir;
}



/////////////////////////////////////////////////////////////////////////////
// CEasyPatternMatchingDlg dialog

CEasyPatternMatchingDlg::CEasyPatternMatchingDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CEasyPatternMatchingDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CEasyPatternMatchingDlg)
	m_matchScore = _T("750");
	m_rotationInvariance = FALSE;
	m_maxMatches = _T("1");
	m_matchesText = _T("");
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CEasyPatternMatchingDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CEasyPatternMatchingDlg)
	DDX_Control(pDX, IDC_LEARNING_TEXT, m_learningText);
	DDX_Control(pDX, ID_DO_SEARCH, m_doSearchButton);
	DDX_Control(pDX, ID_LEARN_TEMPLATE, m_learnTemplateButton);
	DDX_Control(pDX, ID_LOAD_IMAGES, m_loadImagesButton);
	DDX_Text(pDX, IDC_MATCH_SCORE, m_matchScore);
	DDV_MaxChars(pDX, m_matchScore, 4);
	DDX_Check(pDX, IDC_ROTATION_INVARIANCE, m_rotationInvariance);
	DDX_Text(pDX, IDC_MAX_MATCHES, m_maxMatches);
	DDX_Text(pDX, IDC_MATCHES_TEXT, m_matchesText);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CEasyPatternMatchingDlg, CDialog)
	//{{AFX_MSG_MAP(CEasyPatternMatchingDlg)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(ID_LOAD_IMAGES, OnLoadImages)
	ON_BN_CLICKED(ID_LEARN_TEMPLATE, OnLearnTemplate)
	ON_BN_CLICKED(ID_DO_SEARCH, OnDoSearch)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CEasyPatternMatchingDlg message handlers

BOOL CEasyPatternMatchingDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	//-----------------------------------------------------------------------
    //  IMAQ:  Initialize our images.
	//-----------------------------------------------------------------------
    templateImage = imaqCreateImage(IMAQ_IMAGE_U8, 0);
    searchImage = imaqCreateImage(IMAQ_IMAGE_U8, 0);
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CEasyPatternMatchingDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CEasyPatternMatchingDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}


//-----------------------------------------------------------------------
//  IMAQ:  From here down is new code.
//-----------------------------------------------------------------------

void CEasyPatternMatchingDlg::OnLoadImages() 
{
    //-----------------------------------------------------------------------
    //  Load the template and search images.
    //-----------------------------------------------------------------------
    char templateFile[512];
    char searchFile[512];
    strcpy(templateFile, GetImageDirectory());
    strcat(templateFile, "\\pmtemplate.png");
    strcpy(searchFile, GetImageDirectory());
    strcat(searchFile, "\\pcb03-06.png");
    if (!imaqReadFile(templateImage, templateFile, NULL, NULL)) {
        MessageBox("Unable to Read the Template File", "Error", MB_OK | MB_ICONEXCLAMATION);
        EndDialog(0);
    }    
    if (!imaqReadFile(searchImage, searchFile, NULL, NULL)) {
        MessageBox("Unable to Read the Search File", "Error", MB_OK | MB_ICONEXCLAMATION);
        EndDialog(0);
    }    
    //-----------------------------------------------------------------------
    //  Display them in a nice way.
    //-----------------------------------------------------------------------
    imaqSetWindowSize(TEMPLATE_WINDOW, 200, 100);
    imaqMoveWindow(TEMPLATE_WINDOW, imaqMakePoint(488, 1));
    imaqSetWindowTitle(TEMPLATE_WINDOW, "Template Image");
    imaqDisplayImage(templateImage, TEMPLATE_WINDOW, FALSE);
    imaqMoveWindow(SEARCH_WINDOW, imaqMakePoint(1, 258));
    imaqSetWindowTitle(SEARCH_WINDOW, "Search Image");
    imaqDisplayImage(searchImage, SEARCH_WINDOW, TRUE);
    //-----------------------------------------------------------------------
    //  Make the next button in the sequence active.
    //-----------------------------------------------------------------------
    m_loadImagesButton.EnableWindow(FALSE);
    m_learnTemplateButton.EnableWindow(TRUE);
}


void CEasyPatternMatchingDlg::OnLearnTemplate() 
{
    //-----------------------------------------------------------------------
    //  Learn the template.  Since this takes a while put up text to that
    //  effect and set the wait cursor.
    //-----------------------------------------------------------------------
    HCURSOR oldCursor = GetCursor();
    SetCursor(LoadCursor(NULL, IDC_WAIT));
    m_learningText.ShowWindow(SW_SHOW);
    m_learningText.SetWindowText("Learning.  This may take up to 20 seconds.");
    m_learningText.UpdateWindow();
    UpdateWindow();
    imaqLearnPattern(templateImage, IMAQ_LEARN_ALL);
    //-----------------------------------------------------------------------
    //  Done learning.  Restore the cursor, hide the old text, and enable the
    //  next button in the sequence.
    //-----------------------------------------------------------------------
    SetCursor(oldCursor);
    m_learningText.ShowWindow(SW_HIDE);
    m_learnTemplateButton.EnableWindow(FALSE);
    m_doSearchButton.EnableWindow(TRUE);
}


void CEasyPatternMatchingDlg::OnDoSearch() 
{
    //-----------------------------------------------------------------------
    //  Get the control values, then build the match options with those
    //  values.
    //-----------------------------------------------------------------------
    MatchPatternOptions matchOptions;
    UpdateData(TRUE);
    matchOptions.mode = m_rotationInvariance ? IMAQ_MATCH_ROTATION_INVARIANT : IMAQ_MATCH_SHIFT_INVARIANT;
    matchOptions.minContrast = 10;
    matchOptions.subpixelAccuracy = FALSE;
    matchOptions.numMatchesRequested = atoi(m_maxMatches);
    if (matchOptions.numMatchesRequested < 1) {
        matchOptions.numMatchesRequested = 1;
        m_maxMatches.Format("%d", 1);
    }
    matchOptions.minMatchScore = (float) atof(m_matchScore);
    if (matchOptions.minMatchScore < 0) {
        matchOptions.minMatchScore = 0;
        m_matchScore.Format("%d", 0);
    }
    if (matchOptions.minMatchScore > 1000) {
        matchOptions.minMatchScore = 1000;
        m_matchScore.Format("%d", 1000);
    }
    matchOptions.numRanges = 0;
    matchOptions.angleRanges = NULL;
    matchOptions.matchFactor = 0;
    //-----------------------------------------------------------------------
    //  Now do the match
    //-----------------------------------------------------------------------
    int numMatches;
    PatternMatch* report = imaqMatchPattern(searchImage, templateImage, &matchOptions, IMAQ_NO_RECT, &numMatches);
    if (!report) {
        char* err = imaqGetErrorText(imaqGetLastError());
        MessageBox(err, "Error", MB_ICONEXCLAMATION | MB_OK);
        imaqDispose(err);
        EndDialog(0);
    }
    //-----------------------------------------------------------------------
    //  Put the number of matches found on the dialog & draw the matches on
    //  the image.  After that, we are done with the report so dispose it.
    //-----------------------------------------------------------------------
    m_matchesText.Format("Matches Found: %d", numMatches);
    UpdateData(FALSE);
    RGBValue red = {0x20, 0x20, 0xff, 0};
    DrawBoxAroundMatches(report, numMatches, red, SEARCH_WINDOW);
    imaqDispose(report);
}


void CEasyPatternMatchingDlg::DrawBoxAroundMatches (const PatternMatch* report, int numMatches, RGBValue boxColor, int windowNumber) {
    int i, j;
    Point approxCorner[4];
    Overlay* overlay;
    ContourID boxContour;
    ROI* overlayROI;
    
    //-----------------------------------------------------------------------
    //  Create the ROI we'll make the overlay from, then iterate over each
    //  match.
    //-----------------------------------------------------------------------
    overlayROI = imaqCreateROI();
    for (i = 0; i < numMatches; ++i) {
        //-------------------------------------------------------------------
        // Find the nearest pixel to each corner of the match.
        //-------------------------------------------------------------------
        for (j = 0; j < 4; ++j) {
            approxCorner[j].x = (int) (report[i].corner[j].x + 0.5);
            approxCorner[j].y = (int) (report[i].corner[j].y + 0.5);
        }
        //-------------------------------------------------------------------
        //  Add a contour for that box and make it the desired color.
        //-------------------------------------------------------------------
        boxContour = imaqAddClosedContour (overlayROI, approxCorner, 4);
        imaqSetContourColor (overlayROI, boxContour, &boxColor);
    }
    //-----------------------------------------------------------------------
    //  Now that we have the ROI, make an overlay from it & attach that to
    //  the desired window.
    //-----------------------------------------------------------------------
    overlay = imaqCreateOverlayFromROI(overlayROI);
    imaqSetWindowOverlay(windowNumber, overlay);  
    imaqDispose(overlayROI);
    imaqDispose(overlay);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
97精品视频在线观看自产线路二| 日韩成人一级片| 一区二区三区精品久久久| 一区二区三区精品| 美女免费视频一区二区| 国产一区二区视频在线| 99re在线精品| 欧洲精品在线观看| 国产成人精品亚洲777人妖| 91色视频在线| 国产在线播放一区| 国产一区二区主播在线| 国产乱子伦一区二区三区国色天香| 国产一区在线观看麻豆| 成人黄色小视频| 美国十次了思思久久精品导航| 老司机精品视频在线| 蜜桃视频免费观看一区| 国产精品1024久久| 成人a级免费电影| 欧美精品电影在线播放| 国产农村妇女毛片精品久久麻豆 | 亚洲色大成网站www久久九九| 五月天久久比比资源色| 国产成人午夜高潮毛片| 91精品国产一区二区人妖| 国产精品乱码久久久久久| 日本亚洲三级在线| 在线观看区一区二| 中文字幕欧美日韩一区| 欧美aaa在线| 一本大道久久a久久精品综合 | 国产毛片一区二区| 欧美三级韩国三级日本一级| 国产午夜精品久久久久久免费视| 亚洲一区在线视频| 国产成人精品免费网站| 日韩一区二区三区在线视频| 亚洲国产精品精华液网站| 亚洲二区在线视频| 精品在线观看免费| 在线免费视频一区二区| 欧美国产精品中文字幕| 另类的小说在线视频另类成人小视频在线| 91亚洲国产成人精品一区二三| www一区二区| 日本午夜一本久久久综合| 欧美亚洲动漫制服丝袜| 国产色91在线| 九九视频精品免费| 欧美精品久久天天躁| 亚洲与欧洲av电影| 99久久久久久| 国产精品丝袜在线| 国产成人精品亚洲日本在线桃色 | 午夜久久久久久电影| 91精品福利视频| 亚洲三级在线免费观看| av综合在线播放| 国产日韩欧美不卡在线| 黄色精品一二区| 日韩免费电影一区| 欧美aⅴ一区二区三区视频| 欧美日韩精品一区视频| 白白色 亚洲乱淫| 久草在线在线精品观看| 大胆欧美人体老妇| 国产三级欧美三级| 国产一区二区精品久久| 久久久久久久久久久久电影| 美女视频免费一区| 26uuu精品一区二区在线观看| 欧美aⅴ一区二区三区视频| 日韩三级在线观看| 美女免费视频一区二区| 日韩精品一区二| 精品一区二区免费| 精品国产一区二区在线观看| 九一久久久久久| 久久久久一区二区三区四区| 国产精品一区三区| 国产精品毛片久久久久久| 99久久99久久精品国产片果冻 | 丁香天五香天堂综合| 亚洲国产精品国自产拍av| 懂色一区二区三区免费观看| 中文字幕亚洲综合久久菠萝蜜| 99精品在线免费| 亚洲一区二区三区视频在线| 欧美日韩一区成人| 麻豆成人久久精品二区三区红 | 成人综合婷婷国产精品久久| 国产精品亲子乱子伦xxxx裸| 成人av电影在线网| 亚洲精品久久7777| 欧美日韩日日摸| 蜜桃视频在线观看一区二区| 久久综合av免费| 国产91丝袜在线播放九色| 国产精品久久久99| 欧美私人免费视频| 老汉av免费一区二区三区| 久久亚洲综合色| 国产精品久久久久婷婷二区次| youjizz国产精品| 亚洲一区电影777| 91精品国产综合久久精品性色| 激情综合网av| 亚洲欧美怡红院| 8x福利精品第一导航| 国产毛片精品视频| 亚洲与欧洲av电影| 久久综合色之久久综合| 91论坛在线播放| 久久99热国产| 亚洲女人****多毛耸耸8| 在线播放国产精品二区一二区四区 | 日本aⅴ精品一区二区三区| 26uuu国产在线精品一区二区| 99久久综合精品| 日本美女一区二区三区| 欧美激情在线一区二区| 欧美在线色视频| 国产乱理伦片在线观看夜一区| 亚洲日本在线a| 日韩欧美一区二区不卡| 欧美亚洲高清一区| 欧美精品777| 首页欧美精品中文字幕| 久久精品水蜜桃av综合天堂| 91黄色免费看| 国产一区二区看久久| 亚洲国产精品久久人人爱蜜臀| 久久久久久久综合狠狠综合| 91福利精品视频| 国产伦精品一区二区三区免费 | 91久久精品一区二区二区| 狠狠色丁香久久婷婷综合丁香| 亚洲精品国产a久久久久久| 日韩一区二区在线免费观看| av一区二区三区在线| 久久99精品视频| 亚洲激情在线激情| 国产自产视频一区二区三区| 亚洲精品va在线观看| 欧美激情综合五月色丁香小说| 欧美日韩国产小视频在线观看| 国产成人精品午夜视频免费| 日韩福利视频网| 亚洲一区二区在线免费观看视频| 日韩精品一区二| 欧美日韩午夜精品| 91蝌蚪porny九色| 国产激情精品久久久第一区二区| 日韩av电影天堂| 亚洲夂夂婷婷色拍ww47| 国产精品夫妻自拍| 久久精品亚洲麻豆av一区二区| 欧美美女一区二区| 色婷婷一区二区| 99久久777色| caoporm超碰国产精品| 国产自产视频一区二区三区| 日韩电影在线观看网站| 自拍视频在线观看一区二区| 久久精品人人做人人综合 | 国模一区二区三区白浆| 亚洲成av人片在线| 一区av在线播放| 亚洲黄色录像片| 自拍偷拍亚洲欧美日韩| 国产精品久久久99| 国产精品久久久爽爽爽麻豆色哟哟 | 国产精品久久久久久亚洲毛片| 久久亚洲一级片| 久久久综合精品| 欧美精品一区二区三区四区| 欧美一级精品大片| 91精品国产全国免费观看| 欧美日本不卡视频| 欧美乱妇20p| 欧美久久婷婷综合色| 欧美日韩一级黄| 91精品国产全国免费观看| 91精品国产综合久久婷婷香蕉 | 精品一二线国产| 激情深爱一区二区| 国产一区 二区 三区一级| 国产综合色产在线精品| 国产电影一区二区三区| 国产 欧美在线| 99久久伊人精品| 91偷拍与自偷拍精品| 色系网站成人免费| 欧美日韩高清在线播放| 欧美一区二区三区系列电影| 精品国产一区二区三区不卡| 精品国产123| 亚洲欧洲一区二区在线播放| ㊣最新国产の精品bt伙计久久|