开发者

C# Find image match at screen

Hello, I know there are quite a few similar questions asked before but i've read all of them and they haven't given me the answer i am looking for.

What i want to do is, that i want to create a function that could get location (X,Y) of an specified image from the screen if it exists.

I would take a screenshot of the screen, specify the search area (rectangle), then see if it can find the color of the first pixel in the image i'm searching for, if it does it'll check if it can find the last pixel of the image i'm searching for at the distance of images height n' width. If it does find a match, then it'll check 10-20 pixels from the center and see if the matching image has been found, if yes, then it'll return the coordinates of the first pixel.

FindBitmap( int[] Image, int x1, int y1, int x2, int y2 )

Image would be the pixel array of the searchable image

X1Y1开发者_如何学C would be the searchareas starting point while X2Y2 would be the ending point.

If anyone can give me directions on creating this function i'd greatly appreciate that.


Image recognition is quite complex concept. Based on your question i assume that you have the "exact" copy availble and you are trying to find it on the screen.

Use the GetPixel SetPixel on Bitmap at first and then optimize it using the LockBits. It's a great performance boost.

On a side note your solution is a bit of a "brute force" attempt.

There are better solutions like:

  • Neural Networks
  • Cross Correlation

Check out the AForge .Net library. It contains lot of functions used in image processing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