A printing typesetting anomaly detection method and device based on image recognition

By obtaining the gamma values ​​of the shadow and highlight gray levels of the text module and performing adaptive gamma changes, the problem of grayscale correction under the influence of light in the embossed typesetting image is solved and the accuracy of anomaly detection is improved.

CN118447020BActive Publication Date: 2024-08-30SHAANXI ZHONGCAI PRINTING CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410903880.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-08-30
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

In the existing technology, the shadow and highlight areas of embossed typesetting images caused by light irradiation make the text outline unclear, resulting in inaccurate abnormality detection, and the gamma value is inaccurately set manually, and the grayscale correction effect is not good.

Method used

By obtaining the gamma values ​​of the shadow and highlight grayscales of the text module, adaptive gamma changes are performed on them to complete grayscale correction, avoid the influence of light, and improve detection accuracy.

Benefits of technology

It achieves accurate grayscale correction of embossed typesetting images, enhances the accuracy of anomaly detection, avoids the problem of missing or incomplete text outline information, and improves the correction effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118447020B
    Figure CN118447020B
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and more specifically, to a printing typesetting anomaly detection method and device based on image recognition, the method comprising: collecting a embossed typesetting image, dividing the embossed typesetting image into various text modules; obtaining the shadow grayscale and highlight grayscale of the text modules, obtaining the gamma value of the shadow grayscale of each text module and the gamma value of the highlight grayscale of each text module, performing gamma change on the highlight grayscale and the shadow grayscale according to the gamma value of the shadow grayscale and the highlight grayscale of each text module, and completing grayscale correction of the embossed typesetting image. The present invention performs anomaly detection after completing grayscale correction of the embossed typesetting image, thereby avoiding the influence of the phenomenon that the embossed typesetting is affected by light, resulting in unclear font outline, on the anomaly detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and more particularly to a method and device for detecting printing and typesetting anomalies based on image recognition. Background Art

[0002] With the development of digital printing technology, traditional letterpress printing techniques are facing challenges from digital printing technology, but they are still in demand in certain specific scenarios. For example, in the field of art printing, embossed typesetting is used to produce printed products with unique style and texture. There are also some special materials, such as cloth, leather, ceramics, etc., which may not be directly printed using digital printing technology. However, embossed typesetting can achieve the printing of text and patterns on these materials through embossing and other methods. Therefore, automatic detection of typesetting anomalies in the embossed typesetting process and timely discovery and correction of typesetting errors, defects and anomalies can improve the quality and consistency of printed products and enhance the market competitiveness of printed products. At the same time, combining image recognition technology with traditional embossed typesetting techniques can preserve the cultural value of traditional techniques and enable them to be more widely used and inherited in modern digital printing, which will help promote the development of the printing industry towards intelligence and digitalization.

[0003] The patent document currently authorized with publication number CN112907474B discloses an underwater image enhancement method based on background light optimization and gamma transform. The method defogs the underwater image to obtain a defogged underwater image. The defogged underwater image is then gamma transformed to obtain a contrast-enhanced underwater image. The contrast-enhanced underwater image is then color-corrected using the main channel pixel maximum value method to obtain a color-balanced underwater image.

[0004] The surface material of the embossed typesetting is reflective. When light shines on the embossed typesetting surface, highlight areas and shadow areas appear in the collected embossed typesetting image. The shadow areas and highlight areas may make the outline of the text unclear or even partially blocked, resulting in loss or incompleteness of the text outline information, making the abnormality detection of the embossed typesetting image inaccurate. When the gamma transform in the above method is used to correct the grayscale of the image, the degree of grayscale correction mainly depends on the gamma value taken, and the gamma value is manually set. The manually set gamma value is generally inaccurate, resulting in poor grayscale correction effect on the embossed typesetting image. Summary of the Invention

[0005] In order to solve the technical problem that when a manually set gamma value is used to perform gamma transformation on a embossed typesetting image, the grayscale correction effect of the embossed typesetting image is poor, the present invention proposes a printing typesetting anomaly detection method and device based on image recognition.

