Character detection method and apparatus, processing device, and non-transitory readable storage medium

CN115953768BActive Publication Date: 2026-09-29BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210179305.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-25
Publication Date
2026-09-29
Estimated Expiration
2042-02-25

AI Technical Summary

Technical Problem

[0003]实际应用中,上述信息标签会受到印刷工艺等影响而出现不良,因此需要对电子设备上的信息标签进行检测,以保证信息标签中信息的准确性

Benefits of technology

[0072]由上述实施例可知,本公开实施例提供的方案可以获取待识别的第一图像,所述第一图像包括目标信息标签;基于预设配置信息从预设图像处理模型库内选取第一图像处理模型;利用所述第一图像处理模型处理所述第一图像,获得所述目标信息标签中字符是否正确的检测结果。这样,本实施例允许用户预先配置可以得到预设配置信息,然后通过预设配置信息可以选取出适合不同使用场景的第一图像处理模型,从而获取与使用场景相匹配的检测结果,有利于提高检测结果的准确度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115953768B_ABST
    Figure CN115953768B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a character detection method and device, processing equipment and non-transitory readable storage medium. The method comprises: obtaining a first image to be recognized, the first image comprising a target information label; selecting a first image processing model from a preset image processing model library based on preset configuration information; processing the first image using the first image processing model to obtain a detection result of whether the characters in the target information label are correct. The present embodiment allows the user to pre-configure the preset configuration information, and then selects the first image processing model suitable for different use scenarios through the preset configuration information, so as to obtain a detection result matched with the use scenario, which is conducive to improving the accuracy of the detection result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, and in particular to a character detection method and apparatus, processing device, and non-transitory readable storage medium. Background Technology

[0002] Electronic devices typically have labels or silkscreen logos printed on them on the back cover or frame; these will be collectively referred to as information labels. Users can use these information labels to identify relevant information about the electronic device.

[0003] In practical applications, the aforementioned information labels may be defective due to factors such as printing processes. Therefore, it is necessary to inspect the information labels on electronic devices to ensure the accuracy of the information in the labels. Summary of the Invention

[0004] This disclosure provides a character detection method and apparatus, a processing device, and a non-transitory readable storage medium to address the shortcomings of related technologies.

[0005] According to a first aspect of the present disclosure, a character detection method is provided, comprising:

[0006] Acquire a first image to be identified, the first image including target information labels;

[0007] The first image processing model is selected from the preset image processing model library based on the preset configuration information;

[0008] The first image is processed using the first image processing model to obtain the detection result of whether the characters in the target information label are correct.

[0009] Optionally, the first image is processed using the first image processing model to obtain a detection result indicating whether the characters in the target information label are correct, including:

[0010] Obtain the first character data obtained by processing the first image using the first image processing model;

[0011] When the first character data matches the target character data of the target information tag, a detection result indicating that the first character data detection is correct is obtained.

[0012] Optionally, when the first character data is inconsistent with the target character data of the target information tag, the method further includes:

[0013] The first image is processed to obtain a second image with higher clarity than the first image;

[0014] Alternatively, re-acquire the image as a second image;

[0015] Character detection is performed on the second image to obtain the detection results.

[0016] Optionally, character detection is performed on the second image to obtain detection results, including:

[0017] The second image is processed using the first image processing model to obtain the second character data;

[0018] When the second character data matches the target character data, a detection result indicating that the second character data was detected correctly is obtained.

[0019] Optionally, the preset image processing model library further includes at least one second image processing model, which performs character detection based on the second image to obtain detection results, including:

[0020] The second image is processed sequentially using each of the second image processing models to obtain the third character data;

[0021] When the third character data is consistent with the target character data and the number of detections is less than a preset threshold, it is determined that a detection result indicating that the third character data was detected correctly is obtained;

[0022] When the third character data is inconsistent with the target character data and the number of detections is less than a preset threshold, the process of processing the first image to obtain a second image with higher clarity than the first image continues.

[0023] Optionally, the first image is processed to obtain a second image with higher clarity than the first image, including:

[0024] The global mean and local mean of the first image are obtained based on the gray values ​​of the pixels in the first image; the global mean refers to the average gray value of all pixels in the first image, and the local mean refers to the average gray value of pixels within a preset distance of each pixel in the first image.

[0025] For each pixel in the first image, when the local mean corresponding to the location of the pixel is less than the global mean, the difference between the pixel and the local mean is obtained;

[0026] Obtain the product of the difference and a preset scaling factor, calculate the sum of the product and the grayscale value of the pixel, and update the grayscale value of the pixel to the sum.

[0027] Optionally, the first image to be identified is acquired, including:

[0028] Obtain an initial image to be identified; the initial image includes target information tags;

[0029] The initial image is enhanced to obtain an initial enhanced image;

[0030] The initial enhanced image is subjected to tilt correction processing to obtain an initial corrected image;

[0031] Locate the region containing the target information label in the initial corrected image;

[0032] A screenshot of the area where the target information label is located is taken to obtain the first image to be identified.

[0033] Optionally, a first image processing model is selected from a preset image processing model library based on preset configuration information, including:

[0034] When the preset configuration information includes a first preset identifier, the image processing model corresponding to the first preset identifier in the preset image processing model library is selected as the first image processing model.

[0035] When the preset configuration information includes a second preset identifier, the image processing model corresponding to the second preset identifier in the preset image processing model library is selected as the first image processing model;

[0036] The image processing model corresponding to the first preset identifier is obtained by training samples in the first preset training database; the image processing model corresponding to the second preset identifier is obtained by training samples in the second preset training database; and the first preset training database includes samples from the second preset training database and preset samples representing ink bleeding defects.

[0037] Optionally, when the preset configuration information includes a third preset identifier, the third preset identifier refers to the attribute data of a standard template image that matches the first image. The first image is processed using the first image processing model to obtain a detection result indicating whether the characters are correct, including:

[0038] The first image is processed using the first image processing model to obtain the number of first connected components in the first image, and the standard template image is processed using the first image processing model to obtain the number of second connected components corresponding to the standard template image.

[0039] When the number of the first connected components and the number of the second connected components are not equal, it is determined that the characters of the target information label in the first image have defects, and a detection result indicating that the characters are incorrect is obtained.

[0040] Optionally, when the number of the first connected components and the number of the second connected components are equal, the method further includes:

[0041] Obtain a first difference image corresponding to the first image and a second difference image corresponding to the third image; the object distance corresponding to the first image is greater than the object distance corresponding to the third image.

[0042] Obtain the position of the first connected component in the connected component image corresponding to the first difference image, and obtain the position of the second connected component in the connected component image corresponding to the second difference image;

[0043] When the position of the first connected component is the same as the position of the second connected component, it is determined that the character of the target information label in the first image has a defect and is a false detection, and the detection result of the character being incorrect is obtained.

[0044] Optionally, obtaining the first difference image corresponding to the first image includes:

[0045] The characters within the connected component image corresponding to the first image are concatenated to obtain the first concatenated image;

[0046] The characters within the connected component image corresponding to the standard template image are concatenated to obtain a second concatenated image; the character spacing distribution is the same in the first concatenated image and the second concatenated image;

[0047] Obtain the difference image between the first stitched image and the second stitched image, and use the difference image as the first difference image corresponding to the first image;

[0048] The second difference image is obtained in the same way as the first difference image.

[0049] Optionally, the characters within the connected component image corresponding to the first image are concatenated to obtain a first concatenated image, including:

[0050] The connected component image corresponding to the first image is segmented into characters to obtain the size data of each character; the size data includes at least the position, length and width of the character;

[0051] By stitching the characters together at equal intervals into a preset blank image according to their position order, the first stitched image is obtained.

[0052] Optionally, obtaining the position of the first connected component in the connected component image corresponding to the first difference image includes:

[0053] The first difference image is segmented using a threshold to obtain a segmented image corresponding to the first difference image;

[0054] Erosion and dilation are performed on the segmented image corresponding to the first difference image to obtain the connected component image corresponding to the first difference image;

[0055] The positions of each connected component are obtained by performing connected component statistics on the connected component image corresponding to the first difference image, and the positions of each connected component are used as the positions of the first connected component.

[0056] Optionally, an adaptive threshold is used in the step of thresholding the first difference image, and the method further includes a step of obtaining the adaptive threshold, including:

[0057] The grayscale value of the pixel at the position of each character in the first difference image is obtained, and the average value of the pixel grayscale value within a preset distance from the origin in the first difference image is obtained, and the average value is used as the grayscale value of the background in the first difference image.

[0058] The difference between the grayscale value corresponding to each character and the grayscale value of the background is obtained, and the difference is used as the adaptive threshold.

[0059] Optionally, when the positions of the first connected component and the second connected component are not the same, the method further includes:

[0060] Obtain the area of ​​each connected component in the connected component image corresponding to the first difference image;

[0061] When there is at least one connected component whose area exceeds a preset connected component threshold, it is determined that the characters of the target information label in the first image are defective, and a detection result representing incorrect characters is obtained.

[0062] When the area of ​​each connected component is less than the preset connected component threshold, it is determined that the characters of the target information label in the first image are not defective, and a detection result indicating that the characters are correct is obtained.

[0063] According to a second aspect of the present disclosure, a character detection apparatus is provided, comprising:

[0064] The first image acquisition module is used to acquire a first image to be identified, wherein the first image includes target information tags;

[0065] The processing model acquisition module is used to select a first image processing model from a preset image processing model library based on preset configuration information.

[0066] The detection result acquisition module is used to process the first image using the first image processing model to obtain the detection result of whether the characters in the target information label are correct.

[0067] According to a third aspect of the present disclosure, a processing apparatus is provided, comprising: a memory and a processor;

[0068] The memory is used to store computer programs that can be executed by the processor;

[0069] The processor is used to execute computer programs in the memory to implement the methods described above.

[0070] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, which, when an executable computer program in the storage medium is executed by a processor, can implement the method described above.

[0071] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:

[0072] As can be seen from the above embodiments, the solution provided by this disclosure can acquire a first image to be identified, the first image including a target information label; select a first image processing model from a preset image processing model library based on preset configuration information; process the first image using the first image processing model to obtain a detection result on whether the characters in the target information label are correct. Thus, this embodiment allows users to pre-configure and obtain preset configuration information, and then select a first image processing model suitable for different usage scenarios through the preset configuration information, thereby obtaining detection results that match the usage scenario, which is beneficial to improving the accuracy of the detection results.

[0073] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0074] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0075] Figure 1 This is a flowchart illustrating a character detection method according to an exemplary embodiment.

[0076] Figure 2 This is a flowchart illustrating a method for obtaining correct character detection results according to an exemplary embodiment.

[0077] Figure 3 This is a flowchart illustrating another character detection method according to an exemplary embodiment.

[0078] Figure 4 This is a flowchart illustrating a method for increasing the contrast of a first image according to an exemplary embodiment.

[0079] Figure 5 This is a flowchart illustrating a method for obtaining detection results of incorrect characters according to an exemplary embodiment.

[0080] Figure 6 This is a flowchart illustrating a method for obtaining detection results of false detections according to an exemplary embodiment.

[0081] Figure 7 This is a flowchart illustrating an example of acquiring a first difference image according to an exemplary embodiment.

[0082] Figure 8 This is a flowchart illustrating an exemplary embodiment for obtaining the location of a first connected component.

[0083] Figure 9 This is a flowchart illustrating yet another character detection method according to an exemplary embodiment.

[0084] Figure 10 This is a schematic diagram illustrating the effect of moving a target information tag according to an exemplary embodiment.

[0085] Figure 11 This is a flowchart illustrating yet another character detection method according to an exemplary embodiment.

[0086] Figure 12 This is a block diagram illustrating a character detection device according to an exemplary embodiment.

[0087] Figure 13 This is a block diagram illustrating a processing device according to an exemplary embodiment. Detailed Implementation

[0088] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described below by way of example do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatus consistent with some aspects of this disclosure as detailed in the appended claims. It should be noted that, without conflict, the following embodiments and features in the implementation methods can be combined with each other.

[0089] To address the aforementioned technical problems, this disclosure provides a character detection method applicable to various character detection scenarios, such as detecting labels or silkscreened marks on the back cover or frame of electronic devices, or labels on packaging boxes. Since label materials differ, the defects in the characters on the labels also vary. The character detection method provided in this embodiment can detect defects such as ink bleeding, paint buildup, breakage, and damage. Ink bleeding refers to the phenomenon where ink, after being printed onto a label, continues to flow along the label's texture, altering the shape of the character. For some characters (such as the character O), ink bleeding has little impact; for others (such as the character C), ink bleeding at the opening of the character C can be identified as the character O. This character detection method is applicable to processing devices with processing capabilities, including but not limited to servers, laptops, tablets, or smartphones. The appropriate processing device can be selected based on the specific scenario, and no limitation is made here.

[0090] Figure 1 This is a flowchart illustrating a character detection method according to an exemplary embodiment. See also... Figure 1 A character detection method, comprising steps 11 to 13.

