开发者

Python + PIL screenshot comparing

I've made a program that compares screenshots grabbed by PIL, stored in a table and I use ImageChops.difference to compare them.

The program works pretty good but there is one problem. The exactly same screenshots (e.g if you take two screenshots of your desktop with 1 second interval) don't have the exactly same pixels. I found this by using Photoshop with a lot of zoom. So in some cases the program returns some wrong values.

Is there any way to get exactly same pixels from similar screenshots so I don't have to use thresholds? Or any other way to succeed high comparing accuracy for m开发者_开发百科y database?


I'm not sure which of your pixels are different, nor what differences you're looking for exactly, so it's a bit hard to give help.

Turning off all animations and desktop effects should help with getting consistent screenshots, of course. I'm sure one can write a tool that does this.

Also, saving the screenshots as JPEG (or any lossy format) is also right out, as I'm sure you know.

There's also a utility called pdiff which compares images based on perceptual differences, rather than straight value based differences. It might help you, depending on what you're actually trying to achieve.


Capis,

As far as I know Open CV is the best library for Image processing. I coded in C though. However it has a pythonic wrapper too. http://opencv.willowgarage.com/documentation/python/index.html Give it a shot.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