Target positioning method and device
By building an image pyramid and searching the target image using multi-feature templates, the problem of low target positioning accuracy in the prior art is solved, and higher positioning accuracy and more efficient search is achieved.
Patent Information
- Application Number
- CN202211573053.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-08
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-12-08
AI Technical Summary
In the prior art, when target positioning, the positioning accuracy is low due to image clarity and interference from non-target areas.
By building an image pyramid and searching the target image using multiple feature templates, including outline feature templates, edge feature templates, grayscale feature templates, color feature templates, normalized cross-correlation feature templates and SIFT feature templates, target positioning layer by layer.
It improves the accuracy of target positioning, reduces the amount of calculation, improves search efficiency, and avoids positioning failure or missed detection caused by a single feature template.
Smart Images

Figure CN115830119B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of visual image technology, and in particular to a target positioning method and device. Background Art
[0002] In the field of industrial AI, before a robot can grasp a target or determine whether a target exists, it needs to determine the target's location information, which is called target positioning.
[0003] When performing target positioning, related technologies usually search for the target image based on the target's outline. If the outline of a certain area in the target image is highly similar to the target's outline, the area is determined to be the target's location, and the target's location information is then determined. The target image is the image obtained by photographing the target's location. Figure 1A is the target image, Figure 1B Schematic diagram of using contour feature template to locate the target in the target image.
[0004] Depend on Figure 1B It can be seen that due to the influence of image clarity or interference from other non-target areas with the same contour as the target, the positioning accuracy is low when positioning by contour. Summary of the Invention
[0005] In order to solve the problem of low positioning accuracy when locating the target area in the target image by contour, the present application provides a target positioning method and device.
[0006] The embodiment of the present application is implemented as follows:
[0007] This embodiment of the present application provides a target positioning method, the method comprising:
[0008] Sampling the target image layer by layer to generate an image pyramid consisting of multiple layers of images to be measured corresponding to the target image, wherein the higher the layer in the image pyramid, the smaller the area of the image to be measured and the lower the resolution. The target image is located at the lowest layer of the target pyramid and is an image obtained by photographing the area where the target to be located is located.
[0009] determining a plurality of characteristic templates of the target;
[0010] Searching the image to be tested at the highest level of the image pyramid or starting from the highest level of the image pyramid layer by layer according to the multiple feature templates until a first target in the image to be tested is found, and determining first position information of the first target in the image to be tested, wherein a similarity between a feature of the first target and the feature template is greater than a first threshold;
[0011] The first area is searched layer by layer according to the feature template corresponding to the first target until the target contained in the target image is found, and the target position information of the target in the target image is determined, wherein the first area is determined based on the first position information, and the first area is located in a lower layer of the level where the first target is located.
[0012] In some embodiments, the plurality of feature templates include any two or a combination of any two or more of contour feature templates, edge feature templates, grayscale feature templates, color feature templates, normalized cross-correlation feature templates, HOG feature templates, and SIFT feature templates.
[0013] In some embodiments, when the first region is located in the target image, searching the first region according to a feature template corresponding to the first target until the target in the target image is found includes:
[0014] Acquire a second target contained in the first area and feature data of the second target, wherein the feature data of the second target corresponds to a feature template corresponding to the first target;
[0015] Presetting a similarity threshold according to the feature template corresponding to the first target;
[0016] comparing the similarity between the feature data of the second target and the corresponding feature template;
[0017] A second target whose similarity is greater than or equal to the similarity threshold is determined as the target.
[0018] In some embodiments, when the first region closest to the first target is located in a layer other than the target image, searching the first region layer by layer according to a feature template corresponding to the first target until the target of the target image is found includes:
[0019] Acquire a third target contained in the first target area and feature data of the third target, wherein the feature data of the third target corresponds to a feature template corresponding to the first target, the first target area belongs to the first area, and the first target area is located at a level below that of the first target;
[0020] Presetting a similarity threshold according to the feature template corresponding to the first target;
[0021] comparing the similarity between the feature data of the third target and the corresponding feature template;
[0022] Determine the third target whose similarity is greater than or equal to the similarity threshold as the fourth target;
[0023] Other first areas outside the first target area are searched layer by layer according to the fourth position information of the fourth target and the corresponding template feature until the target of the target image is found.
[0024] In some embodiments, the multiple feature templates include at least a first feature template and a second feature template, and searching the image to be tested at the highest level of the image pyramid or starting from the highest level of the image pyramid layer by layer according to the multiple feature templates until the first target in the image to be tested is found, including:
[0025] Searching for a first target to be located and a second target to be located corresponding to the first feature template and the second feature template, respectively, in the image to be measured at the highest level of the image pyramid, and determining first feature data and second feature data of the first target to be located and the second target to be located, respectively;
[0026] Presetting a first similarity threshold and a second similarity threshold according to the first feature template and the second feature template;
[0027] comparing a first similarity between the first feature data and a first feature template and a second similarity between the second feature data and a second feature template;
[0028] The target to be located whose similarity between the first similarity and the second similarity is greater than or equal to the similarity threshold is determined as the first target.
[0029] In some embodiments, the method further comprises:
[0030] If the first similarity is less than the first similarity threshold and the second similarity is less than the second similarity threshold, continue searching at a level next to the highest level of the image pyramid according to the multiple feature templates until the first target is found.
[0031] In some embodiments, determining a plurality of feature templates of the target includes:
[0032] Acquire a template image and a ROI region of the template image, wherein the template image includes the target to be located and the image resolution is greater than a second threshold, and the ROI region includes a region where the target to be located is located;
[0033] Extracting multiple image features of the target contained in the ROI area;
[0034] The target is modeled according to multiple image features of the target to obtain multiple feature templates of the target.
[0035] In some embodiments, determining the first area based on the first location information includes:
[0036] The first position information is the first position coordinate, expressed as (R, C); the range of the first area is (nR-m, nC-m) to (nR+m, nC+m), where n and m are both constants and multiples of 2.
[0037] In some embodiments, generating an image pyramid consisting of multiple layers of images to be tested corresponding to the target image includes:
[0038] Calculating an average of pixel values of each first block in the target image to obtain a first average pixel value of each first block, wherein the first block having a pixel value of the first average pixel value is used to constitute a first image to be tested, the target image is evenly divided into a plurality of first blocks, each first block includes a squared pixel block, where a is a constant;
[0039] Calculating an average of pixel values of each second block in the first image to be tested to obtain a second average pixel value of each second block, wherein the second block having a pixel value of the second average pixel value is used to constitute a second image to be tested, and the first image to be tested is evenly divided into a plurality of second blocks, each second block including a squared number of pixel blocks;
[0040] Continue to divide the second image to be tested into multiple blocks and calculate the average pixel of each block until the obtained image to be tested includes a preset number of pixel blocks. The target image, the first image to be tested, the second image to be tested, and the image to be tested including the preset number of blocks constitute the image pyramid.
[0041] Another embodiment of the present application further provides a target positioning device, comprising:
[0042] a generating module configured to sample the target image layer by layer to generate an image pyramid consisting of multiple layers of images to be measured corresponding to the target image, wherein the higher the layer in the image pyramid, the smaller the area of the image to be measured and the lower the image resolution; the target image is located at the lowest layer of the target pyramid and is an image obtained by photographing the area where the target to be located is located;
[0043] A determination module, configured to determine a plurality of feature templates of the target;
[0044] a first search module, configured to search the image to be tested at the highest level of the image pyramid or layer by layer starting from the highest level of the image pyramid according to the multiple feature templates until a first target in the image to be tested is found, and determine first position information of the first target in the image to be tested, wherein a similarity between a feature of the first target and the feature template is greater than a first threshold;
[0045] The second search module is used to search the first area layer by layer according to the feature template corresponding to the first target until the target contained in the target image is searched, and determine the target position information of the target in the target image, wherein the first area is determined based on the first position information, and the first area is located in a lower layer of the level where the first target is located.
[0046] The beneficial effects of the present application are as follows: by constructing a multi-feature template and searching the target image based on the multi-feature template to determine the target, since there are many target feature templates used in the search, a traversal search is performed based on the multi-target template target. Even if the accuracy of target positioning is low through some of the feature templates, the target can still be positioned through other feature templates, thereby improving the accuracy of positioning.
[0047] For example, if the outline of the target to be located in the target image is not clear, when positioning is performed through the outline feature template, some targets in the target image may not be searched, that is, the positioning accuracy is low. In this case, through the solution of the present application, other feature templates can also be used for target positioning, thereby improving the positioning accuracy.
[0048] Furthermore, the present application determines an image pyramid based on the target image, and then searches the image pyramid based on a multi-feature template, which can avoid searching the entire area of the target image, thereby achieving the purpose of low computational complexity and high search efficiency during the search. 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, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are 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 1A is the target image;
[0051] Figure 1B A schematic diagram of locating an object in a target image using a contour feature template;
[0052] Figure 2 A flowchart of a target positioning method provided in one embodiment of the present application;
[0053] Figure 3 A flowchart of a method for generating an image pyramid provided in yet another embodiment of the present application;
[0054] Figure 4 A schematic diagram of an image pyramid generated according to another embodiment of the present application;
[0055] Figure 5 A flow chart of a method for determining multiple feature templates of a target provided in yet another embodiment of the present application;
[0056] Figure 6 A schematic diagram of determining a contour feature template and a grayscale feature template of a target in an ROI region of a template image provided by another embodiment of the present application;
[0057] Figure 7 A flowchart of a method for searching a pyramid image for obtaining a first target based on multiple feature templates provided in another embodiment of the present application;
[0058] Figure 8 A flowchart of a method for searching a first area until an object of the target image is found when the first area is located in the target image, provided in another embodiment of the present application;
[0059] Figure 9 A flowchart of a method for searching a first area until an object of a target image is found when a first area closest to the first object is located in a layer other than the target image, provided in another embodiment of the present application;
[0060] Figure 10A A schematic diagram of a target image and a target provided in yet another embodiment of the present application;
[0061] Figure 10B A schematic diagram of locating a target using contour features provided in yet another embodiment of the present application;
[0062] Figure 10C A schematic diagram of using a multi-feature template to locate a target image according to another embodiment of the present application;
[0063] Figure 11 This is a structural block diagram of a target positioning device provided in another embodiment of the present application. DETAILED DESCRIPTION
[0064] In order to make the purpose, implementation mode and advantages of the present application clearer, the exemplary implementation mode of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, not all of the embodiments.
[0065] It should be noted that the brief descriptions of terms in this application are only for the purpose of facilitating the understanding of the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their ordinary and usual meanings.
[0066] In the specification and claims of this application and the accompanying drawings, the terms "first," "second," "third," etc. are used to distinguish similar or similar objects or entities, and are not necessarily intended to limit a particular order or sequence, unless otherwise noted. It should be understood that the terms used in this manner are interchangeable under appropriate circumstances.
[0067] The terms "comprise," "comprises," and "having," and any variations thereof, are intended to cover but not exclude inclusion; for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0068] The terms "disposed" and "connected" should be understood broadly. For example, they can refer to fixed connections, detachable connections, or integral connections; they can refer to direct connections, indirect connections through an intermediate medium, or internal connections between two components. Those skilled in the art will understand the specific meanings of these terms in this application based on the specific circumstances.
[0069] Figure 2 The flowchart of the target positioning method provided by an embodiment of the present application is shown as follows: Figure 2 As shown, the target positioning method is implemented by the following steps:
[0070] In step 210, the target image is sampled layer by layer to generate an image pyramid consisting of multiple layers of images to be measured corresponding to the target image. In the image pyramid, the higher the level, the smaller the area of the image to be measured and the lower the image resolution. The target image is located at the lowest level of the target pyramid. The target image is an image obtained by photographing the area where the target to be located is located.
[0071] The image pyramid of the present application is a collection of images arranged in a pyramidal manner with gradually decreasing resolutions and originating from the same original image (i.e., the target image). The image pyramid includes multiple layers of images to be tested (the lowest layer is the target image, and the other three layers of images to be tested are generated by sampling the target image). The higher the layer, the lower the image resolution.
[0072] Figure 3 A flowchart of a method for generating an image pyramid according to another embodiment of the present application is shown as follows: Figure 3 As shown in Figure 2, generating an image pyramid is achieved through the following steps:
[0073] Step 310, calculating an average value of pixel values of each first block in the target image to obtain a first average pixel value of each first block, wherein the first blocks having pixel values equal to the first average pixel value constitute a first image to be tested, the target image is evenly divided into a plurality of first blocks, each first block contains a squared number of pixel blocks, where a is a constant;
[0074] Step 320, calculating an average value of pixel values of each second block in the first image to be tested to obtain a second average pixel value of each second block, wherein the second block having a pixel value of the second average pixel value is used to constitute the second image to be tested, and the first image to be tested is evenly divided into a plurality of second blocks, each second block including a squared pixel block;
[0075] In step 330 , the second image to be tested is further divided into multiple blocks and the average pixel value of each block is calculated until the obtained image to be tested includes a preset number of blocks. The target image, the first image to be tested, the second image to be tested, and the image to be tested including the preset number of blocks constitute an image pyramid.
[0076] Figure 4 A schematic diagram of an image pyramid generated according to another embodiment of the present application is shown as follows: Figure 4 As shown, the target image contains 64 pixel blocks arranged in 8 rows × 8 columns, and the highest-level image to be tested contains 1 pixel block. Generating an image pyramid based on the target image includes the following steps:
[0077] Divide the target image into 16 first blocks, and calculate a first average pixel value of pixel blocks in each first block, where each first block includes 4 pixel blocks, for example, one of the first blocks includes a pixel block in the first row and first column, a pixel block in the first row and second column, a pixel block in the second row and first column, and a pixel block in the second row and second column of the target image;
[0078] 16 pixel blocks having the first average pixel value are arranged in a 4-row×4-column format (the pixel blocks are arranged corresponding to the positions of the first block), the first image to be tested is equally divided into 4 second blocks, and the second average pixel value of the pixel blocks in each second block is calculated, wherein each second block contains 4 pixel blocks, for example, one of the second blocks includes the pixel block in the first row and third column, the pixel block in the first row and fourth column, the pixel block in the second row and third column, and the pixel block in the second row and fourth column of the first image to be tested;
[0079] A second test image is formed by arranging four pixel blocks having the second average pixel value in a 2-row x 2-column format (corresponding to the positions of the second blocks when arranged). A third average pixel value is calculated for the four pixel blocks included in the second test image, and a fourth block having the third average pixel value is used as the third test image.
[0080] If the third image to be tested contains one pixel block, the target image, the first image to be tested, the second image to be tested, and the third image to be tested form an image pyramid.
[0081] Step 220: Determine multiple feature templates of the target.
[0082] Figure 5 A flowchart of a method for determining multiple feature templates of a target provided by another embodiment of the present application is shown as an example. Figure 5 As shown, multiple feature templates of the target are determined by the following steps:
[0083] Step 510: Acquire a template image and a region of interest (ROI) of the template image, wherein the template image includes the target to be located and the image resolution is greater than a second threshold, and the ROI region includes the area where the target to be located is located;
[0084] The present application determines multiple feature templates through a template image, wherein the image resolution of the template image is greater than a second threshold value, indicating that the image resolution of the template image is high and can reflect the correct features and detail features of the target itself. Therefore, the present application selects targets in template images with better image quality for modeling, and can obtain feature templates with higher accuracy to improve the accuracy of similarity comparison of targets to be located in the target image based on feature templates.
[0085] Step 520: extract various image features of the target contained in the ROI region.
[0086] The image features of the target include contour features, grayscale features, color features, normalized cross-correlation features, HOG features, and SIFT features.
[0087] The contour feature refers to the gradient direction of the area with high black-white contrast; the grayscale feature refers to the grayscale value of all pixels in the ROI area; the normalized cross-correlation feature is used to compare the similarity between two images; the HOG feature (Histogram of Oriented Gradient) is constructed by calculating and counting the gradient direction histogram of the local area of the image; the SIFT feature (Scale Invariant Feature Transform) is an algorithm that helps machines identify and match feature points in different images, and can realize the search for feature points in different images at different scales.
[0088] Step 530 : Modeling the target according to the multiple image features of the target to obtain multiple feature templates of the target.
[0089] The multiple feature templates include any two or a combination of any two or more of the following: contour feature template, grayscale feature template, color feature template, normalized cross-correlation feature template, HOG feature template, and SIFT feature template. Figure 6 A schematic diagram of determining a contour feature template and a grayscale feature template of a target in an ROI region of a template image provided by another embodiment of the present application is exemplified.
[0090] Step 230: Search the image to be tested at the highest level of the image pyramid or layer by layer starting from the highest level of the image pyramid according to the multiple feature templates until a first target in the image to be tested is found and first position information of the first target in the image to be tested is determined, wherein a similarity between a feature of the first target and the feature template is greater than a first threshold.
[0091] In some embodiments, the plurality of feature templates include at least a first feature template and a second feature template.
[0092] Figure 7 A flowchart of a method for searching a pyramid image for obtaining a first target according to multiple feature templates provided in another embodiment of the present application is shown as follows: Figure 7 As shown, according to multiple feature templates, the highest level of the image pyramid or starting from the highest level of the image pyramid is searched layer by layer for the image to be tested until the first target in the image to be tested is found, which is achieved by the following steps:
[0093] Step 710: Searching for a first target to be located and a second target to be located corresponding to the first feature template and the second feature template, respectively, in the image to be measured at the highest level of the image pyramid, and determining first feature data and second feature data of the first target to be located and the second target to be located, respectively;
[0094] In some embodiments, since the image to be tested at the highest level has a low resolution and a small image area, searching from the image to be tested at the highest level can reduce the amount of computation during the search and improve search efficiency.
[0095] Step 720: preset a first similarity threshold and a second similarity threshold according to the first feature template and the second feature template;
[0096] Step 730 , comparing a first similarity between the first feature data and the first feature template and a second similarity between the second feature data and the second feature template;
[0097] Step 740 : Determine the target to be located whose similarity between the first similarity and the second similarity is greater than or equal to the similarity threshold as the first target.
[0098] In some embodiments, if the first similarity is less than a first similarity threshold and the second similarity is less than a second similarity threshold, the search continues at a level below the highest level of the image pyramid according to the multiple feature templates until the first target is found.
[0099] Step 240, search the first area layer by layer according to the feature template corresponding to the first target until the target contained in the target image is found, and determine the target position information of the target in the target image, wherein the first area is determined based on the first position information, and the first area is located in a lower layer of the layer where the first target is located.
[0100] In some embodiments, the first position information is a first position coordinate, expressed as (R, C); the range of the first area is (nR-m, nC-m) to (nR+m, nC+m), where n and m are both constants and multiples of 2.
[0101] The first region is located in every layer of the image to be tested except the layer containing the first target. The size of the first region is determined by the location information of the suspected target found in the previous layer. We discuss two cases: when the first region is located in the target image, and when the first region closest to the first target is located in a layer other than the target image.
[0102] In some embodiments, Figure 8 A flowchart of a method for searching a first area until a target of a target image is found is shown as an example in another embodiment of the present application. Figure 8 As shown, when the first area is located in the target image, the first area is searched according to the feature template corresponding to the first target until the target of the target image is found, which is achieved by the following steps:
[0103] Step 810, obtaining a second target contained in the first area and feature data of the second target, wherein the feature data of the second target corresponds to a feature template corresponding to the first target;
[0104] Step 820: Preset a similarity threshold based on the feature template corresponding to the first target;
[0105] Step 830, comparing the similarity between the feature data of the second target and the corresponding feature template;
[0106] Step 830: Determine the second target whose similarity is greater than or equal to the similarity threshold as the target.
[0107] After the target is identified, the position information of the target in the target image is obtained, and the robot manipulator performs operations such as grasping the target based on the position information.
[0108] In some embodiments, Figure 9 A flowchart of a method for searching a first area until a target of a target image is found when a first area closest to the first target is located in a layer other than the target image, provided by another embodiment of the present application, is shown as follows. Figure 9 As shown, when the first area closest to the first target is located in another layer outside the target image, the first area is searched layer by layer according to the feature template corresponding to the first target until the target of the target image is found, including:
[0109] Step 910: Acquire a third target contained in the first target region and feature data of the third target, wherein the feature data of the third target corresponds to a feature template corresponding to the first target, the first target region belongs to the first region, and the first target region is located at a level below the level of the first target;
[0110] Step 920: Preset a similarity threshold based on the feature template corresponding to the first target;
[0111] Step 930, comparing the similarity between the feature data of the third target and the corresponding feature template;
[0112] Step 940 , determining the third target with a similarity greater than or equal to a similarity threshold as the fourth target;
[0113] Step 950 : Search the other first regions outside the first target region layer by layer according to the fourth position information of the fourth target and the corresponding template features until the target of the target image is found.
[0114] In some embodiments, since the image to be tested at the highest level has a low resolution and a small image area, searching from the image to be tested at the highest level can reduce the amount of computation during the search and improve search efficiency.
[0115] When a suspected target is searched in an image to be tested with a smaller image resolution, the position information of the suspected target is determined, and based on the position information, an area is determined in the image to be tested at the next level, and the area is searched; after searching the area, another one or more suspected targets are determined in the area, and the position of the suspected target is determined, and an area is determined at the next level based on the position information, and the process of searching in the area to determine the area is repeated until the target is found in the area in the target image, thereby completing the positioning of the target in the target image.
[0116] Since the search is performed on other images to be tested within the region of the image to be tested, the amount of search calculation can be reduced and the search efficiency can be improved.
[0117] Figure 10A A schematic diagram of a target image and a target provided by another embodiment of the present application is exemplarily shown. Figure 10B The following is a schematic diagram showing how to locate a target using contour features according to another embodiment of the present application. Figure 10B The box in the figure marks the area where the target is located by using the contour feature to locate the target. The box area indicated by the arrow contains an erroneous target that does not match the actual target. Figure 10B It can be seen that when this method of locating the target using only contour features, there are erroneous targets among the identified targets, so this method has the problem of low positioning accuracy.
[0118] Figure 10C The following is a schematic diagram showing how to locate a target image using multiple feature templates according to another embodiment of the present application. Figure 10C In the example, the grayscale feature template (feature 1 in the figure), the first contour feature template (feature 2 in the figure), and the second contour feature template (feature 2 in the figure) are used to locate the target image. The boxed area is the target area. No false targets are found in the boxed area. Therefore, it can be seen that the method of the present application has high positioning accuracy when locating the target.
[0119] Since there are many target feature types (feature types include edge features, contour features, grayscale features, etc.), and the most suitable feature type for searching the target is also uncertain, once the feature type of a given feature template is different from the feature type of the target, it is easy for the search to fall into a local minimum, resulting in target positioning failure or missed detection. When the present application uses a combination of multiple feature templates to locate the target, it can ensure that at least one feature template corresponds to the feature type of the target, thereby avoiding the problem of the search falling into a local minimum due to the feature type of a single feature template being different from the feature type of the target, resulting in target positioning failure or low positioning accuracy.
[0120] In the present application, a multi-feature template is constructed, and the target image is searched based on the multi-feature template to determine the target. Since there are many target feature templates used in the search, the multi-target template can be used to traverse and search targets with various feature types, avoiding missed detection due to the difference between the feature type of a single feature template and the feature type of the target, thereby achieving the purpose of improving positioning accuracy; further, by determining an image pyramid based on the target image and searching the image pyramid determined by the target image based on the multi-feature template, it is possible to avoid searching the entire area of the target image, thereby achieving the purpose of low computational complexity and high search efficiency during the search.
[0121] Figure 11 A structural block diagram of a target positioning device provided by another embodiment of the present application is shown as an example. Figure 11 As shown, the target positioning device 1100 includes: a generation module 1110, a determination module 1120, a first search module 1130 and a second search module 1140, wherein:
[0122] a generating module configured to sample the target image layer by layer to generate an image pyramid consisting of multiple layers of images to be measured corresponding to the target image, wherein the higher the layer in the image pyramid, the smaller the area of the image to be measured and the lower the image resolution; the target image is located at the lowest layer of the target pyramid and is an image obtained by photographing the area where the target to be located is located;
[0123] A determination module, configured to determine a plurality of feature templates of the target;
[0124] a first search module, configured to search the image to be tested at the highest level of the image pyramid or layer by layer starting from the highest level of the image pyramid according to the multiple feature templates until a first target in the image to be tested is found, and determine first position information of the first target in the image to be tested, wherein a similarity between a feature of the first target and the feature template is greater than a first threshold;
[0125] The second search module is used to search the first area layer by layer according to the feature template corresponding to the first target until the target contained in the target image is searched, and determine the target position information of the target in the target image, wherein the first area is determined based on the first position information, and the first area is located in a lower layer of the level where the first target is located.
[0126] Its implementation principle and technical effects are similar to those of the above method embodiment and will not be repeated here.
[0127] In some embodiments, a computer device is provided, including a memory and a processor, which implements the steps of the target positioning method described above when the processor executes a computer program. The implementation principle and technical effects thereof are similar to those of the above method embodiments and will not be repeated here.
[0128] In some embodiments, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to execute the steps of the target location method described above. The implementation principles and technical effects of the method are similar to those of the above-described method embodiment and are not further described here.
[0129] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0130] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0131] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0132] The above embodiments merely illustrate several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A target positioning method, characterized in that: The method comprises: Sampling the target image layer by layer to generate an image pyramid consisting of multiple layers of images to be measured corresponding to the target image, wherein the images to be measured have smaller areas and lower resolutions at higher layers in the image pyramid, and the target image is located at the lowest layer of the image pyramid and is an image obtained by photographing the area where the target to be located is located; determining a plurality of characteristic templates of the target; Searching the image to be tested layer by layer starting from the highest level of the image pyramid according to the multiple feature templates until a first target in the image to be tested is found, and determining first position information of the first target in the image to be tested, wherein a similarity between a feature of the first target and the feature template is greater than a first threshold; Searching the first region layer by layer according to the feature template corresponding to the first target until the target contained in the target image is found, and determining target position information of the target in the target image, wherein the first region is determined based on the first position information and is located in a layer below the layer where the first target is located; The plurality of feature templates include at least a first feature template and a second feature template. The method further comprises searching the image to be tested at the highest level of the image pyramid or starting from the highest level of the image pyramid layer by layer according to the plurality of feature templates until a first target in the image to be tested is found. Searching for a first target to be located and a second target to be located corresponding to a first feature template and a second feature template, respectively, in the image to be measured at the highest level of the image pyramid, and determining first feature data and second feature data of the first target to be located and the second target to be located, respectively; Presetting a first similarity threshold and a second similarity threshold according to the first feature template and the second feature template; comparing a first similarity between the first feature data and a first feature template and a second similarity between the second feature data and a second feature template; The first target to be located or the second target to be located whose similarity between the first similarity and the second similarity is greater than or equal to the similarity threshold is determined as the first target.
2. The target positioning method according to claim 1, wherein: The multiple feature templates include any two or a combination of any two or more of a contour feature template, a grayscale feature template, a color feature template, a normalized cross-correlation feature template, a HOG feature template, and a SIFT feature template.
3. The target positioning method according to claim 1, wherein: When the first region is located in the target image, searching the first region according to a feature template corresponding to the first target until the target of the target image is found includes: Acquire a second target contained in the first area and feature data of the second target, wherein the feature data of the second target corresponds to a feature template corresponding to the first target; Presetting a similarity threshold according to the feature template corresponding to the first target; comparing the similarity between the feature data of the second target and the corresponding feature template; A second target whose similarity is greater than or equal to the similarity threshold is determined as the target.
4. The target positioning method according to claim 1, wherein: When the first region closest to the first target is located in another layer outside the target image, searching the first region layer by layer according to a feature template corresponding to the first target until the target of the target image is found, including: Acquire a third target contained in the first target area and feature data of the third target, wherein the feature data of the third target corresponds to a feature template corresponding to the first target, the first target area belongs to the first area, and the first target area is located at a level below that of the first target; Presetting a similarity threshold according to the feature template corresponding to the first target; comparing the similarity between the feature data of the third target and the corresponding feature template; Determine the third target whose similarity is greater than or equal to the similarity threshold as the fourth target; Other first areas outside the first target area are searched layer by layer according to the fourth position information of the fourth target and the corresponding template feature until the target of the target image is found.
5. The target positioning method according to claim 1, wherein: The method further comprises: If the first similarity is less than the first similarity threshold and the second similarity is less than the second similarity threshold, continue searching at a level next to the highest level of the image pyramid according to the multiple feature templates until the first target is found.
6. The target positioning method according to claim 1, wherein: Determine multiple feature templates of the target, including: Acquire a template image and a ROI region of the template image, wherein the template image includes the target to be located and the image resolution is greater than a second threshold, and the ROI region includes a region where the target to be located is located; Extracting multiple image features of the target contained in the ROI area; The target is modeled according to multiple image features of the target to obtain multiple feature templates of the target.
7. The target positioning method according to claim 1, wherein: The first area is determined based on the first location information, including: The first position information is the first position coordinate, expressed as (R, C); the range of the first area is (nR-m, nC-m) to (nR+m, nC+m), where n and m are both constants and multiples of 2.
8. The target positioning method according to claim 1, wherein: Generating an image pyramid consisting of multiple layers of images to be tested corresponding to the target image, including: Calculating an average of pixel values of each first block in the target image to obtain a first average pixel value of each first block, wherein the first block having a pixel value of the first average pixel value is used to constitute a first image to be tested, and the target image is evenly divided into a plurality of first blocks, each first block including a squared pixel blocks, where a is a constant; Calculating an average of pixel values of each second block in the first image to be tested to obtain a second average pixel value of each second block, wherein the second block having a pixel value of the second average pixel value is used to constitute a second image to be tested, and the first image to be tested is evenly divided into a plurality of second blocks, each second block including a squared number of pixel blocks; Continue to divide the second image to be tested into multiple blocks and calculate the average pixel of each block until the obtained image to be tested includes a preset number of pixel blocks. The target image, the first image to be tested, the second image to be tested, and the image to be tested including the preset number of blocks constitute the image pyramid.
9. A target positioning device, said device being applicable to the method according to any one of claims 1 to 8, characterized in that: include: a generation module configured to sample the target image layer by layer to generate an image pyramid consisting of multiple layers of images to be measured corresponding to the target image, wherein the higher the layer in the image pyramid, the smaller the area of the image to be measured and the lower the image resolution; the target image is located at the lowest layer of the image pyramid and is an image obtained by photographing the area where the target to be located is located; A determination module, configured to determine a plurality of feature templates of the target; a first search module, configured to search the image to be tested at the highest level of the image pyramid or layer by layer starting from the highest level of the image pyramid according to the multiple feature templates until a first target in the image to be tested is found, and determine first position information of the first target in the image to be tested, wherein a similarity between a feature of the first target and the feature template is greater than a first threshold; The second search module is used to search the first area layer by layer according to the feature template corresponding to the first target until the target contained in the target image is searched, and determine the target position information of the target in the target image, wherein the first area is determined based on the first position information, and the first area is located in a lower layer of the level where the first target is located.
Citation Information
Patent Citations
Contour vector feature-based embedded real-time image matching method
CN102654902A
Target positioning candidate position screening strategy method
CN113673518A