[0006] In a first aspect, the present invention provides a method for detecting printing and typesetting anomalies based on image recognition, which adopts the following technical solutions:

[0007] A printing typesetting anomaly detection method based on image recognition comprises the following steps:

[0008] Collect embossed typesetting images; divide the embossed typesetting images into various text modules; obtain the shadow grayscale and highlight grayscale of the text modules; obtain the gamma value of the shadow grayscale of the text modules , where Represents the distribution uniformity of low shadow pixels of the i-th text module; Represents the connectivity of high shadow pixels of the i-th text module;

[0009] Get the gamma value of the highlight grayscale of the text module , where Represents the gradient direction of the kth highlighted pixel in the i-th text module; Represents the gradient direction of the right adjacent highlighted pixel in the vertical direction of the gradient direction of the k-th highlighted pixel in the i-th text module; Represents the number of highlighted pixels in the i-th text module; Represents the maximum value of the gradient direction of all highlighted pixels in the i-th text module; Represents the minimum value of the gradient direction of all highlighted pixels in the i-th text module;

[0010] Based on the gamma value of the shadow grayscale and the gamma value of the highlight grayscale of the text module, the shadow grayscale and the highlight grayscale of the text module are gamma-changed to obtain each text module after grayscale correction; typesetting anomaly detection is performed based on each text module after grayscale correction.

[0011] The innovation of the present invention lies in obtaining the gamma value of the shadow grayscale and the gamma value of the highlight grayscale of each text module, performing gamma change on the shadow grayscale and the highlight grayscale of each text module, completing the grayscale correction of each text module, that is, completing the grayscale correction of the embossed typesetting image, and adaptively obtaining the gamma value of the shadow grayscale and the highlight grayscale and performing gamma change on the shadow grayscale and the highlight grayscale, thereby avoiding the phenomenon that when light is irradiated on the embossed typesetting surface, the shadow area and the highlight area may make the outline of the text unclear, or even cause partial occlusion, resulting in the loss or incompleteness of the outline information of the text, so that the subsequent abnormality detection based on the grayscale-corrected embossed typesetting image is more accurate. Furthermore, The shadow grayscale is the smaller grayscale in the text module, and the highlight grayscale is the larger grayscale in the text module, which facilitates the subsequent correction of the shadow grayscale and the highlight grayscale separately, thereby improving the correction effect; further, the gamma value of the shadow grayscale of the text module is adaptively obtained according to the connectivity of the pixels with larger gradient amplitude and the distribution uniformity of the pixels with smaller gradient amplitude in the shadow grayscale of the text module, so that the subsequent grayscale correction is more accurate; further, the gamma value of the highlight grayscale of the text module is obtained by judging the degree of expression of the highlight grayscale to the text based on the linear characteristics of the highlight pixel points on the embossed typeset image, and then the gamma value is adaptively adjusted to the degree of expression of the text, so that the subsequent grayscale correction is more accurate.

[0012] Preferably, dividing the embossed typeset image into various text modules includes:

[0013] The side length of the text module for the default embossed typesetting is , set the text window size to , set the sliding step size to , place the text window in the upper left corner of the embossed typeset image, slide the text window from left to right and from top to bottom, and use each text window with data as each text module.

[0014] The embossed typesetting image is divided into various text modules, and each text module is subsequently analyzed and the grayscale performance of each text module is corrected. It can adapt to the distribution of shadow areas and highlight areas in each text module, making the grayscale correction more accurate.

[0015] Preferably, obtaining the shadow grayscale and highlight grayscale of the text module includes:

[0016] Default denominator , count the gray levels in each text module, sort the gray levels in each text module in descending order, and obtain the gray level sequence of each text module; obtain the gray level sequence of each text module from front to back. Gray levels are used as highlight gray levels of each text module, and the gray level sequence of each text module is obtained from back to front. Gray levels are used as shadow gray levels for each text module. Represents the ceiling symbol.

