python program that scans a page for a specific combination of pixels?
I'm trying to write a python program that will take a screen shot and then scan the image for a specific combination of pixels, or pattern. For example: it takes a screen shot of a web page and scans the whole image for a 10X10 pixel pattern. It would also be nice if it could record the x-y position of the image on the screen.
I searched the internet for hours for a solution but found nothing. I only know the basics of python and 开发者_如何学Pythonwouldn't know where to begin with this program.
Take a look at some basic pattern recognition and machine vision literature. In order to address your question considerably more detail is needed.
- Is the pattern a binary image, a grayscale image, or a color image?
- How often do you need to do this?
- Have you looked at the Python Imaging Library (PIL)?
- How big of an image do you want to search?
A good course of action is to look at PIL, and then look at convolution in Fourier space to localize the target regions (relatively) quickly. Finally, a good Google search is your friend.
精彩评论