Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Can't identify pixel color over a live image

Can't identify pixel color over a live image

Scheduled Pinned Locked Moved C / C++ / MFC
c++dotnet
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wicked_guy
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • W wicked_guy

      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

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      how are you displaying the video images? Cleek | Image Toolkits | Thumbnail maker

      A 1 Reply Last reply
      0
      • C Chris Losinger

        how are you displaying the video images? Cleek | Image Toolkits | Thumbnail maker

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        yes I am displaying the video and at the same time trying to process the pixels. The problem is that the program doesn't seem to be responding as it does with still images.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups