Method, device, electronic device and program medium for identifying target in image

By acquiring the image template of the target and the area to be detected in the image, and using the direction vector and displacement to simulate the deformation, calculating the similarity to determine the existence of the target, the problem of low recognition accuracy under the influence of deformation in the prior art is solved, and a higher recognition accuracy is achieved.

CN112215032BActive Publication Date: 2025-04-22KUKA ROBOTICS GUANGDONG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201910616273.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-07-09
Publication Date
2025-04-22
Estimated Expiration
2039-07-09

AI Technical Summary

Technical Problem

In the prior art, when identifying objects in images, it is difficult to effectively deal with the impact of deformation, resulting in a low recognition accuracy.

Method used

By acquiring the image template of the target, describing its edge points, and determining the corresponding area to be detected and the point to be detected based on the image to be detected. Then, using the direction vector of the edge point and the direction vector of the adjacent point passing through the preset displacement, the similarity between the image template and the area to be detected is calculated to determine the existence of the target.

Benefits of technology

This method can effectively adapt to the deformation of the target and improve the accuracy of target recognition in the deformation situation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112215032B_ABST
    Figure CN112215032B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device, electronic device and program medium for target recognition in an image, which relates to the field of machine vision. The method comprises: obtaining an image template of the target, wherein the image template describes the edge points of the target; based on the image to be detected, determining the area to be detected corresponding to the image template, and determining each point to be detected in the area to be detected that corresponds to each edge point one by one; for each edge point in the image template, determining the similarity between the image template and the area to be detected based on the direction vector of the edge point and the direction vector of each neighboring point of the corresponding point to be detected after a preset displacement; and determining whether the target exists in the area to be detected based on the similarity between the image template and the area to be detected. The embodiments of the present disclosure can improve the accuracy of target recognition for deformed images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of machine vision, and in particular to a method, device, electronic device and program medium for identifying a target in an image. Background Art

[0002] In the field of machine vision, two methods are often used to identify targets in images. One method is based on grayscale features for detection, which has obvious disadvantages: it is easily affected by light. Another method is based on geometric features for detection. This method can resist the influence of light to a certain extent and effectively handle occlusion problems, but the effect is not ideal when identifying deformed targets, and the recognition accuracy is low. Summary of the invention

[0003] One purpose of the present disclosure is to provide a method, device, electronic device and program medium for object recognition in an image, which can improve the recognition accuracy of deformed objects.

[0004] According to one aspect of an embodiment of the present disclosure, a method for identifying a target in an image is disclosed, the method comprising: obtaining an image template of the target, the image template describing edge points of the target; determining, based on the image to be detected, an area to be detected corresponding to the image template, and determining each point to be detected in the area to be detected that corresponds one-to-one to each edge point; for each edge point in the image template, determining a similarity between the image template and the area to be detected based on a direction vector of the edge point and a direction vector of each neighboring point of the corresponding point to be detected that has undergone a preset displacement; and determining whether the target exists in the area to be detected based on the similarity between the image template and the area to be detected.

[0005] According to one aspect of an embodiment of the present disclosure, a terminal for identifying a target in an image is disclosed, the terminal comprising: an acquisition module, for acquiring an image template of the target, the image template describing edge points of the target; a first determination module, for determining, based on the image to be detected, an area to be detected corresponding to the image template, and determining each point to be detected in the area to be detected that corresponds one-to-one to each edge point; a second determination module, for determining, for each edge point in the image template, a similarity between the image template and the area to be detected based on a direction vector of the edge point and a direction vector of each neighboring point of the corresponding point to be detected that has undergone a preset displacement; and a third determination module, for determining whether the target exists in the area to be detected based on the similarity between the image template and the area to be detected.

[0006] According to one aspect of an embodiment of the present disclosure, a terminal for identifying an object in an image is disclosed, comprising: a memory storing computer-readable instructions; and a processor reading the computer-readable instructions stored in the memory to execute the method described above.

[0007] According to one aspect of an embodiment of the present disclosure, a computer program medium is disclosed, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the method as described above.

[0008] In the prior art, when geometric features are used to identify targets in images, the effects of deformation cannot be effectively counteracted. In the disclosed embodiment, when performing target identification, when determining the similarity between the edge point of the target and the corresponding point to be detected in the image to be detected, this is achieved by comparing the edge point with the neighboring points of the corresponding point to be detected. In the comparison process, the neighboring points corresponding to the point to be detected will undergo a certain displacement, thereby simulating the deformation of the target. The similarity between the edge point and the point to be detected determined on this basis can effectively adapt to the situation where the target is deformed, thereby improving the recognition accuracy of the target in the image in this case.

[0009] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0010] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail example embodiments thereof with reference to the attached drawings.

[0012] Figure 1A-1B An implementation of a method for identifying an object in an image according to an embodiment of the present disclosure is shown.

[0013] Figure 2A-2B An implementation of a method for identifying an object in an image according to an embodiment of the present disclosure is shown.

[0014] Figure 3 A flow chart of a method for identifying an object in an image according to an embodiment of the present disclosure is shown.

[0015] Figure 4 A module diagram of a terminal for identifying an object in an image according to an embodiment of the present disclosure is shown.

[0016] Figure 5 A hardware structure diagram of a terminal for identifying an object in an image according to an embodiment of the present disclosure is shown.

[0017] Figure 6 A program medium diagram showing object recognition in an image according to one embodiment of the present disclosure. DETAILED DESCRIPTION

[0018] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these example embodiments are provided so that the description of the present disclosure will be more comprehensive and complete and the concepts of the example embodiments will be fully conveyed to those skilled in the art. The accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.

[0019] In addition, the described features, structures or characteristics may be combined in one or more example embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the example embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, steps, etc. may be adopted. In other cases, well-known structures, methods, implementations or operations are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0020] Some of the blocks shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0021] Two implementation methods of the present disclosure are first described below.

[0022] Figure 1A-1B An implementation of the present disclosure is shown: Figure 1A An image described as a target in an embodiment of the present disclosure is shown; Figure 1B In the embodiment of the present disclosure, it is described as an image to be detected. In this embodiment, the purpose of the embodiment of the present disclosure is to identify Figure 1A Is the target represented in Figure 1B middle.

[0023] Figure 2A-2B Another implementation of the present disclosure is shown: Figure 2A Showing a layered image, Figure 2B showing a layered image; Figure 2A The underlying image is the target described in the embodiments of the present disclosure, Figure 2BThe underlying image is the image to be detected described in the embodiment of the present disclosure. The purpose of the embodiment of the present disclosure is to identify Figure 2A Is the target represented by the underlying image in Figure 1B in the underlying image.

[0024] The implementation process of the embodiment of the present disclosure is described below.

[0025] like Figure 3 As shown, according to an embodiment of the present disclosure, a method for identifying a target in an image includes:

[0026] Step S310: Acquire an image template of the target, where the image template describes edge points of the target;

[0027] Step S320: Based on the image to be detected, determine the area to be detected corresponding to the image template, and determine each point to be detected in the area to be detected that corresponds one-to-one to each edge point;

[0028] Step S330: for each edge point in the image template, based on the direction vector of the edge point and the direction vectors of the neighboring points of the corresponding point to be detected after a preset displacement, determine the similarity between the image template and the area to be detected;

[0029] Step S340: Determine whether the target exists in the area to be detected based on the similarity between the image template and the area to be detected.

[0030] In the disclosed embodiment, the image template stores information of each edge point constituting the corresponding image, such as the coordinates and direction vector of each edge point. The edge point refers to a pixel point located at the edge of the image; the direction vector refers to a vector describing the gradient strength and direction of the corresponding pixel point.

[0031] In the embodiment of the present disclosure, whether the target is in the image to be detected is determined based on the similarity between each edge point in the image template of the target and each corresponding point to be detected in the image to be detected. When determining the similarity between the edge point and the corresponding point to be detected, the embodiment of the present disclosure does not directly compare the edge point with the corresponding point to be detected. Instead, the similarity between the edge point and the corresponding point to be detected is evaluated by comparing the edge point with each neighboring point of the corresponding point to be detected after a preset displacement.

[0032] The advantage of this method is that it can effectively overcome the influence of target deformation. When performing target recognition based on the similarity of geometric features, if the target or any of the images to be detected is deformed, the geometric features of the deformed area will change. At this time, the traditional target recognition method based on geometric features will not be able to correctly recognize the target.

[0033] The disclosed embodiment can greatly improve the accuracy of target recognition when the image is deformed by comparing the edge point with the neighboring points of the corresponding point to be detected to evaluate the similarity between the edge point and the corresponding point to be detected. This is because, if the image is deformed, not only will the point to be detected in the deformation area undergo a certain displacement, causing the direction vector of the point to be detected to change, but also the neighboring points within a certain range of the point to be detected will make the same displacement, and the corresponding direction vector will also change. At the same time, since the deformation is relative: whether the target is deformed or the image to be detected is deformed, it can be regarded as the image to be detected being deformed relative to the target. Therefore, by comparing the direction vectors of the edge points in the target with the neighboring points of the corresponding point to be detected in the image to be detected that have undergone a preset displacement, it is possible to effectively counteract the influence of the deformation and improve the accuracy of target recognition.

[0034] Reference below Figure 2A-2B The implementation manner shown is used to describe in detail the specific process of each step in the embodiment of the present disclosure.

[0035] refer to Figure 2A-2B The illustrated embodiments are described for the following reasons: Figure 2A-2B In the embodiment shown, when determining whether the target is in the image to be detected, the comparison is performed in each layer of the layered image from top to bottom in turn according to the number of layers of the layered image. Due to the characteristics of the layered image: the higher the number of layers, the fewer pixels the image contains, and the data to be calculated and analyzed during the comparison will also be reduced accordingly. In this way, if the image to be detected does not contain the target, when comparing the top layer image of the layered target image with the top layer image of the layered image to be detected, it can be determined with less calculation that the image to be detected does not contain the target; if the image to be detected contains the target, when comparing the top layer image of the layered target image with the top layer image of the layered image to be detected, it can be considered that there is a greater possibility that the image to be detected contains the target, and a preliminary judgment can be made.

[0036] Therefore, compared to Figure 1A-1B A better implementation method, the following detailed description of the implementation process of each step of the embodiment of the present disclosure is for reference only unless otherwise specified. Figure 2A-2B carried out.

[0037] First, the implementation process of the step of obtaining the image template of the target is described.

[0038] In step S310, an image template of the target is obtained, where the image template describes specific edge points of the target.

[0039] In the embodiment of the present disclosure, whether the target is in the image to be detected is determined based on the similarity between each edge point contained in the target and the corresponding point to be detected in the image to be detected. Therefore, before determining the similarity between the edge point of the target and the corresponding point to be detected in the image to be detected, the embodiment of the present disclosure needs to determine which edge points the target specifically contains, that is, to obtain the image template of the target.

[0040] In one embodiment, obtaining the image template of the target includes:

[0041] Acquire a target image of the target as the bottom layer image of the layered target image;

[0042] Constructing other layer images except the bottom layer image in the layered target image, wherein each layer image is a downsampled image of the next layer image;

[0043] Based on edge detection of each layer of the image in the layered target image, an image template of each layer of the image is obtained.

[0044] In this embodiment, the reason for obtaining the target layered target image is that in the layered target image, each layer of image is a downsampled image of the next layer of image, and each downsampling will reduce the amount of information contained in the next layer of image, thereby achieving the purpose of simplifying the image information amount.

[0045] Accordingly, a corresponding image template must be established for each layer of image, wherein the image template describes each edge point contained in the hierarchical target image of the corresponding layer.

[0046] In one embodiment, in the layered target image, each layer image is a downsampled image of the next layer image, wherein downsampling the next layer image is performed by the following method: convolving the next layer image with a Gaussian kernel, and then deleting all even rows and even columns, so as to obtain a new layer image.

[0047] The area of ​​the new layer of image obtained by this method becomes one quarter of the previous layer of image, and similarly, the information it contains also becomes one quarter of the previous layer of image, thus achieving the purpose of simplifying the amount of information contained in the image.

[0048] In one embodiment, when downsampling the next layer of layered images to obtain a new layer of images, downsampling is repeated a predetermined number of times (eg, 5 times) and the obtained image is used as a new layer of images to improve the accuracy of downsampling.

[0049] The following describes the process of obtaining the image template of each layer image in the layered target image.

[0050] In one embodiment, based on edge detection of each layer of images in the layered target image, an image template of each layer of images is obtained, including:

[0051] Perform edge detection on each layer of the layered target image to determine the edge points contained in each layer of the image;

[0052] According to the edge point information items described by the preset image template, each edge point information contained in each layer of image is stored according to the edge point information items, and the image templates of each layer of image are obtained respectively.

[0053] In one embodiment, after acquiring the layered target image, edge detection is performed on each layer of the image to extract the edge points of the layer of the image. The information about the edge points is stored according to a preset template for storing edge point information, thereby obtaining an image template for each layer of the image.

[0054] In one embodiment, the edge point information items described by the image template include: the coordinates of the edge point, the direction vector of the edge point, and the coordinates of K neighboring points of the edge point, where K is a pre-determined hyperparameter. For example: M rig is the image template; i is the order number of the edge point; (r i ,c i ) is the coordinate of the i-th edge point; Indicates the i-th edge point in the image template M rig The direction vector in; k is the number of neighboring points; u ik represents the kth neighboring point of the ith edge point; n is the number of edge points. i1 ,…,u ik , is stored in the image template in the form of coordinates.

[0055] In one embodiment, the K neighboring points of an edge point refer to each edge point within a predetermined radius of the edge point, for example, each edge point within a radius of 5 to-be-detected points of the edge point.

[0056] In one embodiment, the K neighboring points of an edge point refer to a predetermined number of edge points that are closest to the edge point along the direction of the edge point, for example: the 5 edge points that are closest to the edge point along the positive direction of the edge point; the 5 edge points that are closest to the edge point along the negative direction of the edge point.

[0057] By establishing an image template that describes each edge point contained in each layer of the layered target image, the information of each edge point can be quickly retrieved from the image template in the subsequent process.

[0058] The following describes the process of performing edge detection on each layer of the layered target image to extract the edge points of the layer.

[0059] In one embodiment, performing edge detection on each layer of the layered target image to determine edge points contained in each layer of the image includes:

[0060] For each layer of image, use Gaussian filter to filter;

[0061] Determining a direction vector for each pixel in the filtered image;

[0062] Based on the direction vector of each pixel point, non-maximum suppression is applied to each pixel point, so as to determine a candidate edge point from the non-maximum suppressed pixel points;

[0063] Based on the direction vector of each candidate edge point, double threshold detection is applied to each candidate edge point and marked accordingly;

[0064] Based on the mark of each candidate edge point, each candidate edge point is screened to determine the edge points included in the image.

[0065] A candidate edge point refers to a pixel point from which an edge point is determined.

[0066] In one embodiment, when edge detection is performed on each layer of the layered target image, the layer of image is first filtered to remove the noise of the layer of image, so that when various processing is performed on the layer of image in the subsequent process, the influence of noise can be reduced and the processing accuracy can be improved.

[0067] For example, a Gaussian filter kernel of size (2k+1)x(2k+1) can be generated by the following formula:

[0068]

[0069] When filtering, if a 3x3 window in the image is A and the pixel to be filtered is e, then after Gaussian filtering, the brightness value of pixel e is:

[0070]

[0071] Apply the preset edge detection operator to the filtered image layer and calculate the direction vector of each pixel. The direction vector of a pixel refers to the vector that describes the gradient strength and direction of the pixel, where the gradient strength describes the rate of change of the grayscale value of the corresponding pixel, and the direction describes the direction of change of the grayscale value of the corresponding pixel.

[0072] For example, the Sobel operator of edge detection returns the first-order derivative values ​​in the horizontal Gx and vertical Gy directions, from which the gradient strength G and direction θ of the pixel point can be determined:

[0073]

[0074] Among them, the Sobel operators in the x and y directions are:

[0075]

[0076] For each pixel in the layer image, non-maximum suppression is applied based on the direction vector of the pixel to determine the candidate edge point: for each pixel, the gradient strength of the pixel is compared with the gradient strength of the two neighboring points in the positive and negative directions of the pixel. If the gradient strength of the pixel is the largest, the pixel is determined as a candidate edge point; if the gradient strength of the pixel is not the largest, the pixel is suppressed, that is, the pixel is not determined as a candidate edge point. It can be seen that the candidate edge point is a pixel that is closer to the edge point than the pixel at the adjacent position.

[0077] When determining edge points from candidate edge points, firstly, a dual threshold detection is performed on the candidate edge points: a first threshold and a second threshold are preset, wherein the first threshold is greater than the second threshold. For each candidate edge point, if the gradient strength of the candidate edge point is greater than / equal to the first threshold, the candidate edge point is determined as a strong edge point; if the gradient strength of the candidate edge point is less than the first threshold and greater than / equal to the second threshold, the candidate edge point is determined as a weak edge point; if the gradient strength of the candidate edge point is less than the second threshold, the candidate edge point is discarded.

[0078] Each strong edge point is determined as an edge point of the layered target image; for each weak edge point, if one of the eight neighboring pixels of the weak edge point is a strong edge point, the weak edge point is also determined as an edge point of the layered target image; if none of the eight neighboring pixels of the weak edge point is a strong edge point, the weak edge point is discarded. Thus, each edge point contained in the layer image is determined, that is, the edge detection of the layer image is completed.

[0079] In the embodiment of the present disclosure, the edge detection operator used to calculate the direction vector of the pixel point includes but is not limited to the Sobel operator and the Laplace operator.

[0080] Through the above description, an example illustration of the specific process of the step of obtaining the image template of the target in the embodiment of the present disclosure is completed.

[0081] The following describes the process of determining the area to be detected corresponding to the image template and each point to be detected in the area to be detected corresponding to each edge point one by one after acquiring the image template of the target.

[0082] In step S320, based on the image to be detected, a region to be detected corresponding to the image template is determined, and each point to be detected in the region to be detected that corresponds one-to-one to each edge point is determined.

[0083] In order to determine whether the target exists in the image to be detected, it is necessary to compare the image template of the target with each area to be detected in the image to be detected: if the target exists in an area to be detected, it means that the target exists in the image to be detected.

[0084] To this end, it is necessary to determine the area to be detected in the image to be detected that corresponds to the image template of the target, as well as the points to be detected in the area to be detected that correspond one-to-one to the edge points contained in the target, so that the similarity between the image template and the area to be detected can be determined based on the comparison between the edge points contained in the target and the corresponding points to be detected, and then it can be determined whether there is a target in the area to be detected.

[0085] In one embodiment, the determining, based on the image to be detected, the area to be detected corresponding to the image template includes:

[0086] Obtaining an image to be detected as the bottom layer image of the layered images to be detected;

[0087] Constructing other layer images except the bottom layer image in the layered image to be detected, wherein the layered image to be detected has the same number of layers as the layered target image, wherein each layer image except the bottom layer image in the layered image to be detected is a downsampled image of the next layer image;

[0088] The image template of the top layer image in the layered target image is used as the current mapped template, and the top layer image of the layered image to be detected is used as the current mapping target image. According to different mapping rules, the current mapped template is mapped to the current mapping target image, and the areas occupied by each image are used as multiple current areas to be detected.

[0089] In the embodiment of the present disclosure, the specific implementation process of obtaining the layered to-be-detected image of the to-be-detected image is the same as the specific implementation process of obtaining the layered target image of the target, so it will not be repeated here.

[0090] In one embodiment, a layered image of an image to be detected is obtained, that is, after the image to be detected is layered, the image template of the top layer image in the layered target image is used as the current mapped template, and the top layer image in the layered image to be detected is used as the current mapping target image. According to different mapping rules, the current mapped template is mapped on the current mapping target image. Whenever the current mapped template is mapped to the current mapping target image, the mapped area is the current area to be detected.

[0091] In one embodiment, the currently mapped template is mapped onto the currently mapped target image according to different mapping rules, and the areas occupied by the currently mapped template are respectively used as multiple current areas to be detected, including:

[0092] According to the preset sliding rule, the currently mapped template is used as a sliding window to slide on the currently mapped target image. Each time it slides, the area occupied by the currently mapped template mapped to the currently mapped target image is used as a current area to be detected.

[0093] In this embodiment, the currently mapped template is used as a sliding window, and according to the preset sliding rules, it slides on the currently mapped target image to determine the current area to be detected. Each time the sliding window slides, a new area is mapped on the currently mapped target image, and the new area is used as the current area to be detected.

[0094] In one embodiment, the preset sliding rule is: the left edge of the sliding window coincides with the left edge of the current mapping target image, the lower edge of the sliding window coincides with the lower edge of the current mapping target image, and the sliding is performed in sequence from left to right and from bottom to top until the right edge of the sliding window coincides with the right edge of the current mapping target image and the upper edge of the sliding window coincides with the upper edge of the current mapping target image. Each time the sliding is performed, the sliding window is slid by a distance of a predetermined number of pixels, for example, a distance of 5 pixels.

[0095] In one embodiment, determining each of the to-be-detected points in the to-be-detected area corresponding one-to-one to each of the edge points includes:

[0096] Determine each of the points to be detected that correspond one-to-one to each of the edge points in each of the multiple current areas to be detected.

[0097] In this embodiment, after mapping the current mapped template on the current mapping target image, multiple areas to be detected are obtained, and each mapping obtains an area to be detected. Therefore, according to the mapping rule of mapping the current mapped template on the current mapping target image, each point to be detected corresponding to each edge point (each edge point is located in the current mapped template) can be found in the area to be detected (the area to be detected is located in the current mapping target image).

[0098] Through the above description, an example explanation of determining the area to be detected and each point to be detected in the area to be detected corresponding to each edge point one by one is completed.

[0099] In one embodiment, before determining the similarity between the image template and the area to be detected based on the direction vector of each edge point in the image template and the direction vector of each neighboring point of the corresponding point to be detected after a preset displacement, the method includes:

[0100] According to a preset rotation retrieval table, the direction vector of each edge point in the image template is rotated accordingly to update the direction vector of each edge point. The rotation retrieval table describes the rotation operation on the direction vector of the edge point.

[0101] In the embodiment of the present disclosure, before determining the similarity between the image template and the area to be detected, the direction vector of each edge point in the image template is rotated accordingly according to a preset rotation search table to update the direction vector of each edge point. Figure 2A-2B In the illustrated implementation, before determining the similarity between the current mapped template and the area to be detected, the direction vector of each edge point in the current mapped template is rotated accordingly according to a preset rotation search table to update the direction vector of each edge point.

[0102] The purpose of performing rotation retrieval on the image template is to deal with the situation where the target or the image to be detected has been rotated, so that the target in the image can be recognized more accurately.

[0103] The following describes a process of determining the similarity between the image template and the area to be detected based on the direction vector of the edge point and the direction vectors of the neighboring points of the corresponding point to be detected after a preset displacement.

[0104] In step S320, for each edge point in the image template, the similarity between the image template and the area to be detected is determined based on the direction vector of the edge point and the direction vectors of the neighboring points of the corresponding point to be detected after a preset displacement.

[0105] In one embodiment, step S320 includes:

[0106] For each edge point in the current mapped template, the similarity between the current mapped template and each of the multiple current areas to be detected is determined based on the direction vector of the edge point and the direction vectors of the neighboring points of the corresponding point to be detected after a preset displacement.

[0107] In this embodiment, each time the currently mapped template is mapped on the currently mapped target image, a current region to be detected is obtained. When performing target recognition, for each current region to be detected, the similarity between the currently mapped template and the region to be detected must be determined.

[0108] In one embodiment, for each edge point in the currently mapped template, based on the direction vector of the edge point and the direction vectors of each neighboring point of the corresponding point to be detected that has undergone a preset displacement, determining the similarity between the currently mapped template and each of the multiple current areas to be detected includes:

[0109] For each edge point in the currently mapped template, obtaining a direction vector of the edge point;

[0110] For each current area to be detected, according to a preset displacement table, uniformly displace the neighboring points of the point to be detected in the area to be detected that corresponds to the edge point, until all displacements described in the displacement table are exhausted;

[0111] After each uniform displacement, the direction vectors of the neighboring points are obtained, and the average of the cosine distances between the direction vector of the edge point and the direction vectors of the neighboring points is calculated;

[0112] Determine the maximum mean of the cosine distances as the similarity between the edge point and the corresponding point to be detected;

[0113] The average value of the similarity between each edge point and the corresponding point to be detected is determined as the similarity between the current mapped template and the current area to be detected.

[0114] In one embodiment, when determining the similarity between the current mapped template and the area to be detected, the similarity is measured by determining the similarity between each edge point in the current mapped template and each corresponding point to be detected in the area to be detected.

[0115] For an edge point in the currently mapped template, obtain the direction vector of the edge point; and determine the corresponding point to be detected in the area to be detected. When determining the similarity between the edge point and the corresponding point to be detected, according to the preset displacement table, perform a uniform displacement on each neighboring point of the corresponding point to be detected, for example: uniformly move the distance of 1 pixel along the X axis, and then move the distance of 2 pixels along the Y axis. Among them, the preset displacement table describes the specific content of various displacements.

[0116] Whenever each neighboring point is uniformly displaced, the direction vector of each neighboring point after the displacement is determined. The cosine distance between the direction vector of each neighboring point and the direction vector of the edge point is calculated and averaged to obtain the mean of the cosine distance. This is shown in the following formula:

[0117]

[0118] Among them, s l (r,c,i) is the similarity between the i-th edge point with coordinates (r,c) and the corresponding point to be detected; T 1 is the displacement of the ith edge point (since the displacement is relative, the embodiment of the present disclosure shows that: the edge point is fixed, and the neighboring points of the edge point corresponding to the point to be detected are displaced; which is essentially the same as the formula: the edge point is displaced, and the neighboring points of the edge point corresponding to the point to be detected are fixed), k is the number of the neighboring points corresponding to the point to be detected, j is the ordinal number of the neighboring points corresponding to the point to be detected, is the direction vector of the jth neighboring point of the i-th edge point corresponding to the point to be detected, is the direction vector of the i-th edge point after displacement.

[0119] It can be seen that each time a uniform displacement is performed, a cosine distance mean value is calculated. After exhausting all displacements described in the displacement table, the largest cosine distance mean value is determined as the similarity between the edge point and the corresponding point to be detected.

[0120] Then, the average of the similarities between each edge point and each corresponding point to be detected is determined as the similarity between the current mapped template and the current area to be detected, as shown in the following formula:

[0121] s g is the similarity between the current mapped template and the current area to be detected; n is the number of edge points in the current mapped template; s l (r,c,i) is the similarity between the i-th edge point with coordinates (r,c) and the corresponding point to be detected; i is the ordinal number of the edge point in the currently mapped template.

[0122] The advantage of this embodiment is that by uniformly displacing the neighboring points of the corresponding points to be detected, the deformation of the corresponding area is simulated, so that the calculated similarity between the edge points and the corresponding points to be detected can counteract the influence of the deformation, and then the calculated similarity between the current mapped template and the current area to be detected can counteract the influence of the deformation, which is more accurate and reliable.

[0123] In one embodiment, the neighboring points corresponding to the point to be detected refer to the pixel points within a preset radius with the corresponding point to be detected as the center on the current mapping target image as the neighboring points. For example, the pixel points within a radius of 5 pixels with the point to be detected as the center are the neighboring points of the point to be detected.

[0124] In one embodiment, the neighboring points corresponding to the point to be detected refer to a predetermined number of points along the direction of the point to be detected. For example, the 5 nearest pixel points along the positive direction of the point to be detected and the 5 nearest pixel points along the negative direction of the point to be detected are the neighboring points of the point to be detected.

[0125] In one embodiment, each time the neighboring points are uniformly displaced, the corresponding points to be detected are also uniformly displaced, and after the mean of the largest cosine distances is determined as the similarity between the edge point and the corresponding points to be detected, the method includes:

[0126] Obtaining displacement information of each corresponding point to be detected and coordinate information after displacement;

[0127] For each corresponding point to be detected, a corresponding displacement point template is obtained based on the displacement information and the coordinate information after displacement. The displacement point template describes the corresponding points to be detected in the area to be detected that are most similar to the edge points within a certain displacement range after the current mapped template is mapped.

[0128] In this embodiment, whenever the similarity between an edge point in the currently mapped template and the corresponding point to be detected in the current area to be detected is determined, the neighboring points of the corresponding point to be detected and the corresponding point to be detected are uniformly displaced multiple times, and each uniform displacement will obtain the above-mentioned cosine distance mean. The displacement information of the corresponding point to be detected in the uniform displacement corresponding to the maximum cosine distance mean is stored in the displacement point template. For example: M def ={r,c,M rig ,d ri ,d ci},M def is the displacement point template; (r, c) is the coordinate information of the point to be detected after displacement in the uniform displacement corresponding to the maximum cosine distance mean; M rig is the original coordinate information of the corresponding point to be detected in the current area to be detected; (d ri ,d ci ) is the displacement information of the point to be detected in the uniform displacement corresponding to the maximum cosine distance mean.

[0129] In one embodiment, the displacement point template stores the original coordinate information, displacement information, and coordinate information after displacement of each corresponding detection point in the current area to be detected.

[0130] Through the above description, an example explanation of the step of determining the similarity between the image template and the area to be detected in the implementation of the present disclosure is completed.

[0131] The following describes a process of determining whether there is a target in the area to be detected based on the similarity between the image template and the area to be detected.

[0132] In one embodiment, determining whether the target exists in each of the multiple current areas to be detected based on the similarity between the current mapped template and each of the multiple current areas to be detected includes:

[0133] If the similarity between the current mapped template and the current area to be detected is greater than a predetermined threshold, it is determined that the target exists in the current area to be detected.

[0134] In this embodiment, for a current area to be detected, if the mean value of the similarity is greater than a predetermined threshold value (for example, 95%), it means that when the current mapped template is mapped to the current mapped target image, each edge point in the current mapped template is sufficiently similar to each point to be detected in the obtained area to be detected, so that it can be considered that: based on the top-level image (top-level hierarchical target image and top-level hierarchical image to be detected), it can be regarded as existing in the target in the current area to be detected. It should be noted that the target mentioned here only corresponds to the top-level hierarchical target image, and is not equivalent to the target to be ultimately determined in the embodiment of the present disclosure (i.e., the target corresponding to the bottom-level hierarchical target image).

[0135] Since the information of each layer image except the bottom layer image is missing compared to the bottom layer image that has not been downsampled, that is, the bottom layer image of the layered target image and the bottom layer image of the layered image to be detected, the result that the target exists in the current area to be detected determined in the top layer image is only obtained on the basis of the top layer image that lacks image information, and cannot be used to directly determine whether there is a target in the bottom layer image of the layered target image in the area to be detected of the bottom layer image of the layered image to be detected.

[0136] Through the above description, an example explanation of the step of determining whether there is a target in the area to be detected in the top layer image is completed.

[0137] The following describes a process of determining whether there is an object in the to-be-detected area in the bottom layer image after determining whether there is an object in the to-be-detected area in the top layer image.

[0138] In one embodiment, after determining whether the target exists in the area to be detected based on the similarity between the image template and the area to be detected, the method further includes:

[0139] If it is determined that the target exists in a current area to be detected, the current mapped template is updated with the next layer image of the current mapped template in the layered target image, the current mapped target image is updated with the next layer image of the current mapped target image, and the current mapped template is mapped onto the current mapped target image according to different mapping rules, and the multiple current areas to be detected are updated respectively with the areas occupied by the respective ones;

[0140] Determine the points to be detected in the multiple current areas to be detected that correspond one to one to the target edge points of the currently mapped template;

[0141] For each edge point in the currently mapped template, based on the direction vector of the edge point and the direction vectors of the neighboring points of the corresponding point to be detected that are shifted by a preset value, determine the similarity between the currently mapped template and each of the multiple current areas to be detected;

[0142] If the similarity between the current mapped template and a region to be detected meets a predetermined condition, it is determined that the target exists in the region to be detected, and the process starting from updating the current mapped template with the next layer image of the current mapped template in the layered target image is repeated until the bottom layer image of the layered image to be detected is reached, and the region to be detected where the target exists in the bottom layer image is determined as the target positioning area.

[0143] In one embodiment, after determining that a target exists in a current area to be detected in the top layer image, the current mapped template is updated with the next layer layer target image, that is, the current mapped template is updated with the edge points contained in the next layer layer target image, so that the current mapped template describes the edge points contained in the next layer layer target image; the current mapped target image is updated with the next layer layer image to be detected, that is, the next layer layer image to be detected is used as the current mapped target image. According to different mapping rules (for example: according to a preset sliding rule, the current mapped template is used as a sliding window to slide on the current mapping target image), the areas occupied by each are updated to multiple current areas to be detected.

[0144] Determine the points to be detected that correspond one-to-one between each current region to be detected and each edge point of the currently mapped template. For each edge point in the currently mapped template, based on the direction vector of the edge point and the direction vectors of the neighboring points of the corresponding point to be detected that have undergone a preset displacement, determine the similarity between the currently mapped template and each of the multiple current regions to be detected. If the similarity between the currently mapped template and a region to be detected meets a predetermined condition (e.g., is greater than a predetermined threshold), determine that there is a target in the region to be detected.

