Algorithm/method for printing quality visual inspection

Discussion in 'Math' started by anhnha, Jul 7, 2015.

  1. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    774
    48
    Hi,

    I am working in Visual Inspection and we are checking for printing quality.
    The printing (characters, numbers and symbols) should not have holes, indentation.
    protrusion to some degree as in the picture.
    I am thinking about an algorithm or checking method to inspect
    if a symbol is OK or not.

    The algorithm/method should satisfy the following condition:

    It can applied for all (or most of) printed characters, numbers and symbols.

    I think a lot but couldn't come up with a working one.
    Hope some members here can give me some ideas. Thanks.


    Printing Quality.PNG
     
  2. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,810
    834
    Just an idea. I did something like this once. Do you have images of perfect characters? Assuming so, match the image under test to its corresponding test image. Then align the characters and bit wise XOR each pixel. Those pixels that are still set are the printing errors.

    Problems to solve.
    • Isolating characters to test
    • Identifying character
    • Determining range of pixel count that indicates a perfect match (if number of pixels in XORed image < value, it's a perfect match to account for slight mismatches in scale or alignment)
    • Possible processing of XORed image to determine error type
     
  3. wayneh

    Expert

    Sep 9, 2010
    12,145
    3,054
    This is a great example of something that's easy for a human but darn tough for a machine.

    I'm wondering if OCR software might be adapted for helping here. It would already have the ability to identify what the character should look like, and compare it to standard characters, and even to produce an "error function" to indicate how much it deviates from the standard.
     
  4. panic mode

    Senior Member

    Oct 10, 2011
    1,321
    304
    already exist as part of machine vision products ($$$). but there is also OpenCV which is open source and should work with any camera but have not tried it myself.
     
  5. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    774
    48
    Thanks for these ideas!
    @disfantasi:

    I have images of perfect characters. Also, I already tried your idea two weeks ago.
    After doing alignment and XOR, I checked for error on XORed image. My checking method is as follow:
    1. Create or choose an image of perfect character for master.
    2. Capture picture of target character (the one needs to be inspected)
    3. Make alignment
    4. XOR and create XORed image
    5. Inspect XORed image (Binary --> Count number of pixels on this image)

    However, there is a problem with this method.

    1. It needs extremely good alignment. The alignment difference only one pixel can cause a big difference in XORed image.
    2. There are some properties of printing making it hard for inspection.
    Some characters are bigger than the perfect character but they are still OK because although they are bigger but bigger in all directions and there is no indentation, protrusion .

    @wayneh:
    Actually, we can know which character before checking so OCR is not necessary here. However, I am having problem in comparing between
    target character and standard character to find out the error.

    @panic mode:
    Could you send me the link or suggest a checking method?
     
  6. wayneh

    Expert

    Sep 9, 2010
    12,145
    3,054
    You may be underestimating what the OCR software can do. I suspect it does exactly what you need internally, but does not normally report those results to the user. I's start digging around in the open-source OCR software forum and see if anyone there knows more.
     
  7. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,810
    834
    If you have already tried it, I don't want to belabor the approach. However, I thought I had specified scaling the image as a requirement. Orthogonal scans should produce the scaling factors required so the master and target are the same size. Even in the case where a protrusion challenges this method, the result (a mismatch) is the correct one. There still remains the possibility of also requiring a rotation, but depending on your scanning methodology, this s minimized. However, existing OCR technology would have all this accounted for. Let's see what wayneh comes up with.
     
  8. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    774
    48
    I am reading about tesseract but it is hard to understand. If the character is rotated, is there a good way to detect rotation angle?
     
  9. panic mode

    Senior Member

    Oct 10, 2011
    1,321
    304
  10. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    774
    48
    Do you think that the pattern matching method will work here?
     
Loading...