void CMFC_CAMDlg::OnPaint()
{
 if (IsIconic())
 {
  CPaintDC dc(this);
  SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

  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;

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


 if (m_Image){

  CDC *pDC;
  pDC = m_ctrlPic.GetDC();
  CRect rect;
  m_ctrlPic.GetClientRect(rect);

  rect.top = 0;  rect.left = 0;
  rect.right = 640; rect.bottom = 480;
 // m_cImage.CopyOf(m_Image);
  m_cImage.CopyOf(m_grayImg);
  m_cImage.DrawToHDC(pDC->m_hDC, rect);


   ReleaseDC(pDC);
 }


}

HCURSOR CMFC_CAMDlg::OnQueryDragIcon()
{
 return static_cast<HCURSOR>(m_hIcon);
}


void CMFC_CAMDlg::OnTimer(UINT_PTR nIDEvent)
{
 
 if (m_capture){
  m_Image = cvQueryFrame(m_capture);
  
 // m_grayImg = cvCreateImage(cvGetSize(m_Image), m_Image->depth, 1);
 
  cvCvtColor(m_Image, m_grayImg, CV_BGR2GRAY);

 // cvCanny(m_grayImg, m_grayImg, g_val, g_val2, g_aperture);
 // cvCanny(m_grayImg, m_grayImg, 150, 500, 3);
  cvCanny(m_grayImg, m_grayImg, m_threshold01, m_threshold02, m_mask);
  cvFlip(m_grayImg, m_grayImg, 1);

  Invalidate(FALSE);

}

 CDialog::OnTimer(nIDEvent);
}

'OpenSTUDY > CameraVision' 카테고리의 다른 글

cvFlip  (0) 2011.11.05
CreateVideoWriter  (0) 2011.11.02
CaptureFromAVI  (0) 2011.11.02
openCV 2.1 시작  (0) 2011.10.22
CAM Shift  (0) 2011.10.18

+ Recent posts