Identification pattern detection method and apparatus, electronic device and readable storage medium
By combining segmentation models and contour detection techniques with data augmentation and contrast enhancement, the problem of the universality of sign pattern detection in various scenarios has been solved, enabling effective sign pattern extraction in complex environments.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- UBTECH ROBOTICS CORP LTD
- Filing Date
- 2024-12-28
- Publication Date
- 2026-05-07
AI Technical Summary
Existing technologies for pattern detection have poor scenario applicability, and are prone to missed detection, especially under complex image quality and lighting conditions.
A segmentation model is used to obtain a mask image, contour detection is used to determine the contour position of the region of interest, and the image to be decoded is decoded. Combined with data augmentation and contrast enhancement techniques, the detection accuracy of the marking pattern is improved.
It effectively extracts marking patterns under complex image backgrounds and lighting conditions, improving the scene versatility of marking pattern detection.
Smart Images

Figure CN2024143558_07052026_PF_FP_ABST
Abstract
Description
Methods, apparatus, electronic devices, and readable storage media for detecting identification patterns.
[0001] This application claims priority to Chinese Patent Application No. 202411510081.X, filed on October 28, 2024, entitled "Method, Apparatus, Electronic Device and Readable Storage Medium for Detecting Identification Patterns", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application belongs to the field of image processing technology, and in particular relates to a method, apparatus, electronic device and readable storage medium for detecting marking patterns. Background Technology
[0003] Identification patterns refer to patterns carrying identification content, which can be used in scenarios such as augmented reality, robot localization, and camera calibration. In the traditional method, the detection of identification patterns is carried out by using adaptive threshold segmentation for edge extraction and connected component analysis to achieve detection. However, this method has high requirements for image quality and is prone to missed detection in complex or extreme situations such as image background or lighting conditions, resulting in poor scene universality. Technical issues
[0004] This application provides a method, apparatus, electronic device, and readable storage medium for detecting identification patterns, which can solve the problem of poor scenario universality in identification pattern detection in related technologies. Technical solutions
[0005] A first aspect of this application provides a method for detecting a marker pattern, comprising: acquiring an image to be detected; inputting the image to be detected into a segmentation model to obtain a mask image output by the segmentation model, the mask image being used to indicate the region of a target marker pattern in the image to be detected; performing contour detection on the mask image to determine the contour position of a region of interest corresponding to the target marker pattern; determining an image region at the contour position in the image to be detected, and determining an image to be decoded corresponding to the image region; and decoding the image to be decoded to obtain a marker recognition result corresponding to the target marker pattern.
[0006] In some embodiments of the first aspect, the step of performing contour detection on the mask image to determine the contour position of the region of interest corresponding to the target identification pattern includes: performing contour detection on the mask image to obtain a contour detection result; performing quadrilateral fitting on the contour detection result to obtain the region of interest and the contour position; the step of determining the image to be decoded corresponding to the image region includes: performing homography transformation on the image region to obtain the image to be decoded.
[0007] In some embodiments of the first aspect, before decoding the image to be decoded, the method further includes: for each pixel in the image to be decoded, calculating the product between an initial channel value and a contrast enhancement coefficient in each color channel; for each pixel in the image to be decoded, taking the minimum value between the product and the maximum channel value in each color channel as the enhanced channel value of the corresponding color channel; and obtaining the contrast-enhanced image to be decoded based on the enhanced channel value.
[0008] In some embodiments of the first aspect, the contrast enhancement coefficient is negatively correlated with the exposure of the image to be decoded.
[0009] In some embodiments of the first aspect, the segmentation model is obtained by training a model to be trained based on a training dataset, wherein the sample images in the training dataset are obtained by data augmentation of the original dataset.
[0010] In some embodiments of the first aspect, the process of obtaining the training dataset includes: obtaining the original dataset, which includes a background image without a label pattern and an image of a sample label pattern; performing image processing on the image of the sample label pattern according to randomly generated image processing parameters to obtain an enhanced image; overlaying the enhanced image on a random position of the background image to obtain a new image; and combining the new image with the original dataset to obtain the training dataset.
[0011] In some embodiments of the first aspect, if there are multiple target identification patterns in the image to be detected, the step of performing contour detection on the mask image to determine the contour position of the region of interest corresponding to the target identification pattern, determining the image region at the contour position in the image to be detected, and determining the image to be decoded corresponding to the image region includes: performing contour detection on the mask image to determine the contour positions of multiple regions of interest, wherein the multiple regions of interest correspond one-to-one with multiple target identification patterns; determining the image region at each contour position in the image to be detected to obtain multiple image regions; determining multiple images to be decoded corresponding one-to-one with the multiple image regions; and decoding the images to be decoded to obtain the identification recognition result corresponding to the target identification pattern includes: decoding the multiple images to be decoded respectively to obtain the identification recognition result.
[0012] A second aspect of this application provides a device for detecting a marker pattern, comprising: an image acquisition unit for acquiring an image to be detected; a mask acquisition unit for inputting the image to be detected into a segmentation model to obtain a mask image output by the segmentation model, the mask image being used to indicate the region of a target marker pattern in the image to be detected; a contour extraction unit for performing contour detection on the mask image to determine the contour position of a region of interest corresponding to the target marker pattern; an image determination unit for determining an image region at the contour position in the image to be detected and determining an image to be decoded corresponding to the image region; and a decoding unit for decoding the image to be decoded to obtain a marker recognition result corresponding to the target marker pattern.
[0013] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method for detecting a marking pattern.
[0014] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method for detecting a marking pattern.
[0015] The fifth aspect of this application provides a computer program product that, when run on an electronic device, causes the electronic device to perform the steps of the above-described method for detecting the identification pattern. Beneficial effects
[0016] In the embodiments of this application, the image to be detected is input into a segmentation model to obtain a mask image output by the segmentation model. Contour detection is performed on the mask image to determine the contour position of the region of interest corresponding to the target logo pattern. The image region at the contour position is determined in the image to be detected, and the image to be decoded corresponding to the image region is determined. Thus, the image to be decoded is decoded to obtain the logo recognition result corresponding to the target logo pattern. This method uses a segmentation model to extract a mask image and uses the mask image to replace threshold segmentation to extract the image region where the target logo pattern is located. Even in complex and extreme cases of image background or lighting conditions, the logo pattern can be extracted relatively effectively, thus improving the scene universality of logo pattern detection. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 is a schematic diagram of the implementation process of a method for detecting an identification pattern provided in an embodiment of this application;
[0019] Figure 2 is a schematic diagram of obtaining a mask image provided in an embodiment of this application;
[0020] Figure 3 is a schematic diagram of obtaining sample images provided in an embodiment of this application;
[0021] Figure 4 is a schematic diagram of the specific implementation process of contrast enhancement provided in the embodiments of this application;
[0022] Figure 5 is a schematic diagram of the contrast-enhanced image to be decoded provided in an embodiment of this application;
[0023] Figure 6 is a schematic diagram of the structure of a marking pattern detection device provided in an embodiment of this application;
[0024] Figure 7 is a schematic diagram of the structure of the electronic device provided in an embodiment of this application. Embodiments of the present invention
[0025] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are protected by this application.
[0026] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0027] In the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0028] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0029] To illustrate the technical solution of this application, specific embodiments are described below.
[0030] Figure 1 illustrates a schematic flowchart of a method for detecting an identification pattern according to an embodiment of this application. This method can be applied to electronic devices, such as computers, mobile phones, robots, and other intelligent devices.
[0031] Specifically, the detection method for the above-mentioned marking pattern may include the following steps S101 to S105.
[0032] Step S101: Obtain the image to be detected.
[0033] In the embodiments of this application, the image to be detected is an image for which a marker pattern needs to be detected. The marker pattern may refer to a QR code, barcode, AprilTag code, etc., and this application does not limit this.
[0034] In some embodiments of this application, the image to be detected can be acquired using a camera built into the electronic device. For example, when a robot needs to perform localization, it can acquire images of its operating environment using its built-in camera to obtain the image to be detected. In other embodiments of this application, the image to be detected can also be input by the user or downloaded via a network. This application does not limit the method of acquiring the image to be detected.
[0035] Step S102: Input the image to be detected into the segmentation model to obtain the mask image output by the segmentation model.
[0036] The segmentation model is a pre-trained model used to generate a mask image for the image to be detected. The mask image is used to indicate the regions of the target marker pattern in the image to be detected, so as to extract the image regions where the target marker pattern is located. The target marker pattern is the marker pattern that appears in the image to be detected.
[0037] Specifically, the mask image can be a binary image or a Boolean image of the same size as the image to be detected. In the mask image, the region of interest (ROI) and non-ROI (ROI) corresponding to the target identifier pattern can be distinguished by different pixel values. For example, the ROI corresponding to the target identifier pattern is marked as 1 (or True), while the non-ROI is marked as 0 (or False), thus the location of the ROI in the mask image can characterize the location of the image region containing the target identifier pattern in the image to be detected.
[0038] For example, referring to Figure 2, the segmentation model performs identification pattern code detection on the image to be detected. When an identification pattern code is detected, it returns a mask image of that identification pattern code. In Figure 2, the white area is the region of interest corresponding to the target identification pattern, and the black area is the region of non-interest.
[0039] Step S103: Perform contour detection on the mask image to determine the contour position of the region of interest corresponding to the target logo pattern.
[0040] Since regions of interest (ROIs) and non-ROIs corresponding to the target identifier pattern in a mask image can be distinguished by different pixel values, contour detection of the mask image can detect the contours of the ROIs within the mask image, thus obtaining the contour position of the ROI corresponding to the target identifier pattern. This contour position can be represented as the position coordinates of each contour point on the contour, or as the position coordinates of the contour center and contour corners, etc., and this application does not impose any limitations on this. This application does not restrict the contour detection method; for example, edge regions can be determined using operators such as the Sobel operator, the Prewitt operator, and the Canny operator.
[0041] Step S104: Determine the image region at the contour position in the image to be detected, and determine the image to be decoded corresponding to the image region.
[0042] In the embodiments of this application, the image to be decoded refers to the image used to decode the identified content. Since the contour position of the region of interest in the mask image is the same as the contour position of the target identifier pattern in the image to be detected, the image region at the contour position can be determined in the image to be detected, and this image region is also the image region of the target identifier pattern. Then, the image region of the target identifier pattern in the image to be detected, or the image obtained by further processing the image region of the target identifier pattern, can be used as the image to be decoded.
[0043] Step S105: Decode the image to be decoded to obtain the identification result corresponding to the target identification pattern.
[0044] The decoding method can be selected according to the type of the identifier pattern, and the decoding algorithm used can be implemented according to existing decoding algorithms. For example, when the target identifier pattern is an AprilTag code, since the AprilTag code expresses different codes through a black and white pixel matrix, the identifier content carried by the target identifier pattern can be decoded based on the pixel value of each pixel in the pixel matrix within the target identifier pattern, thus obtaining the identifier recognition result.
[0045] In the embodiments of this application, the image to be detected is input into a segmentation model to obtain a mask image output by the segmentation model. Contour detection is performed on the mask image to determine the contour position of the region of interest corresponding to the target logo pattern. The image region at the contour position is determined in the image to be detected, and the image to be decoded corresponding to the image region is determined. Thus, the image to be decoded is decoded to obtain the logo recognition result corresponding to the target logo pattern. This method uses a segmentation model to extract a mask image and uses the mask image to replace threshold segmentation to extract the image region where the target logo pattern is located. Even in complex and extreme cases of image background or lighting conditions, the logo pattern can be extracted relatively effectively, thus improving the scene universality of logo pattern detection.
[0046] In some embodiments of this application, the segmentation model described above is obtained by training a model to be trained based on a training dataset, wherein the sample images in the training dataset are obtained by data augmentation of the original dataset.
[0047] Specifically, the sample images in the training dataset may include images from the original dataset, as well as images obtained by data augmentation of the images from the original dataset. Data augmentation expands the training dataset, making it more balanced and thus improving the generalization ability of the segmentation model.
[0048] In some embodiments of this application, the process of obtaining the training dataset may include: obtaining an original dataset, which includes a background image without identifier patterns and images of sample identifier patterns; overlaying the images of sample identifier patterns onto random positions of the background image to obtain new images; and combining the new images with the original dataset to obtain the training dataset.
[0049] Furthermore, in some embodiments of this application, the process of obtaining the training dataset may include: obtaining the original dataset, which includes a background image without a label pattern and an image of a sample label pattern; performing image processing on the image of the sample label pattern according to randomly generated image processing parameters to obtain an enhanced image; overlaying the enhanced image on a random position of the background image to obtain a new image; and combining the new image with the original dataset to obtain the training dataset.
[0050] The image of the sample identifier pattern can be obtained by segmenting the image containing the identifier pattern, or it can be directly generated according to the encoding format of the sample identifier pattern; this application does not impose any restrictions on this. Both the background image without the identifier pattern and the image containing the identifier pattern can be collected in real-world application scenarios to meet application requirements.
[0051] Image processing parameters may include, but are not limited to, scaling parameters, brightness adjustment parameters, and blurring parameters. Scaling parameters can be used to randomly scale the image horizontally and vertically according to a scaling ratio, increasing the model's adaptability to scale changes. Brightness adjustment parameters can be used to adjust the image's brightness, increasing the model's robustness to color changes. Blur operations are used to reduce details and edges in the image, making it appear more blurred; blurring parameters control the degree of blurring during the blurring process.
[0052] For example, as shown in Figure 3, firstly, a sufficient number of images containing identification pattern codes are collected from real-world application scenarios to serve as the training dataset for the model. The identification pattern code portion is cropped from the obtained real-world scene images (e.g., the area containing the identification pattern code is cropped using masking annotation results) to obtain the identification pattern image. Secondly, a large number of background images without identification pattern codes are collected. For each background image, one is randomly selected from all the identification pattern images and pasted onto it at a random position in the background image to obtain a new image. Before pasting, random data augmentation operations can be performed on the identification pattern image, including but not limited to random scaling, random brightness adjustment, and random blurring. The above process is repeated for all background images until the identification pattern code has been pasted onto each background image. These images, along with the images from the original dataset, together constitute the training dataset.
[0053] Based on the training dataset, existing model training methods such as gradient descent can be used to train the model to obtain a segmentation model. Then, the image to be detected is input into the segmentation model to obtain the mask image output by the segmentation model.
[0054] In some embodiments of this application, contour detection is performed on the mask image to determine the contour position of the region of interest corresponding to the target identifier pattern. This may include: performing contour detection on the mask image to obtain contour detection results, and performing quadrilateral fitting on the contour detection results to obtain the region of interest and contour position.
[0055] Accordingly, determining the image to be decoded corresponding to the image region may include: performing homography transformation on the image region to obtain the image to be decoded.
[0056] Specifically, the contour detection result can characterize the contour of the region corresponding to the target logo pattern within the mask image. Since the target logo pattern is a quadrilateral pattern, according to the principle of perspective transformation, the quadrilateral target logo pattern remains a quadrilateral after the viewpoint transformation. However, the contour detection result is sometimes not a strictly quadrilateral region. Therefore, quadrilateral fitting can be performed on the contour detection result, and the resulting quadrilateral region can be taken as the region of interest, and its contour position can be obtained. The contour position of the quadrilateral region can characterize the original pose of the target logo pattern in the image to be detected. Through homography transformation, the image region of the target logo pattern in the image to be detected is adjusted to the standard pose of a regular quadrilateral, resulting in the image to be decoded.
[0057] The mask-based contour extraction and quadrilateral fitting method, compared to traditional methods that require line detection to find the fitted quadrilateral, is more advantageous for handling complex environments. Therefore, the implementation method of this application can further improve scene versatility. Moreover, decoding the image to be decoded based on the standard pose of a regular quadrilateral also helps to improve decoding accuracy.
[0058] In some embodiments of this application, before decoding the image to be decoded, the method may further include: contrast enhancement of the image to be decoded. The purpose of contrast enhancement is to increase the difference between black and white pixels in the image, thereby enhancing the decodeability of the identification pattern and avoiding decoding failure caused by excessively bright or dark lighting.
[0059] The method for enhancing contrast can be selected according to the actual situation.
[0060] In some embodiments of this application, as shown in FIG4, the above-mentioned contrast enhancement of the image to be decoded may include steps S401 to S403.
[0061] Step S401: For each pixel in the image to be decoded, calculate the product between the initial channel value and the contrast enhancement coefficient for each color channel.
[0062] Step S402: For each pixel in the image to be decoded, for each color channel, the minimum value between the product and the maximum channel value is taken as the enhanced channel value of the corresponding color channel.
[0063] Step S403: Obtain the contrast-enhanced image to be decoded based on the enhanced channel values.
[0064] The initial channel value is the channel value of each pixel in the image to be decoded.
[0065] The contrast enhancement factor can be set according to the actual situation, and the value range can be between 0.5 and 3. The contrast enhancement factor for different color channels can be the same or different.
[0066] Specifically, steps S401 and S402 can be represented by the following formulas: R'(x,y)=min(α*R(x,y),255); G'(x,y)=min(α*G(x,y),255); B'(x,y)=min(α*B(x,y),255);
[0067] In the formula, R, G, and B represent the red, green, and blue channels, respectively; α represents the contrast enhancement coefficient; R(x,y), G(x,y), and B(x,y) represent the initial channel values; 255 represents the maximum channel value; min represents the minimum value; and R'(x,y), G'(x,y), and B'(x,y) represent the enhanced channel values.
[0068] In some embodiments of this application, the contrast enhancement coefficient is negatively correlated with the exposure of the image to be decoded. For a darker image to be decoded, the contrast enhancement coefficient can be greater than 1, while for an overexposed image to be decoded, the contrast enhancement coefficient can be less than 1.
[0069] The effect of contrast enhancement is shown in Figure 5. It can be seen that the upper edge of the identification pattern code in the image to be decoded in Figure 5 appears gray under the influence of shadow, while in the image to be decoded after contrast enhancement, the influence of this shadow is greatly reduced.
[0070] Correspondingly, the identification result can be obtained from the image to be decoded after contrast enhancement.
[0071] In some embodiments of this application, the number of target identification patterns in the image to be detected can be one or more. If the number of target identification patterns in the image to be detected is multiple, contour detection is performed on the mask image to determine the contour position of the region of interest corresponding to the target identification pattern, the image region at the contour position is determined in the image to be detected, and the image to be decoded corresponding to the image region is determined. This can include: performing contour detection on the mask image to determine the contour position of multiple regions of interest, with each region of interest corresponding to a multiple target identification pattern; determining the image region at each contour position in the image to be detected to obtain multiple image regions; and determining multiple images to be decoded that correspond one-to-one with each of the multiple image regions.
[0072] Accordingly, the process of decoding the image to be decoded to obtain the identification result corresponding to the target identification pattern may include: decoding multiple images to be decoded separately to obtain identification results.
[0073] Specifically, if there are multiple target marking patterns in the image to be detected, a mask image can be used to extract image regions of multiple target marking patterns. The image region of each target marking pattern will be processed independently to obtain the image to be decoded, and then independently enhanced and decoded. Thus, the scheme provided in this application can detect images with a single marking pattern or images with multiple marking patterns, making it more universally applicable.
[0074] It should be noted that, for the sake of simplicity, the aforementioned method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders.
[0075] Figure 6 shows a schematic diagram of a pattern detection device 600 provided in an embodiment of this application. The pattern detection device 600 is disposed on an electronic device.
[0076] Specifically, the identification pattern detection device 600 may include:
[0077] Image acquisition unit 601 is used to acquire the image to be detected;
[0078] The mask acquisition unit 602 is used to input the image to be detected into the segmentation model to obtain a mask image output by the segmentation model. The mask image is used to indicate the region of the target identification pattern in the image to be detected.
[0079] The contour extraction unit 603 is used to perform contour detection on the mask image and determine the contour position of the region of interest corresponding to the target identification pattern.
[0080] The image determination unit 604 is used to determine the image region at the contour position in the image to be detected, and to determine the image to be decoded corresponding to the image region;
[0081] The decoding unit 605 is used to decode the image to be decoded to obtain the identification result corresponding to the target identification pattern.
[0082] In some embodiments of this application, the contour extraction unit 603 can be specifically used to: perform contour detection on the mask image to obtain contour detection results; and perform quadrilateral fitting on the contour detection results to obtain the region of interest and the contour position. The image determination unit 604 can be specifically used to: perform homography transformation on the image region to obtain the image to be decoded.
[0083] In some embodiments of this application, the identification pattern detection device 600 may further include an enhancement unit for: calculating, for each pixel in the image to be decoded, the product between an initial channel value and a contrast enhancement coefficient in each color channel; for each pixel in the image to be decoded, taking the minimum value between the product and the maximum channel value in each color channel as the enhanced channel value of the corresponding color channel; and obtaining the contrast-enhanced image to be decoded based on the enhanced channel value.
[0084] In some embodiments of this application, the contrast enhancement coefficient is negatively correlated with the exposure of the image to be decoded.
[0085] In some embodiments of this application, the segmentation model is obtained by training a model to be trained based on a training dataset, wherein the sample images in the training dataset are obtained by data augmentation of the original dataset.
[0086] In some embodiments of this application, the identification pattern detection device 600 may further include a training unit for: acquiring the original dataset, the original dataset including a background image without identification patterns and an image of a sample identification pattern; performing image processing on the image of the sample identification pattern according to randomly generated image processing parameters to obtain an enhanced image; overlaying the enhanced image on a random position of the background image to obtain a new image; and combining the new image with the original dataset to obtain the training dataset.
[0087] In some embodiments of this application, if there are multiple target identification patterns in the image to be detected, the contour extraction unit 603 may be specifically used to: perform contour detection on the mask image to determine the contour positions of multiple regions of interest, wherein the multiple regions of interest correspond one-to-one with the multiple target identification patterns; the image determination unit 604 may be specifically used to: determine the image region at each contour position in the image to be detected to obtain multiple image regions; determine multiple images to be decoded corresponding one-to-one with the multiple image regions; the decoding unit 605 may be specifically used to: decode the multiple images to be decoded respectively to obtain the identification recognition result.
[0088] It should be noted that, for the sake of convenience and brevity, the specific working process of the above-mentioned identification pattern detection device 600 can be referred to the corresponding process of the method described in Figures 1 to 5, and will not be repeated here.
[0089] Figure 7 shows a schematic diagram of an electronic device provided in an embodiment of this application. Specifically, the electronic device 7 may include: a processor 70, a memory 71, and a computer program 72 stored in the memory 71 and executable on the processor 70, such as a program for detecting identification patterns. When the processor 70 executes the computer program 72, it implements the steps in the various identification pattern detection method embodiments described above, such as steps S101 to S105 shown in Figure 1. Alternatively, when the processor 70 executes the computer program 72, it implements the functions of each module / unit in the various device embodiments described above, such as the functions of the image acquisition unit 601, mask acquisition unit 602, contour extraction unit 603, image determination unit 604, and decoding unit 605 shown in Figure 6.
[0090] The computer program can be divided into one or more modules / units, which are stored in the memory 71 and executed by the processor 70 to complete this application. The one or more modules / units can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device.
[0091] For example, the computer program can be divided into: an image acquisition unit, a mask acquisition unit, a contour extraction unit, an image determination unit, and a decoding unit. The specific functions of each unit are as follows: the image acquisition unit acquires the image to be detected; the mask acquisition unit inputs the image to be detected into a segmentation model to obtain a mask image output by the segmentation model, the mask image indicating the region of the target identifier pattern in the image to be detected; the contour extraction unit performs contour detection on the mask image to determine the contour position of the region of interest corresponding to the target identifier pattern; the image determination unit determines the image region at the contour position in the image to be detected and determines the image to be decoded corresponding to the image region; the decoding unit decodes the image to be decoded to obtain the identifier recognition result corresponding to the target identifier pattern.
[0092] The electronic device may include, but is not limited to, a processor 70 and a memory 71. Those skilled in the art will understand that Figure 7 is merely an example of an electronic device and does not constitute a limitation on the electronic device. It may include more or fewer components than illustrated, or combine certain components, or different components. For example, the electronic device may also include input / output devices, network access devices, buses, etc.
[0093] The processor 70 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0094] The memory 71 can be an internal storage unit of the electronic device, such as a hard drive or RAM. The memory 71 can also be an external storage device of the electronic device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory 71 can include both internal and external storage units. The memory 71 is used to store the computer program and other programs and data required by the electronic device. The memory 71 can also be used to temporarily store data that has been output or will be output.
[0095] It should be noted that, for the sake of convenience and brevity, the structure of the above-mentioned electronic device can also be referred to the specific description of the structure in the method embodiment, which will not be repeated here.
[0096] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0097] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0098] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for various specific applications, but such implementations should not be considered beyond the scope of this application.
[0099] In the embodiments provided in this application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings or direct couplings or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0100] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0101] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0102] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0103] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for detecting a marking pattern, characterized in that, include: Acquire the image to be detected; The image to be detected is input into the segmentation model to obtain a mask image output by the segmentation model. The mask image is used to indicate the region of the target identification pattern in the image to be detected. Contour detection is performed on the mask image to determine the contour position of the region of interest corresponding to the target logo pattern; In the image to be detected, the image region at the contour position is determined, and the image to be decoded corresponding to the image region is determined; The image to be decoded is decoded to obtain the identification result corresponding to the target identification pattern.
2. The method for detecting the marking pattern as described in claim 1, characterized in that, The step of performing contour detection on the mask image to determine the contour position of the region of interest corresponding to the target identifier pattern includes: Contour detection is performed on the mask image to obtain contour detection results; The contour detection results are fitted with a quadrilateral to obtain the region of interest and the contour position. Determining the image to be decoded corresponding to the image region includes: The image region is subjected to homography transformation to obtain the image to be decoded.
3. The method for detecting the marking pattern as described in claim 1, characterized in that, Before decoding the image to be decoded, the process also includes: For each pixel in the image to be decoded, the product between the initial channel value and the contrast enhancement coefficient is calculated for each color channel; For each pixel in the image to be decoded, in each color channel, the minimum value between the product and the maximum channel value is taken as the enhanced channel value of the corresponding color channel; Based on the enhanced channel values, the contrast-enhanced image to be decoded is obtained.
4. The method for detecting the marking pattern as described in claim 3, characterized in that, The contrast enhancement coefficient is negatively correlated with the exposure of the image to be decoded.
5. The method for detecting the marking pattern as described in any one of claims 1-4, characterized in that, The segmentation model is obtained by training the model to be trained based on the training dataset, and the sample images in the training dataset are obtained by data augmentation of the original dataset.
6. The method for detecting the marking pattern as described in claim 5, characterized in that, The process of obtaining the training dataset includes: Obtain the original dataset, which includes a background image without the label pattern and images of sample label patterns; The image of the sample identification pattern is processed according to randomly generated image processing parameters to obtain an enhanced image; The enhanced image is overlaid on a random position in the background image to obtain a new image; The newly added images are combined with the original dataset to obtain the training dataset.
7. The method for detecting a marking pattern as described in any one of claims 1-4, characterized in that, If there are multiple target identifier patterns in the image to be detected, then the process of performing contour detection on the mask image to determine the contour position of the region of interest corresponding to the target identifier pattern, determining the image region at the contour position in the image to be detected, and determining the image to be decoded corresponding to the image region includes: Contour detection is performed on the mask image to determine the contour positions of multiple regions of interest, and each region of interest corresponds one-to-one with a multiple target identification pattern; In the image to be detected, the image region at each of the contour positions is determined to obtain a plurality of the image regions; Determine multiple images to be decoded that correspond one-to-one with each of the multiple image regions; Decoding the image to be decoded to obtain the identifier recognition result corresponding to the target identifier pattern includes: The multiple images to be decoded are decoded respectively to obtain the identifier recognition result.
8. A device for detecting marking patterns, characterized in that, include: The image acquisition unit is used to acquire the image to be detected; The mask acquisition unit is used to input the image to be detected into the segmentation model to obtain a mask image output by the segmentation model. The mask image is used to indicate the region of the target identification pattern in the image to be detected. A contour extraction unit is used to perform contour detection on the mask image and determine the contour position of the region of interest corresponding to the target identification pattern; An image determination unit is used to determine an image region at the contour position in the image to be detected, and to determine the image to be decoded corresponding to the image region; The decoding unit is used to decode the image to be decoded to obtain the identification result corresponding to the target identification pattern.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method for detecting the marking pattern as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for detecting the marking pattern as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Image detection method and device, and computer readable storage medium
CN112258504A
Vein recognition method and device based on region of interest, equipment and storage medium
CN113420690A
Target detection method and device, electronic equipment and readable storage medium
CN113505781A
Target identification method and device, electronic equipment and computer readable storage medium
CN117671462A
Image segmentation model training method and apparatus, and image segmentation method and apparatus
WO2023230936A1