Created
June 16, 2015 15:06
-
-
Save clarkzjw/e61f0be7b946fae5b450 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CHowOldDlg::OnBnClickedButton1() | |
{ | |
cv::Mat img = cv::imread("res/Test.jpeg"); | |
CDC *pDC = GetDlgItem(IDC_Pic)->GetDC(); | |
HDC hDC = pDC->GetSafeHdc(); | |
CRect rect; | |
GetDlgItem(IDC_Pic)->GetClientRect(&rect); | |
int rw = rect.right - rect.left; //the width of your picture control | |
int rh = rect.bottom - rect.top; | |
if (!img.data){ | |
MessageBox(_T("read picture fail!")); | |
cout << GetTime() << " [Error] " << "read picture fail!" << endl; | |
return; | |
} | |
cv::resize(img, img, cv::Size(rw, rh)); | |
IplImage iplimg = img; | |
m_CVvImageObj.CopyOf(&iplimg); | |
UpdateData(); | |
if (m_CVvImageObj.GetImage()){ | |
m_CVvImageObj.Show(pDC->GetSafeHdc(), 0, 0, rw, rh); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment