Compare images to find differences

前端 未结 6 1823
一生所求
一生所求 2021-01-05 01:24

Task: I have a camera mounted on the end of our assembly line, which captures images of produced items. Let\'s for example say, that we produce tickets (with some text and p

6条回答
  •  花落未央
    2021-01-05 02:07

    I'd recommend looking at AForge Imaging library as it has a lot of really useful functions in it for this type of work.

    There are several methods you could use:

    1. Simple subtraction (template image - current) and see how many pixels are different. You'd probably want to threshold the results, i.e. only include pixels that are different by 10 or more (for instance).
    2. If the tickets can move about in the field-of-view then item 1) isn't going to work unless you can locate the ticket first. If for instance the ticket is white on a black background you could do a threshold on the image and that would give you a good idea of where the ticket was.
    3. Another technique I've used it before is "Model Finding" or "Pattern Matching", but I only know of a commercial library Matrox Imaging Library (or MIL) that contains these functions as they aren't trivial.

    Also you need to make sure you know which parts of the ticket are more important. For instance I guess that a missing logo or watermark is a big problem. But some areas could have variable text, such as a serial number and so you'd expect them to be different. Basically you might need to treat some areas of the image differently from others.

提交回复
热议问题