A method and device for color text printing ghosting quality inspection based on reference image

Through the method based on reference images, the color text printing ghosting is automatically detected, which solves the problem of manual detection in the prior art that is time-consuming, laborious and easy to miss the inspection, and realizes high-accuracy automated quality inspection.

CN118865397BActive Publication Date: 2024-11-29MICROPATTERN

Patent Information

Application Number
CN202411368824.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2024-11-29
Estimated Expiration
2044-09-29

AI Technical Summary

Technical Problem

In the prior art, when detecting the printing of colored text, manual inspection is required, which is time-consuming and laborious and easy to miss the inspection, resulting in the missed card certificate or paper.

Method used

Using a reference image-based method, the image to be quality-checked is obtained by shooting or scanning a printed object, and the object detection, segmentation, scaling and rotation processing is used to align it with the reference image. Then, the printing positions of each color channel are positioned in the color text area by using the template matching method, and the offset is calculated to determine whether there is ghosting.

Benefits of technology

Automatic printing quality inspection is realized, the accuracy of quality inspection is improved, the time and energy consumption of manual inspection is avoided, and the missed inspection of unqualified products is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118865397B_ABST
    Figure CN118865397B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for checking ghost images of color text printing based on a reference image, and relates to the technical field of image quality inspection. The image to be inspected is subjected to target detection or segmentation, and the target area is scaled and rotated to align it with the reference image; the reference image is used to locate the color text area therein, and based on the corresponding relationship between the reference image and the image to be inspected, the candidate area of ​​the color text area in the image to be inspected is determined. The image to be inspected and the reference image are both converted to the basic color space used by the printer. After the color space conversion, the printing position of each channel of the printed color text is located in the image to be inspected by using a template matching method. By comparing whether these positions are offset, it can be determined whether there is a ghosting phenomenon; the quality of the printing can be automatically inspected without manual processing, thereby improving the accuracy of quality inspection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image quality inspection, and in particular to a method and device for quality inspection of color text printing ghosting based on a reference image. Background Art

[0002] On some automated equipment, such as the card-making equipment for the Hong Kong and Macau Pass, it is usually necessary to print colored text on a card or paper with a background pattern and attach an anti-counterfeiting film. Color printers use 4 or 6 basic colors to create different colors. Taking a printer with 4 basic colors as an example, various colors are blended by combining cyan, magenta, yellow and black. If the print head of the printer is not aligned, the printing position of the printed colored text on different color channels will be offset, resulting in "ghosting" of the printed colored text. This ghosting will affect the clarity of the text, resulting in unqualified cards or printed paper. In some occasions where strict requirements are placed on the quality of cards, it is necessary to manually check the printed cards or paper to see if the printed colored fonts have "ghosting". This manual processing is not only time-consuming and labor-intensive, but also prone to missed inspections due to visual fatigue, resulting in unqualified cards or paper being missed. Summary of the invention

[0003] In order to solve the defects of the prior art in the detection of printed text defects, the present invention provides a method and device for color text printing ghosting quality inspection based on reference images. The following technical solutions are adopted:

[0004] A method for quality inspection of color text printing ghosting based on a reference image comprises the following steps:

[0005] Step 1, obtain the image to be inspected, obtain the reference image, and locate the color text area of ​​the reference image;

[0006] Step 2: Detect or segment the image to be inspected to obtain a target area, scale and rotate the target area to align the target area with the reference image, and obtain an aligned image;

[0007] Step 3, determining a candidate region of color text in the aligned image according to the correspondence between the aligned image and the reference image;

[0008] Step 4, intercepting the color text area of ​​the reference image and the candidate color text candidate area of ​​the alignment image, and performing color space conversion respectively, and converting them into the basic color space used by the printer;

[0009] Step 5, splitting the image after the color space is transformed into multiple single-channel images;

[0010] Step 6, using a template matching method to locate the printing position of each color channel in the candidate color text area;

[0011] Step 7, binarizing each single-channel image to obtain a single-channel binary image;