[0017] Obtain the shadow grayscale and highlight grayscale of each text module, so as to facilitate the subsequent adaptive acquisition of the gamma values ​​of the shadow grayscale and highlight grayscale according to the shadow grayscale and highlight grayscale.

[0018] Preferably, the connectivity of the high shadow pixel points of the text module is obtained, including:

[0019] Get the right adjacent pixel point and the left adjacent pixel point of each high shadow pixel point of each text module;

[0020] The reciprocal of the absolute value of the difference between the Euclidean distance of each high-shadow pixel point of each text module to its right adjacent pixel point and the Euclidean distance of each high-shadow pixel point of each text module to its left adjacent pixel point is recorded as the continuous feature of each high-shadow pixel point of each text module, and the average of the continuous features of all high-shadow pixels in each text module is taken as the connectivity of the high-shadow pixels of each text module.

[0021] The connectivity of the high shadow pixels of the text module can represent the degree of expression of the shadow grayscale to the shadow area. Therefore, the gamma value of the shadow grayscale of the text module can be adaptively obtained according to the connectivity of the high shadow pixels of the text module.

[0022] Preferably, the calculation formula for the distribution uniformity of the low shadow pixels of the text module is:

[0023] ;

[0024] Where, Represents the distribution uniformity of low shadow pixels of the i-th text module; Represents the number of low shadow pixels of the i-th text module; represents the gradient magnitude of the zth low shadow pixel of the i-th text module; Represents the mean of the gradient magnitudes of all low-shadow pixels of the i-th text module; || represents the absolute value sign.

[0025] The distribution uniformity of the low shadow pixels of the text module can represent the degree of expression of the shadow grayscale to the shadow area. Therefore, the gamma value of the shadow grayscale of the text module can be adaptively obtained based on the connectivity of the high shadow pixels of the text module and the distribution uniformity of the low shadow pixels of the text module.

[0026] Preferably, the step of obtaining the right adjacent pixel point and the left adjacent pixel point of each high shadow pixel point of each text module includes:

[0027] The first high shadow pixel on the right side of the gradient vertical direction of the j-th high shadow pixel of the i-th text module is recorded as the right adjacent pixel of the j-th high shadow pixel of the i-th text module; the first high shadow pixel on the left side of the gradient vertical direction of the j-th high shadow pixel of the i-th text module is recorded as the left adjacent pixel of the j-th high shadow pixel of the i-th text module.

[0028] Preferably, the acquisition of the highlighted pixel points includes:

[0029] The pixel points corresponding to the highlight grayscale levels of each text module in each text module are recorded as highlight pixel points of each text module.

[0030] Preferably, obtaining the high shadow pixel points of the text module includes:

[0031] The pixel points corresponding to the shadow grayscale of each text module in each text module are recorded as the shadow pixel points of each text module. The gradient amplitude mean of all shadow pixel points of each text module is obtained and recorded as the gradient amplitude mean of each text module. The shadow pixel points in each text module whose gradient amplitude is greater than the gradient amplitude mean of each text module are recorded as the high shadow pixel points of each text module.

[0032] Preferably, obtaining the low shadow pixel points of the text module includes:

[0033] The shadow pixel points whose gradient amplitude in each text module is less than or equal to the mean gradient amplitude of each text module are recorded as low shadow pixel points of each text module.

[0034] In a second aspect, the present invention provides a printing and typesetting anomaly detection device based on image recognition, which adopts the following technical solution:

[0035] A printing and typesetting anomaly detection device based on image recognition includes: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned printing and typesetting anomaly detection method based on image recognition is implemented.

[0036] By adopting the above technical solution, the above-mentioned printing and typesetting anomaly detection method based on image recognition is generated into a computer program and stored in a memory so as to be loaded and executed by a processor, thereby making a terminal device based on the memory and the processor for easy use.

[0037] The present invention has the following beneficial effects: the present invention needs to obtain the gamma value of the shadow grayscale and the gamma value of the highlight grayscale of each text module, perform gamma change on the shadow grayscale and the highlight grayscale of each text module, complete the grayscale correction of each text module, that is, complete the grayscale correction of the embossed typesetting image, and adaptively obtain the gamma value of the shadow grayscale and the highlight grayscale to perform gamma change on the shadow grayscale and the highlight grayscale, thereby avoiding the shadow area and the highlight area making the outline of the text unclear or even partially blocked when light is irradiated on the embossed typesetting surface, resulting in the loss or incompleteness of the outline information of the text, so that the subsequent abnormality detection based on the grayscale-corrected embossed typesetting image is more accurate, and the text is further improved. Firstly, the shadow grayscale is the smaller grayscale in the text module, and the highlight grayscale is the larger grayscale in the text module, which facilitates the subsequent correction of the shadow grayscale and the highlight grayscale separately, thereby improving the correction effect; further, the gamma value of the shadow grayscale of the text module is adaptively obtained according to the connectivity of the pixels with larger gradient amplitude and the distribution uniformity of the pixels with smaller gradient amplitude in the shadow grayscale of the text module, so that the subsequent grayscale correction is more accurate; further, the gamma value of the highlight grayscale of the text module is obtained by judging the degree of expression of the highlight grayscale to the text based on the linear characteristics of the highlight pixel points on the embossed typesetting image, and then the gamma value is adaptively adjusted to the degree of expression of the text, so that the subsequent grayscale correction is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] By reading the detailed description below with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts.

[0039] Figure 1 This is a flowchart of the steps of a printing and typesetting anomaly detection method based on image recognition in an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.

[0041] It should be understood that when the terms "first," "second," and the like are used in the claims, description, and drawings of the present invention, they are merely used to distinguish between different objects, rather than to describe a specific order. The terms "comprise" and "comprising" used in the description and claims of the present invention indicate the presence of the described features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or combinations thereof.

[0042] See also Figure 1 , which shows a flowchart of a method for detecting printing and typesetting anomalies based on image recognition according to an embodiment of the present invention, the method comprises the following steps:

[0043] S001. Collect embossed typesetting images.

[0044] In an embodiment of the present invention, a embossed typesetting is placed horizontally on a table, and a camera is installed directly above it to take a picture of the embossed typesetting to obtain an RGB image of the embossed typesetting. In order to facilitate subsequent processing, the RGB image of the embossed typesetting is grayscaled to obtain an embossed typesetting image.

[0045] S002. Divide the embossed typesetting image into various text modules; obtain the shadow grayscale and highlight grayscale of each text module, and obtain the gamma value of the shadow grayscale of each text module.

[0046] It should be noted that due to the material, embossed typesetting will reflect light to a certain extent. Since embossed typesetting is mostly printed in letterpress, the strokes of the characters are full of grooves, which leads to the existence of some shadow areas on the embossed typesetting. In summary, there are shadow areas and highlight areas in the embossed typesetting image collected in step S001, which will cause the outline of the characters in the embossed typesetting to be unclear, thereby affecting the abnormality detection in the embossed typesetting. Therefore, it is necessary to perform grayscale correction on the shadow areas and highlight areas in the embossed typesetting image to reduce the influence of the shadow areas and highlight areas on text recognition.

[0047] It should be further explained that the shadow areas in the embossed typography image are caused by the raised text mural and are primarily represented by smaller, approximately connected domains. The highlight areas in the embossed typography image are caused by reflections from the text strokes and exhibit a certain texture. Furthermore, since embossed typography is a mobile printing technology, each character stroke is different, resulting in a different distribution of shadow and highlight areas. Therefore, in embodiments of the present invention, it is necessary to first obtain each character module from the embossed typography image, analyze each character module, and correct its grayscale. Highlight areas in a character module may cause local overexposure, resulting in loss of character detail. Therefore, the grayscale values ​​of these highlights need to be adjusted downward to reduce their interference with character recognition. Shadow areas in a character module can darken the text, affecting the recognition of character edges and internal structure. Therefore, the grayscale values ​​of these shadow areas need to be adjusted upward. This can moderately increase the grayscale values ​​of these shadow areas to approach or reach the text brightness level under background and normal lighting. Therefore, it is necessary to obtain both the shadow and highlight grayscale levels for each character module.

[0048] In the embodiment of the present invention, the side length of the text module of the known embossed typesetting is , set the text window size to , set the sliding step size to , place the text window in the upper left corner of the embossed typesetting image, and slide the text window from left to right and from top to bottom to obtain each text module. It should be noted that when the text window slides to the edge of the embossed typesetting image, if the number of pixels at the edge of the embossed typesetting image does not meet the size of the text window, it is padded with 0.

[0049] In the embodiment of the present invention, the denominator of the preset ratio , count the gray levels in the i-th text module, sort the gray levels in the i-th text module in descending order, and get the gray level sequence of the i-th text module; get the gray level sequence of the i-th text module from front to back. Gray levels are used as the highlight gray levels of the i-th text module, and the gray level sequence of the i-th text module is obtained from back to front. Gray levels are used as the shadow gray levels of the i-th text module, Represents the rounding symbol. In the embodiment of the present invention, the denominator of the preset ratio =10, in other embodiments, the implementer can preset The value of .

[0050] It should be noted that the shadow area of ​​the raised text in the embossed typeset image under illumination is small and forms an approximately connected domain, and the pixels on the edge of the approximately connected domain have a large gradient amplitude and a certain connectivity, while the gradient amplitude of the pixels inside the approximately connected domain is small and the gradient difference of the pixels inside is also small. In other words, the degree of expression of the shadow grayscale to the shadow area can be judged based on the connectivity of the pixels with a large gradient amplitude and the distribution uniformity of the pixels with a small gradient amplitude in the shadow grayscale, and then the gamma value of the shadow grayscale when performing grayscale correction can be obtained.

[0051] In an embodiment of the present invention, the pixel points corresponding to the shadow grayscale of each text module in each text module are recorded as the shadow pixel points of each text module, the gradient amplitude average of all shadow pixel points of each text module is obtained and recorded as the gradient amplitude average of each text module, the shadow pixel points in each text module whose gradient amplitude is greater than the gradient amplitude average of each text module are recorded as high shadow pixel points of each text module; the shadow pixel points in each text module whose gradient amplitude is less than or equal to the gradient amplitude average of each text module are recorded as low shadow pixel points of each text module.

[0052] The first high shadow pixel that is right adjacent to the j-th high shadow pixel of the i-th text module in the vertical direction of the gradient is recorded as the right adjacent pixel of the j-th high shadow pixel of the i-th text module, and the Euclidean distance between the j-th high shadow pixel of the i-th text module and its right adjacent pixel is obtained:

[0053] ;

[0054] Where, Represents the Euclidean distance between the jth high-shadow pixel of the i-th text module and its right adjacent pixel; Represents the horizontal coordinate of the jth high shadow pixel of the i-th text module; Represents the horizontal coordinate of the right adjacent pixel of the j-th high shadow pixel of the i-th text module; Represents the ordinate of the jth high shadow pixel of the i-th text module; The vertical coordinate of the right adjacent pixel of the j-th high shadow pixel of the i-th text module; Represents the gradient magnitude of the jth high shadow pixel of the i-th text module; Represents the gradient magnitude of the right adjacent pixel of the j-th high shadow pixel in the i-th text module.

[0055] Similarly, the first high shadow pixel that is adjacent to the left of the j-th high shadow pixel in the gradient vertical direction of the i-th text module is recorded as the left adjacent pixel of the j-th high shadow pixel of the i-th text module, and the Euclidean distance between the j-th high shadow pixel of the i-th text module and its left adjacent pixel is obtained;

[0056] Get the continuous features of the jth high shadow pixel of the i-th text module:

[0057]

[0058] Where, Represents the continuous features of the jth high shadow pixel of the i-th text module; Represents the Euclidean distance between the jth high-shadow pixel of the i-th text module and its right adjacent pixel; represents the Euclidean distance between the jth high-shadow pixel of the i-th text module and its left adjacent pixel; || represents the absolute value sign; the mean of the continuous features of all high-shadow pixels in the i-th text module is taken as the connectivity of the high-shadow pixels of the i-th text module.