[0091] In step 11, a first image to be identified is obtained, the first image including target information tags.

[0092] In this embodiment, the processing device can acquire a first image to be identified. In one example, when the target information tag is within the camera's shooting range, an external camera can capture the target information tag to obtain the first image. The processing device can communicate with the external camera to acquire the first image uploaded by the external camera. In one example, after acquiring the first image, the external camera can store it in a designated location, which includes, but is not limited to, the camera's local memory, cache, or cloud storage. The processor can then read the first image from the designated location. In one example, the processing device can integrate a camera; the camera capturing the first image can be considered as the processing device acquiring the first image.

[0093] In another embodiment, the image captured by the camera can be used as the initial image, which includes the target information label. The processing device can acquire the initial image to be identified, and the acquisition method can be the same as in the previous embodiment. Then, the processing device can perform enhancement processing on the initial image, such as median filtering enhancement, histogram equalization enhancement, etc., to obtain an initial enhanced image. By enhancing the initial image, problems such as uneven color and brightness and noise can be eliminated or improved, partially or completely solving the problems existing in the images captured by the camera during continuous operation. Afterwards, the processing device can perform tilt correction processing on the initial enhanced image to obtain an initial corrected image, for example, by performing tilt correction on the initial enhanced image through threshold segmentation, morphological dilation, erosion, contour finding, calculation of the maximum contour, calculation of the minimum bounding rectangle, affine transformation rotation, etc., to solve the character tilting problem caused by the positional difference of the incoming material (i.e., the label on the conveying device) and the positional difference of the label affixing position. Furthermore, the processing device can locate the area where the target information label is located in the initial corrected image; and the processing device can take a screenshot of the image of the area where the target information label is located to obtain the first image to be identified. Thus, in this embodiment, various processing steps are performed on the initial image to make the characters in the first image easier to detect, which helps to improve the efficiency and accuracy of the detection results.

[0094] In step 12, a first image processing model is selected from a preset image processing model library based on preset configuration information.

[0095] In this embodiment, the processing device can store preset configuration information, which may include at least one of the following identifiers: a first preset identifier, a second preset identifier, and a third preset identifier. It should be noted that this embodiment only describes a scenario with three preset identifiers. In practical applications, a preset identifier can be configured for each scenario and / or each defect to refine the types of defects and / or the types of preset identifiers, which is beneficial for improving the accuracy of subsequent detection results.

[0096] In this embodiment, the aforementioned preset configuration information can be configured in the following ways: The user can select a first preset identifier based on the detection scenario, such as whether ink smudging will occur on the label material. If ink smudging will occur, the user can select a first preset identifier in the configuration interface of the processing device. The processing device can, in response to detecting the selection of the first preset identifier, store the first preset identifier in the preset configuration information or save the first preset identifier and generate preset configuration information. The following description will use storing the preset identifier in the preset configuration information as an example to illustrate each approach. Alternatively, if ink smudging will not occur, the user can select a second preset identifier in the configuration interface of the processing device. The processing device can, in response to detecting the selection of the second preset identifier, store the second preset identifier in the preset configuration information. Alternatively, if the user determines that there will be a defect of printing too many or too few characters, they can select a third preset identifier in the configuration interface of the processing device. The processing device can, in response to detecting the selection of the third preset identifier, store the third preset identifier in the preset configuration information. And so on. In other words, the user can select the corresponding preset identifier based on the specific detection scenario, and the processing device can store the aforementioned preset identifier in the preset configuration data. Thus, in this embodiment, the user is allowed to pre-configure a preset identifier, enabling the processing device to accurately obtain the detection scene; furthermore, allowing the user to configure a preset identifier can also improve the interactive experience.

[0097] It should be noted that in actual testing scenarios, the aforementioned preset configuration information can be dynamically changed. That is, after testing some labels, if the deviation between the test result and the actual result exceeds a preset deviation threshold (e.g., 5%), such as when the user anticipates no ink bleeding defect, but the actual result shows an ink bleeding defect even though the test result did not detect it, the user can adjust the preset configuration information according to the result until the deviation between the test result and the actual result is less than the deviation threshold. In this way, this embodiment fully utilizes user experience and improves the overall accuracy of the test results by dynamically adjusting the preset configuration information during batch label testing.

[0098] In this embodiment, the processing device can store a preset correspondence between identifiers and models. That is, the processor can read preset identifiers from preset configuration information and query the corresponding image processing model based on the preset correspondence between identifiers and models. It is understood that the first preset identifier, the second preset identifier, and the third preset identifier correspond to each image processing model, and each image processing model can detect different types of defects. For example, the image processing model corresponding to the first preset identifier can identify ink bleeding defects, the image processing model corresponding to the second preset identifier can identify defects such as unclear printing, paint accumulation, breakage, and missing characters, the image processing model corresponding to the first preset identifier can further identify ink bleeding defects based on the image processing model corresponding to the second preset identifier, and the image processing model corresponding to the third preset identifier can identify defects such as the presence or absence of defects, breakage, missing characters, and extra printed characters.

[0099] In this embodiment, the processing device may store a preset image processing model library. For example, after determining the corresponding image processing model, the processing device can adjust the corresponding image processing model from the preset image processing model library. For example, when the preset configuration information includes a first preset identifier, the processing device can select the image processing model corresponding to the first preset identifier in the preset image processing model library as the first image processing model. Similarly, when the preset configuration information includes a second preset identifier, the processing device can select the image processing model corresponding to the second preset identifier in the preset image processing model library as the first image processing model.

[0100] It should be noted that, in this embodiment, the image processing model corresponding to the first preset identifier is obtained by training samples in the first preset training database; the image processing model corresponding to the second preset identifier is obtained by training samples in the second preset training database; and the first preset training database includes preset samples representing ink smudge defects, or the samples in the second preset training database and preset samples representing ink smudge defects.

[0101] In another embodiment, the preset correspondence between identifiers and models can be integrated into a preset image processing model library. In this case, after the processing device obtains the preset identifier, it can directly access the preset image processing model library, which will then provide the image processing model corresponding to the preset identifier.

[0102] For ease of description, the image processing model obtained in this step is referred to as the first image processing model in this embodiment, to distinguish it from the second image processing model that appears later.

[0103] In step 13, the first image is processed using the first image processing model to obtain a detection result of whether the characters in the target information label are correct.

[0104] In this embodiment, the processing device can process the first image using a first image processing model, see [link to relevant documentation]. Figure 2 The process includes steps 21 and 22. In step 21, the processing device can input the first image into the first image processing model and obtain the character data output by the first image processing model, that is, obtain the character data obtained by the first image processing model from processing the first image.

