Morphology-based target recognition method and device using template matching and medium

By converting images from RGB to YCBCR and performing binarization, filtering and matching pixels, and combining this with template matching methods, the problem of excessive resource consumption for target recognition on FPGA development boards is solved. This enables comprehensive recognition of the color, quantity, and type of targets, making it suitable for simple application scenarios.

CN115131582BActive Publication Date: 2026-01-23XIAMEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210850252.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-19
Publication Date
2026-01-23
Estimated Expiration
2042-07-19

AI Technical Summary

Technical Problem

Existing neural network image recognition technology consumes too many hardware resources in simple use cases and lacks practicality. Traditional recognition methods are difficult to achieve comprehensive recognition of the color, quantity and type of the target on FPGA development boards with limited resources.

Method used

A morphological recognition template matching method is adopted. The image is converted from RGB format to YCBCR format and binarized. Pixels of different colors are filtered out, the distance between pixels is judged and a detection box is generated. Finally, it is matched with a pre-stored binarized template image to identify the target type.

Benefits of technology

The system achieves comprehensive recognition of the target's color, quantity, and type on the FPGA development board. It consumes fewer resources, is suitable for simple application scenarios, and has reliable recognition results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115131582B_ABST
    Figure CN115131582B_ABST
Patent Text Reader

Abstract

The application provides a target recognition method based on a morphological recognition template matching, comprising the following steps: S1, acquiring an original image; S2, converting the original image from an RGB format to a YCBCR format, and performing a binaryzation processing on the original image in the YCBCR format to obtain a binaryzation image, and sequentially screening out pixel points greater than a first threshold value corresponding to YCBCR of various colors from the binaryzation image; S3, judging whether the distance between two pixel points is greater than a second threshold value, if yes, the two pixel points correspond to different targets, if not, the two pixel points are the same target, and a new second threshold value is generated; and S4, matching the binaryzation image with binaryzation template images of various targets, so as to determine the types of various targets existing in the binaryzation image. The application integrates the color, quantity and type of the target into one, and has small resource usage, and is suitable for simple use scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of target recognition, specifically to a target recognition method, device, and medium based on morphological recognition template matching. Background Technology

[0002] With the development of science and technology, target recognition algorithms have gradually matured, and frame signal processing and recognition of camera video streams has always been a hot topic. Object recognition is one of the basic functions of intelligent machines, and this function has a wide range of applications in both military and civilian fields, such as intelligent video surveillance, autonomous driving, various forms of identity recognition, and computer forensics.

[0003] Image recognition in computers has evolved to encompass various techniques, broadly categorized into traditional methods and those incorporating neural network algorithms. Neural network image recognition is a relatively new technology. Within this field, deep learning models based on convolutional neural networks (CNNs) are considered rising stars in artificial intelligence, achieving remarkable progress in numerous AI areas, particularly image recognition. While neural network-based image recognition algorithms offer high accuracy, they consume excessive hardware resources, limiting their applicability to applications requiring high accuracy. For simpler scenarios, they lack practicality.

[0004] Therefore, this application aims to achieve target recognition using traditional recognition methods and with less hardware resources in simple application scenarios. Summary of the Invention

[0005] To address the aforementioned technical problems, this application proposes a target recognition method, apparatus, and medium based on morphological recognition template matching.

[0006] According to the first aspect of this application, a target recognition method based on morphological recognition template matching is proposed, comprising the following steps:

[0007] S1. Obtain the original image;

[0008] S2. Convert the original image from RGB format to YCBCR format, and perform binarization processing on the converted original image to obtain a binarized image. Based on the first threshold of YCBCR corresponding to each color, sequentially filter out pixels greater than the corresponding first threshold from the binarized image.

[0009] S3. Determine whether the distance between two pixels is greater than a second threshold. If yes, the two pixels correspond to different targets; otherwise, the two pixels belong to the same target, and a new second threshold is generated.

[0010] S4. Match the binarized image with the binarized template images of various targets to determine the type of each target present in the binarized image.

[0011] Preferably, steps S2-S4 are implemented on an FPGA development board.

[0012] Preferably, in step S2, for each selected pixel, an enable signal of a corresponding color is generated; in step S3, multiple candidate boxes arranged in sequence are initialized, and when the first pixel appears, the first candidate box is assigned a value according to the corresponding enable signal, thereby selecting a detection box with the corresponding color at the pixel position in the binarized image.

[0013] Preferably, in step S3, when a new pixel appears, it is determined whether the new pixel is within the detection box corresponding to any old pixel. If so, the new pixel and the old pixel belong to the same target, and the new pixel is used as the boundary of the detection box corresponding to the old pixel. If not, the next candidate box is assigned a value according to the enable signal corresponding to the new pixel, thereby selecting a detection box with the corresponding color at the position of the new pixel in the binarized image. The second threshold is the distance between each pixel with a detection box and the upper, lower, left, and right boundaries of its detection box.

[0014] Preferably, step S4 specifically includes: based on the targets determined in step S3, segmenting the binarized image into target images corresponding to each target, wherein the target images are the same size as the binarized template images of each target, and matching the target images with the binarized template images of each target to determine the type corresponding to each target.

[0015] Preferably, the generation process of the detection box specifically includes: using the left border of the row and the left border of the field as the top left border point, scanning to generate the detection box with a value of 500*500 pixels, so that the corresponding pixel points fall in the center of the detection box.

[0016] Preferably, the formula for converting the original image from RGB format to YCBCR format in step S2 is as follows:

[0017] Y = 0.183R + 0.614G + 0.062B + 16

[0018] CB=-0.101R-0.338G+0.439B+128

[0019] CR=0.439R-0.399G-0.040B+128.

[0020] According to a second aspect of this application, a target recognition device based on morphological template matching is proposed, comprising:

[0021] The image acquisition module configures the application to acquire raw images;

[0022] The color recognition module is configured to convert the original image from RGB format to YCBCR format, and perform binarization processing on the converted original image to obtain a binarized image. Based on the first threshold of YCBCR corresponding to each color, pixels greater than the corresponding first threshold are sequentially selected from the binarized image.

[0023] The quantity recognition module is configured to determine whether the distance between two pixels is greater than a second threshold. If so, the two pixels correspond to different targets; otherwise, the two pixels are the same target, and a new second threshold is generated.

[0024] The template matching module is configured to match the binarized image with binarized template images of various targets, thereby determining the type of each target present in the binarized image.

[0025] Preferably, multiple color recognition modules are provided, and each color recognition module is configured to filter pixels of one color.

[0026] According to a third aspect of this application, a computer-readable storage medium is proposed that stores a computer program, which, when executed by a processor, implements the target recognition method based on morphological recognition template matching as described in the first aspect of this application.

[0027] This application proposes a target recognition method, apparatus, and medium based on morphological recognition template matching. First, the image is converted from RGB to YCBCR format and binarized. Then, the image is segmented according to the YCBCR threshold corresponding to each color, thereby filtering out pixels corresponding to each color in the image to achieve color recognition. After filtering out pixels, the distance between two pixels is determined by whether the new pixel is a new target, thus achieving quantity recognition. Finally, the target images of each target are matched one-to-one with pre-placed binarized template images of various targets to achieve type recognition of each target in the image. This application not only integrates the recognition of target color, quantity, and type, but also uses fewer resources compared to traditional neural network target recognition algorithms, can run on FPGA development boards, and is suitable for various simple application scenarios. Attached Figure Description

[0028] The accompanying drawings are included to provide a further understanding of the embodiments and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments and, together with the description, serve to explain the principles of this application. Other embodiments and many anticipated advantages of these embodiments will be readily recognized as they become better understood through reference to the following detailed description. Elements in the drawings are not necessarily to scale. The same reference numerals refer to corresponding similar parts.

[0029] Figure 1 This is a flowchart of a target recognition method based on morphological recognition template matching according to an embodiment of this application;

[0030] Figure 2 This is a schematic diagram of image binarization according to a specific embodiment of this application;

[0031] Figure 3 (a)- Figure 3 (c) is a schematic diagram of target quantity identification by threshold judgment according to a specific embodiment of this application;

[0032] Figure 4 This is a schematic diagram of a binarized template image stored in a ROM according to a specific embodiment of this application;

[0033] Figure 5 This is a template matching diagram according to a specific embodiment of this application;

[0034] Figure 6 This is a schematic diagram of physical image detection according to a specific embodiment of this application;

[0035] Figure 7 This is a target recognition result diagram according to a specific embodiment of this application;

[0036] Figure 8 This is a schematic diagram of physical image detection according to another specific embodiment of this application;

[0037] Figure 9 This is a target recognition result diagram according to another specific embodiment of this application;

[0038] Figure 10 This is a diagram of a three-layer convolutional neural network framework according to a specific embodiment of this application;

[0039] Figure 11 This is a resource usage diagram of a three-layer convolutional neural network according to a specific embodiment of this application;

[0040] Figure 12 This is a schematic diagram of the structure of a target recognition device based on morphological template matching according to an embodiment of this application.

[0041] Explanation of reference numerals in the attached diagram: 1. Image acquisition module; 2. Color recognition module; 3. Quantity recognition module; 4. Module matching module. Detailed Implementation

[0042] The features and exemplary embodiments of various aspects of this application will now be described in detail. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only configured to explain this application and are not configured to limit this application. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples of this application.

[0043] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0044] First, it should be noted that the target recognition method in this application is implemented based on an FPGA chip as the hardware carrier. Current FPGA-related target recognition systems rarely integrate color, quantity, and type information; most algorithms only perform object position tracking and type recognition. Therefore, this application aims to utilize an FPGA as the hardware carrier and employ traditional target recognition methods to integrate target color, quantity, and type recognition with limited resource usage. This approach is suitable for simple application scenarios, thereby broadening the application scenarios of FPGAs.

[0045] According to the first aspect of this application, a target recognition method based on morphological recognition template matching is proposed. Figure 1 A flowchart of a target recognition method based on morphological template matching according to an embodiment of this application is shown, as follows: Figure 1 As shown, the method includes the following steps:

[0046] S1. Obtain the original image.

[0047] In a specific embodiment, the raw images are captured using an ALINX 5640 camera and stored using DDR3.

[0048] S2. Convert the original image from RGB format to YCBCR format, and perform binarization processing on the converted original image to obtain a binarized image. Based on the first threshold of YCBCR corresponding to each color, sequentially filter out pixels in the binarized image that are greater than the corresponding first threshold.

[0049] In a specific embodiment, after acquiring the original image, the data is imported onto the FPGA development board for processing. The formula for converting the original image from RGB format to YCBCR format is as follows:

[0050] Y = 0.183R + 0.614G + 0.062B + 16

[0051] CB=-0.101R-0.338G+0.439B+128

[0052] CR = 0.439R - 0.399G - 0.040B + 128

[0053] Binarizing an image can better distinguish pixels from background points, simplifying the image and highlighting the outline of the target. Taking fruit identification as an example, the main purpose of identifying fruit colors is to find common fruit colors such as red, yellow, green, purple, and brown. In this embodiment, MATLAB is used for image processing to determine the first threshold of YCBCR for each color. To prevent interference between these first thresholds, the first threshold can be continuously refined to ensure it stays within a certain range. After determining the first threshold of YCBCR for each color, pixels in the binarized image that are greater than the corresponding first threshold are selected by comparing their values ​​from top to bottom and left to right, thereby identifying the color of these pixels. Figure 2 A schematic diagram of image binarization according to a specific embodiment of this application is shown.

[0054] In a specific embodiment, after each comparison between a pixel and the corresponding first threshold, an enable signal is generated. For example, if the YCBCR value of a pixel is greater than or equal to the corresponding first threshold, the enable signal is 1; if the YCBCR value of a pixel is less than the corresponding first threshold, the enable signal is 0.

[0055] S3. Determine whether the distance between two pixels is greater than the second threshold. If yes, the two pixels correspond to different targets. If no, the two pixels are the same target, and a new second threshold is generated.

[0056] In a specific embodiment, the pixels selected in step S2 may each correspond to a single target, or two or more pixels may correspond to the same target. Therefore, by determining whether the distance between a new pixel and an old pixel is greater than a second threshold, if it is greater than the second threshold, the new pixel is determined to correspond to a new target; if it is less than the second threshold, the new pixel and the old pixel are determined to correspond to the same target. The following will explain this part using specific embodiments.

