Method, storage medium and device for determining the intersection area of multi-color overlay of printed matter
By converting the color image into HSI color space, calculating saturation characteristics and performing projection processing, the accuracy and real-time problems of color difference detection in the multi-color superposition intersection area in the prior art are solved, and a high-precision and robust contactless detection is achieved.
Patent Information
- Application Number
- CN202311139786.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-05
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2043-09-05
AI Technical Summary
In the prior art, in the color difference detection of the multi-color superposition and intersection area of printed materials, contact measurement is difficult to achieve real-time online detection, and the accuracy is not high. Direct conversion of color images to grayscale images leads to information loss, and it is impossible to accurately calculate the starting and overlap position of the multi-color superposition and intersection area.
The contactless detection method is used to convert the color image from RGB color space to HSI color space, calculate the saturation feature image, and calculate the mask image based on this, acquire the foreground image for projection processing, convert it to Lab image, and fit the projection feature curve to determine the starting position and junction point of the multi-color superposition intersection area.
It is achieved without destroying the surface characteristics of the printed material, and has high detection accuracy and is not affected by the darkness of the ink color.
Smart Images

Figure CN117115126B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a method, storage medium and device for determining a multi-color overlapping intersection area of a printed product. Background Art
[0002] During the printing process, due to various reasons, there will be color differences between the printed product and the sample after printing, which will reduce the quality of the printed product. The control and detection of color differences in the multi-color overlapping intersection area in the printed product is both the key and the difficult point. On the one hand, it can control the cost to the greatest extent, and on the other hand, it can effectively improve the quality of the printed product. The traditional multi-color overlapping intersection area color difference detection is to directly convert the color image into a grayscale image, and analyze and determine the starting point and overlapping position of the multi-color overlapping intersection area by analyzing the grayscale value of the grayscale image. This method is simple to operate, but has low accuracy. The direct conversion of color into grayscale causes a large amount of useful information to be lost, and it is impossible to accurately calculate the starting and overlapping positions of the multi-color overlapping intersection area.
[0003] Specifically, the current color difference detection of multi-color superposition intersection area includes spectrophotometer measurement and grayscale intensity measurement. Spectrophotometer measurement is to use a spectrophotometer to measure at the same position of the same batch of products, and compare with the sample, so as to determine the difference between the starting position of the multi-color superposition intersection area of the product to be tested and the starting position of the sample product; grayscale intensity measurement is to convert the color image into a grayscale image, analyze the transformation of the grayscale image intensity, and thus analyze the starting position and overlapping position of the multi-color superposition intersection area.
[0004] However, for the spectrophotometer measurement method, since the spectrophotometer is a contact measurement, this detection method is difficult to use for real-time online detection, and contact measurement will contaminate the product to be detected; for grayscale intensity measurement, although it is relatively simple to implement, the measurement accuracy is not high, the direct conversion of color images to grayscale images will cause information loss, and the measurement will be affected by the depth of ink, resulting in inaccurate measurements. Summary of the invention
[0005] In view of the defects existing in the prior art, the purpose of the present invention is to provide a method, storage medium and device for determining the intersection area of multiple colors superimposed on a printed product, which adopts a non-contact detection method to obtain accurate detection results without destroying the surface characteristics of the printed body being tested, and has high detection accuracy and stronger robustness, and is not affected by the depth of ink.
[0006] In order to achieve the above object, the present invention provides a method for determining a multi-color overlapping intersection area of a printed product, which specifically comprises the following steps:
[0007] Obtain an RGB image to be detected containing a multi-color overlapping intersection area, convert the RGB image to be detected into an HSI image, and calculate a saturation feature image;
[0008] A mask image of saturation characteristics is calculated based on the saturation characteristic image to obtain a foreground image of the RGB image to be detected;
[0009] The foreground image is projected, and the projected RGB image is converted into a Lab image, that is, a projection feature Lab image is obtained, and the distance between the endpoint and the non-endpoint in the projection feature Lab image is fitted to obtain a projection feature curve;
[0010] Based on the calculated projection characteristic curve, the starting position and the intersection point of the multi-color superposition intersection area in the RGB image to be detected are obtained.
[0011] On the basis of the above technical solution, the RGB image to be detected is obtained by photographing the printed matter to be detected with a CCD color camera, and the photographed RGB image to be detected is an RGB image.
[0012] On the basis of the above technical solution, the RGB image to be detected is converted into an HSI image, and a saturation characteristic image is calculated, wherein the saturation characteristic image is calculated as follows:
[0013] S(ij)=M(ij)-N(ij)
[0014] M(ij)=max(R(ij),G(ij),B(ij))
[0015] N(ij)=min(R(ij),G(ij),B(ij))
[0016] Among them, S(ij) represents the saturation feature of the image coordinate (ij), R(ij) represents the grayscale value of the image at the R channel coordinate (ij), G(ij) represents the grayscale value of the image at the G channel coordinate (ij), B(ij) represents the grayscale value of the image at the B channel coordinate (ij), R, G, and B are the three color channels of the RGB image to be detected, and the size of the RGB image to be detected is M*N, M represents rows, and N represents columns.
[0017] On the basis of the above technical solution, the mask image of the saturation feature is calculated based on the saturation feature image, specifically:
[0018] Perform Canny operation on the saturation feature image to obtain a saturation feature binary image;
[0019] The seed points of the saturation feature binary image are filled to obtain a mask image of the saturation feature.
[0020] On the basis of the above technical solution, the foreground image of the RGB image to be detected is obtained, and the specific steps include:
[0021] The image obtained by performing AND operation on the RGB image to be detected and the mask image of the saturation feature is the foreground image, and the image obtained by performing XOR operation on the RGB image to be detected and the mask image of the saturation feature is the background image. The calculation method is:
[0022] F T =T RGB &S mask
[0023] B T =T RGB ∧S mask
[0024] Among them, F T represents the foreground image, B T represents the background image, T RGB represents the RGB image to be detected, S mask The mask image represents the saturation feature, & represents the AND operation, and ∧ represents the XOR operation.
[0025] On the basis of the above technical solution, the foreground image is projected and the projected RGB image is converted into a Lab image, that is, a projection feature Lab image is obtained. The specific steps include:
[0026] The foreground image is subjected to vertical projection processing, and the projected RGB image is converted into a Lab image, that is, a projection feature Lab image is obtained. The vertical projection processing is to project the two-dimensional image horizontally by column, and then calculate the mean value of each color channel as the projection value of the current column, and then convert the projected RGB image into a Lab image, so as to obtain a projection feature Lab image;
[0027] Perform statistical mean filtering on the projected feature Lab image.
[0028] On the basis of the above technical solution, the distance between the endpoints and the non-endpoints in the fitting projection feature Lab image is obtained to obtain the projection feature curve, and the specific steps include:
[0029] Convert the projected feature Lab image from RGB color space to CIE-Lab color space;
[0030] Calculate the two endpoints of the projected feature Lab image, and calculate the distance between the non-endpoint and the endpoint in the projected feature Lab image;
[0031] The calculated distance is fitted to draw the projection characteristic curve, where the distance is calculated as follows:
[0032] D l (i) = (a(i) - a(l)) 2 +(b(i)-b(l)) 2
[0033] D r (i) = (a(i) - a(r)) 2 +(b(i)-b(r)) 2
[0034] Where l represents the left endpoint of the projected feature Lab image, r represents the right endpoint of the projected feature Lab image, i represents the i-th pixel point of the projected feature Lab image, and D l (i) represents the distance between the i-th pixel of the projected feature Lab image and the left endpoint of the projected feature Lab image, D r (i) represents the distance between the i-th pixel of the projected feature Lab image and the right endpoint of the projected feature Lab image, a(i) represents the a color component value of the i-th pixel of the projected feature Lab image, a(l) represents the a color component value of the left endpoint of the projected feature Lab image, a(r) represents the a color component value of the right endpoint of the projected feature Lab image, b(i) represents the b color component value of the i-th pixel of the projected feature Lab image, b(l) represents the b color component value of the left endpoint of the projected feature Lab image, b(r) represents the b color component value of the right endpoint of the projected feature Lab image, a represents the red and green color value, ranging from -128 to +127, where -128 represents green and +127 represents red, and b represents the yellow and blue color value, ranging from -128 to +127, where -128 represents blue and +127 represents yellow.
[0035] On the basis of the above technical solution, the projection characteristic curve obtained based on the calculation is used to obtain the starting position and the intersection point of the multi-color superposition intersection area in the RGB image to be detected, specifically:
[0036] Based on the projection characteristic curve, the intersection point in the projection characteristic curve is the intersection point of the multi-color superposition intersection area, and the starting position of the multi-color superposition intersection area is determined according to the 3σ principle.
[0037] The present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for determining the multi-color overlapping intersection area of a printed product described above are implemented.
[0038] The present invention provides a device for determining a multi-color overlapping intersection area of a printed product, comprising:
[0039] An acquisition module is used to acquire an RGB image to be detected containing a multi-color overlapping intersection area, convert the RGB image to be detected into an HSI image, and calculate a saturation feature image;
[0040] A calculation module, which is used to calculate a mask image of a saturation feature based on the saturation feature image to obtain a foreground image of the RGB image to be detected;
[0041] A processing module is used to perform projection processing on the foreground image, convert the projected RGB image into a Lab image, that is, obtain a projection feature Lab image, and fit the distance between the endpoint and the non-endpoint in the projection feature Lab image to obtain a projection feature curve;
[0042] The execution module is used to obtain the starting position and intersection point of the multi-color overlapping intersection area in the RGB image to be detected based on the calculated projection characteristic curve.
[0043] Compared with the prior art, the advantages of the present invention are: by converting the color image from the RGB color space to the HSI color space, calculating the saturation feature image, then performing projection analysis on the saturation image, and then calculating the mask image of the saturation feature based on the saturation feature image, and obtaining the foreground image of the RGB image to be detected, the foreground image is projected, and the projected RGB image is converted into a Lab image, that is, the projection feature Lab image is obtained, and the distance between the endpoints and the non-endpoints in the projection feature Lab image is fitted to obtain the projection feature curve, and finally based on the projection feature curve, the information of the multi-color superposition intersection area in the RGB image to be detected can be obtained, and a non-contact detection method is adopted to obtain accurate detection results without destroying the surface features of the printed body to be detected, and the detection accuracy is high, the robustness is stronger, and it is not affected by the depth of ink. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0045] Figure 1 It is a flow chart of a method for determining a multi-color overlapping intersection area of a printed product in an embodiment of the present invention;
[0046] Figure 2 is an example of a projected characteristic curve. DETAILED DESCRIPTION
[0047] The embodiment of the present invention provides a method for determining the multi-color overlapping intersection area of a printed product, by converting a color image from an RGB color space to an HSI color space, calculating a saturation feature image, and then performing a projection analysis on the saturation image, and then calculating a mask image of the saturation feature based on the saturation feature image, and obtaining a foreground image of the RGB image to be detected, and performing projection processing on the foreground image, and converting the projected RGB image into a Lab image, that is, obtaining a projection feature Lab image, fitting the distance between the endpoints and the non-endpoints in the projection feature Lab image to obtain a projection feature curve, and finally based on the projection feature curve, the information of the multi-color overlapping intersection area in the RGB image to be detected can be obtained, and a non-contact detection method is adopted to obtain accurate detection results without destroying the surface features of the printed body to be tested, and the detection accuracy is high, the robustness is stronger, and it is not affected by the depth of the ink color. The embodiment of the present invention also provides a non-transient computer-readable storage medium and a device for determining the multi-color overlapping intersection area of a printed product.
[0048] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments.
[0049] See also Figure 1 As shown, a method for determining a multi-color overlapping intersection area of a printed product provided by an embodiment of the present invention specifically includes the following steps:
[0050] S1: Obtain an RGB image to be detected containing a multi-color overlapping intersection area, convert the RGB image to be detected into an HSI image, and calculate a saturation feature image;
[0051] In the present invention, the RGB image to be detected is obtained by photographing the printed matter to be detected with a CCD (Charge Coupled Device) color camera, and the photographed RGB image to be detected is an RGB image. The CCD color camera collects RGB data of the printed matter image, and the RGB color space belongs to the device-related color space. In order to accurately describe the color, it is necessary to perform a color gamut space transformation on the CCD color camera, that is, convert the device-related color space of the CCD color camera into a device-independent color space.
[0052] For the RGB color space, RGB (red, green, blue) is a space defined based on the colors recognized by the human eye, which can represent most colors. The RGB color space uses a linear combination of three color components to represent colors. Any color is related to these three components, and these three components are highly correlated.
[0053] In the present invention, the RGB image to be detected is converted into an HSI image, and a saturation characteristic image is calculated, wherein the saturation characteristic image is calculated as follows:
[0054] S(ij)=M(ij)-N(ij)
[0055] M(ij)=max(R(ij),G(ij),B(ij))
[0056] N(ij)=min(R(ij),G(ij),B(ij))
[0057] Among them, S(ij) represents the saturation feature of the image coordinate (ij), R(ij) represents the grayscale value of the image at the R channel coordinate (ij), G(ij) represents the grayscale value of the image at the G channel coordinate (ij), B(ij) represents the grayscale value of the image at the B channel coordinate (ij), R, G, and B are the three color channels of the RGB image to be detected, and the size of the RGB image to be detected is M*N, M represents rows, and N represents columns.
[0058] For HSI, the HSI color space is proposed for better digital processing of colors. H represents hue, S represents saturation, and I represents intensity.
[0059] S2: Calculate a mask image of the saturation feature based on the saturation feature image to obtain a foreground image of the RGB image to be detected;
[0060] In the present invention, the mask image of the saturation feature is calculated based on the saturation feature image, specifically:
[0061] S201: performing a Canny (an edge detection algorithm) operation on the saturation feature image to obtain a saturation feature binary image;
[0062] The steps of Canny operation include Gaussian blur, calculating gradient size and direction, non-maximum suppression, double threshold acquisition, and connecting weak edges. For non-maximum suppression, each edge should have only one response; for double threshold acquisition, it is to separate strong edges from weak edges.
[0063] S202: Filling the saturation feature binary image seed points to obtain a saturation feature mask image.
[0064] The seed filling algorithm generally needs to be implemented using a stack data structure, that is, the seed pixel is pushed into the stack first, and the seed pixel is the bottom pixel of the stack. If the stack is not empty, the following three steps are performed: Step 1, the top pixel of the stack is popped out of the stack; Step 2, the popped pixel is drawn according to the fill color; Step 3, the four (eight) pixels adjacent to the popped pixel are searched in the order of left, right, bottom, top (or left, upper left, top, upper right, right, lower right, bottom, lower left). If the color of the pixel is not the boundary color and is not set to the fill color, the pixel is pushed into the stack, otherwise the pixel is discarded.
[0065] In the present invention, the foreground image of the RGB image to be detected is obtained, and the specific steps include: performing an AND operation on the RGB image to be detected and the mask image of the saturation feature, and the image obtained is the foreground image; performing an XOR operation on the RGB image to be detected and the mask image of the saturation feature, and the image obtained is the background image, and the calculation method is:
[0066] F T =T RGB &S mask
[0067] B T =T RGB ∧S mask
[0068] Among them, F T represents the foreground image, B T represents the background image, T RGB represents the RGB image to be detected, S mask The mask image represents the saturation feature, & represents the AND operation, and ∧ represents the XOR operation.
[0069] For the foreground image obtained by performing an AND operation on the RGB image to be detected and the mask image of the saturation feature, an example is given as follows: assuming that the coordinates of the RGB image to be detected are (100, 100), and the pixel value is 192, the coordinates of the mask image of the saturation feature are (100, 100), and the pixel value is 1, the coordinates of the image obtained by performing an AND operation on the two are (100, 100), and the pixel value is 192; assuming that the coordinates of the RGB image to be detected are (101, 101), and the pixel value is 85, the coordinates of the mask image of the saturation feature are (101, 101), and the pixel value is 0, the coordinates of the image obtained by performing an AND operation on the two are (101, 101), and the pixel value is 0.
[0070] S3: Project the foreground image, convert the projected RGB image into a Lab image, that is, obtain a projection feature Lab image, and fit the distance between the endpoint and the non-endpoint in the projection feature Lab image to obtain a projection feature curve;
[0071] In the present invention, the foreground image is projected, and the projected RGB image is converted into a Lab image, that is, a projection feature Lab image is obtained. The specific steps include:
[0072] S301: performing vertical projection processing on the foreground image, converting the projected RGB image into a Lab image, that is, obtaining a projection feature Lab image, wherein the vertical projection processing is to project the two-dimensional image in a horizontal direction by column, and then calculate the mean value of each color channel as the projection value of the current column, and then convert the projected RGB image into a Lab image, thereby obtaining a projection feature Lab image;
[0073] S302: Perform statistical mean filtering on the projection feature Lab image.
[0074] The specific description of step S301 is as follows:
[0075] (1) Performing vertical projection processing on the foreground image. For the vertical projection effect, assuming that the image has M rows and N columns, after vertical projection, the image becomes 1 row and N columns;
[0076] (2) Calculate the mean of each color channel, where the vertical projection calculation rule is to accumulate the pixel values in the Y-axis (vertical) direction and calculate the average value. For example, the color image has only three pixels in the Y-axis direction, and the R channel pixel values are 111, 120, and 129 respectively. Then the pixel value of the R channel after projection is: 120 = (111 + 120 + 129) / 3; the G channel pixel values are 135, 145, and 155 respectively. Then the pixel value of the G channel after projection is: 145 = (135 + 145 + 155) / 3; the B channel pixel values are 211, 220, and 199 respectively. Then the pixel value of the R channel after projection is: 210 = (211 + 220 + 199) / 3;
[0077] (3) Calculate the mean value of each color channel as the projection value of the current column. The foreground image in the present invention is a color image and remains a color image after processing.
[0078] (4) The image size is described using rows and columns, for example, M rows and N columns; a color image generally refers to an image composed of multiple color channels, and the number of color channels is greater than 1;
[0079] (5) The mean value of each color channel is calculated as the projection value of the current column, and then the projection feature Lab image is obtained through color space conversion. Regarding the relationship between the projection value and the projection feature Lab image, the images processed in the present invention are all digital images, and the digital images are images represented in the form of two-dimensional digital groups.
[0080] The projected feature Lab image will cause large-scale color jumps due to color discontinuity, affecting the segmentation effect. Therefore, it is necessary to perform statistical mean filtering on the projected feature Lab image to obtain a smoother image. Statistical mean filtering is equivalent to median filtering + mean filtering. The specific implementation steps are: take the 8 pixels (or 24 pixels or 48 pixels) around the pixel point, remove the maximum value pixel point and the minimum value pixel point, average the remaining pixel points, and replace the pixel value of the point with the average pixel value.
[0081] In the present invention, the distance between the endpoints and the non-endpoints in the projection feature Lab image is fitted to obtain the projection feature curve, and the specific steps include:
[0082] S311: converting the projection characteristic Lab image from the RGB color space to the CIE-Lab color space;
[0083] For the CIE-Lab space, the CIE-Lab color model is a color model developed by CIE (International Commission on Illumination).
[0084] S312: Calculate and obtain two endpoints of the projected feature Lab image, and calculate the distance between the non-endpoint and the endpoint in the projected feature Lab image;
[0085] S313: Fitting the calculated distance to draw a projection characteristic curve, wherein the distance calculation method is:
[0086] D l (i) = (a(i) - a(l)) 2 +(b(i)-b(l)) 2
[0087] D r (i) = (a(i) - a(r)) 2 +(b(i)-b(r)) 2
[0088] Where l represents the left endpoint of the projected feature Lab image, r represents the right endpoint of the projected feature Lab image, i represents the i-th pixel point of the projected feature Lab image, and D l (i) represents the distance between the i-th pixel of the projected feature Lab image and the left endpoint of the projected feature Lab image, D r(i) represents the distance between the i-th pixel of the projected feature Lab image and the right endpoint of the projected feature Lab image, a(i) represents the a color component value of the i-th pixel of the projected feature Lab image, a(l) represents the a color component value of the left endpoint of the projected feature Lab image, a(r) represents the a color component value of the right endpoint of the projected feature Lab image, b(i) represents the b color component value of the i-th pixel of the projected feature Lab image, b(l) represents the b color component value of the left endpoint of the projected feature Lab image, b(r) represents the b color component value of the right endpoint of the projected feature Lab image, a represents the red and green color value, ranging from -128 to +127, where -128 represents green and +127 represents red, and b represents the yellow and blue color value, ranging from -128 to +127, where -128 represents blue and +127 represents yellow.
[0089] The projected feature Lab image is an image with 1 row and N columns. After converting the projected feature Lab image from RGB space to CIE-Lab space, each pixel has a set of Lab values. When performing endpoint calculation on the projected feature Lab image, first assume that the left endpoint of the projected feature Lab image is the starting point and the right endpoint is the end point, and calculate the distance between the endpoint and the non-end point. Then assume that the left endpoint of the projected feature Lab image is the end point and the right endpoint is the starting point, and calculate the distance between the endpoint and the non-end point.
[0090] In the present invention, the distance between the non-endpoint and the punctuation point of the projected feature Lab image is calculated, specifically, the distance between the non-endpoint and the endpoint in the projected feature Lab image is calculated.
[0091] In the present invention, the calculated distance data can be fitted using the least square method, so that a corresponding curve, ie, a projection characteristic curve, can be drawn.
[0092] S4: Based on the calculated projection characteristic curve, the starting position and the intersection point of the multi-color overlapping intersection area in the RGB image to be detected are obtained.
[0093] In the present invention, based on the calculated projection characteristic curve, the starting position and the intersection point of the multi-color superposition intersection area in the RGB image to be detected are obtained, specifically:
[0094] Based on the projection characteristic curve, the intersection point in the projection characteristic curve is the intersection point of the multi-color superposition intersection area, and the starting position of the multi-color superposition intersection area is determined according to the 3σ principle.
[0095] The projection characteristic curve is specifically described as follows: 1. There are 2 projection characteristic curves in total, one of which is to use the left endpoint of the projection characteristic Lab image as the starting point, calculate the spatial distance between the starting point and other points, and then fit the calculated distance to obtain the curve, and the other curve is to use the right endpoint of the projection characteristic Lab image as the starting point, calculate the spatial distance between the starting point and other points, and then fit the calculated distance to obtain the curve; 2. The interaction point of the two curves is the "most serious point" of the interaction between the two colors, that is, the intersection point; 3. When one color is mixed into another color, its color component value will change significantly (the present invention is embodied in the spatial distance). When the aliasing ends, its color component value will become a stable value again. This change is similar to the normal distribution. The color component value in the aliasing area changes sharply, and the color value in the non-aliasing area changes very little.
[0096] In such Figure 2 In the projection characteristic curve example shown, point A is the intersection point of the multi-color superposition intersection area, and point B and point C are the starting points of the multi-color superposition intersection of two colors, respectively.
[0097] The multi-color overlapping intersection area described in the present invention refers to an area where only two colors overlap. Figure 2 There are 2 curves in the projected characteristic curve shown. Figure 2 In the figure, both curves represent the transition from one color to another. The intersection point is the point where the color transition is the most serious. Points B and C represent the starting points of the intersection. Figure 2 The horizontal axis represents the number of columns of the image, and the vertical axis represents the spatial distance.
[0098] The present invention converts RGB color into HSI, separates foreground and background images by calculating saturation, projects the foreground image and then converts it into LAB space, determines the interaction point of the multi-color superposition intersection area by calculating the spatial distance, and determines the starting point and end point of the multi-color superposition intersection area by the 3σ principle. The AOI (Automated Optical Inspection) non-contact detection method is adopted to obtain accurate detection results without destroying the surface features of the object being tested; converts RGB color into HSI, distinguishes the foreground and background by calculating the saturation, and then converts the foreground image into LAB space to calculate the spatial distance of the two colors. The detection accuracy is high, the robustness is stronger, and it is not affected by the depth of ink.
[0099] The method for determining the multi-color overlapping intersection area of a printed product in an embodiment of the present invention converts the color image from the RGB color space to the HSI color space, calculates the saturation feature image, and then performs projection analysis on the saturation image. Then, a mask image of the saturation feature is calculated based on the saturation feature image, and a foreground image of the RGB image to be detected is obtained. The foreground image is projected, and the RGB image obtained after projection is converted into a Lab image, that is, a projection feature Lab image is obtained, and the distance between the endpoints and the non-endpoints in the projection feature Lab image is fitted to obtain a projection feature curve. Finally, based on the projection feature curve, information on the multi-color overlapping intersection area in the RGB image to be detected can be obtained. A non-contact detection method is adopted to obtain accurate detection results without destroying the surface features of the printed body to be detected, and the detection accuracy is high, the robustness is stronger, and it is not affected by the depth of ink.
[0100] In a possible implementation, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, the readable storage medium is located in a PLC (Programmable Logic Controller) controller, and a computer program is stored on the readable storage medium. When the program is executed by a processor, the following steps of the method for determining the intersection area of multiple color overlays of a printed product are implemented:
[0101] Obtain an RGB image to be detected containing a multi-color overlapping intersection area, convert the RGB image to be detected into an HSI image, and calculate a saturation feature image;
[0102] A mask image of saturation characteristics is calculated based on the saturation characteristic image to obtain a foreground image of the RGB image to be detected;
[0103] The foreground image is projected, and the RGB image obtained after the projection is converted into a Lab image, that is, a projection feature Lab image is obtained, and the distance between the endpoint and the non-endpoint in the projection feature Lab image is fitted to obtain a projection feature curve;
[0104] Based on the calculated projection characteristic curve, the starting position and the intersection point of the multi-color superposition intersection area in the RGB image to be detected are obtained.
[0105] The storage medium may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device or device.
[0106] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0107] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0108] An embodiment of the present invention provides a device for determining a multi-color overlapping intersection area of a printed product, comprising an acquisition module, a calculation module, a processing module and an execution module.
[0109] The acquisition module is used to acquire an RGB image to be detected containing a multi-color overlapping intersection area, and convert the RGB image to be detected into an HSI image, and calculate a saturation feature image; the calculation module is used to calculate a mask image of a saturation feature based on the saturation feature image to obtain a foreground image of the RGB image to be detected; the processing module is used to perform projection processing on the foreground image, convert the RGB image obtained after projection into a Lab image, that is, obtain a projection feature Lab image, and fit the distance between the endpoints and non-endpoints in the projection feature Lab image to obtain a projection feature curve; the execution module is used to obtain the starting position and the intersection point of the multi-color overlapping intersection area in the RGB image to be detected based on the calculated projection feature curve.
[0110] In the present invention, the RGB image to be detected is obtained by photographing the printed matter to be detected with a CCD color camera, and the photographed RGB image to be detected is an RGB image.
[0111] In the present invention, the RGB image to be detected is converted into an HSI image, and a saturation characteristic image is calculated, wherein the saturation characteristic image is calculated as follows:
[0112] S(ij)=M(ij)-N(ij)
[0113] M(ij)=max(R(ij),G(ij),B(ij))
[0114] N(ij)=min(R(ij),G(ij),B(ij))
[0115] Among them, S(ij) represents the saturation feature of the image coordinate (ij), R(ij) represents the grayscale value of the image at the R channel coordinate (ij), G(ij) represents the grayscale value of the image at the G channel coordinate (ij), B(ij) represents the grayscale value of the image at the B channel coordinate (ij), R, G, and B are the three color channels of the RGB image to be detected, and the size of the RGB image to be detected is M*N, M represents rows, and N represents columns.
[0116] In the present invention, the mask image of the saturation feature is calculated based on the saturation feature image, specifically:
[0117] Perform Canny operation on the saturation feature image to obtain a saturation feature binary image;
[0118] The seed points of the saturation feature binary image are filled to obtain a mask image of the saturation feature.
[0119] In the present invention, the foreground image of the RGB image to be detected is obtained, and the specific steps include:
[0120] The image obtained by performing AND operation on the RGB image to be detected and the mask image of the saturation feature is the foreground image, and the image obtained by performing XOR operation on the RGB image to be detected and the mask image of the saturation feature is the background image. The calculation method is:
[0121] F T =T RGB &S mask
[0122] B T =T RGB ∧S mask
[0123] Among them, F T represents the foreground image, B T represents the background image, T RGB represents the RGB image to be detected, S mask The mask image represents the saturation feature, & represents the AND operation, and ∧ represents the XOR operation.
[0124] In the present invention, the foreground image is projected, and the RGB image obtained after the projection is converted into a Lab image, that is, the projection feature Lab image is obtained. The specific steps include:
[0125] The foreground image is subjected to vertical projection processing, and the RGB image obtained after the projection is converted into a Lab image, that is, a projection feature Lab image is obtained. The vertical projection processing is to project the two-dimensional image in a horizontal direction by column, and then calculate the mean value of each color channel as the projection value of the current column, and then convert the RGB image obtained after the projection into a Lab image, so as to obtain a projection feature Lab image;
[0126] Perform statistical mean filtering on the projected feature Lab image.
[0127] In the present invention, the distance between the endpoints and the non-endpoints in the projection feature Lab image is fitted to obtain the projection feature curve, and the specific steps include:
[0128] Convert the projected feature Lab image from RGB color space to CIE-Lab color space;
[0129] Calculate the two endpoints of the projected feature Lab image, and calculate the distance between the non-endpoint and the endpoint in the projected feature Lab image;
[0130] The calculated distance is fitted to draw the projection characteristic curve, where the distance is calculated as follows:
[0131] Dl (i) = (a(i) - a(l)) 2 +(b(i)-b(l)) 2
[0132] D r (i) = (a(i) - a(r)) 2 +(b(i)-b(r)) 2
[0133] Where l represents the left endpoint of the projected feature Lab image, r represents the right endpoint of the projected feature Lab image, i represents the i-th pixel point of the projected feature Lab image, and D l (i) represents the distance between the i-th pixel of the projected feature Lab image and the left endpoint of the projected feature Lab image, D r (i) represents the distance between the i-th pixel of the projected feature Lab image and the right endpoint of the projected feature Lab image, a(i) represents the a color component value of the i-th pixel of the projected feature Lab image, a(l) represents the a color component value of the left endpoint of the projected feature Lab image, a(r) represents the a color component value of the right endpoint of the projected feature Lab image, b(i) represents the b color component value of the i-th pixel of the projected feature Lab image, b(l) represents the b color component value of the left endpoint of the projected feature Lab image, b(r) represents the b color component value of the right endpoint of the projected feature Lab image, a represents the red and green color value, ranging from -128 to +127, where -128 represents green and +127 represents red, and b represents the yellow and blue color value, ranging from -128 to +127, where -128 represents blue and +127 represents yellow.
[0134] In the present invention, based on the calculated projection characteristic curve, the starting position and the intersection point of the multi-color superposition intersection area in the RGB image to be detected are obtained, specifically:
[0135] Based on the projection characteristic curve, the intersection point in the projection characteristic curve is the intersection point of the multi-color superposition intersection area, and the starting position of the multi-color superposition intersection area is determined according to the 3σ principle.
[0136] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
[0137] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
Claims
1. A method for determining the intersection area of multiple colors of printed matter, characterized in that: The specific steps include: Obtain an RGB image to be detected containing a multi-color overlapping intersection area, convert the RGB image to be detected into an HSI image, and calculate a saturation feature image; A mask image of saturation characteristics is calculated based on the saturation characteristic image to obtain a foreground image of the RGB image to be detected; The foreground image is projected, and the projected RGB image is converted into a Lab image, that is, a projection feature Lab image is obtained, and the distance between the endpoint and the non-endpoint in the projection feature Lab image is fitted to obtain a projection feature curve; Based on the calculated projection characteristic curve, the starting position and the intersection point of the multi-color superposition intersection area in the RGB image to be detected are obtained; Among them, the projection feature curves include two curves, one of which takes the left endpoint of the projection feature Lab image as the starting point, calculates the spatial distance between the starting point and the non-endpoint in the fitted projection feature Lab image, and fits the calculated spatial distance, and the other curve takes the right endpoint of the projection feature Lab image as the starting point, calculates the spatial distance between the starting point and the non-endpoint in the fitted projection feature Lab image, and fits the calculated spatial distance.
2. A method for determining a multi-color overlapping intersection area of a printed product as claimed in claim 1, characterized in that: The RGB image to be detected is obtained by photographing the printed matter to be detected with a CCD color camera, and the photographed RGB image to be detected is an RGB image.
3. A method for determining a multi-color overlapping intersection area of a printed product as claimed in claim 2, characterized in that: The RGB image to be detected is converted into an HSI image, and a saturation characteristic image is calculated. The saturation characteristic image is calculated as follows: S(ij)=M(ij)-N(ij) M(ij)=max(R(ij),G(ij),B(ij)) N(ij)=min(R(ij),G(ij),B(ij)) Among them, S(ij) represents the saturation feature of the image coordinate (ij), R(ij) represents the grayscale value of the image at the R channel coordinate (ij), G(ij) represents the grayscale value of the image at the G channel coordinate (ij), B(ij) represents the grayscale value of the image at the B channel coordinate (ij), R, G, and B are the three color channels of the RGB image to be detected, and the size of the RGB image to be detected is M*N, M represents rows, and N represents columns.
4. A method for determining a multi-color overlapping intersection area of a printed product as claimed in claim 2, characterized in that: The mask image of the saturation feature is calculated based on the saturation feature image, specifically: Perform Canny operation on the saturation feature image to obtain a saturation feature binary image; The seed points of the saturation feature binary image are filled to obtain a mask image of the saturation feature.
5. A method for determining a multi-color overlapping intersection area of a printed product as claimed in claim 4, characterized in that: The foreground image of the RGB image to be detected is obtained, and the specific steps include: The image obtained by performing AND operation on the RGB image to be detected and the mask image of the saturation feature is the foreground image, and the image obtained by performing XOR operation on the RGB image to be detected and the mask image of the saturation feature is the background image. The calculation method is: F T =T RGB &S mask B T =T RGB ∧S mask Among them, F T represents the foreground image, B T represents the background image, T RGB represents the RGB image to be detected, S mask The mask image represents the saturation feature, & represents the AND operation, and ∧ represents the XOR operation.
6. A method for determining a multi-color overlapping intersection area of a printed product as claimed in claim 5, characterized in that: The foreground image is projected and the projected RGB image is converted into a Lab image, that is, a projection feature Lab image is obtained. The specific steps include: The foreground image is subjected to vertical projection processing, and the RGB image obtained after the projection is converted into a Lab image, that is, a projection feature Lab image is obtained. The vertical projection processing is to project the two-dimensional image in a horizontal direction by column, and then calculate the mean value of each color channel as the projection value of the current column, and then convert the RGB image obtained after the projection into a Lab image, so as to obtain a projection feature Lab image; Perform statistical mean filtering on the projected feature Lab image.
7. A method for determining a multi-color overlapping intersection area of a printed product as claimed in claim 6, characterized in that: The step of fitting the distance between the endpoint and the non-endpoint in the projection feature Lab image to obtain the projection feature curve specifically includes: Convert the projected feature Lab image from RGB color space to CIE-Lab color space; Calculate the two endpoints of the projected feature Lab image, and calculate the distance between the non-endpoint and the endpoint in the projected feature Lab image; The calculated distance is fitted to draw the projection characteristic curve, where the distance is calculated as follows: D l (i)=(a(i)-a(l)) 2 +(b(i)-b(l)) 2 D r (i)=(a(i)-a(r)) 2 +(b(i)-b(r)) 2 Where l represents the left endpoint of the projected feature Lab image, r represents the right endpoint of the projected feature Lab image, i represents the i-th pixel point of the projected feature Lab image, and D l (i) represents the distance between the i-th pixel of the projected feature Lab image and the left endpoint of the projected feature Lab image, D r (i) represents the distance between the i-th pixel of the projected feature Lab image and the right endpoint of the projected feature Lab image, a(i) represents the a color component value of the i-th pixel of the projected feature Lab image, a(l) represents the a color component value of the left endpoint of the projected feature Lab image, a(r) represents the a color component value of the right endpoint of the projected feature Lab image, b(i) represents the b color component value of the i-th pixel of the projected feature Lab image, b(l) represents the b color component value of the left endpoint of the projected feature Lab image, b(r) represents the b color component value of the right endpoint of the projected feature Lab image, a represents the red and green color value, ranging from -128 to +127, where -128 represents green and +127 represents red, and b represents the yellow and blue color value, ranging from -128 to +127, where -128 represents blue and +127 represents yellow.
8. A method for determining a multi-color overlapping intersection area of a printed product as claimed in claim 6, characterized in that: The projection characteristic curve obtained based on the calculation is used to obtain the starting position and the intersection point of the multi-color superposition intersection area in the RGB image to be detected, specifically: Based on the projection characteristic curve, the intersection point in the projection characteristic curve is the intersection point of the multi-color superposition intersection area, and the starting position of the multi-color superposition intersection area is determined according to the 3σ principle.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for determining the multi-color overlapping intersection area of a printed product as described in any one of claims 1 to 8 are implemented.
10. A device for determining the overlapping area of multiple colors in a printed product, characterized in that: include: An acquisition module is used to acquire an RGB image to be detected containing a multi-color overlapping intersection area, convert the RGB image to be detected into an HSI image, and calculate a saturation feature image; A calculation module, which is used to calculate a mask image of a saturation feature based on the saturation feature image to obtain a foreground image of the RGB image to be detected; A processing module is used to perform projection processing on the foreground image, convert the projected RGB image into a Lab image, that is, obtain a projection feature Lab image, and fit the distance between the endpoint and the non-endpoint in the projection feature Lab image to obtain a projection feature curve; An execution module, which is used to obtain the starting position and intersection point of the multi-color superposition intersection area in the RGB image to be detected based on the calculated projection characteristic curve; Among them, the projection feature curves include two curves, one of which takes the left endpoint of the projection feature Lab image as the starting point, calculates the spatial distance between the starting point and the non-endpoint in the fitted projection feature Lab image, and fits the calculated spatial distance, and the other curve takes the right endpoint of the projection feature Lab image as the starting point, calculates the spatial distance between the starting point and the non-endpoint in the fitted projection feature Lab image, and fits the calculated spatial distance.
Citation Information
Patent Citations
Printed matter quality detection method and device, electronic equipment and storage medium
CN114943719A
Human hand detection method and device based on skin colour
WO2017092431A1