[0105] In practical applications, the label can have a barcode or QR code, which users can directly read by scanning. Characters with the same content are then printed around the barcode, allowing users to identify the content. Therefore, in step 21, the processing device can also acquire the (real) target character data of the target information label, which can be obtained by scanning the barcode or QR code on the target information label.

[0106] It should be noted that the first character data may be consistent with the subsequent target character data or may not be consistent with the subsequent target character data. Therefore, in step 21, the character data obtained by the first image processing model is also referred to as the first character data, in order to distinguish it from the target character data, the subsequent second character data, and the third character data.

[0107] In step 22, the processing device can compare whether the first character data and the target character data of the target information label are consistent.

[0108] When the first character data matches the target character data of the target information label, the processing device can determine that it has obtained a detection result indicating that the first character data detection is correct, that is, the character data in the target information label is printed normally.

[0109] In one example, when the first character data is inconsistent with the target character data of the target information label, the processing device can re-acquire an image as the second image. It is understood that the second image can be an image re-acquired by adjusting the camera's focus or changing the lens, etc. In principle, the clarity of the second image needs to be higher than that of the first image to improve the accuracy of the detection results. Then, the processor can perform character detection based on the second image to obtain the detection result, that is, process the second image using the first image processing model to obtain character data (hereinafter referred to as the second character data). When the second character data is consistent with the target character data, the processing device can determine that it has obtained a detection result indicating that the second character data detection is correct. When the second character data is inconsistent with the target character data, the processing device can determine that it has obtained a detection result indicating that the second character data detection is incorrect.

[0110] In another example, when the first character data does not match the target character data of the target information label, see [reference needed]. Figure 3In step 31, the processing device can process the first image to obtain a second image with higher clarity than the first image. See [link to relevant documentation]. Figure 4 This includes steps 41 to 43.

[0111] In step 41, the processing device can obtain the global mean and local mean of the first image based on the grayscale values ​​of the pixels in the first image. The global mean refers to the average grayscale value of all pixels in the first image. The local mean refers to the average grayscale value of pixels within a preset distance in the first image. The preset distance can be 2 to 20 pixels and can be adjusted according to the specific scenario. Taking a preset distance of 5 pixels as an example, the local region corresponding to pixel A is a rectangular region with a width of 11 pixels (5 pixels to the left and right of pixel A, including pixel A) and a height of 11 pixels (5 pixels above and below pixel A, including pixel A).

[0112] In step 42, for each pixel in the first image, when the local mean corresponding to the location of the pixel is less than the global mean, the processing device can obtain the difference between the pixel and the local mean.

[0113] In step 43, the processing device can obtain the product of the aforementioned difference and a preset scaling factor, calculate the sum of this product and the grayscale value of the pixel, and update the grayscale value of the pixel to the aforementioned sum. The scaling factor can be greater than 0, its purpose being to amplify the difference between the character and the background, thereby enhancing contrast. In practical applications, the scaling factor ranges from 1 to 2; in one example, the scaling factor is 1.2.

[0114] It should be noted that when acquiring the second image, the processing device may also employ mean filtering, contrast enhancement, or threshold segmentation to enhance high-frequency areas such as edges in the first image, making the characters in the acquired second image clearer and reducing interference from the surrounding background. Technicians can choose an appropriate method for acquiring the second image based on the specific scenario, and the corresponding solution falls within the protection scope of this disclosure.

[0115] In step 32, the processing device can perform character detection based on the second image to obtain the detection result.

[0116] In one example, the processing device can use a first image processing model to process the second image to obtain second character data. When the second character data matches the target character data, the processing device can determine that it has obtained a detection result indicating that the second character data was detected correctly. When the second character data does not match the target character data, the processing device can determine that it has obtained a detection result indicating that the second character data was detected incorrectly. Thus, in this embodiment, re-detecting characters using the enhanced second image can improve the accuracy of the detection results.

[0117] In another example, the preset image processing model library also includes at least one second image processing model, which, together with the first image processing model, is capable of detecting different character defects or improving the accuracy of some character defects.

[0118] In this scenario, the processing device can sequentially process the second image using each of the second image processing models to obtain the third character data. In short, the processing device can process the second image once using each second image processing model, and each processing yields a set of third character data. This third character data can then be used to determine the detection result. Alternatively, in this example, the detection process can be cyclical. That is, during each processing step, the processing device can count the number of detections. For example, after processing the second image using the first second image processing model to obtain the third character data, the count is 2; similarly, after processing the second image using the second second image processing model to obtain the third character data, the count is 3; and so on. It is understood that the above count includes one detection of the first image.

[0119] Then, the processing device can compare the third character data with the target character data of the target information label. When the third character data matches the target character data and the number of detections is less than a preset threshold, the processing device can determine that a detection result indicating correct detection of the third character data has been obtained; when the third character data does not match the target character data and the number of detections is equal to the preset threshold, a detection result indicating incorrect detection of the third character data has been obtained. When the third character data does not match the target character data and the number of detections is less than the preset threshold, the step of processing the first image to obtain a second image with higher clarity than the first image continues. Thus, in this example, by performing multiple enhancement processes on the first image and detecting character data, the accuracy of the detection result can be improved. Furthermore, limiting the maximum number of detections to the preset threshold can reduce the time consumed in the detection process and ensure the efficiency of the detection result.

[0120] In one embodiment, when the preset configuration information includes a third preset identifier, the third preset identifier refers to the attribute data of a standard template image that matches the first image. The processing device processes the first image using the first image processing model to obtain a detection result indicating whether the characters are correct. See [link to relevant documentation]. Figure 5 This includes steps 51 to 52.

[0121] In step 51, the processing device can process the first image using the first image processing model to obtain the number of first connected components in the first image, and process the standard template image using the first image processing model to obtain the number of second connected components corresponding to the standard template image.

[0122] In step 52, the processing device can compare whether the number of the first connected components and the number of the second connected components are equal. When the number of the first connected components and the number of the second connected components are not equal, the processing device can determine that the characters of the target information label in the first image have defects, and obtain a detection result indicating that the characters are incorrect. That is to say, when the number of connected components is different, there must be some defects in the first image that change the number of connected components. For example, broken characters can increase the number of connected components, missing characters can reduce the number of connected components, and extra printed characters can increase the number of connected components, etc. Therefore, this step can determine the detection result of incorrect characters by the unequal number of connected components, which can improve the detection efficiency of character defects.