[0057] First, multiple candidate boxes are initialized sequentially. The number of candidate boxes can be set by the user, and their initial horizontal and vertical coordinates are (0, 0). In step S2, when the first pixel is selected, the first candidate box is assigned a value according to the corresponding enable signal, thus selecting a detection box with the corresponding color at the pixel location in the binarized image. The detection box is generated through line and field localization scanning. Specifically, using the left border of the line and the left border of the field as the top-left border points, a 500*500 pixel detection box is generated, ensuring that the corresponding pixel falls in the center of the detection box.

[0058] When new pixels are selected again in step S2, it is first determined whether the new pixel is within the detection box of the old pixel (i.e., whether the distance between the new and old pixels is less than half the length of the detection box, 250 pixels). If so, it can be determined that the new and old pixels belong to the same target. In this case, the new pixel is used as the boundary of the detection box corresponding to the old pixel. This reduces the detection box of the old pixel, allowing for more accurate selection of the target in the binarized image. If not, it is determined that the new pixel corresponds to a new target. At this time, the next (i.e., the second) candidate box is assigned a value according to the corresponding enable signal, thereby selecting the detection box with the corresponding color at the position of the new pixel in the binarized image. This process continues until all pixels are evaluated. Therefore, it is easy to understand that the second threshold is continuously increased based on the evaluation results. The second threshold is equivalent to the distance between each pixel with a detection box and the top, bottom, left, and right boundaries of its detection box.

[0059] Figure 3 This illustration shows a target quantity identification method based on a specific embodiment of the present application, using threshold judgment. Figure 3 As shown in (a), the distance between the first pixel (left) and the second pixel (right) is greater than the second threshold, therefore the two pixels correspond to two targets and both display detection boxes; Figure 3 As shown in (b), the distance between the first pixel (left) and the second pixel (right) is greater than the second threshold. Although the detection boxes of the two pixels overlap, they are still determined to correspond to different targets. Figure 3 As shown in (c), the distance between the first pixel (right) and the second pixel (left) is greater than the second threshold. The second pixel falls within the detection box of the first pixel. Therefore, the two pixels correspond to the same target. The second pixel is used as the left boundary of the detection box of the first pixel, and the detection box of the first pixel is shrunk.

[0060] S4. Match the binarized image with the binarized template images of various targets to determine the type of each target present in the binarized image.

[0061] In a specific embodiment, for fruit type recognition, to save on-chip resources and improve recognition speed, a morphological recognition method was adopted after comprehensively considering the features of the target to be recognized. In short, it first identifies fruit categories that can be distinguished by color. For example, fruits with distinctive colors such as apples, kiwis, and dragon fruit can be identified by color. For fruits of the same color, such as bananas and mangoes, a template matching method is used for identification. Template matching involves storing binarized template images of various targets, such as bananas and mangoes, in the FPGA using ROM. When the camera captures a banana or mango, based on the targets identified in step S3, the binarized image is segmented into target images corresponding to each target, and the target images are the same size as the binarized template images of each target. The target images are then matched with the binarized template images of each target, and the matching results are statistically analyzed. The category with the highest score is the corresponding category. This method can be applied to the recognition of other fruits with the same color but different categories.

[0062] Figure 4 A schematic diagram of a binarized template image stored in a ROM according to a specific embodiment of this application is shown, such as... Figure 4 As shown, the stored images are binarized template images of mangoes and bananas. Figure 5 A template matching diagram according to a specific embodiment of this application is shown, such as... Figure 5 As shown, the leftmost image is the template information, and the two images on the right are the collected image information. By performing a bitwise AND operation between the collected image information and the template information and counting the number of 1s, it is clear that the middle image has the highest matching degree.

[0063] To verify the reliability of the target recognition algorithm in this application, the following target recognition and detection experiments were also conducted.

[0064] Figure 6 This illustration shows a schematic diagram of physical image detection according to a specific embodiment of the present application. Figure 7 The diagram showing the target recognition result according to a specific embodiment of this application is shown, such as Figure 6 , Figure 7 As shown, Figure 6 There are 3 green grapes in it. Figure 7 The first column of data is the color recognition result, the second column is the species recognition result, and the third column is the quantity recognition result. According to the detection results of the latest frame image, the detected color is GREEN, the species is grape, and the quantity is 3.