[0145] So far, the process of determining whether there is a target in the area to be detected in the next layer image of the top layer image is completed.

[0146] In each layer of the layered image, if it is determined that there is a target in the area to be detected, the process of updating the current mapped template with the next layer image of the current mapped template, updating the current mapped target image with the next layer image of the current mapped target image, updating the current area to be detected, and determining whether there is a target in the current area to be detected is repeated until the bottom layer image of the layered images to be detected is reached, and the area to be detected where the target exists in the bottom layer image is determined as the target positioning area.

[0147] In one embodiment, if no target exists in each of the areas to be detected determined in one layer of the layered images to be detected, it is determined that no target exists in the bottom layer of the layered images to be detected, that is, no target exists in the images to be detected.

[0148] Through the above description, the reference Figure 2A-2B In the illustrated embodiment, an example description is given of the process of determining whether a target exists in an image to be detected and the exact area where the target is located, that is, the target positioning area.

[0149] For reference Figure 1A-1B The embodiments of the present disclosure implemented by the embodiments shown in the figure are Figure 2A-2B Compared with the embodiment shown in the reference Figure 1A-1B The embodiment shown in the figure implements the process of the method for object recognition in the image, and the reference Figure 2A-2B In the embodiment shown, the process of determining whether the target in the uppermost layer image of the hierarchical target image exists in the to-be-detected region of the uppermost layer image of the hierarchical to-be-detected image is similar. Figure 2A-2B The implementation shown differs in that: Figure 1A-1B The embodiment shown implements the process of the target recognition method in the image, and there is no process of updating the current mapped template, updating the current mapped target image, and updating the area to be detected; Figure 1A-1B The embodiment shown only performs target recognition on one layer of images, that is, unlayered targets and unlayered images to be detected. Figure 1A-1B The specific implementation process of each step of the method for identifying a target in an image in the illustrated embodiment will not be repeated here.

[0150] According to the embodiment of the present disclosure, Figure 4 As shown, a terminal for identifying an object in an image is also provided, the terminal comprising:

[0151] An acquisition module, used for acquiring an image template of the target, wherein the image template describes edge points of the target;

[0152] A first determination module is used to determine, based on the image to be detected, a region to be detected corresponding to the image template, and determine each point to be detected in the region to be detected that corresponds one-to-one to each edge point;

[0153] A second determination module is used to determine the similarity between the image template and the area to be detected based on the direction vector of each edge point in the image template and the direction vector of each neighboring point of the corresponding point to be detected after a preset displacement;

[0154] The third determination module is used to determine whether the target exists in the area to be detected based on the similarity between the image template and the area to be detected.

[0155] In one embodiment, obtaining the image template of the target includes:

[0156] Acquire a target image of the target as the bottom layer image of the layered target image;

[0157] Constructing other layer images except the bottom layer image in the layered target image, wherein each layer image is a downsampled image of the next layer image;

[0158] Based on edge detection of each layer of the image in the layered target image, an image template of each layer of the image is obtained;

[0159] The step of determining the area to be detected corresponding to the image template based on the image to be detected includes:

[0160] Obtaining an image to be detected as the bottom layer image of the layered images to be detected;

[0161] Constructing other layer images except the bottom layer image in the layered image to be detected, wherein the layered image to be detected has the same number of layers as the layered target image, wherein each layer image except the bottom layer image in the layered image to be detected is a downsampled image of the next layer image;

[0162] The image template of the top layer image in the layered target image is used as the current mapped template, the top layer image of the layered image to be detected is used as the current mapping target image, and the current mapped template is mapped onto the current mapping target image according to different mapping rules, and the areas occupied by the respective images are used as multiple current areas to be detected;

[0163] The step of determining the points to be detected in the area to be detected that correspond one-to-one to the edge points comprises:

[0164] Determine each of the plurality of current to-be-detected areas and each of the to-be-detected points corresponding one-to-one to each of the edge points;

[0165] The determining, for each edge point in the image template, the similarity between the image template and the area to be detected based on the direction vector of the edge point and the direction vector of each neighboring point of the corresponding point to be detected after a preset displacement, comprises:

[0166] For each edge point in the currently mapped template, based on the direction vector of the edge point and the direction vectors of the neighboring points of the corresponding point to be detected that are shifted by a preset value, determine the similarity between the currently mapped template and each of the multiple current areas to be detected;

[0167] The determining whether the target exists in the area to be detected based on the similarity between the image template and the area to be detected includes:

[0168] Determining whether the target exists in each of the multiple current areas to be detected based on the similarity between the current mapped template and each of the multiple current areas to be detected;

[0169] After determining whether the target exists in the area to be detected based on the similarity between the image template and the area to be detected, the method further includes:

[0170] If it is determined that the target exists in a current area to be detected, the current mapped template is updated with the next layer image of the current mapped template in the layered target image, the current mapped target image is updated with the next layer image of the current mapped target image, and the current mapped template is mapped onto the current mapped target image according to different mapping rules, and the multiple current areas to be detected are updated respectively with the areas occupied by the respective ones;

[0171] Determine the points to be detected in the multiple current areas to be detected that correspond one to one to the edge points of the currently mapped template;

[0172] For each edge point in the currently mapped template, based on the direction vector of the edge point and the direction vectors of the neighboring points of the corresponding point to be detected that are shifted by a preset value, determine the similarity between the currently mapped template and each of the multiple current areas to be detected;

[0173] If the similarity between the current mapped template and a region to be detected meets a predetermined condition, it is determined that the target exists in the region to be detected, and the process starting from updating the current mapped template with the next layer image of the current mapped template in the layered target image is repeated until the bottom layer image of the layered image to be detected is reached, and the region to be detected where the target exists in the bottom layer image is determined as the target positioning area.

[0174] In one embodiment, the step of acquiring the image template of each layer of the image based on edge detection of each layer of the layered target image includes:

[0175] Perform edge detection on each layer of the layered target image to determine the edge points contained in each layer of the image;

[0176] According to the edge point information items described by the preset image template, each edge point information contained in each layer of image is stored according to the edge point information items, and the image templates of each layer of image are obtained respectively.

[0177] In one embodiment, performing edge detection on each layer of the layered target image to determine edge points contained in each layer of the image includes:

[0178] For each layer of image, use Gaussian filter to filter;

[0179] Determining a direction vector for each pixel in the filtered image;

[0180] Based on the direction vector of each pixel point, non-maximum suppression is applied to each pixel point, so as to determine a candidate edge point from the non-maximum suppressed pixel points;

[0181] Based on the direction vector of each candidate edge point, double threshold detection is applied to each candidate edge point and marked accordingly;

[0182] Based on the mark of each candidate edge point, each candidate edge point is screened to determine the edge points included in the image.