[0059] In this embodiment of the present invention, the distribution uniformity of the low shadow pixels of the i-th text module is obtained:

[0060] ;

[0061] Where, Represents the distribution uniformity of low shadow pixels of the i-th text module; Represents the number of low shadow pixels of the i-th text module; represents the gradient magnitude of the zth low shadow pixel of the i-th text module; Represents the mean of the gradient magnitudes of all low-shadow pixels in the i-th text module.

[0062] It should be noted that the greater the connectivity of pixels with larger gradient amplitude in the shadow grayscale and the higher the distribution uniformity of pixels with smaller gradient amplitude, the better the shadow grayscale will express the shadow area. The connectivity and distribution uniformity results are multiplied and normalized, and used as the gamma value for grayscale correction of the shadow grayscale.

[0063] In an embodiment of the present invention, the gamma value of the shadow grayscale of the i-th text module is obtained:

[0064] ;

[0065] Where, Represents the gamma value of the shadow grayscale of the i-th text module; Represents the distribution uniformity of low shadow pixels of the i-th text module; Represents the connectivity of the high shadow pixels of the i-th text module; norm() represents the normalization function.

[0066] S003. Obtain the gamma value of the highlight grayscale of each text module, and perform gamma shift on the highlight grayscale and shadow grayscale based on the gamma values ​​of the shadow grayscale and highlight grayscale of each text module to complete the grayscale correction of the embossed typesetting image.

[0067] It should be noted that the text in the embossed typesetting image is composed of a number of horizontal, vertical and hook strokes, that is, the text strokes have certain linear characteristics on the image. Therefore, first, the highlighted pixels in the text module are obtained according to the highlighted grayscale level in the text module, and then the degree to which the highlighted grayscale level represents the text is judged according to the linear characteristics of the highlighted pixels in the text module on the embossed typesetting image, and then the gamma value when the highlighted grayscale level in the text module is corrected is obtained. When the degree to which the highlighted grayscale level represents the text is greater, it means that a smaller gamma value is required to reduce its grayscale value representation. When the degree to which the highlighted grayscale level represents the text is smaller, it means that a larger gamma value is required to reduce its grayscale value representation.

[0068] In the embodiment of the present invention, the pixel corresponding to the highlight gray level of the i-th text module in the i-th text module is recorded as the highlight pixel of the i-th text module.

[0069] Get the gamma value of the highlight grayscale of the i-th text module:

[0070] ;

[0071] Where, Represents the gamma value of the highlight grayscale of the i-th text module; Represents the gradient direction of the kth highlighted pixel in the i-th text module; Represents the gradient direction of the right adjacent highlighted pixel in the vertical direction of the gradient direction of the k-th highlighted pixel in the i-th text module; Represents the number of highlighted pixels in the i-th text module; Represents the maximum value of the gradient direction of all highlighted pixels in the i-th text module; Represents the minimum value of the gradient direction of all highlighted pixels in the i-th text module. If the linear characteristics of the highlighted pixels are more obvious, that is, the degree of expression of the highlighted pixels to the text is higher, a smaller gamma value is needed to reduce its grayscale value expression. The smaller the value is; if the linear characteristics of the highlighted pixels are not obvious, that is, the highlighted pixels have a small degree of expression for the text, then a larger gamma value is needed to reduce its grayscale value expression. The larger the value of .

[0072] In an embodiment of the present invention, a maximum-minimum normalization method is adopted to normalize the highlight grayscale and shadow grayscale in the i-th text module. According to the gamma value of the shadow grayscale of the i-th text module and the gamma value of the highlight grayscale of the i-th text module, the normalized shadow grayscale and highlight grayscale are gamma-transformed, and then the highlight grayscale and shadow grayscale after gamma transformation are expanded to [0,255] to achieve grayscale correction of the i-th text module.

[0073] Similarly, according to the above method of performing grayscale correction on the i-th text module, grayscale correction is performed on each of the remaining text modules to complete the grayscale correction of the embossed typesetting image.

