Can't identify pixel color over a live image
-
Hello Programmers, I am having a program that aquires live video signals and displays them on a picture holder. I am trying to identify the pixel color as the user clicks on the video screen. The program gave me an RGB number but obviously not correct. The following is the program on an MFC dialog based application. void CIdsSimpleLiveDlg::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CString hi; int ali; CWnd *pDesktop = GetDlgItem(IDC_DISPLAY); CDC *pDC = pDesktop->GetWindowDC(); COLORREF clr = pDC->GetPixel(point.x,point.y); ali = (GetRValue(clr)+GetGValue(clr)+GetBValue(clr))/3; hi.Format("%d",ali); AfxMessageBox(hi); pDesktop->ReleaseDC(pDC); CDialog::OnLButtonDown(nFlags, point); } Note that the notation 'IDC_DISPLAY' represents the ID of the picture holder. Thanks in advance
-
Hello Programmers, I am having a program that aquires live video signals and displays them on a picture holder. I am trying to identify the pixel color as the user clicks on the video screen. The program gave me an RGB number but obviously not correct. The following is the program on an MFC dialog based application. void CIdsSimpleLiveDlg::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CString hi; int ali; CWnd *pDesktop = GetDlgItem(IDC_DISPLAY); CDC *pDC = pDesktop->GetWindowDC(); COLORREF clr = pDC->GetPixel(point.x,point.y); ali = (GetRValue(clr)+GetGValue(clr)+GetBValue(clr))/3; hi.Format("%d",ali); AfxMessageBox(hi); pDesktop->ReleaseDC(pDC); CDialog::OnLButtonDown(nFlags, point); } Note that the notation 'IDC_DISPLAY' represents the ID of the picture holder. Thanks in advance
how are you displaying the video images? Cleek | Image Toolkits | Thumbnail maker
-
how are you displaying the video images? Cleek | Image Toolkits | Thumbnail maker