[0123] When the number of the first connected components and the number of the second connected components are equal, the processing device can continue processing. See [link to documentation]. Figure 6 This includes steps 61 to 63.

[0124] In step 61, the processing device can acquire a first differential image corresponding to the first image and a second differential image corresponding to the third image; the object distance corresponding to the first image is greater than the object distance corresponding to the third image. The third image refers to the image captured by the camera after adjusting the focus based on the first image and magnifying the target information label, or the image obtained by processing this image.

[0125] In this step, the processor acquires the first difference image corresponding to the first image, see [link to relevant documentation]. Figure 7 The process includes steps 71 to 73. In step 71, the processing device can perform splicing processing on the characters in the connected component image corresponding to the first image to obtain a first spliced ​​image. For example, the processing device can perform character segmentation on the connected component image corresponding to the first image to obtain the size data of each character; the size data includes at least the position, length, and width of the character. Then, the processing device can splice each character at equal intervals into a preset blank image according to the character position order to obtain the first spliced ​​image. The splicing process involves truncating single characters from the grayscale image corresponding to the first image according to their position, length, and width; relevant technologies can be referenced, and will not be elaborated here. In this step, by arranging the characters at equal intervals, the deviation caused by different character spacing sizes and the deviation caused by inaccurate positioning can be eliminated, which is beneficial to improving the accuracy of the detection results.

[0126] In step 72, the processing device can concatenate the characters within the connected component image corresponding to the standard template image to obtain a second concatenated image; the character spacing distribution is the same in the first concatenated image and the second concatenated image. It is understood that the acquisition method of the second concatenated image is similar to that of the first concatenated image, and will not be described again here.

[0127] In step 73, the processing device can acquire a difference image between the first stitched image and the second stitched image, and use this difference image as the first difference image corresponding to the first image. It can be understood that the first difference image is the image obtained by subtracting the first stitched image from the second stitched image; that is, the difference between the grayscale values ​​of pixels at the same position in the two stitched images constitutes the grayscale value of the pixel at the same position in the first difference image. In this example, image differencing can remove the effects of bubbles and dust between characters.

[0128] Understandably, the method for obtaining the second difference image corresponding to the third image is similar to the method for obtaining the first difference image, and will not be repeated here.

[0129] In step 62, the processing device can obtain the position of the first connected component in the connected component image corresponding to the first difference image, and obtain the position of the second connected component in the connected component image corresponding to the second difference image.

[0130] The processing device obtains the position of the first connected component in the connected component image corresponding to the first difference image, see [reference]. Figure 8 This includes steps 81 to 83.

[0131] In step 81, the processing device can perform threshold segmentation on the first difference image to obtain a segmented image corresponding to the first difference image. In this step, threshold segmentation can highlight defective areas.

[0132] Considering the brightness deviations that may occur during camera imaging, using a fixed threshold may fail to distinguish between different regions. Therefore, an adaptive threshold can be used for threshold segmentation in this step. The adaptive threshold is obtained by the processing device acquiring the grayscale value of the pixels at the location of each character in the first difference image, and the average grayscale value of pixels within a preset distance from the origin in the first difference image. This average value is then used as the grayscale value of the background in the first difference image. Next, the processing device acquires the difference between the grayscale value of each character and the grayscale value of the background, and uses this difference as the adaptive threshold. By using an adaptive threshold for threshold segmentation in this step, the problem of inaccurate thresholding caused by differences in camera imaging brightness can be solved.

[0133] In step 82, the processing device can perform erosion and dilation processing on the segmented image corresponding to the first difference image to obtain the connected component image corresponding to the first difference image. The erosion and dilation processing methods can be found in related technologies and will not be elaborated here.

[0134] In step 83, the processing device can perform connected component statistics on the connected component image corresponding to the first difference image to obtain the position of each connected component, and then set the position of each connected component to the first connected component position.

[0135] Understandably, the method for obtaining the position of the second connected component is similar to that for obtaining the position of the first connected component, and will not be repeated here.

[0136] In step 63, the processing device can compare the positions of the first connected component and the second connected component. When the positions of the first and second connected components are the same, the processing device can determine that the characters of the target information label in the first image have defects and are false detections, thus obtaining a detection result indicating that the incorrect character representation is a false detection.

[0137] In one embodiment, when the positions of the first connected component and the second connected component are not the same, the processing device can obtain the area of ​​each connected component in the connected component image corresponding to the first difference image. For example, the processing device can count the number of pixels in each connected component in the connected component image and obtain the product of the number and the area of ​​each pixel, using the product as the area of ​​the connected component. The processing device can compare the area with a preset connected component threshold. When there is at least one connected component with an area exceeding the preset connected component threshold, the processing device can determine that the character of the target information label in the first image has a defect, obtaining a detection result indicating that the character is incorrect; when the area of ​​each connected component is less than the preset connected component threshold, the processing device can determine that the character of the target information label in the first image does not have a defect, obtaining a detection result indicating that the character is correct.

[0138] Thus, the solution provided in this embodiment can acquire a first image to be identified, the first image including a target information label; select a first image processing model from a preset image processing model library based on preset configuration information; process the first image using the first image processing model to obtain a detection result on whether the characters in the target information label are correct. In this way, this embodiment allows users to pre-configure and obtain preset configuration information, and then select a first image processing model suitable for different usage scenarios through the preset configuration information, thereby obtaining detection results that match the usage scenario, which is beneficial to improving the accuracy of the detection results.

[0139] The following describes a practical scenario of a character detection method provided in this disclosure embodiment. (See also...) Figure 9 ,include:

[0140] (1) When a camera is working continuously, the images it acquires are not always in a stable state. The images it acquires usually have uneven color and brightness and are accompanied by noise. Therefore, the processing device can use median filtering and histogram equalization to enhance the initial image and obtain the initial enhanced image.

[0141] (2) Due to differences in the location of incoming materials and the location of label placement, the characters in the initial image are tilted. The processing equipment can perform threshold segmentation, morphological dilation, erosion, contour finding, maximum contour calculation, minimum bounding rectangle calculation, affine transformation rotation and other processing on the initial enhanced image to correct the tilt of the initial enhanced image and obtain the initial corrected image.

[0142] (3) The processing device can use fixed character grayscale or shape matching to locate the character region to be identified (i.e. target information label) in the initial correction image; and crop the image of the above character region to obtain the first image to be identified.

[0143] (4) The processing device can use the Chinese and English training databases provided with Tesseract (i.e., the second preset training library in the above embodiment) to train an initial image processing model (such as LSTM) to obtain the image processing model corresponding to the second preset identifier. At this time, an image processing model for recognizing Chinese characters and an image processing model for recognizing English characters can be obtained. It is understood that there can be multiple second preset training libraries, thereby obtaining multiple image processing models (i.e., image processing models corresponding to the second preset identifier).

