An image recognition method based on mask contour tracking and related products
The image is binarized and pixel-by-pixel scanning is performed through the mask profile tracking algorithm, which solves the problem of poor non-continuous pixel point recognition effect in the prior art, and achieves efficient and accurate image recognition.
Patent Information
- Application Number
- CN202310138440.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-14
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2043-02-14
AI Technical Summary
The existing chain code-based image tracking algorithm has poor image recognition effect under discontinuous pixel points, and has high computational cost in high pixel images, which affects customer experience.
Using a mask contour tracking method, the image is binarized, and the target contour points are identified in the mask area by scanning pixel by pixel, and the mask contour tracking algorithm is used to track and identify the contours to improve the recognition effect of non-connected pixel points.
It improves the accuracy and efficiency of image recognition, reduces the computing cost of high-pixel images, and improves customer experience.
Smart Images

Figure CN116229098B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image recognition technology, and in particular to an image recognition method based on mask contour tracking and related products. Background Art
[0002] With the development of machine learning and mobile internet technologies, e-commerce is becoming increasingly popular, and online payment has become one of the main payment methods. However, most online payments involve bank card binding, which requires entering the bank card number to complete the binding.
[0003] Currently, most banks use a simple contour tracking algorithm, namely, a chain code-based image tracking algorithm. First, the image is binarized; then, the algorithm searches for the next contour point in a clockwise direction among neighboring pixels. Once a contour point has been found, it is not retraversed, and the next contour point is iteratively searched until the starting point of contour tracking is reached. Due to the influence of external noise and image-specific factors, the pixels in the binarized image are generally discontinuous. As a result, image recognition methods based on chain code-based image tracking algorithms, when applied to scenarios where pixels are connected, have poor recognition performance. Summary of the Invention
[0004] Based on the above problems, the present application provides an image recognition method and related products based on mask contour tracking to improve image recognition effect.
[0005] The embodiments of this application disclose the following technical solutions:
[0006] In a first aspect, the present application provides an image recognition method based on mask contour tracking, the method comprising:
[0007] Binarizing the acquired image to obtain a binary image with pixel values of the first value or the second value;
[0008] Scan the binary image pixel by pixel according to a preset rule, and use a pixel point whose first pixel value is the second value as a first target contour point, where the first target contour point is the starting point of the target contour;
[0009] The first target contour point is used as the center of the mask area, and in the mask area, according to a preset rule, a pixel point whose first pixel value is the second value is used as a second target contour point, and the second target contour point is the first middle point of the target contour;
[0010] The second target contour point is used as the center of the mask area, and in the mask area, according to a preset rule, a pixel point whose first pixel value is the second value is used as a third target contour point, and the third target contour point is the middle point of the target contour or the end point of the target contour;
[0011] If the third target contour point is the end point of the target contour, the target image enclosed by the first target contour point, each of the second target contour points, and the third target contour point is recognized.
[0012] Optionally, the mask is an (m, n) mask, and taking a pixel point having a first pixel value of the second value as a second target contour point in the mask area according to a preset rule includes:
[0013] In the (m, n) mask area, in ascending order from 0 to (2m+1)*(2n+1)-2, the first pixel point whose pixel value is the second value is taken as the second target contour point.
[0014] Optionally, the method further includes:
[0015] Comparing the resolution of the image with a preset threshold to obtain a comparison result;
[0016] If the comparison result indicates that the resolution of the image is greater than a preset threshold, the mask area is increased; if the comparison result indicates that the resolution of the image is less than the preset threshold, the mask area is decreased.
[0017] Optionally, scanning the binary image according to a preset rule and taking a pixel point whose first pixel value is the second value as a first target contour point includes:
[0018] Scan the binary image pixel by pixel from top to bottom and from left to right, and take the pixel point whose first pixel value is the second value as the first target contour point.
[0019] Optionally, the target image is a digital image contour separated from the image, and identifying the target image enclosed by the first target contour point, each of the second target contour points, and the third target contour point includes:
[0020] The digital image outline separated from the image is matched with the outline image in the template in sequence until the number corresponding to the digital image is found to obtain a recognition result.
[0021] Optionally, the step of taking the second target contour point as the center of the mask area, taking the first pixel point having the second value as the third target contour point in the mask area according to a preset rule, and the third target contour point being the middle point of the target contour or the end point of the target contour, includes:
[0022] The second target contour point is used as the center of the mask area, and the first pixel point whose pixel value is the second value is used as the third target contour point in the mask area according to a preset rule;
[0023] If the third target contour point is not the same as the first target contour point, the third target contour point is the middle point of the target contour; if the third target contour point is the same as the first target contour point, the third target contour point is the end point of the target contour.
[0024] Optionally, the method further includes:
[0025] A morphological closing operation is performed on the binary image.
[0026] In a second aspect, the present application provides an image recognition device based on mask contour tracking, the device comprising: a binarization processing module, a scanning module, a first acquisition module, a second acquisition module, and a recognition module;
[0027] The binarization processing module is used to perform binarization processing on the acquired image to obtain a binary image with pixel values of the first value or the second value;
[0028] The scanning module is used to scan the binary image pixel by pixel according to a preset rule, and take the pixel point whose first pixel value is the second value as the first target contour point, and the first target contour point is the starting point of the target contour;
[0029] The first acquisition module is configured to use the first target contour point as the center of a mask area, and in the mask area, according to a preset rule, use a pixel point whose first pixel value is the second value as a second target contour point, wherein the second target contour point is a first middle point of the target contour;
[0030] The second acquisition module is configured to use the second target contour point as the center of the mask area, and in the mask area, according to a preset rule, use a pixel point having a first pixel value equal to the second value as a third target contour point, wherein the third target contour point is the middle point of the target contour or the end point of the target contour;
[0031] The recognition module is configured to recognize a target image enclosed by the first target contour point, each of the second target contour points, and the third target contour point if the third target contour point is an end point of the target contour.
[0032] Optionally, the mask is an (m, n) mask, and the first acquisition module is specifically configured to:
[0033] In the (m, n) mask area, in ascending order from 0 to (2m+1)*(2n+1)-2, the first pixel point whose pixel value is the second value is taken as the second target contour point.
[0034] Optionally, the device further comprises: an adjustment module;
[0035] The adjustment module is used to compare the resolution of the image with a preset threshold to obtain a comparison result;
[0036] If the comparison result indicates that the resolution of the image is greater than a preset threshold, the mask area is increased; if the comparison result indicates that the resolution of the image is less than the preset threshold, the mask area is decreased.
[0037] Optionally, the scanning module is specifically configured to:
[0038] Scan the binary image pixel by pixel from top to bottom and from left to right, and take the pixel point whose first pixel value is the second value as the first target contour point.
[0039] Optionally, the target image is a digital image outline separated from the image, and the recognition module is specifically configured to:
[0040] The digital image outline separated from the image is matched with the outline image in the template in sequence until the number corresponding to the digital image is found to obtain a recognition result.
[0041] Optionally, the second acquisition module is specifically configured to:
[0042] The second target contour point is used as the center of the mask area, and the first pixel point whose pixel value is the second value is used as the third target contour point in the mask area according to a preset rule;
[0043] If the third target contour point is not the same as the first target contour point, the third target contour point is the middle point of the target contour; if the third target contour point is the same as the first target contour point, the third target contour point is the end point of the target contour.
[0044] Optionally, the device further comprises: a morphological closing operation processing module;
[0045] The morphological closing operation processing module is used to perform morphological closing operation processing on the binary image.
[0046] In a third aspect, the present application provides an electronic device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the image recognition method based on mask contour tracking as described in any one of the first aspects is implemented.
[0047] In a fourth aspect, the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a terminal device, the terminal device executes the image recognition method based on mask contour tracking as described in any one of the first aspects.
[0048] The acquired image is binarized to obtain a binary image with pixel values of the first value or the second value; the binary image is scanned pixel by pixel according to a preset rule, and the pixel point with the first pixel value of the second value is used as the first target contour point, and the first target contour point is the starting point of the target contour; the first target contour point is used as the center of the mask area, and the pixel point with the first pixel value of the second value is used as the second target contour point in the mask area according to the preset rule, and the second target contour point is the first middle point of the target contour; the second target contour point is used as the center of the mask area, and the pixel point with the first pixel value of the second value is used as the third target contour point in the mask area according to the preset rule, and the third target contour point is the middle point of the target contour or the end point of the target contour; if the third target contour point is the end point of the target contour, the target image surrounded by the first target contour point, each second target contour point and the third target contour point is identified. The mask used in this application is a natural extension or generalized form of the chain code. It detects target contour points through newly defined connectivity. During the target recognition process, the mask contour tracking algorithm is used to track the contour and perform target recognition, thereby improving the recognition effect of images with non-connected pixels. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0050] Figure 1 A flowchart corresponding to an image recognition method based on mask contour tracking provided in an embodiment of the present application;
[0051] Figure 2 A schematic diagram of an (m,n) mask provided in an embodiment of the present application;
[0052] Figure 3 A flowchart corresponding to another image recognition method based on mask contour tracking provided in an embodiment of the present application;
[0053] Figure 4 A schematic structural diagram of an image recognition device based on mask contour tracking provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] As previously described, current image recognition algorithms based on chain code contour tracking have limited effectiveness for images with disconnected pixels. Furthermore, these algorithms require iterative traversal of the next contour point, making them suitable for images with relatively few pixels. Given that each image currently contains tens of millions of pixels, continuing to use these algorithms would be prohibitively time-consuming and inefficient, significantly impacting the customer experience.
[0055] In view of this, the present application provides an image recognition method based on mask contour tracking, the method comprising:
[0056] The acquired image is binarized to obtain a binary image with pixel values of the first value or the second value; the binary image is scanned pixel by pixel according to a preset rule, and the pixel point with the first pixel value of the second value is used as the first target contour point, and the first target contour point is the starting point of the target contour; the first target contour point is used as the center of the mask area, and the pixel point with the first pixel value of the second value is used as the second target contour point in the mask area according to the preset rule, and the second target contour point is the first middle point of the target contour; the second target contour point is used as the center of the mask area, and the pixel point with the first pixel value of the second value is used as the third target contour point in the mask area according to the preset rule, and the third target contour point is the middle point of the target contour or the end point of the target contour; if the third target contour point is the end point of the target contour, the target image surrounded by the first target contour point, each second target contour point and the third target contour point is identified.
[0057] In order to help those skilled in the art better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0058] See also Figure 1 , this figure is a flowchart corresponding to an image recognition method based on mask contour tracking.
[0059] like Figure 1 As shown, the method includes:
[0060] S101: Binarize the acquired image to obtain a binary image whose pixel values are the first value or the second value.
[0061] Specifically, image binarization involves setting the grayscale values of pixels in an image to a first or second value, effectively rendering the entire image in black and white. This involves applying an appropriate threshold to a grayscale image with 256 brightness levels to create a binary image that still reflects both the overall and local features of the image.
[0062] The image may be a picture of a bank card, and the first and second values represent the brightness of the pixels. The first value may be "0", indicating that the corresponding pixel is white, and the second value may be "1", indicating that the corresponding pixel is black.
[0063] S102: Scan the binary image pixel by pixel according to a preset rule, and use a pixel point whose first pixel value is the second value as a first target contour point, and the first target contour point as a starting point of the target contour.
[0064] In an optional embodiment, the binary image is scanned pixel by pixel from top to bottom and from left to right, and a pixel point whose first pixel value is the second value is taken as a first target contour point.
[0065] As an example, assume that the rows and columns of the pixels in the image are numbered, that is, scanning starts from the pixels in the first column and the first row from left to right. After scanning the pixels in the first row, scanning starts from the pixels in the first column and the second row from left to right, and so on.
[0066] In an optional embodiment, it is sufficient to scan pixel by pixel according to a certain rule, but repeated scanning should be avoided.
[0067] S103: The first target contour point is used as the center of the mask area, and the pixel point whose first pixel value is the second value is used as the second target contour point in the mask area according to a preset rule, and the second target contour point is the first middle point of the target contour.
[0068] Specifically, the mask is an (m, n) mask, and the step of taking a pixel point whose first pixel value is the second value as a second target contour point in the mask area according to a preset rule includes:
[0069] In the (m, n) mask area, in ascending order from 0 to (2m+1)*(2n+1)-2, the first pixel point whose pixel value is the second value is taken as the second target contour point.
[0070] Among them, the mask is a binary image composed of 0 and 1. When the mask is applied to a certain function, the 1-value area is processed, and the masked 0-value area is not included in the calculation. The image mask is defined by specifying the data value, data range, finite or infinite value, area of interest and annotation file. You can also apply any combination of the above options as input to create a mask. In addition, the mask can also be regarded as a template for an image filter. Practical masks are often used to process remote sensing images. When extracting roads, rivers, or houses, the image is filtered by a (2m+1)*(2n+1) matrix, and then the required features or signs are highlighted. This matrix is a mask.
[0071] As an example, the schematic diagram of the (m,n) mask is as follows Figure 2 As shown, Figure 2 Where m and n are respectively equal to 3, the center of the mask area is the first target contour point, the mask area is scanned in the order of 0 to 47 in the mask area, and the pixel point whose first pixel value is the second value is taken as the second target contour point.
[0072] S104: The second target contour point is used as the center of the mask area, and the pixel point whose first pixel value is the second value in the mask area is used as the third target contour point according to a preset rule. The third target contour point is the middle point of the target contour or the end point of the target contour.
[0073] Specifically, the second target contour point is used as the center of the mask area, and the pixel point whose first pixel value is the second value in the mask area is used as the third target contour point according to a preset rule;
[0074] If the third target contour point is not the same as the first target contour point, the third target contour point is the middle point of the target contour; if the third target contour point is the same as the first target contour point, the third target contour point is the end point of the target contour.
[0075] S105: If the third target contour point is the end point of the target contour, identify the target image enclosed by the first target contour point, each second target contour point, and the third target contour point.
[0076] Specifically, the target image is a digital image contour separated from the image, and identifying the target image surrounded by the first target contour point, each second target contour point, and the third target contour point includes:
[0077] The digital image outline separated from the image is matched with the outline image in the template in sequence until the number corresponding to the digital image is found, thereby obtaining a recognition result. The target outline can be the digital image outline separated from the bank card.
[0078] The acquired image is binarized to obtain a binary image with pixel values of the first value or the second value; the binary image is scanned pixel by pixel according to a preset rule, and the pixel point with the first pixel value of the second value is used as the first target contour point, and the first target contour point is the starting point of the target contour; the first target contour point is used as the center of the mask area, and the pixel point with the first pixel value of the second value is used as the second target contour point in the mask area according to the preset rule, and the second target contour point is the first middle point of the target contour; the second target contour point is used as the center of the mask area, and the pixel point with the first pixel value of the second value is used as the third target contour point in the mask area according to the preset rule, and the third target contour point is the middle point of the target contour or the end point of the target contour; if the third target contour point is the end point of the target contour, the target image surrounded by the first target contour point, each second target contour point and the third target contour point is identified. The mask used in this application is a natural extension or generalized form of the chain code. It detects target contour points through newly defined connectivity. During the target recognition process, the mask contour tracking algorithm is used to track the contour and perform target recognition, thereby improving the recognition effect of images with non-connected pixels.
[0079] See also Figure 3 , this figure is a flowchart corresponding to another image recognition method based on mask contour tracking.
[0080] like Figure 3 As shown, the method includes:
[0081] S301: Acquire the resolution of the image, and adjust the size of the mask area according to the resolution of the image.
[0082] Specifically, comparing the resolution of the image with a preset threshold to obtain a comparison result;
[0083] If the comparison result indicates that the resolution of the image is greater than a preset threshold, the mask area is increased; if the comparison result indicates that the resolution of the image is less than the preset threshold, the mask area is decreased.
[0084] As an example, if the preset threshold is 10000, the corresponding mask is (3,3). If the image resolution is 10100, that is, the image resolution is greater than the preset threshold, the mask area needs to be expanded, for example, the corresponding mask is adjusted to (4,4); if the image resolution is 9000, that is, the image resolution is less than the preset threshold, the mask area needs to be reduced, for example, the corresponding mask is adjusted to (2,2).
[0085] By adjusting the mask, the efficiency of image recognition can be effectively improved.
[0086] S302: Performing morphological closing operation on the binary image.
[0087] Morphological operations are generally performed on binary images, including dilation, erosion, opening, and closing operations. Closing operations involve dilating and then eroding the image in order to highlight the image area and weaken the impact of noise.
[0088] S303: Binarize the acquired image to obtain a binary image whose pixel values are the first value or the second value.
[0089] S304: Scan the binary image pixel by pixel according to a preset rule, and use the pixel point whose first pixel value is the second value as the first target contour point, and the first target contour point as the starting point of the target contour.
[0090] S305: The first target contour point is taken as the center of the mask area, and the pixel point whose first pixel value is the second value is taken as the second target contour point in the mask area according to a preset rule, and the second target contour point is the first middle point of the target contour.
[0091] S306: The second target contour point is used as the center of the mask area, and the pixel point whose first pixel value is the second value in the mask area is used as the third target contour point according to the preset rule. The third target contour point is the middle point of the target contour or the end point of the target contour.
[0092] S307: If the third target contour point is the end point of the target contour, identify the target image enclosed by the first target contour point, each second target contour point, and the third target contour point.
[0093] See also Figure 4 , this figure is a structural schematic diagram corresponding to an image recognition device based on mask contour tracking.
[0094] like Figure 4 As shown, the device includes: a binarization processing module 401, a scanning module 402, a first acquisition module 403, a second acquisition module 404 and a recognition module 405;
[0095] A binarization processing module 401 is used to perform binarization processing on the acquired image to obtain a binary image with pixel values of a first value or a second value;
[0096] A scanning module 402 is configured to scan the binary image pixel by pixel according to a preset rule, and to use a pixel point whose first pixel value is the second value as a first target contour point, and the first target contour point as a starting point of the target contour;
[0097] A first acquisition module 403 is configured to use the first target contour point as the center of the mask area, and use the pixel point whose first pixel value is the second value in the mask area as the second target contour point according to a preset rule, where the second target contour point is the first middle point of the target contour;
[0098] A second acquisition module 404 is configured to use the second target contour point as the center of the mask area, and in the mask area, according to a preset rule, use a pixel point whose first pixel value is the second value as a third target contour point, where the third target contour point is the middle point or the end point of the target contour;
[0099] The recognition module 405 is configured to recognize a target image enclosed by the first target contour point, each second target contour point, and the third target contour point if the third target contour point is the end point of the target contour.
[0100] Optionally, the mask is an (m, n) mask, and the first acquisition module 403 is specifically configured to:
[0101] In the (m, n) mask area, in ascending order from 0 to (2m+1)*(2n+1)-2, the pixel point whose first pixel value is the second value is taken as the second target contour point.
[0102] Optionally, the device further comprises: an adjustment module;
[0103] An adjustment module, used for comparing the resolution of the image with a preset threshold to obtain a comparison result;
[0104] If the comparison result indicates that the resolution of the image is greater than a preset threshold, the mask area is increased; if the comparison result indicates that the resolution of the image is less than the preset threshold, the mask area is decreased.
[0105] Optionally, the scanning module 402 is specifically configured to:
[0106] The binary image is scanned pixel by pixel from top to bottom and from left to right, and the pixel point whose first pixel value is the second value is taken as the first target contour point.
[0107] Optionally, the target image is a digital image outline separated from the image, and the recognition module 505 is specifically configured to:
[0108] The digital image contour separated from the image is matched with the contour image in the template in sequence until the digit corresponding to the digital image is found and the recognition result is obtained.
[0109] Optionally, the second acquisition module 404 is specifically configured to:
[0110] The second target contour point is used as the center of the mask area, and the pixel point whose first pixel value is the second value is used as the third target contour point in the mask area according to a preset rule;
[0111] If the third target contour point is not the same as the first target contour point, the third target contour point is the middle point of the target contour; if the third target contour point is the same as the first target contour point, the third target contour point is the end point of the target contour.
[0112] Optionally, the device further comprises: a morphological closing operation processing module;
[0113] The morphological closing operation processing module is used to perform morphological closing operation processing on the binary image.
[0114] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device described above is merely schematic, wherein the units described as separate components may or may not be physically separated, and the components indicated as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.
[0115] The above is merely one specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. An image recognition method based on mask contour tracking, characterized in that: The method comprises: Binarizing the acquired image to obtain a binary image with pixel values of the first value or the second value; Scan the binary image pixel by pixel according to a preset rule, and use a pixel point whose first pixel value is the second value as a first target contour point, where the first target contour point is the starting point of the target contour; The first target contour point is used as the center of the mask area, and in the mask area, according to a preset rule, a pixel point whose first pixel value is the second value is used as a second target contour point, and the second target contour point is the first middle point of the target contour; The second target contour point is used as the center of the mask area, and in the mask area, according to a preset rule, a pixel point whose first pixel value is the second value is used as a third target contour point, and the third target contour point is the middle point of the target contour or the end point of the target contour; If the third target contour point is the end point of the target contour, the target image enclosed by the first target contour point, each of the second target contour points, and the third target contour point is recognized.
2. The method according to claim 1, wherein The mask is an (m, n) mask, and the step of taking a pixel point whose first pixel value is the second value as a second target contour point in the mask area according to a preset rule includes: In the (m, n) mask area, in ascending order from 0 to (2m+1)*(2n+1)-2, the first pixel point whose pixel value is the second value is taken as the second target contour point.
3. The method according to claim 1, wherein The method further comprises: Comparing the resolution of the image with a preset threshold to obtain a comparison result; If the comparison result indicates that the resolution of the image is greater than a preset threshold, the mask area is increased; if the comparison result indicates that the resolution of the image is less than the preset threshold, the mask area is decreased.
4. The method according to claim 1, wherein The step of scanning the binary image according to a preset rule and taking a pixel point whose first pixel value is the second value as a first target contour point includes: Scan the binary image pixel by pixel from top to bottom and from left to right, and take the pixel point whose first pixel value is the second value as the first target contour point.
5. The method according to claim 1, wherein The target image is a digital image contour separated from the image, and identifying the target image surrounded by the first target contour point, each of the second target contour points, and the third target contour point includes: The digital image outline separated from the image is matched with the outline image in the template in sequence until the number corresponding to the digital image is found to obtain a recognition result.
6. The method according to claim 1, wherein The method of taking the second target contour point as the center of the mask area, taking the first pixel point having the second value as the third target contour point in the mask area according to a preset rule, and the third target contour point being the middle point of the target contour or the end point of the target contour, includes: The second target contour point is used as the center of the mask area, and the first pixel point whose pixel value is the second value is used as the third target contour point in the mask area according to a preset rule; If the third target contour point is not the same as the first target contour point, the third target contour point is the middle point of the target contour; if the third target contour point is the same as the first target contour point, the third target contour point is the end point of the target contour.
7. The method according to claim 1, wherein The method further comprises: Performing morphological closing operation on the binary image.
8. An image recognition device based on mask contour tracking, characterized in that: The device comprises: a binarization processing module, a scanning module, a first acquisition module, a second acquisition module and a recognition module; The binarization processing module is used to perform binarization processing on the acquired image to obtain a binary image with pixel values of the first value or the second value; The scanning module is used to scan the binary image pixel by pixel according to a preset rule, and take the pixel point whose first pixel value is the second value as the first target contour point, and the first target contour point is the starting point of the target contour; The first acquisition module is configured to use the first target contour point as the center of a mask area, and in the mask area, according to a preset rule, use a pixel point whose first pixel value is the second value as a second target contour point, wherein the second target contour point is a first middle point of the target contour; The second acquisition module is configured to use the second target contour point as the center of the mask area, and in the mask area, according to a preset rule, use a pixel point having a first pixel value equal to the second value as a third target contour point, wherein the third target contour point is the middle point of the target contour or the end point of the target contour; The recognition module is configured to recognize a target image enclosed by the first target contour point, each of the second target contour points, and the third target contour point if the third target contour point is an end point of the target contour.
9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the image recognition method based on mask contour tracking according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device executes the image recognition method based on mask contour tracking according to any one of claims 1 to 7.
Citation Information
Patent Citations
Image recognition method, image recognition apparatus, and recording medium
US20010016071A1
Image recognition method and image recognition apparatus
US20050201622A1