[0012] Step 8, using the binary image of a single channel of the reference image as a template, performing template matching in the binary image of the candidate color text area of ​​the corresponding color channel, taking the position with the highest matching degree as the best match, and obtaining the actual printing position of the single channel;

[0013] Step 9, obtaining the actual printing position for all channels, calculating the offsets between the two channels, and determining whether ghosting occurs based on the maximum value of all the offsets between the two channels.

[0014] By adopting the above technical solution, firstly, the image to be inspected is obtained by photographing or scanning the printed target. To reduce the interference of the background, when photographing the target, the target is placed on a pure color and contrasting background, such as a black background, and all the light around the target is blocked to prevent interference from other light. A suitable light source is used to illuminate the target, and the angle of the camera is adjusted so that the camera looks down at the target to prevent affine transformation of the target. A scanner can also be used to scan the printed target and intercept the target area.

[0015] Subsequently, the image to be inspected is subjected to target detection or segmentation to identify and extract the target area. For a more accurate comparison, the target area is scaled and rotated to align it with the reference image. Next, the reference image is used to locate the color text area therein, and based on the correspondence between the reference image and the image to be inspected, the candidate area of ​​the color text area in the image to be inspected is determined. For a more accurate color comparison, both the image to be inspected and the reference image are converted to the basic color space used by the printer. After the color space conversion, the template matching method is used to locate the printing position of each channel of the printed color text in the image to be inspected. By comparing whether these positions are offset and the offset amount, it can be determined whether there is a ghosting phenomenon.

[0016] The printing quality can be automatically inspected without manual processing, thus improving the accuracy of quality inspection.

[0017] Optionally, in step 1, the reference image is an image provided to a printing device, and the color text area of ​​the reference image is located according to the typesetting information.

[0018] By adopting the above technical solution, since the reference image is an image provided to the printing device, the color text area can be obtained by using prior knowledge, such as obtaining the color text area according to typesetting information.

[0019] Optionally, the specific method of step 2 is: extracting a grayscale image from the quality inspection image, then performing threshold segmentation on the grayscale image, extracting the largest connected domain from the segmentation result as the target area, rotating and scaling the target area to align the target area with the reference image.

[0020] By adopting the above technical solution, for more accurate comparison, the target area will be scaled and rotated to align it with the reference image. Under a controllable environment (controllable light source, controllable background), extract the grayscale image of the quality inspection image, and then perform simple threshold segmentation (such as OTSU) on the grayscale image. For the segmentation result, extract the largest connected domain as the target area, rotate and scale the target area to align it with the reference image. You can also use target detection or key point positioning algorithms to detect the position or key points of the target to extract the target area.

[0021] Optionally, in step 4, the basic color space used by the printer is the CMYK color space. In step 5, the image in the CMYK color space is split to obtain images of four channels, C, M, Y and K, and the image of each channel is a grayscale image.

[0022] By adopting the above technical solution, the printer that prints the card can combine 4 or 6 basic colors into different colors. CMYK is a subtractive color mixing space. The amount of ink is determined by the values ​​of C, M, Y and K. Binarization is performed in a single channel, which helps to segment the printed text area in a complex background.

[0023] Optionally, in step 8, template matching is implemented by an XOR operation, and the matching degree is calculated according to the following formula:

[0024] ;

[0025] in represents the matching degree, T(x,y) represents the value of the template image at the position (x,y) after binarization, S(i,j,x,y) represents the value of the sub-image S(i,j) at the position (x,y) of the search image at (i,j), Represents the exclusive OR operation.

[0026] By adopting the above technical solution, the foreground (i.e., printed text) of the image after binarization is white and the background is black. Through the XOR operation, when the template image at (x, y) and the search image at (x, y) are both foreground or both background, they match at this pixel and the XOR result is 0. Otherwise, they are judged as not matching and the XOR result is 1. The proportion of the number of non-matching pixels to all pixels is counted, and the matching degree is 1 minus the proportion. On the one hand, a suitable binarization algorithm can reduce the interference of complex backgrounds, and on the other hand, the use of logical XOR operations can speed up template matching.

[0027] Optionally, the matching degree ranges from [0,1], where a higher value indicates a better match.