[0065] Figure 8 A schematic diagram of physical image detection according to another specific embodiment of this application is shown. Figure 9The diagram showing the target recognition result according to another specific embodiment of this application is shown, such as Figure 8 , Figure 9 As shown, Figure 8 There is one yellow banana in the image. According to the detection results of the latest frame, the detected color is YELLOW, the type is banana, and the quantity is 1.

[0066] The above test results demonstrate that the target recognition method of this application is reliable. Furthermore, it should be noted that... Figure 7 and Figure 9 In the third column of data, the number of some frame images is displayed as ">", "<" or "=". This is because when the camera is moving to capture images, some frames cannot capture the target well, so the specific number cannot be identified.

[0067] This embodiment also provides a comparison of the resource usage of the target recognition method of this application with that of existing neural network-based target recognition algorithms. In this embodiment, the on-chip resources of the Ziguang Tongchuang PGL22G development board are only 22K. Figure 10 A diagram of a three-layer convolutional neural network framework according to a specific embodiment of this application is shown. Figure 11 This diagram illustrates the resource usage of a three-layer convolutional neural network according to a specific embodiment of this application, such as... Figure 10 , Figure 11 As shown, the proportion of FPGA resources consumed in implementing a three-layer convolutional neural network is huge. Moreover, this is a ZYNQ development board with large computing resources, not just implemented with FPGA, and the resource usage is also relatively high.

[0068] In summary, this application proposes a target recognition method based on morphological recognition template matching. First, the image is converted from RGB to YCBCR format and binarized. Then, the image is segmented according to the YCBCR threshold corresponding to each color, thereby filtering out pixels corresponding to each color in the image to achieve color recognition. After filtering out pixels, the distance between two pixels is determined by whether the new pixel is a new target, thus achieving quantity recognition. Finally, the target images of each target are matched one-to-one with pre-placed binarized template images of various targets to achieve type recognition of each target in the image. This application not only integrates the recognition of target color, quantity, and type, but also uses fewer resources compared to traditional neural network target recognition algorithms, can run on FPGA development boards, and is suitable for various simple application scenarios.

[0069] According to a second aspect of this application, a target recognition device based on morphological recognition template matching is proposed, which is built based on the target recognition method described above. Figure 12 A schematic diagram of the structure of a target recognition device based on morphological template matching according to an embodiment of this application is shown, as follows: Figure 12 As shown, the device includes:

[0070] Image acquisition module 1 is configured to acquire raw images.

[0071] Color recognition module 2 is configured to convert the original image from RGB format to YCBCR format, and perform binarization processing on the converted original image to obtain a binarized image. Based on the first threshold of YCBCR corresponding to each color, pixels greater than the corresponding first threshold are sequentially selected from the binarized image.

[0072] The quantity recognition module 3 is configured to determine whether the distance between two pixels is greater than a second threshold. If it is, the two pixels correspond to different targets; otherwise, the two pixels are the same target, and a new second threshold is generated.

[0073] Template matching module 4 is configured to match the binarized image with the binarized template images of various targets, thereby determining the type of each target present in the binarized image.

[0074] In a specific embodiment, multiple color recognition modules 2 are provided. Each color recognition module 2 stores the first threshold data of YCBCR corresponding to a certain color, so that each color recognition module 2 can filter pixels of a certain color.

[0075] According to a third aspect of this application, a computer-readable storage medium is proposed that stores a computer program, which, when executed by a processor, implements the target recognition method based on morphological recognition template matching as described in the first aspect of this application.

[0076] In the embodiments of this application, it should be understood that the disclosed technical content can be implemented in other ways. The device / system / method embodiments described above are merely illustrative. For example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, 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 coupling or direct coupling or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0077] 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 units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0078] 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.

[0079] If the integrated 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, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0080] It is obvious that those skilled in the art can make various modifications and alterations to the embodiments of this application without departing from the spirit and scope of this application. In this way, this application also aims to cover such modifications and alterations if they fall within the scope of the claims and their equivalents. The word "comprising" does not exclude the presence of other elements or steps not listed in the claims. The simple fact that certain measures are described in mutually different dependent claims does not indicate that a combination of these measures cannot be used for profit. Any reference numerals in the claims should not be considered limiting in scope.