[0183] In one embodiment, the currently mapped template is mapped onto the currently mapped target image according to different mapping rules, and the areas occupied by the currently mapped template are respectively used as multiple current areas to be detected, including:

[0184] According to the preset sliding rule, the currently mapped template is used as a sliding window to slide on the currently mapped target image. Each time it slides, the area occupied by the currently mapped template mapped to the currently mapped target image is used as a current area to be detected.

[0185] In one embodiment, before determining the similarity between the image template and the area to be detected based on the direction vector of each edge point in the image template and the direction vector of each neighboring point of the corresponding point to be detected after a preset displacement, the method includes:

[0186] According to a preset rotation retrieval table, the direction vector of each edge point in the image template is rotated accordingly to update the direction vector of each edge point. The rotation retrieval table describes the rotation operation on the direction vector of the edge point.

[0187] In one embodiment, for each edge point in the currently mapped template, determining the similarity between the currently mapped template and each of the multiple current areas to be detected based on the direction vector of the edge point and the direction vectors of each neighboring point of the corresponding point to be detected that has undergone a preset displacement, includes:

[0188] For each edge point in the currently mapped template, obtaining a direction vector of the edge point;

[0189] For each current area to be detected, according to a preset displacement table, uniformly displace the neighboring points of the point to be detected in the area to be detected that corresponds to the edge point, until all displacements described in the displacement table are exhausted;

[0190] After each uniform displacement, the direction vectors of the neighboring points are obtained, and the average of the cosine distances between the direction vector of the edge point and the direction vectors of the neighboring points is calculated;

[0191] Determine the maximum mean of the cosine distances as the similarity between the edge point and the corresponding point to be detected;

[0192] The average value of the similarity between each edge point and the corresponding point to be detected is determined as the similarity between the current mapped template and the current area to be detected.

[0193] In one embodiment, the neighboring points include: on the current mapping target image, with the corresponding point to be detected as the center, each pixel point within a preset radius is used as the neighboring point.

[0194] In one embodiment, the determining whether the target exists in each of the multiple current areas to be detected based on the similarity between the current mapped template and each of the multiple current areas to be detected includes:

[0195] If the similarity between the current mapped template and the current area to be detected is greater than a predetermined threshold, it is determined that the target exists in the current area to be detected.

[0196] The method for identifying an object in an image according to the embodiment of the present disclosure can be performed by Figure 5 The target recognition terminal 400 shown in the image is implemented. Figure 5 The target recognition terminal 400 in an image according to an embodiment of the present disclosure is described. Figure 5 The target recognition terminal 400 in the displayed image is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0197] like Figure 5As shown, the target recognition terminal 400 in the image is presented in the form of a general computing device. The components of the target recognition terminal 400 in the image may include, but are not limited to: the at least one processing unit 510, the at least one storage unit 520, and a bus 530 connecting different system components (including the storage unit 520 and the processing unit 510).

[0198] The storage unit stores program codes, which can be executed by the processing unit 510, so that the processing unit 510 performs the steps according to various exemplary embodiments of the present invention described in the description of the exemplary method described above in this specification. For example, the processing unit 510 can perform the following steps: Figure 4 The steps shown in .

[0199] The storage unit 520 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 5201 and / or a cache storage unit 5202 , and may further include a read-only storage unit (ROM) 5203 .

[0200] The storage unit 520 may also include a program / utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0201] Bus 530 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0202] The target recognition terminal 400 in the image can also communicate with one or more external devices 600 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), and can also communicate with one or more devices that enable users to interact with the target recognition terminal 400 in the image, and / or communicate with any device that enables the target recognition terminal 400 in the image to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication can be performed through an input / output (I / O) interface 550. In addition, the target recognition terminal 400 in the image can also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs) and / or public networks, such as the Internet) through a network adapter 560. As shown in the figure, the network adapter 560 communicates with other modules of the target recognition terminal 400 in the image through a bus 530. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the target recognition terminal 400 in the image, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0203] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0204] In an exemplary embodiment of the present disclosure, a computer program medium is further provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer is enabled to execute the method described in the above method embodiment.

[0205] refer to Figure 6 As shown, a program product 600 for implementing the above method according to an embodiment of the present disclosure is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0206] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0207] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0208] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0209] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0210] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0211] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0212] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0213] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.

Claims

1. A method for identifying an object in an image, characterized in that: The method comprises: Acquire an image template of a target, wherein the image template describes edge points of the target; Based on the image to be detected, determining a region to be detected corresponding to the image template, and determining points to be detected in the region to be detected that correspond one-to-one to the edge points; For each edge point in the currently mapped template, based on the direction vector of the edge point and the direction vectors of the neighboring points of the corresponding point to be detected that have undergone a preset displacement, determine the similarity between the currently mapped template and each of the multiple current areas to be detected; The currently mapped template is the image template of the topmost image in the hierarchical target image; the hierarchical target image includes multiple layers of images, the bottommost image is the target image of the target, and each layer of images in the layers other than the bottommost image is a downsampled image of the next layer of image; the multiple current areas to be detected are the areas occupied by mapping the currently mapped template to the current mapping target image according to different mapping rules; the current mapping target image is the topmost image of the hierarchical image to be detected; the hierarchical image to be detected includes multiple layers of images, the bottommost image is the image to be detected, and each layer of images in the layers other than the bottommost image is a downsampled image of the next layer of image; the neighboring points include each pixel point within a preset radius on the current mapping target image, with the corresponding point to be detected as the center; The determining, for each edge point in the currently mapped template, the similarity between the currently mapped template and each of the multiple current areas to be detected based on the direction vector of the edge point and the direction vector of each neighboring point of the corresponding point to be detected that has undergone a preset displacement, comprises: For each edge point in the currently mapped template, obtaining a direction vector of the edge point; For each current area to be detected, according to a preset displacement table, uniformly displace the neighboring points of the point to be detected in the area to be detected that corresponds to the edge point, until all displacements described in the displacement table are exhausted; After each uniform displacement, the direction vectors of the neighboring points are obtained, and the average of the cosine distances between the direction vector of the edge point and the direction vectors of the neighboring points is calculated; Determine the maximum mean of the cosine distances as the similarity between the edge point and the corresponding point to be detected; Determine the average of the similarities between each edge point and the corresponding point to be detected as the similarity between the current mapped template and the current area to be detected; Based on the similarity between the current mapped template and each of the multiple current areas to be detected, it is determined whether the target exists in each of the multiple current areas to be detected.

