Target center position detection method, device, computer equipment and storage medium
By determining the weight of the judgment area and edge pixels in the detection of light spots and reflective marking points, and calculating the target center position information, the problem of target center position detection deviation in the existing technology is solved, and the detection precision and accuracy are improved.
Patent Information
- Application Number
- CN202210667118.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-13
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-06-13
AI Technical Summary
In the existing technology, in the detection of bright targets such as light spots and reflective marking points, the detection of the center position of the target is easily affected by the uniformity of illumination and the aging of the marking points, resulting in detection deviation.
By obtaining the image to be detected, it is determined that the gray value of the central pixel in the judgment area is less than the preset binarization threshold, and the central pixel is determined based on the edge pixels around the central pixel, combining the first pixel and the third pixel of the image to be detected. Two pixels, calculate the center position information of the target to be detected, and use the weight formula to improve detection accuracy.
It effectively improves the detection accuracy of the target center position, reduces deviation problems caused by illumination uniformity and aging of marking points, and improves detection accuracy.
Smart Images

Figure CN114926455B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of visual image processing, and in particular to a method, device, computer equipment and storage medium for detecting the center position of a target. Background Art
[0002] For the detection of bright targets such as light spots and reflective marking points, a dark background is mainly used in the visual imaging process.
[0003] Related technologies, for the detection of bright targets such as light spots and reflective marking points, include the detection of the target center position, wherein the target center position is mainly determined by the centroid method; however, the centroid method will be affected by the uniformity of lighting, the aging of reflective marking points, etc., resulting in deviations in the detected target center position. Summary of the invention
[0004] In order to solve the problem of deviation in the center position of a detected target, the present application provides a method, apparatus, computer equipment and storage medium for detecting the center position of a target.
[0005] The embodiment of the present application is implemented as follows:
[0006] A first aspect of an embodiment of the present application provides a method for detecting a center position of a target, comprising:
[0007] Acquire the image to be detected;
[0008] Determine a judgment area in the image to be detected, wherein the grayscale value of the central pixel point of the judgment area is less than a preset binarization threshold;
[0009] Based on edge pixels around the central pixel, the central pixel is determined to be the first pixel, wherein the grayscale value of the edge pixel is greater than or equal to a preset binarization threshold;
[0010] Based on the first pixel point and the second pixel point of the image to be detected, the target to be detected and the central position information of the target to be detected are determined, wherein the gray value of the second pixel point is greater than or equal to a preset binarization threshold.
[0011] In a possible manner, after determining the central pixel point as the first pixel point based on edge pixels around the central pixel point, the method further includes:
[0012] Determine the weight of the first pixel.
[0013] In one possible manner, in the step of determining the weight of the first pixel, the method further includes:
[0014] When the number of edge pixels is equal to 1, the intermediate weight is determined according to the corresponding edge pixels;
[0015] The weight of the first pixel is the intermediate weight.
[0016] In one possible manner, in the step of determining the weight of a second pixel point among the pixel points, the method further includes:
[0017] When the number of edge pixels is greater than 1, determine the intermediate weight of each corresponding edge pixel;
[0018] The weight of the first pixel is the average of all intermediate weights; or,
[0019] The weight of the first pixel is the maximum value of all intermediate weights.
[0020] In one possible approach, the intermediate weight is calculated according to the following formula:
[0021]
[0022] In the formula, ω o is the intermediate weight, T is the preset binarization threshold, d o is the gray value of the edge pixel, and D is the gray value of the first pixel.
[0023] In one possible manner, in the step of determining the target to be detected based on the first pixel point and the second pixel point of the image to be detected, the method further includes:
[0024] The first pixel point and the second pixel point are analyzed based on the connected domain to determine the target to be detected.
[0025] In a possible manner, in determining the target to be detected and the central position information of the target to be detected based on the first pixel point and the second pixel point of the image to be detected, the method further includes:
[0026] Determine a weight of a first pixel and a weight of a second pixel;
[0027] Among them, the center position information of the target to be detected is calculated according to the following formula:
[0028]
[0029] In the formula, x i is the row coordinate of the pixel point in the area where the target to be detected is located, y i is the column coordinate of the pixel point in the area where the target to be detected is located, M is the number of pixel points in the area where the target to be detected is located, that is, the sum of the number of the first pixel points and the number of the second pixel points, ω i is the weight of the pixel point in the area where the target to be detected is located, X is the row coordinate of the center position information of the target to be detected, and Y is the column coordinate of the center position information of the target to be detected.
[0030] A second aspect of an embodiment of the present application provides a device for detecting a center position of a target, comprising:
[0031] An acquisition module, used for acquiring an image to be detected;
[0032] An analysis module is used to determine a judgment area in the image to be detected, wherein the grayscale value of the central pixel point of the judgment area is less than a preset binarization threshold;
[0033] The analysis module is further used to determine the central pixel as the first pixel based on edge pixels of the judgment area around the central pixel, wherein the grayscale value of the edge pixel is greater than or equal to a preset binarization threshold;
[0034] The detection module is used to determine the target to be detected and the central position information of the target to be detected based on the first pixel point and the second pixel point of the image to be detected, wherein the grayscale value of the second pixel point is greater than or equal to a preset binarization threshold.
[0035] A third aspect of an embodiment of the present application provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned target center position detection method.
[0036] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor executes the steps of the above-mentioned target center position detection method.
[0037] The beneficial effects of the present application are as follows: by determining the judgment area in the image to be detected, the grayscale value of the central pixel point of the judgment area is less than the preset binarization threshold, so as to realize the judgment of the edge area of the target to be detected in the image to be detected; further based on the edge pixel points around the central pixel point, the central pixel point can be determined as the first pixel point; further based on the first pixel point and the second pixel point of the image to be detected, the target to be detected and the central position information of the target to be detected can be determined. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] 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.
[0039] Figure 1 A schematic diagram showing a flow chart of a method for detecting a target center position according to an embodiment of the present application is shown;
[0040] Figure 2 Another schematic diagram of a flow chart of a method for detecting a target center position according to another embodiment of the present application is shown;
[0041] Figure 3 A schematic diagram of the process of S140 in a method for detecting a target center position according to another embodiment of the present application is shown;
[0042] Figure 4 A schematic structural diagram of a target center position detection device according to another embodiment of the present application is shown;
[0043] Figure 5 A block diagram of a computer device according to another embodiment of the present application is shown. DETAILED DESCRIPTION
[0044] 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, rather than all the embodiments.
[0045] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.
[0046] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.
[0047] The terms "comprises," "comprising," 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.
[0048] The detection method of the center position of the target may include a centroid method and a centroid method, wherein the weights of all pixels in the target area calculated by the centroid method are the same, and the weights of all pixels in the target area calculated by the centroid method are the grayscale values of the image.
[0049] Among them, the centroid method is affected by the different target segmentation results, resulting in low repeatability of target detection, and the centroid method is affected by the uneven distribution of target grayscale values, resulting in deviation of the target center.
[0050] To improve the accuracy of target center position detection, an embodiment of the present application provides a method for detecting the target center position, by acquiring an image to be detected; determining a judgment area in the image to be detected, so that the grayscale value of the central pixel of the determined judgment area is less than a preset binarization threshold. In addition, because the grayscale value of the edge pixel is greater than or equal to the preset binarization threshold, the edge pixel points on the periphery of the central pixel point determine that the central pixel point is the first pixel point. In addition, through the first pixel point and the second pixel point of the image to be detected (the grayscale value of the second pixel point is greater than or equal to the preset binarization threshold), the target to be detected and the central position information of the target to be detected are determined, and the problem of deviation of the central position of the target to be detected is improved.
[0051] The following is a detailed description of the target center position detection method, device, computer equipment and storage medium of the embodiments of the present application in conjunction with the accompanying drawings.
[0052] Figure 1 is a flow chart of a method for detecting the center position of a target provided in an embodiment of the present application, such as Figure 1 As shown, an embodiment of the present application provides a method for detecting the center position of a target.
[0053] Specifically, the detection method comprises the following steps:
[0054] S110: Acquire an image to be detected.
[0055] It should be noted that the image to be detected may include but is not limited to images of targets such as light spots and / or reflective marking points (Marker points).
[0056] In some examples, the light spot may be a circular light spot or a square light spot; the marker point may be a circle or other set graphics. Generally, the target in the above-mentioned image to be detected is a bright target, and the background in the image to be detected is a dark background.
[0057] S120, determining a determination area in the image to be detected, wherein the grayscale value of a central pixel point in the determination area is less than a preset binarization threshold.
[0058] Among them, when the judgment area has a pixel point at the center position, the central pixel point can be the pixel point at the center position of the judgment area; when the judgment area does not have a pixel point at the center position, the central pixel point can be a pixel point in the judgment area close to the center position.
[0059] It can be understood that the determination area can be, but is not limited to, a square area or a cross-shaped area.
[0060] For example, when the judgment area is a 5*5 pixel area, the center pixel point can be the pixel point in the 3rd row and 3rd column in the judgment area; when the judgment area is a 2*2 pixel area, the center pixel point can be the pixel point in the 2nd row and 2nd column in the judgment area; when the judgment area is a 4*4 pixel area, the center pixel point can be the pixel point in the 3rd row and 3rd column in the judgment area.
[0061] S130. Determine the central pixel as a first pixel based on edge pixels around the central pixel, wherein the grayscale value of the edge pixel is greater than or equal to a preset binarization threshold.
[0062] The edge pixels are other pixels in the judgment area except the center pixel whose grayscale value is greater than or equal to the preset binary threshold. That is, the edge pixels are in the judgment area and the grayscale value of the edge pixels is greater than or equal to the preset binary threshold.
[0063] It can be understood that when there are edge pixels around the central pixel, the central pixel at this time is the first pixel.
[0064] S140, determining the target to be detected and the central position information of the target to be detected based on the first pixel point and the second pixel point of the image to be detected, wherein the grayscale value of the second pixel point is greater than or equal to a preset binarization threshold.
[0065] There may be one or more targets to be detected in the image to be detected.
[0066] By determining the judgment area in the image to be detected, and the grayscale value of the central pixel point of the judgment area is less than the preset binarization threshold, the edge area of the target to be detected in the image to be detected can be determined; further based on the edge pixel points around the central pixel point, the central pixel point can be determined as the first pixel point; further based on the first pixel point and the second pixel point of the image to be detected, the target to be detected and the central position information of the target to be detected can be determined, thereby improving the central position of the target to be detected.
[0067] Figure 2 is another flow chart of a method for detecting a target center position provided in an embodiment of the present application, such as Figure 2 As shown, Figure 1 The corresponding examples are different in that, in a feasible manner, after determining the central pixel point as the first pixel point based on the edge pixels around the central pixel point, that is, after step 130, the following steps may be included:
[0068] S131 determines the weight of the first pixel.
[0069] Specifically, in the step of determining the weight of the first pixel in step S131, the following steps may be included:
[0070] When the number of edge pixels is equal to 1, the intermediate weight is determined according to the corresponding edge pixels; the weight of the first pixel is the intermediate weight.
[0071] When the number of edge pixels is greater than 1, the intermediate weight of each corresponding edge pixel is determined; the weight of the first pixel is the average of all the intermediate weights.
[0072] When the number of edge pixels is greater than 1, the weight of the first pixel being the average of all intermediate weights may be replaced by the weight of the first pixel being the maximum value of all intermediate weights.
[0073] It should be noted that the weight of the first pixel point can be determined by the intermediate weight of each corresponding edge pixel point. In addition to the above average and maximum value methods, the conventional technical means in the cost field can also be replaced.
[0074] In the process of determining the weight of the first pixel in the above steps, the intermediate weight is calculated according to the following formula:
[0075]
[0076] In the formula, ω o is the intermediate weight, T is the preset binarization threshold, d o is the gray value of the edge pixel, and D is the gray value of the first pixel.
[0077] The weight of the first pixel is determined by judging the edge pixel in the area, so that the first pixel can participate in determining the target to be detected.
[0078] Figure 3 is a flow chart of S140 in a method for detecting a target center position provided in an embodiment of the present application, such as Figure 3 As shown, step S140 specifically includes the following steps:
[0079] S141. The first pixel and the second pixel are analyzed by connected domain to determine the target to be detected.
[0080] S142: Determine the central position information of the target to be detected.
[0081] The center position information of the target to be detected includes row coordinates and column coordinates, which are calculated according to the following formula:
[0082]
[0083] In the formula, x i is the row coordinate of the pixel point in the target to be detected, y iis the column coordinate of the pixel point in the target to be detected, M is the number of pixels in the target to be detected, ω i is the weight of the pixel point in the target to be detected, X is the row coordinate of the center position information of the target to be detected, and Y is the column coordinate of the center position information of the target to be detected.
[0084] It should be noted that, based on the gray value being greater than or equal to the preset binarization threshold, a weight of 1 may be assigned to the second pixel to obtain the weight of the second pixel.
[0085] When the grayscale values of other pixels around the central pixel in the judgment area are all less than the preset binarization threshold (that is, there are no edge pixels around the central pixel), the central pixel at this time is the third pixel, and the third pixel can be assigned a weight of 0 to obtain the weight of the third pixel.
[0086] The weight of the first pixel is obtained through step 131 .
[0087] For example, a weight is assigned to each pixel in the image to be detected by presetting a binarization threshold T.
[0088] Specifically: if the pixel point in the image to be detected is greater than or equal to the preset binarization threshold T, the corresponding pixel point is determined to be the second pixel point, and the weight of the second pixel point is assigned to be 1.
[0089] If the pixel in the image to be detected is smaller than the preset binarization threshold T, the corresponding pixel is determined as the central pixel, and the judgment area is determined based on the central pixel.
[0090] The judgment area is a 3*3 pixel window centered on the central pixel, and it is judged whether there is an edge pixel whose grayscale value is greater than or equal to the preset binary threshold T. If so, the central pixel at this time is the first pixel. If not, the central pixel at this time is the third pixel, and the weight of the third pixel is 0.
[0091] The edge pixel points are pixel points whose grayscale values are greater than or equal to a preset binarization threshold and are within the judgment area.
[0092] Specifically: when the number of edge pixels is 1, the weight of the first pixel is calculated by the following formula:
[0093]
[0094] Wherein, ω is the weight of the first pixel, T is the preset binarization threshold, d is the gray value of the edge pixel, and D is the gray value of the first pixel.
[0095] When there are multiple edge pixels, an intermediate weight is determined for each edge pixel, and the average or maximum value of these weights is taken as the weight of the first pixel.
[0096] A connected domain analysis is performed on the first pixel and the second pixel. The connected domain analysis method includes but is not limited to Blob analysis to determine the target to be detected.
[0097] The center position information of the target to be detected is determined according to the gray value of the pixel point in the target to be detected and the corresponding weight, and is calculated according to the following formula:
[0098]
[0099] In the formula, x i is the row coordinate of the pixel point in the target to be detected, y i is the column coordinate of the pixel point in the target to be detected, M is the number of pixels in the target to be detected, ω i is the weight of the pixel point in the target to be detected, X is the row coordinate of the center position information of the target to be detected, and Y is the column coordinate of the center position information of the target to be detected.
[0100] In this embodiment, by determining the judgment area in the image to be detected, the grayscale value of the central pixel point of the judgment area is less than the preset binarization threshold, the edge area of the target to be detected in the image to be detected can be determined; further based on the edge pixel points around the central pixel point, the central pixel point can be determined as the first pixel point; further based on the first pixel point and the second pixel point of the image to be detected, the target to be detected and the central position information of the target to be detected can be determined, thereby improving the central position of the target to be detected.
[0101] Based on the same inventive concept, the embodiment of the present application also provides a device for detecting the target center position of the target center position detection method mentioned above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more version synchronization device embodiments provided below can refer to the limitations on the version synchronization method above, and will not be repeated here.
[0102] Figure 4 is a schematic diagram of a structure of a target center position detection device provided in an embodiment of the present application, such as Figure 4 As shown, the embodiment of the present application provides a detection device 400 for the target center position, including an acquisition module 401, an analysis module 402 and a detection module 403, wherein:
[0103] The acquisition module 401 is used to acquire the image to be detected.
[0104] The analysis module 402 is used to determine the judgment area in the image to be detected, wherein the grayscale value of the central pixel point of the judgment area is less than a preset binarization threshold; and is also used to determine the central pixel point as the first pixel point based on the edge pixel points of the judgment area around the central pixel point, wherein the grayscale value of the edge pixel point is greater than or equal to the preset binarization threshold.
[0105] The detection module 403 is used to determine the target to be detected and the central position information of the target to be detected based on the first pixel point and the second pixel point of the image to be detected, wherein the grayscale value of the second pixel point is greater than or equal to a preset binarization threshold.
[0106] In some embodiments, the analysis module 402 is further used to determine the weight of the first pixel.
[0107] When the number of edge pixels is equal to 1, the intermediate weight is determined according to the corresponding edge pixels; the weight of the first pixel is the intermediate weight.
[0108] When the number of edge pixels is greater than 1, the intermediate weight of each corresponding edge pixel is determined; the weight of the first pixel is the average of all intermediate weights; or, the weight of the first pixel is the maximum value of all intermediate weights.
[0109] In some other embodiments, the detection module 403 is further used to determine the target to be detected based on the connected domain analysis of the first pixel and the second pixel; determine the weight of the first pixel and the weight of the second pixel;
[0110] The detection device for the center position of the target can determine the edge area of the target to be detected in the image to be detected by determining the judgment area in the image to be detected. The grayscale value of the central pixel point of the judgment area is less than the preset binary threshold value; further based on the edge pixel points around the central pixel point, the central pixel point can be determined as the first pixel point; further based on the first pixel point and the second pixel point of the image to be detected, the target to be detected and the center position information of the target to be detected can be determined, thereby improving the center position of the target to be detected.
[0111] Each module in the above device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0112] The method for detecting the center position of a ground target provided in the embodiment of the present application can be applied to a computer device, which can be a server or a terminal. The server can be a single server or a server cluster composed of multiple servers. The embodiment of the present application does not make specific limitations on this. The terminal can be but is not limited to various personal computers, laptops, smart phones, tablet computers and portable devices.
[0113] Figure 5 A block diagram of a computer device is shown, such as Figure 5 As shown, the computer includes a memory and a processor connected via a system bus, wherein the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store version synchronization data.
[0114] Wherein, a computer program is stored in the memory, and when the computer program is executed by the processor, a method for detecting the center position of a target is implemented.
[0115] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the server or terminal to which the solution of the present application is applied. Optionally, the server or terminal may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0116] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0117] Acquire an image to be detected; determine a judgment area in the image to be detected, wherein the grayscale value of a central pixel point in the judgment area is less than a preset binarization threshold; determine the central pixel point as a first pixel point based on edge pixel points around the central pixel point, wherein the grayscale value of the edge pixel point is greater than or equal to the preset binarization threshold; determine a target to be detected and the center position information of the target to be detected based on the first pixel point and a second pixel point of the image to be detected, wherein the grayscale value of the second pixel point is greater than or equal to the preset binarization threshold.
[0118] In some embodiments, after determining the central pixel point as the first pixel point based on edge pixels around the central pixel point, the method further includes: determining a weight of the first pixel point.
[0119] In some embodiments, in the step of determining the weight of the first pixel point, the method further includes: when the number of edge pixels is equal to 1, determining an intermediate weight according to the corresponding edge pixels; the weight of the first pixel point is the intermediate weight.
[0120] In some embodiments, in the step of determining the weight of a second pixel point among the pixel points, the method further includes: when the number of edge pixel points is greater than 1, determining the intermediate weight of each corresponding edge pixel point; the weight of the first pixel point is the average of all intermediate weights; or, the weight of the first pixel point is the maximum value of all intermediate weights.
[0121] In other embodiments, in the step of determining the target to be detected based on the first pixel point and the second pixel point of the image to be detected, the method also includes: determining the target to be detected based on connected domain analysis of the first pixel point and the second pixel point; determining the weight of the first pixel point and the weight of the second pixel point; and determining the central position information of the target to be detected.
[0122] The computer device provided in the embodiment of the present application has similar implementation principles and technical effects to those of the above-mentioned method embodiment, and will not be described in detail here.
[0123] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0124] Acquire an image to be detected; determine a judgment area in the image to be detected, wherein the grayscale value of a central pixel point in the judgment area is less than a preset binarization threshold; determine the central pixel point as a first pixel point based on edge pixel points around the central pixel point, wherein the grayscale value of the edge pixel point is greater than or equal to the preset binarization threshold; determine a target to be detected and the center position information of the target to be detected based on the first pixel point and a second pixel point of the image to be detected, wherein the grayscale value of the second pixel point is greater than or equal to the preset binarization threshold.
[0125] In some embodiments, after determining the central pixel point as the first pixel point based on edge pixels around the central pixel point, the method further includes: determining a weight of the first pixel point.
[0126] In some embodiments, in the step of determining the weight of the first pixel point, the method further includes: when the number of edge pixels is equal to 1, determining an intermediate weight according to the corresponding edge pixels; the weight of the first pixel point is the intermediate weight.
[0127] In some embodiments, in the step of determining the weight of a second pixel point among the pixel points, the method further includes: when the number of edge pixel points is greater than 1, determining the intermediate weight of each corresponding edge pixel point; the weight of the first pixel point is the average of all intermediate weights; or, the weight of the first pixel point is the maximum value of all intermediate weights.
[0128] In other embodiments, in the step of determining the target to be detected based on the first pixel point and the second pixel point of the image to be detected, the method also includes: determining the target to be detected based on connected domain analysis of the first pixel point and the second pixel point; determining the weight of the first pixel point and the weight of the second pixel point; and determining the central position information of the target to be detected.
[0129] The computer-readable storage medium provided in this embodiment has similar implementation principles and technical effects to those of the above method embodiments, and will not be described in detail here.
[0130] The following paragraphs will compare and list the Chinese terms involved in this application specification and their corresponding English terms to facilitate reading and understanding.
[0131] For the convenience of explanation, the above description has been made in conjunction with specific embodiments. However, the above discussion in some embodiments is not intended to be exhaustive or limit the embodiments to the specific forms disclosed above. According to the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.
Claims
1. A method for detecting the center position of a target, characterized in that: include: Acquire the image to be detected; Determine a judgment area in the image to be detected, wherein the grayscale value of a central pixel point of the judgment area is less than a preset binarization threshold; Based on edge pixels around the central pixel, the central pixel is determined to be a first pixel, wherein the edge pixel is a pixel whose gray value is greater than or equal to the preset binarization threshold and is within the judgment area; Determine the target to be detected and the center position information of the target to be detected based on the first pixel point and the second pixel point of the image to be detected, wherein the second pixel point is a pixel point in the image to be detected whose grayscale value is greater than or equal to the preset binarization threshold; The center position information of the target to be detected is calculated according to the following formula: In the formula, x i is the row coordinate of the pixel point in the area where the target to be detected is located, .y i is the column coordinate of the pixel point in the area where the target to be detected is located, M is the number of pixel points in the area where the target to be detected is located, that is, the sum of the number of the first pixel points and the number of the second pixel points, ω i is the weight of the pixel point in the area where the target to be detected is located, X is the row coordinate of the center position information of the target to be detected, and Y is the column coordinate of the center position information of the target to be detected.
2. The method for detecting the target center position according to claim 1, characterized in that: After determining that the central pixel is the first pixel based on the edge pixels around the central pixel, the method further includes: Determine the weight of the first pixel.
3. The method for detecting the target center position according to claim 2, characterized in that: In the step of determining the weight of the first pixel, the method further includes: When the number of edge pixels is equal to 1, the intermediate weight is determined according to the corresponding edge pixels; The weight of the first pixel is the intermediate weight.
4. The method for detecting the target center position according to claim 1, characterized in that: In the step of determining the weight of the first pixel, the method further includes: When the number of edge pixels is greater than 1, determine the intermediate weight of each corresponding edge pixel; The weight of the first pixel is the average value of all the intermediate weights; or, The weight of the first pixel is the maximum value of all the intermediate weights.
5. The method for detecting the target center position according to claim 3 or 4, characterized in that: The intermediate weight is calculated according to the following formula: In the formula, ω o is the intermediate weight, T is the preset binarization threshold, d o is the gray value of the edge pixel, and D is the gray value of the first pixel.
6. The method for detecting the target center position according to claim 1, characterized in that: In the step of determining the target to be detected based on the first pixel point and the second pixel point of the image to be detected, the method further includes: The first pixel point and the second pixel point determine the target to be detected based on connected domain analysis.
7. The method for detecting the target center position according to claim 1, characterized in that: In determining the target to be detected and the central position information of the target to be detected based on the first pixel point and the second pixel point of the image to be detected, the method further includes: Determine a weight of the first pixel and a weight of the second pixel.
8. A device for detecting the center position of a target, characterized in that: include: An acquisition module, used for acquiring an image to be detected; An analysis module, used to determine a judgment area in the image to be detected, wherein the grayscale value of a central pixel point of the judgment area is less than a preset binarization threshold; The analysis module is further configured to determine that the central pixel is a first pixel based on edge pixels around the central pixel, wherein the edge pixel is a pixel having a gray value greater than or equal to the preset binarization threshold and within a determination area; A detection module, used to determine the target to be detected and the central position information of the target to be detected based on the first pixel point and the second pixel point of the image to be detected, wherein the second pixel point is a pixel point in the image to be detected whose grayscale value is greater than or equal to the preset binarization threshold; The center position information of the target to be detected is calculated according to the following formula: In the formula, x i is the row coordinate of the pixel point in the area where the target to be detected is located, y i is the column coordinate of the pixel point in the area where the target to be detected is located, M is the number of pixel points in the area where the target to be detected is located, that is, the sum of the number of the first pixel points and the number of the second pixel points, ω i is the weight of the pixel point in the area where the target to be detected is located, X is the row coordinate of the center position information of the target to be detected, and Y is the column coordinate of the center position information of the target to be detected.
9. A computer device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the target center position detection method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the method for detecting the target center position according to any one of claims 1 to 7.
Citation Information
Patent Citations
Sign image recognition and center coordinate extraction method
CN101846513A
Image recognition system and method
CN114092358A