[0028] Optionally, obtain the actual printing position for all channels, calculate the offsets between the two channels, and determine whether ghosting occurs based on the maximum value of all the offsets between the two channels. When the maximum value exceeds the threshold T, it is determined that ghosting occurs. Taking the CMYK color space as an example, obtain the actual printing position of the text on the C, M, Y, and K channels respectively. Let's set them as C_loc, M_loc, Y_loc, and K_loc, and define the ghosting degree:

[0029] ;

[0030] D(m,n) represents the Euclidean distance between two points in two-dimensional space. When t>T, it is judged that ghosting occurs.

[0031] A color text printing ghosting quality inspection device based on reference images comprises an imaging device, a memory and a processor. The imaging device is used to image a quality inspection target, obtain an image to be inspected, and store it in the memory. The memory stores a color text printing ghosting quality inspection program designed using a color text printing ghosting quality inspection method based on a reference image. The processor is communicatively connected with the memory, runs the color text printing ghosting quality inspection program, inputs the image to be inspected into the color text printing ghosting quality inspection program, and outputs a quality inspection result.

[0032] Optionally, a display is also included, and the processor controls the display to display the quality inspection results.

[0033] In summary, the present invention includes at least the following beneficial technical effects:

[0034] The present invention can provide a method and device for checking ghost images of color text printing based on a reference image. First, the image to be checked is obtained by photographing or scanning a printed target. Subsequently, the image to be checked is subjected to target detection or segmentation to identify and extract the target area. In order to make a more accurate comparison, the target area is scaled and rotated to align it with the reference image. Next, the reference image is used to locate the color text area therein, and based on the corresponding relationship between the reference image and the image to be checked, the candidate area of ​​the color text area in the image to be checked is determined. In order to make a more accurate color comparison, both the image to be checked and the reference image are converted to the basic color space used by the printer. After the color space conversion, the printing position of each channel of the printed color text is located in the image to be checked by using a template matching method. By comparing whether these positions are offset, it can be determined whether ghosting occurs; the quality of the printing can be automatically checked without manual processing, thereby improving the accuracy of the quality inspection. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 It is a flow chart of a method for quality inspection of color text printing ghosting based on a reference image of the present invention;

[0036] Figure 2 This is a schematic diagram comparing normal printing and ghosting effects;

[0037] Figure 3 It is a schematic diagram of an image to be inspected and a reference image according to a specific embodiment of the present invention. DETAILED DESCRIPTION

[0038] The present invention is further described in detail below in conjunction with the accompanying drawings.

[0039] The embodiment of the invention discloses a method and device for color text printing ghosting quality inspection based on a reference image.

[0040] Reference Figure 1-Figure 3 , a color text printing ghosting quality inspection method based on a reference image, comprising the following steps:

[0041] Step 1, obtain the image to be inspected, obtain the reference image, and locate the color text area of ​​the reference image;

[0042] Step 2: Detect or segment the image to be inspected to obtain a target area, scale and rotate the target area to align the target area with the reference image, and obtain an aligned image;

[0043] Step 3, determining a candidate region of color text in the aligned image according to the correspondence between the aligned image and the reference image;

[0044] Step 4, intercepting the color text area of ​​the reference image and the candidate color text candidate area of ​​the alignment image, and performing color space conversion respectively, and converting them into the basic color space used by the printer;

[0045] Step 5, splitting the image after the color space is transformed into multiple single-channel images;

[0046] Step 6, using a template matching method to locate the printing position of each color channel in the candidate color text area;

[0047] Step 7, binarizing each single-channel image to obtain a single-channel binary image;

[0048] Step 8, using the binary image of a single channel of the reference image as a template, performing template matching in the binary image of the candidate color text area of ​​the corresponding color channel, taking the position with the highest matching degree as the best match, and obtaining the actual printing position of the single channel;

[0049] Step 9, obtaining the actual printing position for all channels, calculating the offsets between the two channels, and determining whether ghosting occurs based on the maximum value of all the offsets between the two channels.