[0144] In one example, the processing device can acquire samples characterizing ink smudge defects and train an LSTM to obtain an image processing model corresponding to a first preset label.

[0145] In another example, a first pre-defined training library can be constructed by adding samples representing ink bleed defects to the aforementioned Chinese and English training libraries, respectively. Then, the initial image processing model is trained using the training samples in the first pre-defined training library to obtain the image processing model corresponding to the first pre-defined identifier, i.e., the image processing model for recognizing Chinese characters and the image processing model for recognizing English characters. In this way, only a small number of samples representing ink bleed defects need to be added to the original database, and the image processing model corresponding to the second pre-defined identifier can be trained in a shorter time based on the second pre-defined identifier's image processing model, reducing training costs. Furthermore, the image processing model corresponding to the first pre-defined identifier can recognize characters exhibiting ink bleed phenomena (such as 5, 6, 8, and 9).

[0146] (5) The processing device can acquire preset configuration information. In practical applications, the above-mentioned preset configuration information can be used by the user to determine whether to identify the "ink bleed" character as a defect based on the current standards, printing quality, etc. For example, when the "ink bleed" character is identified as a defect, the preset configuration information includes a first preset identifier (such as 1); when the "ink bleed" character is not identified as a defect, the preset configuration information includes a second preset identifier (such as 2).

[0147] (6) The processing device obtains a preset identifier based on the preset configuration information and obtains the image processing model corresponding to the preset identifier. Then, it processes the first image using the image processing model to obtain the first character data and compares the first character data with the barcode reading result (i.e., the target character data). If the first character data matches the target character data, the recognition is confirmed to be correct, and the first character data is directly output. If the first character data does not match the target character data, the process proceeds to step (7) to continue subsequent processing.

[0148] (7) When the number of detections is less than 4 (i.e., the preset number threshold in the above embodiment), the processing device can enhance the high-frequency areas such as the edges of the image through mean filtering, contrast enhancement, and threshold segmentation to obtain a second image. This second image is clearer than the first image and can reduce interference from the surrounding background. In this step, the second image is obtained by contrast enhancement, that is, by comparing the magnitude of the global mean and the local mean. When the local mean is less than the global mean, the product of the difference between the gray value of the current pixel and the local mean and the scaling factor (greater than 0, optionally greater than 1) is obtained, and the sum of the product and the gray value of the current pixel is obtained. This sum is used to replace the gray value of the current pixel, thereby amplifying the difference between the character and the background and achieving the contrast enhancement effect.

[0149] (8) The processing device uses different second image processing models to identify the enhanced second image in a loop until the detection result representing the character is normal and the number of detections is less than 4, then the recognition process ends, or the detection result representing the character is incorrect is obtained 4 times in a row, then the recognition process ends.

[0150] The following describes a practical scenario of a character detection method provided in this disclosure embodiment. (See also...) Figure 10 ,include:

[0151] (1) Select the standard template image corresponding to the target information data, locate the position of the target information data by contour shape matching method and obtain the first image.

[0152] (2) Threshold segmentation is performed on the first image and the standard template image respectively, noise is filtered out, and rotation is performed according to the position of all black and white points in the image to improve the positioning accuracy and provide a basis for subsequent stitching and differential.

[0153] (3) Obtain the connected components of the rotated images corresponding to the first image and the standard model image respectively, and calculate the number of connected components, namely the number of the first connected components and the data of the second connected components.

[0154] (4) Compare whether the number of the first connected components and the number of the second connected components are equal. If they are not equal, it is determined that the characters in the first image have defects such as character breaks, missing characters, and multiple characters. If they are equal, jump to step (5).

[0155] (5) Perform character segmentation on the connected component image corresponding to the first image and the connected component image corresponding to the standard template image respectively, and calculate the position, length, width, area and other information of each character.

[0156] (6) Sort the two connected component images according to the position of the characters, recreate the blank image, and extract single characters from the rotated grayscale image according to their position, length, and width. Then, stitch the characters together at equal intervals in the blank image to obtain the first stitched image and the second stitched image. Since the spacing between characters is not fixed, there is usually a deviation of 2 to 3 pixels. In this step, the deviation caused by the inherent deviation and the deviation caused by inaccurate positioning can be removed by stitching at equal intervals. In addition, the influence of bubbles and dust between characters can also be removed during subsequent image differencing.

[0157] (7) Difference the first stitched image and the second stitched image to obtain the first difference image.

[0158] (8) Self-designed threshold segmentation: Threshold segmentation is performed on the first difference image to highlight defective areas. Considering potential brightness deviations in camera imaging, an adaptive threshold is used in this step: the grayscale value of the character is found using the character's position information, and the average grayscale value of pixels within the origin's neighborhood (i.e., within a preset distance) is used as the grayscale value of the background. Then, the difference between the character's grayscale value and the average value is obtained, and this difference is used as the segmentation threshold for that pixel. This solves the problem of inaccurate threshold segmentation caused by differences in imaging brightness.

[0159] (9) Use morphological erosion and dilation to remove artifacts and other false defects, while retaining the magnified defect areas.

[0160] (10) Perform connected component statistics and calculate the location of all detected defect regions.

[0161] (11) See Figure 11 The target information tag is moved from position A to position B, and the distance and direction can be random, where C is dust on the lens; a second image is then formed to obtain a third image. Steps (1) to (10) are repeated based on the third image.

[0162] (12) Compare the positions of the connected components detected in steps (9) and (10) to determine if there has been a change; if there has been no change, it is determined that the character loss or breakage is caused by dust on the mirror or lens, and the detection result indicating that the character is incorrect is a false detection. If there is a change, the detection result indicating that the character is incorrect is determined. That is, this step can remove the interference of dust on the mirror or lens, reduce the false detection rate, and improve the yield.

[0163] (13) The number of white pixels in the connected region is the defect area.

[0164] (14) If the number of white pixels is greater than the set area threshold, then the detection result indicating that the character is defective is determined; otherwise, the detection result indicating that the character is correct is determined.

[0165] Based on the character detection method provided in this disclosure, this disclosure also provides a character detection device, see [link to relevant documentation]. Figure 12 The device includes:

[0166] The first image acquisition module 121 is used to acquire a first image to be identified, the first image including target information tags;

[0167] The processing model acquisition module 122 is used to select a first image processing model from a preset image processing model library based on preset configuration information;