2. The method according to claim 1, characterized in that The acquiring target image template comprises: Acquire a target image of the target as the bottom layer image of the layered target image; Constructing other layer images except the bottom layer image in the layered target image, wherein each layer image is a downsampled image of the next layer image; Based on edge detection of each layer of the image in the layered target image, an image template of each layer of the image is obtained; The step of determining the area to be detected corresponding to the image template based on the image to be detected includes: Obtaining an image to be detected as the bottom layer image of the layered images to be detected; Constructing other layer images except the bottom layer image in the layered image to be detected, wherein the layered image to be detected has the same number of layers as the layered target image, wherein each layer image except the bottom layer image in the layered image to be detected is a downsampled image of the next layer image; The image template of the top layer image in the layered target image is used as the current mapped template, the top layer image of the layered image to be detected is used as the current mapping target image, and the current mapped template is mapped onto the current mapping target image according to different mapping rules, and the areas occupied by the respective images are used as multiple current areas to be detected; The step of determining the points to be detected in the area to be detected that correspond one-to-one to the edge points comprises: Determine each of the plurality of current to-be-detected areas and each of the to-be-detected points corresponding one-to-one to each of the edge points; After determining whether the target exists in each of the multiple current areas to be detected based on the similarity between the current mapped template and each of the multiple current areas to be detected, the method further includes: If it is determined that the target exists in a current area to be detected, the current mapped template is updated with the next layer image of the current mapped template in the layered target image, the current mapped target image is updated with the next layer image of the current mapped target image, and the current mapped template is mapped onto the current mapped target image according to different mapping rules, and the multiple current areas to be detected are updated respectively with the areas occupied by the respective ones; Determine the points to be detected in the multiple current areas to be detected that correspond one to one to the edge points of the currently mapped template; For each edge point in the currently mapped template, based on the direction vector of the edge point and the direction vectors of the neighboring points of the corresponding point to be detected that are shifted by a preset value, determine the similarity between the currently mapped template and each of the multiple current areas to be detected; If the similarity between the current mapped template and a region to be detected meets a predetermined condition, it is determined that the target exists in the region to be detected, and the process starting from updating the current mapped template with the next layer image of the current mapped template in the layered target image is repeated until the bottom layer image of the layered image to be detected is reached, and the region to be detected where the target exists in the bottom layer image is determined as the target positioning area.

3. The method according to claim 2, characterized in that The step of obtaining an image template of each layer of the image based on edge detection of each layer of the layered target image comprises: Perform edge detection on each layer of the layered target image to determine the edge points contained in each layer of the image; According to the edge point information items described by the preset image template, each edge point information contained in each layer of image is stored according to the edge point information items, and the image templates of each layer of image are obtained respectively.

4. The method according to claim 3, characterized in that The step of performing edge detection on each layer of the layered target image to determine the edge points contained in each layer of the image includes: For each layer of image, use Gaussian filter to filter; Determining a direction vector for each pixel in the filtered image; Based on the direction vector of each pixel, non-maximum suppression is applied to each pixel, so as to determine the candidate edge points from the pixels subjected to non-maximum suppression; Based on the direction vector of each candidate edge point, double threshold detection is applied to each candidate edge point and marked accordingly; Based on the mark of each candidate edge point, each candidate edge point is screened to determine the edge points included in the image.

5. The method according to claim 2, characterized in that: According to different mapping rules, the currently mapped template is mapped onto the currently mapped target image, and the areas occupied by the currently mapped template are respectively used as multiple current areas to be detected, including: According to the preset sliding rule, the currently mapped template is used as a sliding window to slide on the currently mapped target image. Each time it slides, the area occupied by the currently mapped template mapped to the currently mapped target image is used as a current area to be detected.

6. The method according to claim 1, characterized in that Before determining the similarity between the current mapped template and each of the multiple current to-be-detected areas based on the direction vector of each edge point in the current mapped template and the direction vector of each neighboring point of the corresponding to-be-detected point after a preset displacement, the method includes: According to a preset rotation retrieval table, the direction vector of each edge point in the image template is rotated accordingly to update the direction vector of each edge point. The rotation retrieval table describes the rotation operation on the direction vector of the edge point.

7. The method according to claim 1, characterized in that The determining whether the target exists in each of the multiple current areas to be detected based on the similarity between the current mapped template and each of the multiple current areas to be detected comprises: If the similarity between the current mapped template and the current area to be detected is greater than a predetermined threshold, it is determined that the target exists in the current area to be detected.

8. A terminal for identifying an object in an image, characterized in that: The terminal comprises: An acquisition module, used for acquiring an image template of the target, wherein the image template describes edge points of the target; A first determination module is used to determine, based on the image to be detected, a region to be detected corresponding to the image template, and determine each point to be detected in the region to be detected that corresponds one-to-one to each edge point; A second determination module is used to determine, for each edge point in the current mapped template, a similarity between the current mapped template and each of the multiple current to-be-detected areas based on a direction vector of the edge point and a direction vector of each neighboring point of the corresponding to-be-detected point after a preset displacement; The currently mapped template is the image template of the topmost image in the hierarchical target image; the hierarchical target image includes multiple layers of images, the bottommost image is the target image of the target, and each layer of images in the layers other than the bottommost image is a downsampled image of the next layer of image; the multiple current areas to be detected are the areas occupied by mapping the currently mapped template to the current mapping target image according to different mapping rules; the current mapping target image is the topmost image of the hierarchical image to be detected; the hierarchical image to be detected includes multiple layers of images, the bottommost image is the image to be detected, and each layer of images in the layers other than the bottommost image is a downsampled image of the next layer of image; the neighboring points include each pixel point within a preset radius on the current mapping target image, with the corresponding point to be detected as the center; The second determination module is used to determine, for each edge point in the current mapped template, the similarity between the current mapped template and each of the multiple current areas to be detected based on the direction vector of the edge point and the direction vector of each neighboring point of the corresponding point to be detected after a preset displacement, specifically for: For each edge point in the currently mapped template, obtaining a direction vector of the edge point; For each current area to be detected, according to a preset displacement table, uniformly displace the neighboring points of the point to be detected in the area to be detected that corresponds to the edge point, until all displacements described in the displacement table are exhausted; After each uniform displacement, the direction vectors of the neighboring points are obtained, and the average of the cosine distances between the direction vector of the edge point and the direction vectors of the neighboring points is calculated; Determine the maximum mean of the cosine distances as the similarity between the edge point and the corresponding point to be detected; Determine the average of the similarities between each edge point and the corresponding point to be detected as the similarity between the current mapped template and the current area to be detected; The third determination module is used to determine whether the target exists in each of the multiple current areas to be detected based on the similarity between the current mapped template and each of the multiple current areas to be detected.

9. A terminal for identifying an object in an image, characterized in that: include: a memory storing computer-readable instructions; A processor reads the computer readable instructions stored in the memory to execute the method according to any one of claims 1 to 7.

10. A computer program medium, characterized in that Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image matching algorithm of bonding point characteristic and line characteristic

    CN104915949A

  • A method and apparatus for identifying a target object

    CN109101982A