[0050] First, obtain the image to be inspected by photographing or scanning the printed target. To reduce background interference, place the target on a pure color and contrasting background, such as a black background, and block all light around the target to prevent interference from other light. Use a suitable light source to illuminate the target, adjust the camera angle so that the camera looks down at the target to prevent affine transformation of the target; you can also use a scanner to scan the printed target and capture the target area.

[0051] Subsequently, the image to be inspected is subjected to target detection or segmentation to identify and extract the target area. For a more accurate comparison, the target area is scaled and rotated to align it with the reference image. Next, the reference image is used to locate the color text area therein, and based on the correspondence between the reference image and the image to be inspected, the candidate area of ​​the color text area in the image to be inspected is determined. For a more accurate color comparison, both the image to be inspected and the reference image are converted to the basic color space used by the printer. After the color space conversion, the template matching method is used to locate the printing position of each channel of the printed color text in the image to be inspected. By comparing whether these positions are offset and the offset amount, it can be determined whether there is a ghosting phenomenon.

[0052] The printing quality can be automatically inspected without manual processing, thus improving the accuracy of quality inspection.

[0053] In step 1, the reference image is an image provided to the printing device, and the color text area of ​​the reference image is located according to the typesetting information.

[0054] Since the reference image is an image provided to the printing device, the color text area can be obtained by using prior knowledge, such as obtaining the color text area according to typesetting information.

[0055] The specific method of step 2 is: extract a grayscale image from the quality inspection image, then perform threshold segmentation on the grayscale image, extract the largest connected domain from the segmentation result as the target area, rotate and scale the target area to align the target area with the reference image.

[0056] For more accurate comparison, the target area will be scaled and rotated to align it with the reference image. Under a controllable environment (controllable light source, controllable background), extract the grayscale image of the quality inspection image, and then perform simple threshold segmentation (such as OTSU) on the grayscale image. For the segmentation result, extract the largest connected domain as the target area, rotate and scale the target area to align it with the reference image. You can also use target detection or key point positioning algorithms to detect the position or key points of the target to extract the target area.

[0057] In step 4, the basic color space used by the printer is the CMYK color space. In step 5, the image in the CMYK color space is split to obtain images of four channels, C, M, Y and K. The image of each channel is a grayscale image.

[0058] The printer that prints the card creates different colors by combining 4 or 6 basic colors, such as the CMYK color space.

[0059] In step 8, template matching is implemented using an XOR operation, and the matching degree is calculated according to the following formula:

[0060] ;

[0061] in represents the matching degree, T(x,y) represents the value of the template image at the position (x,y) after binarization, S(i,j,x,y) represents the value of the sub-image S(i,j) at the position (x,y) of the search image at (i,j), Represents the exclusive OR operation.

[0062] After the binarization, the foreground (i.e., the printed text) is white and the background is black. Through the XOR operation, when the template image at (x, y) and the search image at (x, y) are both foreground or both background, they match at this pixel and the XOR result is 0. Otherwise, they are judged as not matching and the XOR result is 1. The proportion of the number of non-matching pixels to all pixels is counted, and the matching degree is 1 minus the proportion. On the one hand, binarization is used to reduce the interference of complex backgrounds, and on the other hand, the logical XOR operation can speed up the template matching.

[0063] The matching degree ranges from [0,1], and the higher the value, the better the match.

[0064] Get the actual printing position for all channels, calculate the offsets between the two channels, and determine whether ghosting occurs based on the maximum value of all the offsets between the two channels. When the maximum value exceeds the threshold T, ghosting is considered to occur. Taking the CMYK color space as an example, get the actual printing position of the text on the C, M, Y, and K channels respectively. Let's set them as C_loc, M_loc, Y_loc, and K_loc, and define the ghosting degree:

[0065] ;

[0066] D(m,n) represents the Euclidean distance between two points in two-dimensional space. When t>T, it is judged that ghosting occurs.

