How to detect occurrencies of a small image in a larger image?
I would like to detect the occurrencies of a small image in a larger image, as well as coordinates.
开发者_运维百科How do I do it with C#/.NET?
Your question fits into the realm of computer vision. This is a branch of computing where even many of the simple problems require a fair understanding of image processing and algorithms. I recommend you implement a CV library like AForget.NET to simplify the task.
Basic strategy.
- Find descriptors that can fairly specifically describe (pinpoint) the small image and can be evaluated given a certain coordinate.
- Find ways to evaluate that descriptor function at various locations in the larger image.
- Find ways to make #2 fast. If not possible, go back to #1 and try another descriptor.
Useful ideas.
Phase correlation appears to be a hot technique on SO.
- http://en.wikipedia.org/wiki/Phase_correlation
- Phase correlation
- Detecting if two images are visually identical
- Numerical Pattern Matching
Image pyramid. (for its ability to speed up many classes of descriptors with minimal tinkering)
- http://en.wikipedia.org/wiki/Pyramid_(image_processing)
An extremely low-level way to do it would be to read in the file as a bitmap stream (assuming you can convert it to bitmap) and parse it to search for patterns. But your algorithm would have to be very, very refined. So basically, what P.Brian.Mackey said.
精彩评论