Character color judgment method and device, equipment, medium and product
By automatically identifying and analyzing the image pixel information of laser marking products, combining linewidth correlation coefficient and color determination standards, the accurate recognition of the color of radium engraved characters is achieved, and the subjectivity and efficiency of manual judgment in the prior art is solved, and the accuracy and consistency of judgments are improved.
Patent Information
- Application Number
- CN202411702103.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-03-18
AI Technical Summary
In the prior art, laser mark/printing product information judgment relies on manual labor, and there are problems of excessive subjective factors and low efficiency, which leads to the inability to form accurate and replicable color judgment standards, affecting product information identification and appearance.
By obtaining the product image, line width correlation coefficient and color determination standard information of the product to be judged, the characters in the product image are automatically identified, the color chromaticity value of the characters is determined, and the color determination standard information is compared, so as to realize automatic and accurate recognition of character colors.
Automatic determination of the chromaticity value of radium characters is achieved, the accuracy of the color chromaticity value is ensured, the subjectivity and error rate of manual judgment are reduced, and the judgment efficiency and consistency are improved.
Smart Images

Figure CN119649379A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a character color judgment method, device, equipment, medium and product. Background Art
[0002] Laser engraving is a technology that uses a high-energy laser beam to irradiate the surface of a material, causing it to undergo chemical or physical changes, thereby forming permanent patterns, text or textures. Laser engraving technology can form permanent marks on the surfaces of various materials.
[0003] At present, the product information of laser marking / printing basically relies on manual judgment to determine whether the product imprint of the laser engraved product meets the marking color requirements.
[0004] This judgment method has too many subjective factors and is inefficient. Manual judgment is prone to fatigue and it is impossible to form an accurate and reproducible color judgment standard. The uncontrollable color of the information mark will affect the product information recognition and appearance. Summary of the invention
[0005] The present invention provides a character color determination method, device, equipment, medium and product to realize automatic and accurate recognition of character color.
[0006] According to a first aspect of the present invention, a character color determination method is provided, characterized in that it comprises:
[0007] Obtain product images, line width correlation coefficients, and color judgment standard information of the product to be judged;
[0008] Determining character pixel information of characters in the product image according to the image pixel information of the product image;
[0009] Determining the color chromaticity value of the character in the product image according to the line width correlation coefficient and the character pixel information;
[0010] Based on the comparison between the color chromaticity value and the color judgment standard information, a color judgment result of the product to be judged is determined.
[0011] According to a second aspect of the present invention, there is provided a character color determination device, comprising:
[0012] An information acquisition module, used to acquire product images, line width correlation coefficients and color determination standard information of the product to be determined;
[0013] An information determination module, used to determine character pixel information of characters in the product image according to the image pixel information of the product image;
[0014] A chromaticity value determination module, used to determine the color chromaticity value of the character in the product image according to the line width correlation coefficient and the character pixel information;
[0015] The color determination module is used to determine the color determination result of the product to be determined based on the comparison between the color chromaticity value and the color determination standard information.
[0016] According to a third aspect of the present invention, there is provided an electronic device, the electronic device comprising:
[0017] at least one processor; and
[0018] a memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the character color determination method described in any embodiment of the present invention.
[0020] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the character color determination method described in any embodiment of the present invention when executed.
[0021] According to a fifth aspect of the present invention, an embodiment of the present invention further provides a computer program product, the computer program product includes a computer program, and when the computer program is executed by a processor, the character color determination method of any embodiment of the present invention is implemented.
[0022] The technical solution of the embodiment of the present invention obtains the product image, line width correlation coefficient and color judgment standard information of the product to be judged; determines the character pixel information of the characters in the product image according to the image pixel information of the product image; determines the color chromaticity value of the characters in the product image according to the line width correlation coefficient and the character pixel information; and determines the color judgment result of the product to be judged based on the comparison of the color chromaticity value and the color judgment standard information. The characters in the product image are automatically recognized by the image pixel information, and the influence of different character widths on the determination of color chromaticity value is balanced by introducing the line width correlation coefficient of the product to be judged, so as to obtain a more accurate color chromaticity value, realize the automatic determination of the chromaticity value of the laser engraved characters, and ensure the accuracy of the color chromaticity value.
[0023] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 is a flow chart of a character color determination method provided according to Embodiment 1 of the present invention;
[0026] Figure 2 This is an example diagram of the relationship between line width and chromaticity in a character color determination method provided in Embodiment 2 of the present invention;
[0027] Figure 3 is a flow chart of a character color determination method provided according to Embodiment 2 of the present invention;
[0028] Figure 4 This is an example diagram of a product to be determined in a character color determination method provided in Embodiment 2 of the present invention;
[0029] Figure 5 is an example diagram of a pixel range in a character color determination method provided in Embodiment 2 of the present invention;
[0030] Figure 6 is an example diagram of a character area in a character color determination method provided in Embodiment 2 of the present invention;
[0031] Figure 7 is an example diagram of pixel grayscale values in a character color determination method provided in Embodiment 2 of the present invention;
[0032] Figure 8 is a structural schematic diagram of a character color determination device provided according to Embodiment 3 of the present invention;
[0033] Fig. 9 It is a schematic diagram of the structure of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0034] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0035] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0036] Embodiment 1
[0037] Figure 1 A flowchart of a character color judgment method is provided for the first embodiment of the present invention. This embodiment is applicable to the judgment of character color. The method can be executed by a character color judgment device. The character color judgment device can be implemented in the form of hardware and / or software. The character color judgment device can be configured in an electronic device. Figure 1 As shown, the method includes:
[0038] S110, obtaining a product image, a line width correlation coefficient, and color determination standard information of a product to be determined.
[0039] In this embodiment, the product to be determined can be understood as a product with laser engraved characters on its surface. The product image can be understood as an image formed by photographing the laser engraved character area.
[0040] It is known that characters with the same chromaticity but different widths have different depths in vision. In order to balance the influence of different character widths on chromaticity, the line width correlation coefficient is introduced. The line width correlation coefficient can be understood as a coefficient reflecting the relationship between character width and color. Color judgment standard information can be understood as information used to judge whether the color of the laser characters on the product to be judged is correct, for example, it can be a standard chromaticity value.
[0041] Specifically, the processor may obtain a product image of the product to be determined taken by a camera, and obtain a predetermined line width correlation coefficient of the product to be determined from a connected storage medium, as well as color determination standard information set by relevant personnel.
[0042] S120: Determine character pixel information of characters in the product image according to the image pixel information of the product image.
[0043] In this embodiment, the image pixel information can be understood as including the position of each pixel point of the product image and its corresponding pixel value. The character can be understood as the laser engraved character contained in the product image. The character pixel information can be understood as the pixel information corresponding to the character.
[0044] Specifically, the processor can roughly divide the product image into a character area and a background area according to the image pixel information of the product image, and locate the characters in the divided character area to distinguish the characters in the character area. Since the positioning may be inaccurate, the processor can further determine the interference part and the pure character part in the character part according to the image pixel information of the character, and determine the character pixel information through the interference part and the pure character part.
[0045] S130 , determining the color chromaticity value of the characters in the product image according to the line width correlation coefficient and the character pixel information.
[0046] In this embodiment, the color chromaticity value can be understood as being used to reflect the color of a character in the form of a numerical value, so as to facilitate comparison.
[0047] Specifically, the processor may determine the color chromaticity value of the character in the product image according to the association between the line width correlation coefficient and the character pixel information.
[0048] S140: Determine a color determination result of the product to be determined based on a comparison between the color chromaticity value and the color determination standard information.
[0049] In this embodiment, the color determination result can be understood as reflecting whether the characters in the product to be determined meet the color standard.
[0050] Specifically, the processor may compare the color chromaticity value with the color judgment standard information to determine whether the color chromaticity value is within the color range corresponding to the color judgment standard information. If so, the color judgment result of the product to be judged is qualified, otherwise, it is unqualified.
[0051] The technical solution of the embodiment of the present invention obtains the product image, line width correlation coefficient and color judgment standard information of the product to be judged; determines the character pixel information of the characters in the product image according to the image pixel information of the product image; determines the color chromaticity value of the characters in the product image according to the line width correlation coefficient and the character pixel information; and determines the color judgment result of the product to be judged based on the comparison of the color chromaticity value and the color judgment standard information. The characters in the product image are automatically recognized by the image pixel information, and the influence of different character widths on the determination of color chromaticity value is balanced by introducing the line width correlation coefficient of the product to be judged, so as to obtain a more accurate color chromaticity value, realize the automatic determination of the chromaticity value of the laser engraved characters, and ensure the accuracy of the color chromaticity value.
[0052] As a first optional embodiment of the first embodiment, based on the above embodiment, the step of determining the line width correlation coefficient can be optimized as follows:
[0053] A sample picture set of the product to be judged is obtained, wherein the sample picture set includes sample pictures of characters with the same chromaticity and different widths; critical line width information is determined based on single-pixel width information of each sample picture in the sample picture set; and a line width correlation coefficient of the product to be judged is determined based on the critical line width information and the corresponding critical chromaticity information.
[0054] In this embodiment, the sample image set can be understood as a set of sample images of different character widths under the same chromaticity. The single pixel width information can be understood as the size of a single pixel. The critical line width information can include the maximum value of the character line width and the minimum value of the character line width. The critical chromaticity information can include the visual color depth value corresponding to the maximum value of the character line width in the critical line width information, and the visual color depth value corresponding to the minimum value of the character line width.
[0055] Specifically, the processor can pre-set the line width and chromaticity standards of the characters, take a sample picture of the product to be judged by a CCD camera and obtain the single pixel width information of the sample picture, and form a sample picture set through multiple sample pictures, and the sample picture set includes sample pictures of characters with different line widths under the same chromaticity. The lower critical line width value (for example, it can be represented by X(S)) can be calculated through the single pixel width information, and the lower critical line width value X(S) = the lower critical number of pixels * the single pixel size, and the chromaticity value L of the point is set in the model as the lower critical chromaticity value (for example, it can be represented by Y(S)). Similarly, the upper critical line width value (for example, it can be represented by X(A)) and the upper critical chromaticity value (for example, it can be represented by Y(A)) can be obtained through the upper limit sample. The processor can use the upper critical line width value and the lower critical line width value as critical line width information, and the upper critical chromaticity value and the lower critical chromaticity value as critical chromaticity information. By dividing the difference between the upper critical chromaticity value and the lower critical chromaticity value by the difference between the upper critical pixel and the lower critical pixel, the line width correlation coefficient of the product to be judged can be determined.
[0056] Exemplarily, taking a specific example as a demonstration, it is assumed that under the conditions of the same chromaticity and different character line widths, multiple groups of sample images are formed, and plots are drawn based on the character width and visual color depth of the sample images to obtain a relationship diagram between line width and chromaticity. Figure 2 This is an example diagram of the relationship between line width and chromaticity in a character color determination method provided in the second embodiment of the present invention, such as Figure 2As shown, the horizontal axis represents the character line width, and the vertical axis represents the visual color depth. The marking points of different symbols in the figure (including quadrilateral marking points, circular marking points and triangular marking points in the figure) represent different types of samples. It can be seen from the figure that when the same chromaticity is set, different character widths will correspond to different visual color depths. It can be seen from the figure that as the character line width increases, the speed also increases, that is, the larger the character line width, the deeper the chromaticity. The influence of line width on chromaticity can be eliminated by introducing a line width correlation. The line width correlation b can be calculated by the formula: b = (Y(A)-Y(S)) / (X(A)-X(S)), where the upper critical line width value of the upper critical point A is X(A), the lower critical pixel is Y(A), and the upper critical line width value of the lower critical point S is X(S), and the lower critical pixel is Y(S).
[0057] The first optional embodiment of the present embodiment 1 analyzes the sample picture set of the product to be judged, determines the relationship between the line width and chromaticity of the product to be judged, obtains the line width correlation, realizes the determination of the influence of the line width on the chromaticity, provides support for the subsequent accurate determination of the color chromaticity value, and eliminates the influence of different character widths on the visual chromaticity.
[0058] Embodiment 2
[0059] Figure 3 This is a flowchart of a character color determination method provided in Embodiment 2 of the present invention. This embodiment is a further refinement of the above embodiment. Figure 3 As shown, the method includes:
[0060] S301, obtaining a product image, a line width correlation coefficient, and color determination standard information of a product to be determined.
[0061] S302: Determine character-background separation information based on image pixel information of the product image, where the character-background separation information includes a character area and a background area.
[0062] In this embodiment, the character-background separation information can be understood as the distinguished character area and background area. The character area can be understood as the area containing only characters, and the background area can be understood as the area excluding characters.
[0063] Specifically, since there is a certain difference between the image pixel values corresponding to the characters and the image pixel values corresponding to the background, the processor can determine the boundary between the characters and the background in the product image based on the image pixel information of the product image and the set difference threshold, divide the character area and the background area by the boundary, and obtain the character-background separation information.
[0064] Further, according to the image pixel information of the product image, the character background separation information is determined, including:
[0065] Obtain a preset boundary grayscale threshold; determine the pixel difference between two adjacent pixels in the product image based on the image pixel information of the product image; determine the character boundary of the product image based on each pixel difference and the preset boundary grayscale threshold; divide the product image into a character area and a background area based on the character boundary; and use the character area and the background area as character-background separation information.
[0066] In this embodiment, the preset boundary grayscale threshold can be understood as the difference between the character and the background at the preset character boundary. The appropriate threshold can be set according to data collection of different product samples, and can also be determined by the fluctuation of the change value of the pixel value actually determined. The pixel difference can be understood as the difference between the pixel values of adjacent pixels. The character boundary can be understood as the boundary line between the pixels used to distinguish the character from the background.
[0067] Specifically, the processor can obtain the preset boundary grayscale threshold of the product to be judged pre-stored in the storage medium. The processor can determine the pixel difference between two adjacent pixels in the product image based on the image pixel information of the product image. In order to more accurately determine the character boundary, the pixel difference between two adjacent pixels can be divided by the pixel value of the outer boundary to obtain the pixel difference in the form of a ratio, which can then be compared with the preset boundary grayscale threshold to determine whether the two adjacent pixels are the character boundary that demarcates the character and the background. Then, the pixel points inside the boundary are used as the character area, and the pixel points outside the boundary are used as the background area through the character boundary to obtain the character background separation information.
[0068] S303: Determine the first character grayscale mean value, the interference pixel range, and the second character grayscale mean value of the characters in the product image according to the character background separation information.
[0069] In this embodiment, the grayscale mean of the first character can be understood as the mean value calculated from the pixel values of all pixels in the character area. Since the characters engraved by laser engraving technology are characters in grayscale color, the pixel values are also grayscale values. The interference pixel range can be understood as the range composed of the maximum pixel value and the minimum pixel value in the background area. The grayscale mean of the second character can be understood as the pixel value mean of the pure character area.
[0070] Specifically, the processor can determine the sum of the pixel values of all pixels in the character area based on the character background separation information, and divide it by the number of pixels to obtain the first character grayscale mean. The processor can obtain the interference pixel range by dividing the sum of all pixel values in the background area by the number of pixels. Since the above-mentioned determination of the character boundary is not the most accurate, and usually the range of the character boundary is larger than the actual character, the processor can also correct the character area through the pixel values in the background area, determine the area containing only the characters, and then determine the second character grayscale mean.
[0071] Further, according to the character background separation information, determining the first character grayscale mean value, the interference pixel range and the second character grayscale mean value of the characters in the product image includes:
[0072] According to the image pixel values in the character area, the grayscale mean of the first character is determined; according to the image pixel values in the background area, the interference pixel range is determined; based on the interference pixel range, the boundary of the character area is corrected to obtain a corrected character area; according to the image pixel values in the corrected character area, the grayscale mean of the second character is determined.
[0073] In this embodiment, the image pixel value can be understood as the pixel value of the pixel point. The corrected character area can be understood as the pure character area obtained by correcting the background area included in the character area.
[0074] Specifically, the processor may sum the image pixel values of each pixel in the character area, and then divide the sum by the number of all pixels in the character area to obtain the first character grayscale mean. The processor may sum the image pixel values of each pixel in the background area, and then divide the sum by the number of all pixels in the background area to obtain the interference pixel range. The processor may filter out all pixels in the character area that are in the interference pixel range to obtain a corrected character area. The processor may sum the image pixel values of each pixel in the corrected character area, and then divide the sum by the number of all pixels in the corrected character area to obtain the second character grayscale mean.
[0075] Exemplarily, the larger the corresponding chromaticity value under the light background, the darker the color is perceived by the visual sense, and the maximum value points within the interference pixel range are filtered out, while the smaller the corresponding chromaticity value under the dark background, the darker the color is perceived by the visual sense.
[0076] S304: Determine a character pixel ratio according to the first character grayscale mean value and the second character grayscale mean value.
[0077] Specifically, the processor may use the ratio of the second character grayscale mean value to the first character grayscale mean value as the character pixel ratio.
[0078] For example, a specific example is used as a demonstration. A1 is the original product image, and the red box in A2 is the dividing box between the background area and the character area. Figure 4 is an example of a product to be determined in a character color determination method provided in Embodiment 2 of the present invention, such as Figure 4 As shown, the product to be judged includes three character marks formed by laser engraving technology. Figure 5 : is an example of a pixel range in a character color determination method provided in the second embodiment of the present invention. First, the character and the background can be roughly located by a preset boundary grayscale threshold. Figure 5 The range of characters is divided by the red rectangle. Since the determined character range is large at this time, the processor can also correct the character area by the pixel value in the background area to determine the area containing only the characters. Figure 5 The red edge line of each character in the red box corresponds to the corrected character area. The interference pixel range after removing the characters in the red box is L(c1~c2) (c1 is the minimum gray value of the background area after removing the characters in the red box, and c2 is the maximum gray value of the background area). Further enlarging the pixels corresponding to each corrected character area, we can get Figure 6 is an example diagram of a character area in a character color determination method provided in Embodiment 2 of the present invention. Figure 6 As shown, it can be seen that after the character area is corrected by the pixel value in the background area, the character area and the background area can be accurately distinguished.
[0079] Combination Figure 7 This is an example diagram of pixel grayscale values in a character color determination method provided in the second embodiment of the present invention, such as Figure 7 As shown in the figure, the horizontal axis is the size of the product image, and the vertical axis is the grayscale value. The mean value corresponding to L(b1-b2) is the grayscale mean value of the first character in the character area; L(c1-c2) corresponds to Figure 5 The horizontal coordinates in the character area are b3 and b4, and the area b3~b4 is the corrected character area. The corresponding second character grayscale mean L(b3~b4) (after eliminating the interference pixel range) can be further obtained. The relationship between the first character grayscale mean L(b1~b2) and the second character grayscale mean L(b3~b4) is: L(b3~b4)=L(b1~b2)*Sd1 / Sd2, where Sd1 / Sd2 is the character pixel ratio a, where Sd1 represents the area of the character area, Sd2 represents the area of the corrected character area, d1 represents the size of the character area, and d2 represents the size of the corrected character area, where d2=d1-(|(L(C1~C2)-Lb3)|+|(L(C1~C2)-Lb4)|)
[0080] S305: Use the grayscale mean value of the first character and the character pixel ratio as character pixel information of the character.
[0081] Specifically, the processor may use the first character grayscale mean value and the character pixel ratio as the character pixel information of the character.
[0082] S306: Determine the color chromaticity value of the characters in the product image according to the line width correlation coefficient and the character pixel information by the following formula:
[0083] L=L1×a+b
[0084] Wherein, L represents the color chromaticity value, a represents the character pixel ratio in the character pixel information, L1 represents the grayscale mean value of the first character in the character pixel information, and b represents the line width correlation coefficient.
[0085] S307: Determine a color determination result of the product to be determined based on a comparison between the color chromaticity value and the color determination standard information.
[0086] The technical solution of the embodiment of the present invention determines the character boundary in the product image through the image pixel information of the product image and the preset boundary grayscale threshold, separates the character area of the product image from the background area, determines the grayscale mean of the first character by determining the image pixel value of the character area, determines the interference pixel range by the image pixel value in the background area, and then divides the character area again to obtain the corrected character area, and obtains a more accurate character area, which provides support for the subsequent accurate recognition of the character chromaticity. The grayscale mean of the second character is determined by the image pixel value of the corrected character area, and then the character pixel ratio is determined by the grayscale mean of the first character and the grayscale mean of the second character, and the color chromaticity value is determined by the line width correlation coefficient, the grayscale mean of the first character and the character pixel ratio, which balances the influence of different character widths on the determination of the color chromaticity value, obtains a more accurate color chromaticity value, realizes the automatic determination of the chromaticity value of the laser engraved character, and ensures the accuracy of the color chromaticity value.
[0087] Embodiment 3
[0088] Figure 8 This is a structural schematic diagram of a character color judgment device provided in Embodiment 3 of the present invention.
[0089] like Figure 8 As shown, the device comprises:
[0090] The information acquisition module 61 is used to acquire the product image, line width correlation coefficient and color judgment standard information of the product to be judged;
[0091] An information determination module 62, configured to determine character pixel information of characters in the product image based on the image pixel information of the product image;
[0092] A chromaticity value determination module 63, used to determine the color chromaticity value of the character in the product image according to the line width correlation coefficient and the character pixel information;
[0093] The color determination module 64 is used to determine the color determination result of the product to be determined based on the comparison between the color chromaticity value and the color determination standard information.
[0094] The technical solution of the embodiment of the present invention obtains the product image, line width correlation coefficient and color judgment standard information of the product to be judged; determines the character pixel information of the characters in the product image according to the image pixel information of the product image; determines the color chromaticity value of the characters in the product image according to the line width correlation coefficient and the character pixel information; and determines the color judgment result of the product to be judged based on the comparison of the color chromaticity value and the color judgment standard information. The characters in the product image are automatically recognized by the image pixel information, and the influence of different character widths on the determination of color chromaticity value is balanced by introducing the line width correlation coefficient of the product to be judged, so as to obtain a more accurate color chromaticity value, realize the automatic determination of the chromaticity value of the laser engraved characters, and ensure the accuracy of the color chromaticity value.
[0095] Furthermore, the information determination module 62 includes:
[0096] A first determining unit, configured to determine character-background separation information according to image pixel information of the product image, wherein the character-background separation information includes a character area and a background area;
[0097] A second determination unit, configured to determine a first character grayscale mean and a second character grayscale mean of characters in the product image according to the character background separation information;
[0098] A third determining unit, configured to determine a character pixel ratio according to the first character grayscale mean value and the second character grayscale mean value;
[0099] The fourth determining unit is used to use the first character grayscale mean value and the character pixel ratio as character pixel information of the character.
[0100] Wherein, the first determining unit is specifically used for:
[0101] Get the preset boundary grayscale threshold;
[0102] Determine a pixel difference between two adjacent pixels in the product image according to the image pixel information of the product image;
[0103] Determining a character boundary of the product image according to each of the pixel differences and the preset boundary grayscale threshold;
[0104] Based on the character boundary, dividing the product image into a character area and a background area;
[0105] The character area and the background area are used as the character-background separation information.
[0106] Wherein, the second determining unit is specifically used for:
[0107] Determining a grayscale mean value of a first character according to each image pixel value in the character area;
[0108] Determining an interference pixel range according to each image pixel value in the background area;
[0109] Correcting the boundary of the character area based on the interference pixel range to obtain a corrected character area;
[0110] The grayscale mean value of the second character is determined according to the pixel values of each image in the corrected character area.
[0111] Furthermore, the chromaticity value determination module 63 is specifically used to:
[0112] According to the line width correlation coefficient and the character pixel information, the color chromaticity value of the character in the product image is determined by the following formula:
[0113] L=L1×a+b
[0114] In the formula, L represents the color chromaticity value, a represents the character pixel ratio in the character pixel information, L1 represents the first character grayscale mean value in the character pixel information, and b represents the line width correlation coefficient.
[0115] Furthermore, the device also includes: a coefficient determination module.
[0116] The coefficient determination module is specifically used for:
[0117] Acquire a sample picture set of the product to be judged, wherein the sample picture set includes sample pictures of characters with the same chroma and different widths;
[0118] Determining critical line width information according to single pixel width information of each of the sample pictures in the sample picture set;
[0119] The line width correlation coefficient of the product to be judged is determined according to the critical line width information and the corresponding critical chromaticity information.
[0120] The character color determination device provided in the embodiment of the present invention can execute the character color determination method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0121] Embodiment 4
[0122] Fig. 9 A schematic diagram of an electronic device 70 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0123] like Fig. 9 As shown, the electronic device 70 includes at least one processor 71, and a memory connected to the at least one processor 71, such as a read-only memory (ROM) 72, a random access memory (RAM) 73, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 71 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 72 or the computer program loaded from the storage unit 78 to the random access memory (RAM) 73. In the RAM 73, various programs and data required for the operation of the electronic device 70 can also be stored. The processor 71, the ROM 72, and the RAM 73 are connected to each other via a bus 74. An input / output (I / O) interface 75 is also connected to the bus 74.
[0124] A number of components in the electronic device 70 are connected to the I / O interface 75, including: an input unit 76, such as a keyboard, a mouse, etc.; an output unit 77, such as various types of displays, speakers, etc.; a storage unit 78, such as a disk, an optical disk, etc.; and a communication unit 79, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 79 allows the electronic device 70 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0125] The processor 71 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 71 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 71 executes the various methods and processes described above, such as a character color determination method.
[0126] In some embodiments, the character color determination method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 78. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 70 via the ROM 72 and / or the communication unit 79. When the computer program is loaded into the RAM 73 and executed by the processor 71, one or more steps of the character color determination method described above may be performed. Alternatively, in other embodiments, the processor 71 may be configured to perform the character color determination method in any other appropriate manner (e.g., by means of firmware).
[0127] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0128] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0129] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 foregoing.
[0130] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0131] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0132] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0133] In one embodiment, the embodiment of the present invention further includes a computer program product, the computer program product includes a computer program, and the computer program implements the character color determination method of any embodiment of the present invention when executed by a processor.
[0134] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can 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 can 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 can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0135] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0136] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A character color determination method, characterized in that: include: Obtain product images, line width correlation coefficients, and color judgment standard information of the product to be judged; Determining character pixel information of characters in the product image according to the image pixel information of the product image; Determining the color chromaticity value of the character in the product image according to the line width correlation coefficient and the character pixel information; Based on the comparison between the color chromaticity value and the color judgment standard information, a color judgment result of the product to be judged is determined.
2. The method according to claim 1, characterized in that The step of determining character pixel information of characters in the product image according to the image pixel information of the product image includes: Determining character-background separation information according to image pixel information of the product image, wherein the character-background separation information includes a character area and a background area; Determining a first character grayscale mean and a second character grayscale mean of characters in the product image according to the character background separation information; Determining a character pixel ratio according to the first character grayscale mean value and the second character grayscale mean value; The first character grayscale mean value and the character pixel ratio are used as character pixel information of the character.
3. The method according to claim 2, characterized in that The step of determining character background separation information according to image pixel information of the product image includes: Get the preset boundary grayscale threshold; Determine a pixel difference between two adjacent pixels in the product image according to the image pixel information of the product image; Determining a character boundary of the product image according to each of the pixel differences and the preset boundary grayscale threshold; Based on the character boundary, dividing the product image into a character area and a background area; The character area and the background area are used as the character-background separation information.
4. The method according to claim 2, characterized in that: The step of determining the first character grayscale mean and the second character grayscale mean of the characters in the product image according to the character background separation information includes: Determining a grayscale mean value of a first character according to each image pixel value in the character area; Determining an interference pixel range according to each image pixel value in the background area; Correcting the boundary of the character area based on the interference pixel range to obtain a corrected character area; The second character grayscale mean value is determined according to each image pixel value of the corrected character area.
5. The method according to claim 1, characterized in that Determining the color chromaticity value of the character in the product image according to the line width correlation coefficient and the character pixel information includes: According to the line width correlation coefficient and the character pixel information, the color chromaticity value of the character in the product image is determined by the following formula: L=L1×a+b In the formula, L represents the color chromaticity value, a represents the character pixel ratio in the character pixel information, L1 represents the first character grayscale mean value in the character pixel information, and b represents the line width correlation coefficient.
6. The method according to claim 1, characterized in that The step of determining the line width correlation coefficient comprises: Acquire a sample picture set of the product to be judged, wherein the sample picture set includes sample pictures of characters with the same chroma and different widths; Determining critical line width information according to single pixel width information of each of the sample pictures in the sample picture set; The line width correlation coefficient of the product to be judged is determined according to the critical line width information and the corresponding critical chromaticity information.
7. A character color judgment device, characterized in that: include: An information acquisition module, used to acquire product images, line width correlation coefficients and color determination standard information of the product to be determined; An information determination module, used to determine character pixel information of characters in the product image according to the image pixel information of the product image; A chromaticity value determination module, used to determine the color chromaticity value of the character in the product image according to the line width correlation coefficient and the character pixel information; The color determination module is used to determine the color determination result of the product to be determined based on the comparison between the color chromaticity value and the color determination standard information.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the character color judgment method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the character color determination method according to any one of claims 1 to 6 when executed.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the character color determination method according to any one of claims 1 to 6.