[0067] A color text printing ghosting quality inspection device based on reference images comprises an imaging device, a memory and a processor. The imaging device is used to image a quality inspection target, obtain an image to be inspected, and store it in the memory. The memory stores a color text printing ghosting quality inspection program designed using a color text printing ghosting quality inspection method based on a reference image. The processor is communicatively connected with the memory, runs the color text printing ghosting quality inspection program, inputs the image to be inspected into the color text printing ghosting quality inspection program, and outputs a quality inspection result.

[0068] The device also includes a display, and the processor controls the display to display the quality inspection result.

[0069] The following uses a specific embodiment to illustrate the implementation principle of a method and device for color text printing ghosting quality inspection based on a reference image:

[0070] Take the quality inspection of Hong Kong and Macau Pass as an example. Hong Kong and Macau Pass usually prints personalized information on the card with background pattern. When "ghosting" detection is required, it is easy to be disturbed by the background pattern.

[0071] Scan the printed Hong Kong and Macau Pass and crop the document area to obtain the image to be inspected.

[0072] Because the scanning process can avoid background interference, there is no need for target detection or segmentation. You only need to scale the image to be inspected to align it with the reference image. After alignment, the image to be inspected has the same width and height as the reference image.

[0073] For the reference image, the position of the colored text area is obtained according to the prior knowledge of typesetting. If there is no prior knowledge of typesetting, the position of the text line can also be obtained by the text line detection method, and then the color value of the font is used to determine whether it is a colored area. There is a colored text line in the upper right corner of the Hong Kong and Macau Pass, and it is necessary to determine whether the text line has a double image, such as Figure 3 As shown in the figure, the upper half of each letter in the color text line is red, and the lower half is blue. The red part is composed of two primary colors, M and Y, and the blue part is composed of two primary colors, M and C. When the parameter image is converted to the CMYK color space, it can be seen that the C channel only has the lower half of the text line, the M channel can see all the complete text, and the Y channel only has the upper half of the text line.

[0074] For the aligned image to be inspected, the candidate area of ​​its color text is determined according to its correspondence with the reference image, such as directly expanding the position of the color text in the reference image appropriately as the candidate area of ​​the color text in the image to be inspected; similarly, a suitable range in the upper right corner of the image to be inspected is determined as the candidate area of ​​the color text.

[0075] The color text area of ​​the reference image and the candidate color text area of ​​the image to be inspected are intercepted, and the color spaces of the two are converted respectively to the basic color space used by the printer, such as the CMYK color space.

[0076] For the image after the color space is transformed, a single channel is split. For example, for the image in the CMYK color space, images of four channels C, M, Y and K are obtained. The image of each channel is a grayscale image. For red fonts, the printing device needs to print the text at the same position on the M and Y channels; and for blue fonts, the printing device needs to print the text at the same position on the C and M channels. Therefore, for the red characters in the reference image, the image is displayed as white characters on the M and Y channels, and the same black as the background on the C and K channels. The blue characters are displayed as white characters on the C and M channels, and the same black as the background on the Y and K channels.

[0077] The template matching method is used to locate the printing position of each color channel in the candidate color text area.

[0078] The image of each channel is binarized to obtain a single-channel binarized image. For example, the color text area and the candidate color text area of ​​the C channel are binarized respectively to obtain a binarized image.

[0079] Using the binary image of a single channel of the reference image as a template, perform template matching in the binary image of the candidate color text area of ​​the corresponding color channel; template matching can be quickly implemented using an XOR operation, and the matching degree is calculated according to the following formula:

[0080] ;

[0081] In the above formula, T(x,y) represents the value of the template image at position (x,y) after binarization, S(i,j,x,y) represents the value of the sub-image S(i,j) at position (x,y) of the search image at position (i,j), Indicates XOR operation. According to the above formula, the matching degree range is [0,1], and the higher the value, the better the match.

[0082] The position with the highest matching degree is taken as the best match to obtain the actual printing position of a single channel.

[0083] According to the above steps, the positions of the color characters in each color channel on the image to be inspected are obtained respectively. For the Hong Kong and Macau Pass, the printing positions of the color characters on the C, M and Y channels are obtained respectively. Let's set them as loc_C, loc_M and loc_Y respectively.

