Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I find a picture in the screen and click on it if it matches another picture file?

example: I have a "face.jpg" (a file containing a picture of a person's face) and I wanna find the x,y coordinates of that picture that would exactly match my "eye.jpg" (a cropped eye from face.jpg and saved the eye as eye.jpg) and click it with a mouse. my code needs to find that eye.jpg image on the face.jpg and return the x,y mouse coordinates / click it.

if that make sense :| thanks a lot in advance!!!

I already know how to move the mouse and click, i just need to get the x,y on my screen where eye.jpg was found in face.jpg.
Posted
Updated 3-Feb-11 17:47pm
v4
Comments
Henry Minute 3-Feb-11 16:41pm    
Which part of this are you stuck on?

Is your code throwing exceptions? If so then show the code giving problems together with a full description of the error.
fjdiewornncalwe 3-Feb-11 21:10pm    
OP's Comment: i know how to compare images and i know how to move the mouse. what i dont get is getting the pixel and returning the x & y coordinates on where it was found.
fjdiewornncalwe 3-Feb-11 21:11pm    
As per your comment, perhaps that information would have been useful upfront. The point of my answer was that you would ask something more specific and you have. Now perhaps you will get a better answer.

Where is your image? it must be in some form of control, say ImageBox? right. You can call the Control.PointToScreen[^] to get the point (left,top) poistion of your control. Once you have that you can get the Control.Size[^]to get the width and hight of your control. Armed with this, you can simulate mouse click.
 
Share this answer
 
For image comparison, check this.
To click the mouse programmatically, check this.
Now go forth and code. When you have issues in the code, feel free to ask a more specific question to get a more specific answer.
 
Share this answer
 
Comments
fjdiewornncalwe 3-Feb-11 21:09pm    
Moved from OPs answer: i know how to compare images and i know how to move the mouse. what i dont get is getting the pixel and returning the x & y coordinates on where it was found.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900