[0168] The detection result acquisition module 123 is used to process the first image using the first image processing model to obtain the detection result of whether the characters in the target information label are correct.

[0169] It should be noted that the apparatus shown in this embodiment matches the content of the method embodiment, and the content of the above method embodiment can be referred to, which will not be repeated here.

[0170] Figure 13 This is a block diagram illustrating a processing device according to an exemplary embodiment. For example, the processing device 1300 may be a smartphone, computer, digital broadcasting terminal, tablet device, fitness equipment, personal digital assistant, etc.

[0171] Reference Figure 13 The processing device 1300 may include one or more of the following components: processing component 1302, memory 1304, power supply component 1306, multimedia component 1308, audio component 1310, input / output (I / O) interface 1312, sensor component 1314, communication component 1316, and image acquisition component 1318.

[0172] Processing component 1302 typically controls the overall operation of processing device 1300, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 1302 may include one or more processors 1320 to execute computer programs. Furthermore, processing component 1302 may include one or more modules to facilitate interaction between processing component 1302 and other components. For example, processing component 1302 may include a multimedia module to facilitate interaction between multimedia component 1308 and processing component 1302.

[0173] Memory 1304 is configured to store various types of data to support the operation of processing device 1300. Examples of such data include computer programs for any application or method operating on processing device 1300, contact data, phone book data, messages, pictures, videos, etc. Memory 1304 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0174] Power supply component 1306 provides power to various components of processing device 1300. Power supply component 1306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to processing device 1300. Power supply component 1306 may include a power chip, which a controller can communicate with to control, thereby controlling the power chip to turn on or off switching devices, enabling or disabling battery power to the motherboard circuitry. In one example, power supply component 1306 includes a first charging path, a second charging path, and a charging interface. The processor is connected to both the first and second charging paths. The first charging path is connected in series between the charging interface and the battery, and the second charging path is connected in series between the charging interface and the battery. The processor, according to… Figure 2 The method shown controls the first and second charging paths to charge the battery.

[0175] Multimedia component 1308 includes a screen that provides an output interface between processing device 1300 and target object. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input information from the target object. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.

[0176] Audio component 1310 is configured to output and / or input audio file information. For example, audio component 1310 includes a microphone (MIC) configured to receive external audio file information when processing device 1300 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio file information may be further stored in memory 1304 or transmitted via communication component 1316. In some embodiments, audio component 1310 also includes a speaker for outputting audio file information.

[0177] I / O interface 1312 provides an interface between processing component 1302 and peripheral interface modules, such as keyboards, click wheels, buttons, etc.

[0178] Sensor assembly 1314 includes one or more sensors for providing various aspects of status assessment for processing device 1300. For example, sensor assembly 1314 can detect the on / off state of processing device 1300, the relative positioning of components (e.g., the display screen and keypad of processing device 1300), changes in the position of processing device 1300 or a component, the presence or absence of contact between a target object and processing device 1300, the orientation or acceleration / deceleration of processing device 1300, and temperature changes of processing device 1300. In this example, sensor assembly 1314 may include a first temperature sensor and a second temperature sensor. The first temperature sensor is set within a preset range of the first charging path to collect a first temperature value corresponding to the first charging path; the second temperature sensor is set within a preset range of the second charging path to collect a second temperature value corresponding to the second charging path. The preset range can be 1–20 mm. In one example, the preset range can be 2–5 mm.

[0179] Communication component 1316 is configured to facilitate wired or wireless communication between processing device 1300 and other devices. Processing device 1300 can access wireless networks based on communication standards, such as WiFi, 2G, 3G, 4G, 5G, or combinations thereof. In one exemplary embodiment, communication component 1316 receives broadcast information or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 1316 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0180] In an exemplary embodiment, the processing device 1300 may be implemented by one or more application-specific integrated circuits (ASICs), digital information processors (DSPs), digital information processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components.

[0181] In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided, such as a memory 1304 including instructions, wherein the executable computer program described above can be executed by a processor. The readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, or optical data storage device, etc.

[0182] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This disclosure is intended to cover any variations, uses, or adaptations that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0183] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A character detection method, characterized in that, include: Acquire a first image to be identified, the first image including target information labels; The target information label has a real identification code; Based on preset configuration information, a first image processing model is selected from a preset image processing model library; the first image processing model is used to identify ink smudge defects. The first image is processed using the first image processing model to obtain a detection result indicating whether the characters in the target information label are correct. When the preset configuration information includes a third preset identifier, the third preset identifier refers to the attribute data of a standard template image that matches the first image. The first image is processed using the first image processing model to obtain a detection result indicating whether the characters are correct, including: The first image is processed using the first image processing model to obtain the number of first connected components in the first image, and the standard template image is processed using the first image processing model to obtain the number of second connected components corresponding to the standard template image. When the number of the first connected components and the number of the second connected components are equal, a first difference image corresponding to the first image and a second difference image corresponding to the third image are obtained; the object distance corresponding to the first image is greater than the object distance corresponding to the third image. Obtain the position of the first connected component in the connected component image corresponding to the first difference image, and obtain the position of the second connected component in the connected component image corresponding to the second difference image; When the positions of the first connected component and the second connected component are not the same, the method further includes: obtaining the area of ​​each connected component in the connected component image corresponding to the first difference image; when there is at least one connected component whose area exceeds a preset connected component threshold, determining that the character of the target information label in the first image has a defect, and obtaining a detection result indicating that the character is incorrect; when the area of ​​each connected component is less than the preset connected component threshold, determining that the character of the target information label in the first image does not have a defect, and obtaining a detection result indicating that the character is correct.

2. The character detection method according to claim 1, characterized in that, The first image is processed using the first image processing model to obtain a detection result indicating whether the characters in the target information label are correct, including: Obtain the first character data obtained by processing the first image using the first image processing model; When the first character data matches the target character data of the target information tag, a detection result indicating that the first character data detection is correct is obtained.

3. The character detection method according to claim 2, characterized in that, When the first character data is inconsistent with the target character data of the target information tag, the method further includes: The first image is processed to obtain a second image with higher clarity than the first image; Alternatively, re-acquire the image as a second image; Character detection is performed on the second image to obtain the detection results.

4. The character detection method according to claim 3, characterized in that, Character detection is performed on the second image to obtain the detection results, including: The second image is processed using the first image processing model to obtain the second character data; When the second character data matches the target character data, a detection result indicating that the second character data was detected correctly is obtained.