[0074] S004. Perform anomaly detection on the grayscale-corrected embossed typesetting image.

[0075] It should be noted that after grayscale correction is performed on the embossed typesetting image, anomaly detection can be performed.

[0076] In an embodiment of the present invention, after the grayscale-corrected embossed typesetting image is mirror-flipped, it is compared and analyzed with the required printed material using existing technologies (such as perceptual hash algorithm, structural similarity index, etc.), and the difference areas are marked to achieve anomaly detection of the embossed typesetting image.

[0077] The present invention has the following beneficial effects: the present invention needs to obtain the gamma value of the shadow grayscale and the gamma value of the highlight grayscale of each text module, perform gamma change on the shadow grayscale and the highlight grayscale of each text module, complete the grayscale correction of each text module, that is, complete the grayscale correction of the embossed typesetting image, and perform gamma change on the shadow grayscale and the highlight grayscale by adaptively obtaining the gamma value of the shadow grayscale and the highlight grayscale, thereby avoiding the shadow area and the highlight area making the outline of the text unclear or even partially blocked when light is irradiated on the embossed typesetting surface, resulting in the loss or incompleteness of the outline information of the text, so that the subsequent embossed typesetting image corrected according to the grayscale is corrected. The image is more accurate when performing anomaly detection. Furthermore, the shadow grayscale is the smaller grayscale in the text module, and the highlight grayscale is the larger grayscale in the text module. Furthermore, the gamma value of the shadow grayscale of the text module is adaptively obtained according to the connectivity of the pixels with larger gradient amplitude and the distribution uniformity of the pixels with smaller gradient amplitude in the shadow grayscale of the text module, so that the subsequent grayscale correction is more accurate. Furthermore, the gamma value of the highlight grayscale of the text module is obtained by judging the degree of expression of the highlight grayscale for the text based on the linear characteristics of the highlight pixel points on the embossed typesetting image, and then the gamma value is adaptively adjusted according to the degree of expression of the text, so that the subsequent grayscale correction is more accurate.

[0078] The above-mentioned device also includes other components well known to those skilled in the art, such as a communication bus and a communication interface. Their configuration and functions are known in the art and will not be described in detail here.

[0079] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium may be any suitable magnetic storage medium or magneto-optical storage medium, such as resistive random access memory, dynamic random access memory, static random access memory, enhanced dynamic random access memory, high bandwidth memory, hybrid memory cube, etc., or any other medium that can be used to store the required information and can be accessed by an application, module, or both. Any such computer storage medium may be part of, accessible to, or connectable to the device.

[0080] While several embodiments of the present invention have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Numerous modifications, variations, and alternatives will occur to those skilled in the art without departing from the concept and spirit of the present invention. It should be understood that various alternatives to the embodiments of the present invention described herein may be employed in practicing the present invention.

[0081] The above are all preferred embodiments of the present invention, and are not intended to limit the scope of protection 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 scope of protection of the present invention.

Claims

1. A printing typesetting anomaly detection method based on image recognition, It is characterized in that include: Collecting embossed typesetting images; Dividing the embossed typesetting image into individual text modules; Get the shadow grayscale and highlight grayscale of the text module; The pixel points corresponding to the shadow grayscale of each text module in each text module are recorded as the shadow pixel points of each text module, the gradient amplitude mean of all shadow pixel points of each text module is obtained, recorded as the gradient amplitude mean of each text module, the shadow pixel points in each text module whose gradient amplitude is greater than the gradient amplitude mean of each text module are recorded as the high shadow pixel points of each text module, and the shadow pixel points in each text module whose gradient amplitude is less than or equal to the gradient amplitude mean of each text module are recorded as the low shadow pixel points of each text module; the gamma value of the shadow grayscale of the text module is obtained. , where represents the gamma value of the shadow grayscale of the i-th text module; Represents the distribution uniformity of low shadow pixels of the i-th text module; Represents the connectivity of high shadow pixels of the i-th text module; norm() represents the normalization function; Get the gamma value of the highlight grayscale of the text module , where Represents the gamma value of the highlight grayscale of the i-th text module; Represents the gradient direction of the kth highlighted pixel in the i-th text module; Represents the gradient direction of the right adjacent highlighted pixel in the vertical direction of the gradient direction of the kth highlighted pixel in the i-th text module; Represents the number of highlighted pixels in the i-th text module; Represents the maximum value in the gradient direction of all highlighted pixels in the i-th text module; Represents the minimum value in the gradient direction of all highlighted pixels in the i-th text module; Based on the gamma value of the shadow grayscale and the gamma value of the highlight grayscale of the text module, gamma changes are performed on the shadow grayscale and the highlight grayscale of the text module to obtain each text module after grayscale correction; typesetting anomaly detection is performed based on each text module after grayscale correction.

