LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine the color of a pixel on any given point on the screen?

Solved!
Go to solution
Does anyone know if it is possible to get the hex color value of a particular pixel on the screen? And if so how would I do this? I'm trying to set up an application that can detect the color of an object in another (open) window and based on that will execute certain steps. Any help with this would be greatly appreciated.
0 Kudos
Message 1 of 9
(7,737 Views)

Hi P-ylezc,

if you are on Windows, then you can use this function.

 

Mike

0 Kudos
Message 2 of 9
(7,712 Views)
Thank you mike. I now understand a bit more about what I'm trying to do, but I'm still not sure how i would go about implementing this in a labview application. Could you clarify a bit more on that?
0 Kudos
Message 3 of 9
(7,690 Views)
Solution
Accepted by P-ylezc

Hi P-ylezc,

 

You'll need to use the Call Library Function Node to use GetPixel in LabVIEW.  Here is the document to the help file about configuring the node:

 

http://zone.ni.com/reference/en-XX/help/371361F-01/lvexcodeconcepts/configuring_the_clf_node/

 

In your case, this code will work:

 

getpixel.png 

 

Note this is on 32-bit Windows, you may need to tweak this depending on what your system is. 

Message 4 of 9
(7,663 Views)

I can't seem to set up the getDC and getPixel lib correctly (i.e., what are the arg names and type): does anyone have an example of what the parameters are set to ?

 

0 Kudos
Message 5 of 9
(7,085 Views)

I'm attaching a LabVIEW 8.6 version of this example, for those not able to use a VI Snippet.

 

 

0 Kudos
Message 6 of 9
(7,060 Views)

Thanks, Smootastic: You've been a great help !

0 Kudos
Message 7 of 9
(7,051 Views)

Hi, Smootastic

I met a problem, use this method is that in the development environment works well, but after the compiled(building EXE), it can't work, don't know why, do you have the same problem, I try it in Windows 7 and WinXP is the same problem. Can you and anybody help me?

0 Kudos
Message 8 of 9
(6,561 Views)
Message 9 of 9
(6,546 Views)