Claims

1. A target recognition method based on morphological template matching, characterized in that, Includes the following steps: S1. Obtain the original image; S2. Convert the original image from RGB format to YCBCR format, and perform binarization processing on the converted original image to obtain a binarized image. Based on the first threshold of YCBCR corresponding to each color, sequentially filter out pixels greater than the corresponding first threshold from the binarized image. S3. Determine whether the distance between two pixels is greater than a second threshold. If yes, the two pixels correspond to different targets. If no, the two pixels are the same target, and a new second threshold is generated. as well as S4. Match the binarized image with the binarized template images of various targets to determine the type of each target present in the binarized image; In step S2, for each pixel selected, an enable signal of a corresponding color is generated; in step S3, multiple candidate boxes arranged in sequence are initialized, and when the first pixel appears, the first candidate box is assigned a value according to the corresponding enable signal, thereby selecting a detection box with the corresponding color at the pixel position in the binarized image. In step S3, when a new pixel appears, it is determined whether the new pixel is within the detection box corresponding to any old pixel. If so, the new pixel and the old pixel belong to the same target, and the new pixel is used as the boundary of the detection box corresponding to the old pixel. If not, the next candidate box is assigned a value according to the enable signal corresponding to the new pixel, thereby selecting a detection box with the corresponding color at the position of the new pixel in the binarized image. The second threshold is the distance between each pixel with a detection box and the upper, lower, left, and right boundaries of its detection box.

2. The method according to claim 1, characterized in that, Steps S2-S4 are implemented on the FPGA development board.

3. The method according to claim 2, characterized in that, Step S4 specifically includes: based on the targets determined in step S3, segmenting the binarized image into target images corresponding to each target, wherein the target images are the same size as the binarized template images of each target, and matching the target images with the binarized template images of each target to determine the type corresponding to each target.

4. The method according to claim 1, characterized in that, The generation process of the detection box specifically includes: using the left border of the row and the left border of the field as the top left border point, scanning to generate a detection box with a value of 500*500 pixels, so that the corresponding pixel points fall in the center of the detection box.

5. The method according to claim 2, characterized in that, The formula for converting the original image from RGB format to YCBCR format in step S2 is as follows: Y = 0.183R + 0.614G + 0.062B + 16 CB=-0.101R-0.338G+0.439B+128 CR=0.439R-0.399G-0.040B+128.

6. A target recognition device based on morphological template matching, characterized in that, include: The image acquisition module configures the application to acquire raw images; The color recognition module is configured to convert the original image from RGB format to YCBCR format, and perform binarization processing on the converted original image to obtain a binarized image. Based on a first threshold of YCBCR corresponding to each color, pixels greater than the corresponding first threshold are sequentially selected from the binarized image. For each pixel selected, an enable signal of the corresponding color is generated. The quantity recognition module is configured to determine whether the distance between two pixels is greater than a second threshold. If so, the two pixels correspond to different targets; otherwise, the two pixels are the same target, and a new second threshold is generated. The module initializes multiple candidate boxes arranged in sequence. When the first pixel appears, the first candidate box is assigned a value according to the corresponding enable signal, thereby selecting a detection box with the corresponding color at the pixel location in the binarized image. When a new pixel appears, it is determined whether the new pixel is within the detection box corresponding to any old pixel. If so, the new pixel and the old pixel belong to the same target, and the new pixel is used as the boundary of the detection box corresponding to the old pixel. If not, the next candidate box is assigned a value according to the enable signal corresponding to the new pixel, thereby selecting a detection box with the corresponding color at the new pixel location in the binarized image. The second threshold is the distance between each pixel with a detection box and the top, bottom, left, and right boundaries of its detection box. The template matching module is configured to match the binarized image with binarized template images of various targets, thereby determining the type of each target present in the binarized image.

7. The apparatus according to claim 6, characterized in that, The color recognition module is configured in multiple ways, and each color recognition module is configured to filter pixels of one color.

8. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Gesture recognition system and method based on video image processing

    CN110309806A

  • Image frame recognition method, device and equipment and computer storage medium

    CN111080665A