| 394 | |
| 395 | } |
| 396 | void CMatchToolDlg::RefreshDstView () |
| 397 | { |
| 398 | HWND hWnd = (HWND)cvGetWindowHandle ("DstView"); |
| 399 | if (!hWnd || m_matDst.empty ()) |
| 400 | return; |
| 401 | CWnd* pWnd = CWnd::FromHandle (hWnd); |
| 402 | CDC* dc = pWnd->GetDC (); |
| 403 | CRect rect; |
| 404 | //將背景繪製上白色網格 |
| 405 | CBrush brush (HS_DIAGCROSS, RGB (200, 200, 200)); |
| 406 | ::GetWindowRect (GetDlgItem (IDC_STATIC_DST_VIEW)->m_hWnd, rect); |
| 407 | ScreenToClient (rect); |
| 408 | dc->FillRect (CRect (0, 0, rect.Width (), rect.Height ()), &brush); |
| 409 | |
| 410 | |
| 411 | Mat matResize; |
| 412 | Size size (int (m_dDstScale * m_matDst.cols), int (m_dDstScale * m_matDst.rows)); |
| 413 | resize (m_matDst, matResize, size); |
| 414 | imshow ("DstView", matResize); |
| 415 | resizeWindow ("DstView", size.width, size.height); |
| 416 | |
| 417 | ::ShowWindow (hWnd, SW_SHOW); |
| 418 | LearnPattern (); |
| 419 | pWnd->ReleaseDC (dc); |
| 420 | } |
| 421 | void CMatchToolDlg::DrawDashLine (Mat& matDraw, Point ptStart, Point ptEnd, Scalar color1, Scalar color2) |
| 422 | { |
| 423 | LineIterator itLine (matDraw, ptStart, ptEnd, 8, 0); |