5. The character detection method according to claim 3, characterized in that, The preset image processing model library also includes at least one second image processing model, which performs character detection based on the second image to obtain detection results, including: The second image is processed sequentially using each of the second image processing models to obtain the third character data; When the third character data is consistent with the target character data and the number of detections is less than a preset threshold, it is determined that a detection result indicating that the third character data was detected correctly is obtained; When the third character data is inconsistent with the target character data and the number of detections is less than a preset threshold, the process of processing the first image to obtain a second image with higher clarity than the first image continues.

6. The character detection method according to claim 3, characterized in that, Processing the first image to obtain a second image with higher clarity than the first image includes: The global mean and local mean of the first image are obtained based on the gray values ​​of the pixels in the first image; the global mean refers to the average gray value of all pixels in the first image, and the local mean refers to the average gray value of pixels within a preset distance of each pixel in the first image. For each pixel in the first image, when the local mean corresponding to the location of the pixel is less than the global mean, the difference between the pixel and the local mean is obtained; Obtain the product of the difference and a preset scaling factor, calculate the sum of the product and the grayscale value of the pixel, and update the grayscale value of the pixel to the sum.

7. The character detection method according to claim 1, characterized in that, Obtain the first image to be identified, including: Obtain an initial image to be identified; the initial image includes target information tags; The initial image is enhanced to obtain an initial enhanced image; The initial enhanced image is subjected to tilt correction processing to obtain an initial corrected image; Locate the region containing the target information label in the initial corrected image; A screenshot of the area where the target information label is located is taken to obtain the first image to be identified.

8. The character detection method according to claim 1, characterized in that, Based on preset configuration information, a first image processing model is selected from a preset image processing model library, including: When the preset configuration information includes a first preset identifier, the image processing model corresponding to the first preset identifier in the preset image processing model library is selected as the first image processing model. When the preset configuration information includes a second preset identifier, the image processing model corresponding to the second preset identifier in the preset image processing model library is selected as the first image processing model; The image processing model corresponding to the first preset identifier is obtained by training samples in the first preset training database; the image processing model corresponding to the second preset identifier is obtained by training samples in the second preset training database; and the first preset training database includes samples from the second preset training database and preset samples representing ink bleeding defects.

9. The character detection method according to claim 1, characterized in that, When the preset configuration information includes a third preset identifier, the third preset identifier refers to the attribute data of a standard template image that matches the first image. The first image is processed using the first image processing model to obtain a detection result indicating whether the characters are correct. The method also includes: When the number of the first connected components and the number of the second connected components are not equal, it is determined that the characters of the target information label in the first image have defects, and a detection result indicating that the characters are incorrect is obtained.

10. The character detection method according to claim 1, characterized in that, Obtaining the first difference image corresponding to the first image includes: The characters within the connected component image corresponding to the first image are concatenated to obtain the first concatenated image; The characters within the connected component image corresponding to the standard template image are concatenated to obtain a second concatenated image; the character spacing distribution is the same in the first concatenated image and the second concatenated image; Obtain the difference image between the first stitched image and the second stitched image, and use the difference image as the first difference image corresponding to the first image; The second difference image is obtained in the same way as the first difference image.

11. The character detection method according to claim 10, characterized in that, The characters within the connected component image corresponding to the first image are concatenated to obtain the first concatenated image, including: The connected component image corresponding to the first image is segmented into characters to obtain the size data of each character; the size data includes at least the position, length and width of the character; By stitching the characters together at equal intervals into a preset blank image according to their position order, the first stitched image is obtained.

12. The character detection method according to claim 1, characterized in that, Obtaining the position of the first connected component in the connected component image corresponding to the first difference image includes: The first difference image is segmented using a threshold to obtain a segmented image corresponding to the first difference image; Erosion and dilation are performed on the segmented image corresponding to the first difference image to obtain the connected component image corresponding to the first difference image; The positions of each connected component are obtained by performing connected component statistics on the connected component image corresponding to the first difference image, and the positions of each connected component are used as the positions of the first connected component.

13. The character detection method according to claim 12, characterized in that, The method further includes a step of obtaining the adaptive threshold in the step of thresholding the first difference image, wherein an adaptive threshold is used. The grayscale value of the pixel at the position of each character in the first difference image is obtained, and the average value of the pixel grayscale value within a preset distance from the origin in the first difference image is obtained, and the average value is used as the grayscale value of the background in the first difference image. The difference between the grayscale value corresponding to each character and the grayscale value of the background is obtained, and the difference is used as the adaptive threshold.

14. A character detection device, characterized in that, include: The first image acquisition module is used to acquire a first image to be identified, wherein the first image includes target information tags; The target information label has a real identification code; The processing model acquisition module is used to select a first image processing model from a preset image processing model library based on preset configuration information; the first image processing model is used to identify ink smudge defects; when the preset configuration information includes a third preset identifier, the third preset identifier refers to the attribute data of a standard template image that matches the first image; The detection result acquisition module is used to process the first image using the first image processing model to obtain a detection result on whether the characters in the target information label are correct. This includes: processing the first image using the first image processing model to obtain the number of first connected components in the first image; and processing the standard template image using the first image processing model to obtain the number of second connected components corresponding to the standard template image. When the number of first connected components and the number of second connected components are equal, a first difference image corresponding to the first image and a second difference image corresponding to the third image are acquired. The object distance corresponding to the first image is greater than the object distance corresponding to the third image. The system obtains the position of the first connected component in the connected component image corresponding to the first difference image, and the position of the second connected component in the connected component image corresponding to the second difference image. When the positions of the first and second connected components are different, the system obtains the area of ​​each connected component in the connected component image corresponding to the first difference image. When there is at least one connected component whose area exceeds a preset connected component threshold, the system determines that the character of the target information label in the first image has a defect, and obtains a detection result indicating that the character is incorrect. When the area of ​​each connected component is less than the preset connected component threshold, the system determines that the character of the target information label in the first image does not have a defect, and obtains a detection result indicating that the character is correct.

15. A processing apparatus, characterized in that, include: Memory and processor; The memory is used to store computer programs that can be executed by the processor; The processor is configured to execute a computer program in the memory to implement the method as described in any one of claims 1 to 13.

16. A non-transitory computer-readable storage medium, characterized in that, When the executable computer program in the storage medium is executed by a processor, it can implement the method as described in any one of claims 1 to 13.

Citation Information

Patent Citations

  • Character recognition method and device, electronic equipment and storage medium

    CN111680688A

  • Picture recognition method and device, electronic equipment and computer readable storage medium

    CN111932564A

  • Method, device and system for recognizing tampering of bill number area and readable medium

    CN112307824A

  • Image recognition method and device, equipment and storage medium

    CN112906819A