Ink jet image coding method and device, electronic equipment and storage medium
By performing ink dot recognition and connection processing on the characters in the inkjet image and generating path codes, the problem in the existing technology that it is difficult to effectively utilize the detailed information of the ink dots in the inkjet image is solved, and the unique identification and identification of the inkjet image are realized. Efficient utilization.
Patent Information
- Application Number
- CN202310902650.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-21
- Publication Date
- 2025-01-21
AI Technical Summary
The prior art is difficult to effectively use the ink dot details information in the inkjet image for unique identification, and cannot meet the product's unique identification and anti-counterfeiting needs.
By performing ink dot recognition and connection processing on the characters in the inkjet image, an ink dot path is generated, and a path code is generated based on the coverage relationship between the pixel points and the ink dots, thereby determining the coding of the inkjet image.
It realizes the unique identification of inkjet images, improves the utilization of inkjet images, and can be used in scenarios such as product traceability and anti-counterfeiting.
Smart Images

Figure CN119339394A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing, and in particular to an inkjet image encoding method, device, electronic device and storage medium. Background Art
[0002] In the manufacturing process of modern products, product codes are usually printed on products through high-precision dot-shaped inkjet devices. These inkjet devices accurately print ink on the surface of products in the form of small dots, forming a dot matrix consisting of numbers and letters. These numbers and letters represent the unique identification of the product, and their existence enables each product to be accurately traced. However, with the surge in the number of products, it is difficult to meet the unique identification and anti-counterfeiting needs of products by simply relying on the above-mentioned number and letter identification method.
[0003] Image hash technology generates a unique hash value by calculating the image's feature values (such as color, texture, shape, etc.). This hash value can be used as the "fingerprint" of the image for image matching and identification. However, image hash technology analyzes the overall features of the image, not the individual elements in the image (such as inkjet dots). Therefore, it cannot be applied to the detection and identification of inkjet images. There is currently no effective solution for how to use the content contained in the inkjet image to uniquely identify a product. Summary of the invention
[0004] The purpose of the present disclosure is to provide an inkjet image encoding method, device, electronic device and storage medium, so as to uniquely identify the inkjet image by using the detailed information of ink dots contained in the inkjet image, thereby improving the utilization rate of the inkjet image.
[0005] The disclosed embodiment provides a method for encoding an inkjet image, the method comprising: performing ink dot recognition on an area where characters in the inkjet image are located to obtain specified positions of the ink dots of the characters; wherein the characters in the inkjet image are composed of ink dots; performing connection processing on the specified positions of the ink dots of the characters to obtain an ink dot path of the characters; generating a path code of the characters based on an overlapping relationship between pixel points on the ink dot path and the ink dots of the characters; and determining the code of the inkjet image based on the path code of the characters.
[0006] In a second aspect, the embodiments of the present disclosure also provide an encoding device for inkjet images, the device comprising: an ink dot recognition module, used to perform ink dot recognition on the area where the characters in the inkjet image are located, and obtain the specified positions of the ink dots of the characters; wherein the characters in the inkjet image are composed of ink dots; an ink dot connection module, used to perform connection processing on the specified positions of the ink dots of the characters, and obtain the ink dot path of the characters; a path code generation module, used to generate the path code of the characters according to the overlapping relationship between the pixel points on the ink dot path and the ink dots of the characters; and an image code determination module, used to determine the code of the inkjet image according to the path code of the characters.
[0007] In a third aspect, an embodiment of the present disclosure further provides an electronic device, including a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the above-mentioned inkjet image encoding method.
[0008] In a fourth aspect, the embodiments of the present disclosure further provide a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned inkjet image encoding method.
[0009] The disclosed embodiments provide an inkjet image encoding method, device, electronic device and storage medium, which perform ink dot recognition processing and connection processing of designated positions of ink dots on the area where characters are located in the inkjet image, obtain an ink dot path corresponding to the character composed of ink dots, and then generate the path encoding of the character according to the covering relationship between the pixels on the ink dot path and the ink dots of the character. In this method, the phenomenon of slight differences in the same characters on the inkjet image due to the operation of the inkjet device and the slight irregularities on the surface of the inkjet medium during the inkjet process is fully considered, and the detailed information of the covering relationship between the pixels and the ink dots in the ink dot path corresponding to the character is applied to the encoding of the character to obtain an image encoding that can characterize the uniqueness of the inkjet image. While effectively utilizing the advantages of inkjet coding technology such as fast implementation speed and flexible printing, a more reliable inkjet coding image encoding is obtained, which effectively improves the utilization rate of the inkjet image. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0011] Figure 1A flowchart of an inkjet image encoding method provided by an embodiment of the present disclosure;
[0012] Figure 2 A schematic diagram of an inkjet image provided by an embodiment of the present disclosure;
[0013] Figure 3 A schematic diagram of ink dot recognition results provided by an embodiment of the present disclosure;
[0014] Figure 4 A schematic diagram of connecting the centers of ink dots of characters provided by an embodiment of the present disclosure;
[0015] Figure 5 A schematic diagram of pixel points on an ink dot path provided by an embodiment of the present disclosure;
[0016] Figure 6 A schematic diagram of path coding provided by an embodiment of the present disclosure;
[0017] Figure 7 A structural block diagram of an inkjet image encoding device provided by an embodiment of the present disclosure;
[0018] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0019] The technical solution of the present disclosure will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present disclosure.
[0020] Coding technology has the advantages of fast speed, good printing effect, and variable printing content, so it is widely used in packaging, manufacturing, logistics and other fields. Through research on coding technology, the inventor found that the operation of the inkjet device and the slight irregularities on the surface of the inkjet medium may cause the inkjet dots with the same code to have slight differences on the inkjet image, and these differences can be detected and identified through high-precision image processing and analysis technology. The inkjet dots on the inkjet image may overlap visually to form complex shapes and patterns, and traditional shape matching or template matching methods are difficult to obtain satisfactory results. Based on this, the embodiments of the present disclosure provide an encoding method, device, electronic device and storage medium for inkjet images, which encodes the inkjet image by making full use of the detailed information of the ink dots in the inkjet image, so that the encoding of the inkjet image can uniquely identify the inkjet image and its corresponding product, and can be used in scenarios such as product tracing and anti-counterfeiting.
[0021] Figure 1This is a flow chart of an inkjet image encoding method provided by an embodiment of the present disclosure. The method can be applied to a terminal device or a server. The inkjet image may include one or more characters composed of ink dots. Figure 1 , the method comprises the following steps:
[0022] Step S102, performing ink dot recognition on the area where the character in the inkjet image is located to obtain the designated position of the ink dot of the character; wherein the character in the inkjet image is composed of ink dots.
[0023] If there are multiple characters in the inkjet image, ink dot recognition and subsequent path coding processing can be performed on the area where each character in the multiple characters is located; or, ink dot recognition and subsequent path coding processing can be performed only on the area where a set number of target characters in the multiple characters are located. The set number of target characters can be one character, two characters, or three characters in the multiple characters whose clarity meets the preset requirements. The set number is determined according to the number of characters contained in the inkjet image, and this embodiment does not limit this.
[0024] If there are multiple characters in the inkjet image, when performing ink dot recognition on the area where the characters are located in the inkjet image, ink dot recognition can be performed on the entire area where the multiple characters are located, or ink dot recognition can be performed on the area where each character in the multiple characters is located. Figure 2 A schematic diagram of an inkjet image is shown, which contains multiple characters, specifically: 202302192022-035AH003044. Since the area where these characters are located is the entire image area of the inkjet image, when performing ink dot recognition, ink dot recognition can be performed on the entire inkjet image, or ink dot recognition can be performed separately for the position of each character.
[0025] Above Figure 2 The inkjet image shown may be a color image or an image obtained by binarizing a color image.
[0026] The ink dot recognition process can use image processing technology, such as Hough transform or deep learning method, to accurately identify the ink dots on the inkjet image. Through these technologies, all inkjet dots can be identified, including those that may overlap. Then, through high-precision image analysis technology, the designated position of each identified ink dot is determined. Among them, the designated position can be the center position of the ink dot, or the position of a pixel on the edge of the ink dot, for example: the designated position is the pixel position of the highest point of the ink dot, or the designated position is the pixel position of the lowest point of the ink dot, or the designated position is the pixel position of the leftmost point of the ink dot, or the designated position is the pixel position of the rightmost point of the ink dot, etc.
[0027] For example, the specified position is the center of the ink dot. Figure 3 The ink dot recognition result diagram shown in the figure is for the above Figure 2 The result obtained after ink dot recognition in the area where the characters in the inkjet image are located, wherein the small circle in the white area is the circle corresponding to the ink dot, and the black dot in the circle is the center position of the ink dot.
[0028] Step S104, connecting the designated positions of the ink dots of the characters to obtain the ink dot paths of the characters.
[0029] When connecting the designated positions of the ink dots, the designated positions of the ink dots can be directly connected in order from top to bottom and from left to right. Of course, in practical applications, other connection orders of designated positions of the ink dots can also be set, for example, starting from the highest designated position of the ink dot of the character, connecting the designated positions of each ink dot in clockwise (or counterclockwise, or a combination of clockwise and left to right) order, which is not limited in this embodiment. In the connection process, in addition to the ink dots corresponding to the starting and ending strokes of the character being connected to one adjacent ink dot, the remaining ink dots in the character can be connected to two adjacent ink dots to reduce redundant ink dot paths.
[0030] See also Figure 4 A schematic diagram of connecting the centers of ink dots of a character is shown, wherein the figure takes the character 0 on the left as an example. The character 0 is composed of multiple ink dots. It can be seen from the figure that due to the stacking of ink dots, multiple ink dots overlap on the upper and lower sides of the character. Through the above-mentioned ink dot recognition process, the overlapping ink dots also identify the corresponding multiple circles and centers. When connecting the center positions of the ink dots of the character 0, first connect from the upper left to the right to the highest center position, then from top to bottom to the bottom center position, and then connect adjacent center positions in sequence from right to left and from bottom to top.
[0031] Step S106, generating a path code of the character according to the overlapping relationship between the pixel points on the ink dot path and the ink dots of the character.
[0032] The covering relationship between the pixel points on the ink dot path and the ink dot of the character represents the positional relationship between the pixel points on the ink dot path and the ink dot of the character, and the pixel points in the area where the ink dot is located belong to the pixel points covered by the ink dot. Therefore, by checking whether the position of the pixel point on the ink dot path falls within the area where a certain ink dot is located, the covering relationship between the pixel point and the ink dot of the character can be determined.
[0033] exist Figure 4 Based on the generated ink dot path, see Figure 5The figure shows a schematic diagram of pixels on a dot path. The left side of the figure shows a schematic diagram of a dot path drawn in an inkjet image. It can be seen from the figure that the pixels on the dot path include both pixels covered by the ink dots and pixels not covered by the ink dots. For example, the pixel 51 in the figure corresponds to a pixel in the dot coverage area, and the pixel 52 between two ink dots is not covered by any ink dots. Based on this dot coverage relationship, the code corresponding to the dot path can be generated. In order to see the shape of the dot path more clearly, Figure 5 The right side is a schematic diagram of the ink dot path extracted from the left side figure.
[0034] As a possible implementation, determination of the above-mentioned covering relationship may also include: obtaining the coordinates of the first pixel point on the ink dot path, determining the pixel point coordinate set belonging to the ink dot based on the center coordinates of the ink dot and the ink dot radius, and checking whether the first pixel point belongs to the pixel point coordinate set; if so, the first pixel point is covered by the ink dot; if the first pixel point does not belong to the pixel point coordinate set of any ink dot, the first pixel point is not covered by the ink dot.
[0035] When performing path encoding, the encoding of the pixel points on the ink dot path that are within the ink dot coverage area can be set to one value, and the encoding of the pixel points on the ink dot path that are not within the ink dot coverage area can be set to another value, and then the encoding of all the pixel points on the ink dot path can be combined together to obtain the path encoding of the character.
[0036] Step S108, determining the code of the inkjet image according to the path code of the above characters.
[0037] The coding of the inkjet image of this embodiment can be the path coding of the above-mentioned characters, or the path coding corresponding to the character part with higher clarity can be intercepted from a character as the coding of the inkjet image according to the clarity of the characters. In specific applications, the method for determining the inkjet image coding can be selected according to the application scenario of the inkjet image.
[0038] In the above method, ink dot recognition processing and connection processing of designated positions of ink dots are performed on the area where the characters in the inkjet image are located to obtain an ink dot path corresponding to the characters composed of ink dots, and then the path code of the character is generated according to the covering relationship between the pixels on the ink dot path and the ink dots of the character. In this method, the phenomenon of slight differences in the same characters on the inkjet image due to the operation of the inkjet equipment and the slight irregularities on the surface of the inkjet medium during the inkjet process is fully considered, and the detailed information of the covering relationship between pixels and ink dots in the ink dot path corresponding to the character is applied to the encoding of the character to obtain an image code that can characterize the uniqueness of the inkjet image. While effectively utilizing the advantages of inkjet coding technology such as fast implementation speed and flexible printing, a more reliable inkjet coding image code is obtained, which effectively improves the utilization rate of the inkjet image.
[0039] Compared with the existing two-dimensional bar code encoding method, the above-mentioned inkjet image encoding method utilizes the detailed information of the ink dots, so the information capacity is very large. The two-dimensional bar code encoding method encodes the information into a matrix of black and white pixels, so the information capacity is limited. Therefore, the same two-dimensional bar code is used for the same kind of products in the two-dimensional bar code encoding method, and it is difficult to uniquely identify a product through a two-dimensional bar code. The inkjet image encoding method of the embodiment of the present disclosure can accurately identify all ink dots and their positions, and generate a unique code based on the positional relationship between the ink dots and the pixels on the ink dot path, so the product can be uniquely identified, expanding the application scenarios of inkjet images.
[0040] In order to be able to quickly perform ink dot recognition, before performing ink dot recognition on the area where the characters in the inkjet image are located, the method also includes: performing character segmentation processing on the inkjet image to obtain the area where each character in the inkjet image is located. The character segmentation processing can be achieved through character detection technology, or it can be performed according to the pre-set position of each character in the inkjet image. By performing character segmentation processing on the inkjet image, the area where each character is located can be accurately determined, thereby improving the efficiency of subsequent ink dot recognition.
[0041] Taking the designated position of the ink dot as the center position of the ink dot as an example, in order to accurately locate each inkjet dot, the ink dot recognition is performed on the area where the character in the inkjet image is located to obtain the designated position of the ink dot of the character, including the following steps:
[0042] (1) performing circular object detection on the region where the characters are located in the inkjet image to obtain the circular objects in the region where the characters are located;
[0043] This embodiment uses a pre-trained deep learning model (such as a convolutional neural network, Convolutional Neural Networks, CNN) to identify circular or approximately circular objects in inkjet images. In the process of training the deep learning model, the model can be trained by a certain amount of annotated data.
[0044] The input of the above-mentioned deep learning model can be a sub-image corresponding to the area where the characters are located in the inkjet image, and the output of the deep learning model can be a binary image, in which the position with a pixel value of 1 represents the position of the circular object.
[0045] (2) Determine the center position of the ink dot of the character according to the preset ink dot radius and the radius of the circular object.
[0046] Some of the above circular objects may not be ink dots, for example, circular stains in inkjet images. Although these objects are circular, their radius is usually quite different from the radius of the ink dots. Therefore, the circular objects corresponding to the ink dots can be screened out from these circular objects based on the preset ink dot radius and the radius of the circular object, and the center of the circular object can be used as the center position of the ink dot.
[0047] In order to accurately determine the circle corresponding to the ink dot and the center position of the ink dot, the above-mentioned determination of the center position of the ink dot of the character according to the preset ink dot radius and the radius of the circular object includes: performing graphic optimization processing on the position of the circular object to obtain a standard circle corresponding to the circular object; wherein the graphic optimization processing includes expansion processing and / or corrosion processing; selecting a target circle from the standard circles according to the preset ink dot radius; and determining the center position of the target circle in the area where the character is located as the center position of the ink dot.
[0048] After the circular object is identified, the circular object can be further corrected. The correction process can be done by image processing techniques, such as morphological operations (such as dilation and erosion), or model-based methods (such as fitting an optimal circle), so that the identified circular object is closer to an ideal standard circle.
[0049] Through the above processing, a binary image containing a standard circle can be obtained, and the ink dot circle can be selected. For example, the Hough transform can be used to detect a circle with a fixed radius. The principle of the Hough circle transform is to find a point set that meets the conditions of a specific center and radius. Therefore, the Hough transform can be used to efficiently and accurately obtain the center coordinates (x, y) and radius r of each detected circular object.
[0050] The above steps can obtain a standard circle by optimizing the detected circular object, and then determine a relatively accurate center position of the ink dot.
[0051] In order to reduce redundant ink dot paths, the above-mentioned connection processing of the designated positions of the ink dots of the characters to obtain the ink dot paths of the characters includes: connecting the designated positions of the ink dots of the characters according to a preset connection order to obtain the ink dot paths of the characters. For example: according to the forward stroke order or the reverse stroke order of the character, the center positions of the ink dots of the characters are connected to obtain the ink dot paths of the characters. Among them, the forward stroke order refers to the order of writing characters, and the reverse stroke order refers to the reverse order of the order of writing characters. For example, for character 1, the forward stroke order is from top to bottom, and the reverse stroke order is from bottom to top. Usually, the characters used in inkjet images are mainly letters and numbers. The stroke order of these characters (including the forward stroke order or the reverse stroke order) is relatively simple, and the stroke order of each character can be pre-stored, such as Figure 5The center position connection method shown can quickly obtain an ink dot path by connecting the center positions according to the stroke order of character 0. The ink dot path is determined by the stroke order of the character, which can quickly and simply connect the center positions of the ink dots in an orderly manner into an ink dot path.
[0052] In order to further improve the accuracy of the ink dot path, the above-mentioned connection processing of the designated positions of the ink dots of the characters to obtain the ink dot path of the characters includes: (1) connecting the designated positions of the ink dots of the characters to obtain the initial path of the ink dots of the characters; (2) obtaining the template of the characters; wherein the template contains the ink dot path information corresponding to the standard shape of the characters; (3) performing path interpolation processing on the initial path of the ink dots according to the ink dot path information contained in the template to obtain the ink dot path of the characters. The original circular ink dots of the inkjet image may not be detected due to wear. In order to reduce the changes in the shape of the ink dot path corresponding to the characters due to the wear of the ink dots, the present embodiment can reconstruct the ink dot path through the character template to make up for the missing part of the path. The character template contains the ink dot path information corresponding to the standard shape of the characters, which can provide a reference direction for the reconstruction of the ink dot path. In this way, when a part of the circular ink dots is worn or cannot be recognized, the missing part can be predicted or interpolated with reference to the character template to ensure the accuracy of the ink dot path.
[0053] A set of character templates are generated in advance based on the characters contained in the inkjet image, and each template corresponds to a character. Each template contains the standard shape and path information of the character. During the ink dot recognition process, the locations where the ink dot circles are worn or cannot be recognized can be marked. When the ink dot path needs to be reconstructed, the initial ink dot path of the character can be matched with a set of pre-generated character templates to find the best matching character template, and then the marked location is interpolated according to the character template. The pixel points of the interpolated path are all pixel points that are not covered by the ink dots.
[0054] By performing path interpolation processing on the initial path of ink dots through the above character template, the ink dot path of the character can be made more accurate, thereby ensuring the accuracy of subsequent path encoding.
[0055] As a possible implementation, the above-mentioned generation of the path encoding of the character based on the covering relationship between the pixel points on the ink dot path and the ink dots of the character includes: sampling the pixel points on the ink dot path; checking whether the sampled target pixel points are covered by the ink dots of the character; setting the encoding of the target pixel points on the ink dot path covered by the ink dots to a first value (for example, 1), and setting the encoding of the target pixel points on the ink dot path not covered by the ink dots to a second value (for example, 2); using the encoding of all target pixel points on the ink dot path as the path encoding of the character. The above-mentioned first value may also be 0, and the second value may be 1. When performing path encoding, the encoding of the pixel points of the section interpolated by the above-mentioned initial path of the ink dots may be directly set to the second value to reduce the amount of calculation. See. Figure 6 A path coding schematic diagram is shown, in which the black rectangle represents the pixel covered by the ink dot, and the corresponding code is 1, and the white part between the black rectangular boxes is the pixel not covered by the ink dot, and the corresponding code is 0.
[0056] The above-mentioned method of setting the coding value according to the relationship between the pixels and the ink dot coverage on the ink dot path, and using the coding of all target pixels on the ink dot path as the path coding of the character, can make the path coding reflect the detailed characteristics of all pixels in the ink dot path, thereby ensuring a one-to-one relationship between the path coding and the ink dot path, and enhancing the reliability of the data.
[0057] As a possible implementation, the step of sampling the pixels on the ink dot path may include: sampling the pixels on the ink dot path one by one; or sampling the pixels on the ink dot path according to a set pixel interval. Alternatively, the pixels on a part or all of the ink dot path may be sampled. The specific sampling method may set the pixel interval according to actual needs, and this embodiment does not limit this.
[0058] The ink dot path is usually 1 to 5 pixels wide. Because the path width is set to a very small value (for example, only one pixel wide), each path segment is represented by a pixel code when path encoding is performed. If the ink dot path width is set to a larger value, each path segment is represented by a plurality of pixel codes when path encoding is performed. This encoding method may make the encoding result more robust, but may introduce some unnecessary noise. Based on this, when setting the ink dot path width, the present embodiment sets the ink dot path width to a certain ratio of the ink dot radius, that is, the ratio of the ink dot path width to the preset ink dot radius is less than or equal to the set ratio, for example, the set ratio is a value between 1 / 6 and 1 / 3. Assuming that the ink dot radius is 20 pixels, the ink dot path width can be 3-5 pixels. If the ink dot path width does not reach 3-5 pixels, the ink dot path can be widened. In this way, the pixels near the line connecting the designated positions of the ink dots can be used as pixels on the ink dot path and participate in path encoding. Based on this, the above-mentioned checking whether the sampled target pixel point is covered by the ink dot of the character includes: for each sampled target pixel point, the distance between the target pixel point and the center position of the ink dot of the character is calculated; if the minimum value of the calculated distance is greater than the ink dot radius, it is determined that the target pixel point is not covered by the ink dot; if the minimum value of the calculated distance is less than or equal to the ink dot radius, it is determined that the target pixel point is covered by the ink dot. In this way, scanning can be performed along the ink dot path, and the distance from each target pixel point on the ink dot path to the center of the nearest ink dot circle is calculated to determine which pixels on the ink dot path are covered by the ink dot and which pixels are not covered by the ink dot. This method of determining whether a pixel point is covered by the ink dot based on the size of the distance between the pixel point on the ink dot path and the center of the ink dot circle can quickly and accurately obtain results.
[0059] For the same number "2", due to the difference in image resolutions captured by different devices, the number of pixels on the ink dot path corresponding to the number "2" is different. Based on this, the above-mentioned generation of the path encoding of the character based on the coverage relationship between the pixels on the ink dot path and the ink dots of the character includes: normalizing the pixels on the ink dot path according to the total pixel value of the preset path corresponding to the character and the total pixel value on the ink dot path to obtain the optimized path of the ink dot path; generating the path encoding of the character according to the coverage relationship between the pixels on the optimized path and the ink dots of the character. By normalizing the above-mentioned ink dot path, the number of pixels on the ink dot path corresponding to each character can be made the same. For example, the total number of pixels on the ink dot path of the number "2" is 1000. If it exceeds or falls short of this number, it is normalized to 1000 in proportion. In this way, inkjet images captured by different devices can also be encoded in the same way, which is beneficial to the subsequent use of inkjet image encoding.
[0060] The above method normalizes the generated ink dot path and generates a string of special codes according to whether the pixels on the ink dot path are covered by inkjet dots. If the width of the ink dot path is one pixel, the encoding format can be a string of "111001001111011..." If the width of the ink dot path is three pixels, the encoding format can be an array form {010, 110, 111, 101...}. This code represents the distribution and layout details of the ink dots that make up the characters on the inkjet image, and can identify the inkjet image.
[0061] Corresponding to the above method, this embodiment also provides an inkjet image encoding device, see Figure 7 , the device includes the following modules:
[0062] The ink dot recognition module 72 is used to perform ink dot recognition on the area where the characters in the inkjet image are located to obtain the designated positions of the ink dots of the characters; wherein the characters in the inkjet image are composed of ink dots;
[0063] The ink dot connection module 74 is used to connect the designated positions of the ink dots of the characters to obtain the ink dot paths of the characters;
[0064] A path code generation module 76, for generating a path code of a character according to the covering relationship between the pixel points on the ink dot path and the ink dots of the character;
[0065] The image coding determination module 78 is used to determine the coding of the inkjet image according to the path coding of the characters.
[0066] In the above-mentioned device, ink dot recognition processing and connection processing of designated positions of ink dots are performed on the area where the characters in the inkjet image are located, so as to obtain an ink dot path corresponding to the characters composed of ink dots, and then generate a path code of the character according to the covering relationship between the pixels on the ink dot path and the ink dots of the character. In this method, full consideration is given to the phenomenon that slight differences of the same characters on the inkjet image exist due to the operation of the inkjet equipment and the slight irregularities on the surface of the inkjet medium during the inkjet process, and the detailed information of the covering relationship between the pixels and the ink dots in the ink dot path corresponding to the characters is applied to the encoding of the characters to obtain an image code that can characterize the uniqueness of the inkjet image. While effectively utilizing the advantages of inkjet coding technology such as fast implementation speed and flexible printing, a more reliable inkjet coding image code is obtained, which effectively improves the utilization rate of the inkjet image.
[0067] The ink dot recognition module 72 is also used to perform character segmentation processing on the inkjet image to obtain the area where each character in the inkjet image is located. By performing character segmentation processing on the inkjet image, the area where each character is located can be accurately determined, thereby improving the efficiency of subsequent ink dot recognition.
[0068] The designated position of the ink dot is the center position of the ink dot; accordingly, the ink dot recognition module 72 is also used to detect circular objects in the area where the characters are located in the inkjet image, and obtain the circular objects in the area where the characters are located; the center position of the ink dot of the characters is determined according to the preset ink dot radius and the radius of the circular object. Specifically, the position of the circular object is subjected to graphic optimization processing to obtain a standard circle corresponding to the circular object; wherein the graphic optimization processing includes expansion processing and / or corrosion processing; a target circle is selected from the standard circle according to the preset ink dot radius; and the center position of the target circle in the area where the characters are located is determined as the center position of the ink dot of the characters. By optimizing the detected circular objects, a standard circle can be obtained, and then a relatively accurate center position of the ink dot can be determined.
[0069] The ink dot connection module 74 is further used to connect the designated positions of the ink dots of the character according to a preset connection sequence to obtain the ink dot path of the character.
[0070] The ink dot connection module 74 is also used to connect the designated positions of the ink dots of the character according to the forward stroke sequence or the reverse stroke sequence of the character to obtain the ink dot path of the character. By determining the ink dot path by the stroke sequence of the character, the designated positions of the ink dots can be quickly and simply connected in order to form an ink dot path, and the obtained ink dot path is more concise.
[0071] The ink dot connection module 74 is also used to: connect the designated positions of the ink dots of the character to obtain the initial path of the ink dots of the character; obtain the template of the character; wherein the template contains the ink dot path information corresponding to the standard shape of the character; perform path interpolation processing on the initial path of the ink dots according to the ink dot path information contained in the template to obtain the ink dot path of the character. Performing path interpolation processing on the initial path of the ink dots through the above character template can make the ink dot path of the character more accurate, thereby ensuring the accuracy of subsequent path encoding.
[0072] The path code generation module 76 is also used to: sample the pixel points on the ink dot path, check whether the sampled target pixel points are covered by the ink dots of the character; set the code of the target pixel points on the ink dot path covered by the ink dots to a first value, and set the code of the target pixel points on the ink dot path not covered by the ink dots to a second value; and use the code of all target pixel points on the ink dot path as the path code of the character. By setting the code value according to the relationship between the target pixel points on the ink dot path and the ink dot coverage, and using the code of all target pixel points on the ink dot path as the path code of the character, the path code can reflect the detailed features of all target pixel points on the ink dot path, thereby ensuring a one-to-one relationship between the path code and the ink dot path, and enhancing the reliability of the data.
[0073] The above-mentioned sampling of the pixel points on the ink dot path includes: sampling the pixel points on the ink dot path one by one; or sampling the pixel points on the ink dot path according to a set pixel interval.
[0074] The ratio of the width of the ink dot path to the preset ink dot radius is less than or equal to the set ratio; accordingly, the path code generation module 76 is also used to: for each target pixel point obtained by sampling, calculate the distance between the target pixel point and the center position of the ink dot of the character; if the minimum value of the calculated distance is greater than the ink dot radius, determine that the target pixel point is not covered by the ink dot; if the minimum value of the calculated distance is less than or equal to the ink dot radius, determine that the target pixel point is covered by the ink dot. The method of determining whether a pixel point is covered by the ink dot according to the size of the distance between the pixel point on the ink dot path and the center position of the ink dot can quickly and accurately obtain the result.
[0075] The path code generation module 76 is also used to: perform normalization processing on the pixels on the ink dot path according to the total pixel value of the preset path corresponding to the character and the total pixel value on the ink dot path to obtain the optimized path of the ink dot path; and generate the path code of the character according to the overlapping relationship between the pixels on the optimized path and the ink dots of the character. Through normalization processing, inkjet images taken by different devices can also be encoded in the same way, which is beneficial to the subsequent use of inkjet image encoding.
[0076] The inkjet image encoding device provided in the embodiment of the present disclosure has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for parts not mentioned in the embodiment of the inkjet image encoding device, reference may be made to the corresponding contents in the aforementioned inkjet image encoding method embodiment.
[0077] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.
[0078] The present disclosure also provides an electronic device, such as Figure 8 As shown, it is a schematic diagram of the structure of the electronic device, wherein the electronic device includes a processor 81 and a memory 80, the memory 80 stores computer executable instructions that can be executed by the processor 81, and the processor 81 executes the computer executable instructions to implement the above-mentioned inkjet image encoding method.
[0079] exist Figure 8 In the illustrated embodiment, the electronic device further includes a bus 82 and a communication interface 83 , wherein the processor 81 , the communication interface 83 and the memory 80 are connected via the bus 82 .
[0080] Among them, the memory 80 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 83 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 82 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 82 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0081] The processor 81 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 81 or the instruction in the form of software. The above processor 81 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in conjunction with the embodiment of the present disclosure can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor 81 reads the information in the memory and completes the steps of the inkjet image encoding method of the above embodiment in combination with its hardware.
[0082] The embodiment of the present disclosure also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned inkjet image encoding method. The specific implementation can be found in the aforementioned method embodiment, which will not be repeated here.
[0083] The computer program product of the inkjet image encoding method, device and electronic device provided in the embodiments of the present disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments and will not be repeated here.
[0084] Unless otherwise specifically stated, the relative steps, numerical expressions and numerical values of the components and steps set forth in these embodiments do not limit the scope of the present disclosure.
[0085] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that can be executed by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0086] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0087] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for encoding an inkjet image, characterized in that: The method comprises: Performing ink dot recognition on the area where the characters in the inkjet image are located to obtain the designated positions of the ink dots of the characters; wherein the characters in the inkjet image are composed of ink dots; Connecting the designated positions of the ink dots of the character to obtain the ink dot path of the character; Generate a path code of the character according to the covering relationship between the pixel points on the ink dot path and the ink dots of the character; The code of the inkjet image is determined according to the path code of the character.
2. The method according to claim 1, characterized in that Before performing ink dot recognition on the area where the characters are located in the inkjet image, the method further includes: The inkjet image is subjected to character segmentation processing to obtain the region where each character in the inkjet image is located.
3. The method according to claim 1 or 2, characterized in that: The designated position of the ink dot is the center position of the ink dot; performing ink dot recognition on the area where the character in the inkjet image is located to obtain the designated position of the ink dot of the character includes: Performing circular object detection on the area where the characters are located in the inkjet image to obtain the circular objects in the area where the characters are located; The center position of the ink dot of the character is determined according to a preset ink dot radius and the radius of the circular object.
4. The method according to claim 3, characterized in that: Determining the center position of the ink dot of the character according to the preset ink dot radius and the radius of the circular object includes: Performing a graphic optimization process on the position of the circular object to obtain a standard circle corresponding to the circular object; wherein the graphic optimization process includes an expansion process and / or an erosion process; Selecting a target circle from the standard circle according to a preset ink dot radius; The center position of the target circle in the area where the character is located is determined as the center position of the ink dot of the character.
5. The method according to claim 1, characterized in that Connecting the designated positions of the ink dots of the character to obtain the ink dot path of the character includes: The designated positions of the ink dots of the character are connected according to a preset connection sequence to obtain the ink dot path of the character.
6. The method according to claim 5, characterized in that Connecting the designated positions of the ink dots of the character according to a preset connection sequence to obtain the ink dot path of the character includes: According to the forward stroke sequence or the reverse stroke sequence of the character, the designated positions of the ink dots of the character are connected to obtain the ink dot path of the character.
7. The method according to claim 1, characterized in that Connecting the designated positions of the ink dots of the character to obtain the ink dot path of the character includes: Connecting the designated positions of the ink dots of the character to obtain the initial path of the ink dots of the character; Acquire a template of the character; wherein the template includes ink dot path information corresponding to the standard shape of the character; The initial ink dot path is interpolated according to the ink dot path information contained in the template to obtain the ink dot path of the character.
8. The method according to claim 1, characterized in that Generating the path code of the character according to the covering relationship between the pixel points on the ink dot path and the ink dots of the character includes: Sampling pixel points on the ink dot path; Check whether the sampled target pixel is covered by the ink dot of the character; The codes of the target pixels covered by the ink dots on the ink dot path are set to a first value, and the codes of the target pixels not covered by the ink dots on the ink dot path are set to a second value; The codes of all target pixels on the ink dot path are used as the path code of the character.
9. The method according to claim 8, characterized in that Sampling the pixel points on the ink dot path includes: The pixel points on the ink dot path are sampled one by one; or the pixel points on the ink dot path are sampled according to a set pixel interval.
10. The method according to claim 8, characterized in that The ratio of the width of the ink dot path to the preset ink dot radius is less than or equal to a set ratio; The step of checking whether the sampled target pixel is covered by the ink dot of the character comprises: For each target pixel point obtained by sampling, the distance between the target pixel point and the center position of the ink dot of the character is calculated; If the minimum value of the calculated distance is greater than the ink dot radius, it is determined that the target pixel is not covered by the ink dot; if the minimum value of the calculated distance is less than or equal to the ink dot radius, it is determined that the target pixel is covered by the ink dot.
11. The method according to claim 1, characterized in that Generating the path code of the character according to the covering relationship between the pixel points on the ink dot path and the ink dots of the character includes: According to the total value of pixels of the preset path corresponding to the character and the total value of pixels on the ink dot path, normalizing the pixels on the ink dot path to obtain an optimized path of the ink dot path; The path code of the character is generated according to the covering relationship between the pixel points on the optimized path and the ink dots of the character.
12. An inkjet image encoding device, characterized in that: The device comprises: An ink dot recognition module is used to perform ink dot recognition on the area where the characters in the inkjet image are located to obtain the designated positions of the ink dots of the characters; wherein the characters in the inkjet image are composed of ink dots; An ink dot connection module, used for connecting the designated positions of the ink dots of the character to obtain the ink dot path of the character; A path code generation module, used for generating the path code of the character according to the covering relationship between the pixel points on the ink dot path and the ink dots of the character; The image coding determination module is used to determine the coding of the inkjet image according to the path coding of the character.
13. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method according to any one of claims 1 to 11.