[0084] For loc_C, loc_M, and loc_Y, calculate the pairwise offsets and determine whether "ghosting" occurs based on the maximum value of the pairwise offsets.

[0085] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A color text printing ghosting quality inspection method based on reference image, characterized in that: The following steps are involved: Step 1, obtain the image to be inspected, obtain the reference image, and locate the color text area of ​​the reference image; Step 2: Detect or segment the image to be inspected to obtain a target area, scale and rotate the target area to align the target area with the reference image, and obtain an aligned image; Step 3, determining a candidate region of color text in the aligned image according to the correspondence between the aligned image and the reference image; Step 4, intercepting the color text area of ​​the reference image and the candidate color text candidate area of ​​the alignment image, and performing color space conversion respectively, and converting them into the basic color space used by the printer; Step 5, splitting the image after the color space is transformed into multiple single-channel images; Step 6, using a template matching method to locate the printing position of each color channel in the candidate color text area; Step 7, binarizing each single-channel image to obtain a single-channel binary image; Step 8, using the binary image of a single channel of the reference image as a template, performing template matching in the binary image of the candidate color text area of ​​the corresponding color channel, taking the position with the highest matching degree as the best match, and obtaining the actual printing position of the single channel; Step 9, obtaining the actual printing position for all channels, calculating the offsets between the two channels, and determining whether ghosting occurs based on the maximum value of all the offsets between the two channels.

2. The method for color text printing ghosting quality inspection based on reference image according to claim 1, characterized in that: In step 1, the reference image is an image provided to the printing device, and the color text area of ​​the reference image is located according to the typesetting information.

3. The method for color text printing ghosting quality inspection based on reference image according to claim 1, characterized in that: The specific method of step 2 is: extract a grayscale image from the quality inspection image, then perform threshold segmentation on the grayscale image, extract the largest connected domain from the segmentation result as the target area, rotate and scale the target area to align the target area with the reference image.

4. The method for color text printing ghosting quality inspection based on reference image according to claim 1, characterized in that: In step 4, the basic color space used by the printer is the CMYK color space. In step 5, the image in the CMYK color space is split to obtain images of four channels, C, M, Y and K. The image of each channel is a grayscale image.

5. The method for color text printing ghosting quality inspection based on reference image according to claim 1, characterized in that: In step 8, template matching is implemented using an XOR operation, and the matching degree is calculated according to the following formula: ; in represents the matching degree, T(x,y) represents the value of the template image at the position (x,y) after binarization, S(i,j,x,y) represents the value of the sub-image S(i,j) at the position (x,y) of the search image at (i,j), Represents the exclusive OR operation.

6. The method for color text printing ghosting quality inspection based on reference image according to claim 5, characterized in that: The matching degree ranges from [0,1], and the higher the value, the better the match.

7. The method for color text printing ghosting quality inspection based on reference image according to claim 6, characterized in that: The actual printing position is obtained for all channels, and the offsets are calculated pairwise. Whether ghosting occurs is determined based on the maximum value of all pairwise offsets. When the maximum value exceeds a threshold value T, it is determined that ghosting occurs.

8. A color text printing ghosting quality inspection device based on a reference image, characterized in that: The invention comprises an imaging device, a memory and a processor, wherein the imaging device is used to image a target with quality inspection, obtain an image to be inspected, and store it in the memory, wherein the memory stores a color text printing ghosting quality inspection program designed by using a color text printing ghosting quality inspection method based on a reference image as described in any one of claims 1 to 7, the processor is communicatively connected with the memory, runs the color text printing ghosting quality inspection program, inputs the image to be inspected into the color text printing ghosting quality inspection program, and outputs a quality inspection result.

9. The color text printing ghosting quality inspection device based on reference image according to claim 8, characterized in that: It also includes a display, and the processor controls the display to display the quality inspection result.

Citation Information

Patent Citations

  • Character printing defect detection method based on character recognition and template matching

    CN115294062A

  • monitoring the visual quality of color images embedded in print products

    DE102008016538A1

Cited By

  • File image quality detection method

    CN120088794A

  • A method for detecting the quality of archive images

    CN120088794B