2. According to the method for detecting printing typesetting anomalies based on image recognition according to claim 1, It is characterized in that The step of dividing the embossed typesetting image into various text modules includes: The side length of the text module for the default embossed typesetting is , set the text window size to , set the sliding step size to , place the text window at the upper left corner of the embossed typesetting image, slide the text window from left to right and from top to bottom, and use each text window with data as each text module.

3. According to the method for detecting printing typesetting anomalies based on image recognition according to claim 1, It is characterized in that Get the shadow grayscale and highlight grayscale of the text module, including: Default ratio denominator , count the gray levels in each text module, sort the gray levels in each text module in descending order, and obtain the gray level sequence of each text module; obtain the gray level sequence of each text module from front to back The gray levels are used as the highlight gray levels of each text module, and the gray level sequence of each text module is obtained from back to front. The gray level is used as the shadow gray level of each text module. Represents the ceiling symbol.

4. The printing typesetting anomaly detection method based on image recognition according to claim 1, It is characterized in that Get the connectivity of high shadow pixels of the text module, including: Obtain the right adjacent pixel point and the left adjacent pixel point of each high shadow pixel point of each text module; The reciprocal of the absolute value of the difference between the Euclidean distance from each high shadow pixel of each text module to its right adjacent pixel and the Euclidean distance from each high shadow pixel of each text module to its left adjacent pixel is recorded as the continuous feature of each high shadow pixel of each text module, and the average of the continuous features of all high shadow pixels in each text module is taken as the connectivity of the high shadow pixels of each text module.

5. The printing typesetting anomaly detection method based on image recognition according to claim 1, It is characterized in that The calculation formula for the distribution uniformity of low shadow pixels of the text module is: ; In the formula, Represents the distribution uniformity of low shadow pixels of the i-th text module; Represents the number of low shadow pixels of the i-th text module; represents the gradient amplitude of the zth low shadow pixel of the i-th text module; Represents the mean value of the gradient amplitude of all low shadow pixels of the i-th text module; || represents the absolute value symbol.

6. The printing typesetting anomaly detection method based on image recognition according to claim 4, It is characterized in that Get the right adjacent pixel points and the left adjacent pixel points of each high shadow pixel point of each text module, including: The first high shadow pixel on the right side of the gradient vertical direction of the j-th high shadow pixel of the i-th text module is recorded as the right adjacent pixel of the j-th high shadow pixel of the i-th text module; the first high shadow pixel on the left side of the gradient vertical direction of the j-th high shadow pixel of the i-th text module is recorded as the left adjacent pixel of the j-th high shadow pixel of the i-th text module.

7. The printing typesetting anomaly detection method based on image recognition according to claim 1, It is characterized in that Get highlighted pixels, including: The pixel points corresponding to the highlight grayscale levels of each text module in each text module are recorded as the highlight pixel points of each text module.

8. A printing typesetting anomaly detection device based on image recognition, It is characterized in that include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a printing typesetting anomaly detection method based on image recognition according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • An underwater image enhancement method based on background light optimization and gamma transform

    CN112907474B

  • Image table detection method based on MSER under natural photographing condition

    CN114120303A

  • Polysaccharide test data storage and digitalization method

    CN116682112A