MCPcopy Create free account
hub / github.com/DennisLiu1993/Fastest_Image_Pattern_Matching / LoadSrc

Method LoadSrc

MatchTool/MatchToolDlg.cpp:1683–1742  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1681}
1682
1683void CMatchToolDlg::LoadSrc ()
1684{
1685 CRect rectSrc;
1686 ::GetWindowRect (GetDlgItem (IDC_STATIC_SRC_VIEW)->m_hWnd, rectSrc);
1687 double dScaleX = rectSrc.Width () / (double)m_matSrc.cols;
1688 double dScaleY = rectSrc.Height () / (double)m_matSrc.rows;
1689 m_dSrcScale = min (dScaleX, dScaleY);
1690 m_dNewScale = m_dSrcScale;
1691 m_bShowResult = FALSE;
1692 m_iScaleTimes = 0;
1693 //防止顯示不同比例圖片時DC殘留
1694 CWnd* pWnd = GetDlgItem (IDC_STATIC_SRC_VIEW);
1695 pWnd->GetClientRect (&rectSrc);//得到控件客户端区域坐标
1696 pWnd->ClientToScreen (rectSrc);//将区域坐标由 控件客户区转成对话框区
1697 this->ScreenToClient (rectSrc); //将区域坐标由 对话框区转成对话框客户区坐标
1698 InvalidateRect (rectSrc);
1699 //防止顯示不同比例圖片時DC殘留
1700
1701 //Scroll Bar
1702 m_hScrollBar.SetScrollPos (0);
1703 m_vScrollBar.SetScrollPos (0);
1704 RefreshSrcView ();
1705 CString strSize;
1706 strSize.Format (L"%s : %d X %d", m_strLanSourceImageSize, m_matSrc.cols, m_matSrc.rows);
1707 m_statusBar.SetPaneText (1, strSize);
1708
1709 //Test
1710 //double d1 = clock ();
1711 //Mat matResult;
1712 //matchTemplate (m_matSrc, m_matDst, matResult, CV_TM_CCORR);
1713 //double d2 = clock ();
1714
1715 ////From ImageShop
1716 //matResult.create (m_matSrc.rows - m_matDst.rows + 1,
1717 // m_matSrc.cols - m_matDst.cols + 1, CV_32FC1);
1718 //matResult.setTo (0);
1719 //cv::Mat& matTemplate = m_matDst;
1720
1721 //int t_r_end = matTemplate.rows, t_r = 0;
1722 //for (int r = 0; r < matResult.rows; r++)
1723 //{
1724 // float* r_matResult = matResult.ptr<float> (r);
1725 // uchar* r_source = m_matSrc.ptr<uchar> (r);
1726 // uchar* r_template, *r_sub_source;
1727 // for (int c = 0; c < matResult.cols; ++c, ++r_matResult, ++r_source)
1728 // {
1729 // r_template = matTemplate.ptr<uchar> ();
1730 // r_sub_source = r_source;
1731 // for (t_r = 0; t_r < t_r_end; ++t_r, r_sub_source += m_matSrc.cols, r_template += matTemplate.cols)
1732 // {
1733 // *r_matResult = *r_matResult + IM_Conv_SIMD (r_template, r_sub_source, matTemplate.cols);
1734 // }
1735 // }
1736 //}
1737 //double d3 = clock ();
1738
1739 //double d = (d3 - d2) / (d2 - d1);
1740 //CString str; str.Format (L"%.3f", d); AfxMessageBox (str);

Callers

nothing calls this directly

Calls 2

WidthMethod · 0.80
HeightMethod · 0.80

Tested by

no test coverage detected