Vision-based automatic target reporting method, device, equipment and medium for shooting
Through the visual automatic target reporting method, image correction and deep learning model detection are used to realize high-precision bullet hole target detection and score calculation, solving the accuracy and safety problems of traditional target reporting methods and reducing calculation costs.
Patent Information
- Application Number
- CN202410952744.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-07-16
AI Technical Summary
The traditional manual target reporting method has low accuracy and poor robustness. The deep learning-based algorithm has poor detection of bullet holes in large picture environments, and it is impossible to automatically calculate the number of rings, which poses a safety hazard.
Using the visual-based automatic target reporting method, the image is corrected by image gradient calculation, convex hull algorithm, sliding window cutting and YoLoV5-S model detection, combined with deep learning algorithm and ring value detection, the coordinates and ring value of bullet holes are calculated to achieve High-precision bullet hole target detection and fraction calculation.
It improves the accuracy and robustness of shooting automatic target reporting, reduces the cost of calculating bullet hole scores, enhances safety, and can work effectively in different environments and lighting conditions.
Smart Images

Figure CN118485670B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of automatic target reporting in shooting, and in particular to a vision-based automatic target reporting method, device, equipment and medium for shooting. Background Art
[0002] The problem of target reporting during shooting has gradually become the focus of shooting training. Timely and effective target scoring can help shooters adjust their shooting state and improve their shooting ability. At present, live-fire shooting target reporting mainly adopts two methods: manual target reporting and camera target reporting. Manual target reporting refers to the use of telescopes and other observation equipment by observers. Camera target reporting uses a high-definition camera to shoot the target position in real time, and the safety officer next to it observes the target part-time.
[0003] However, the traditional manual target reporting method has problems such as low accuracy, poor robustness, and high computational cost. At present, the camera target scoring has problems such as the inability to automatically calculate the number of rings, the need for security personnel to be distracted and observe, and the existence of safety hazards. Most mainstream deep learning-based algorithms directly learn the entire image, and do not have a good solution to the problem of small bullet holes in a large image environment; the images for learning have not been calibrated, and no clear scoring method has been proposed. Summary of the invention
[0004] Based on this, it is necessary to provide a vision-based automatic shooting target reporting method, device, equipment and medium that can achieve high-precision bullet hole target detection and reduce the cost of bullet hole score calculation in order to address the above technical problems.
[0005] A vision-based automatic target reporting method for shooting, the method comprising:
[0006] Acquire the captured target paper image; calculate the image gradient of the target paper image, select pixel points with the same or similar image gradient direction, connect the pixel points to form a specific line segment, perform angle screening on the specific line segment and use the convex hull algorithm to find the minimum convex polygon that can surround all the pixel points; perform perspective transformation on the minimum convex polygon to obtain the corrected image;
[0007] Sliding windows and overlapping areas are set on the rectified image to perform image cutting to obtain multiple small images. Target detection is performed on the small images according to the YoLoV5-S target detection model. If a target is detected, the corresponding window is marked as the target area and the overlapping window is processed by the non-maximum suppression method so that each target is detected only once.
[0008] The ring value of the bullet hole in the target area is determined, and the target area is detected according to the deep learning target detection algorithm to obtain the coordinate bounding box of the bullet hole and the coordinate bounding box of the ring value number; a mask is made for the digital part of the coordinate bounding box and then the mask is used to obtain a new frame;
[0009] The coordinates of the center point of the target paper are calculated according to the center coordinates of the ring value numbers in the new frame; the radius of the ring of each score and the radius of the center circle are calculated according to the distance from the coordinates of the center point of the target paper to the center coordinates of the ring value numbers; the ring line is set according to the radius of the ring of each score and the radius of the center circle;
[0010] Calculate the distance between the center coordinates of the bullet hole in the coordinate boundary box and the coordinates of the center point of the target paper, compare the distance with the ring line, and obtain the ring value of the bullet hole.
[0011] In one embodiment, threshold segmentation is performed on the target paper image to convert the original image into a binary image; expansion and erosion operations are performed on the binary image to obtain an eroded image;
[0012] Perform edge detection on the eroded image according to the candy function and the sorted function to obtain the maximum edge of the target surface; fill the maximum edge of the target surface with white, and the obtained filled area is the target surface area;
[0013] Determine whether the center coordinates of the coordinate bounding box of the detected bullet hole are on the target surface area. If the bullet hole coordinates are not on the target surface area, the score is counted as 0.
[0014] In one embodiment, calculating the image gradient of the target paper image includes:
[0015] The image gradient of the target paper image is calculated and the image gradient is obtained as
[0016]
[0017] in, and The images are exist Direction and Direction gradient.
[0018] In one embodiment, the calculation formula for the starting position of the sliding window is:
[0019]
[0020]
[0021] in, x , y are the starting position coordinates of the sliding window, corresponding to the width and height respectively, Indicates the width of the original image. and m Represents the row and column information of the sliding window, represents the size of the sliding window, represents the overlapping part between sliding windows, represents a natural number, Indicates the height of the original image. Represents an integer.
[0022] In one embodiment, the coordinates of the center point of the target paper are calculated based on the center coordinates of the ring value numbers in the new frame, including:
[0023] The coordinates of the center point of the target paper are calculated based on the center coordinates of the ring value numbers in the new frame:
[0024]
[0025]
[0026] in, represents the coordinates of the center point of the target paper, Indicates the center coordinates of the ring value number.
[0027] A vision-based automatic target reporting device for shooting, comprising:
[0028] The image preprocessing module is used to obtain the captured target paper image; calculate the image gradient of the target paper image, screen out the pixels with the same or similar image gradient direction, connect the pixels to form a specific line segment, screen the angle of the specific line segment, and use the convex hull algorithm to find the minimum convex polygon that can surround all the pixels; perform perspective transformation on the minimum convex polygon to obtain the corrected image;
[0029] The image detection module is used to set sliding windows and overlapping areas on the rectified image to perform image cutting to obtain multiple small images; the small images are subjected to target detection according to the YoLoV5-S target detection model. If a target is detected, the corresponding window is marked as the target area and the overlapping windows are processed by the non-maximum suppression method so that each target is detected only once;
[0030] The bounding box extraction module is used to determine the ring value of the bullet hole in the target area, detect the target area according to the deep learning target detection algorithm, obtain the coordinate bounding box of the bullet hole and the coordinate bounding box of the ring value number; make a mask for the digital part of the coordinate bounding box and then use the mask to obtain a new border;
[0031] The loop line setting module is used to calculate the coordinates of the center point of the target paper according to the center coordinates of the ring value numbers in the new frame; calculate the radius of the ring of each score and the radius of the center circle according to the distance from the coordinates of the center point of the target paper to the center coordinates of the ring value numbers; and set the loop line according to the radius of the ring of each score and the radius of the center circle;
[0032] The bullet hole ring value determination module is used to calculate the distance between the center coordinates in the coordinate boundary box of the bullet hole and the coordinates of the center point of the target paper, compare the distance with the ring line, and obtain the ring value of the bullet hole.
[0033] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0034] Acquire the captured target paper image; calculate the image gradient of the target paper image, select pixel points with the same or similar image gradient direction, connect the pixel points to form a specific line segment, perform angle screening on the specific line segment and use the convex hull algorithm to find the minimum convex polygon that can surround all the pixel points; perform perspective transformation on the minimum convex polygon to obtain the corrected image;
[0035] Sliding windows and overlapping areas are set on the rectified image to perform image cutting to obtain multiple small images. Target detection is performed on the small images according to the YoLoV5-S target detection model. If a target is detected, the corresponding window is marked as the target area and the overlapping window is processed by the non-maximum suppression method so that each target is detected only once.
[0036] The ring value of the bullet hole in the target area is determined, and the target area is detected according to the deep learning target detection algorithm to obtain the coordinate bounding box of the bullet hole and the coordinate bounding box of the ring value number; a mask is made for the digital part of the coordinate bounding box and then the mask is used to obtain a new frame;
[0037] The coordinates of the center point of the target paper are calculated according to the center coordinates of the ring value numbers in the new frame; the radius of the ring of each score and the radius of the center circle are calculated according to the distance from the coordinates of the center point of the target paper to the center coordinates of the ring value numbers; the ring line is set according to the radius of the ring of each score and the radius of the center circle;
[0038] Calculate the distance between the center coordinates of the bullet hole in the coordinate boundary box and the coordinates of the center point of the target paper, compare the distance with the ring line, and obtain the ring value of the bullet hole.
[0039] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0040] Acquire the captured target paper image; calculate the image gradient of the target paper image, select pixel points with the same or similar image gradient direction, connect the pixel points to form a specific line segment, perform angle screening on the specific line segment and use the convex hull algorithm to find the minimum convex polygon that can surround all the pixel points; perform perspective transformation on the minimum convex polygon to obtain the corrected image;
[0041] Sliding windows and overlapping areas are set on the rectified image to perform image cutting to obtain multiple small images. Target detection is performed on the small images according to the YoLoV5-S target detection model. If a target is detected, the corresponding window is marked as the target area and the overlapping window is processed by the non-maximum suppression method so that each target is detected only once.
[0042] The ring value of the bullet hole in the target area is determined, and the target area is detected according to the deep learning target detection algorithm to obtain the coordinate bounding box of the bullet hole and the coordinate bounding box of the ring value number; a mask is made for the digital part of the coordinate bounding box and then the mask is used to obtain a new frame;
[0043] The coordinates of the center point of the target paper are calculated according to the center coordinates of the ring value numbers in the new frame; the radius of the ring of each score and the radius of the center circle are calculated according to the distance from the coordinates of the center point of the target paper to the center coordinates of the ring value numbers; the ring line is set according to the radius of the ring of each score and the radius of the center circle;
[0044] Calculate the distance between the center coordinates of the bullet hole in the coordinate boundary box and the coordinates of the center point of the target paper, compare the distance with the ring line, and obtain the ring value of the bullet hole.
[0045] The above-mentioned vision-based automatic target reporting method, device, equipment and medium for shooting, the present application detects and extracts line segments of a specific length from the target paper image based on a straight line segment detection algorithm, and then finds the contour with the largest area based on these line segments, and corrects the original image through polygon fitting and perspective transformation to eliminate the distortion in the image and the tilt correction of the target surface image, so that the target paper image is more in line with the actual situation, thereby improving the accuracy of subsequent target detection, and then based on the YoLoV5-S model, a sliding window cutting technology is proposed to cut the large-scale target surface image into small pieces, thereby realizing accurate detection of bullet hole targets in high-resolution target surface images; finally, a method based on digital detection of target surface ring value is proposed to determine the ring value, and the ring value is determined by fitting the center and radius of the target surface ring, and then the bullet hole score calculation is realized in combination with the center coordinates of the bullet hole target, which greatly reduces the bullet hole score calculation cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A schematic diagram of a flow chart of a vision-based automatic target reporting method for shooting in one embodiment;
[0047] Figure 2 Schematic diagram of the result of image correction in one embodiment; wherein (a) and (c) are target paper images before correction, and (b) and (d) are target paper images after correction;
[0048] Figure 3 A schematic diagram of the target paper image size and the bullet hole small target size in one embodiment;
[0049] Figure 4 Schematic diagram of the whole process of sliding window cutting in another embodiment; wherein (a) is a schematic diagram of the initial sliding window, (b) is a schematic diagram of the first column of sliding window, (c) is a schematic diagram of the second column of sliding window, (d) is a schematic diagram of the last column of sliding window, (e) is a complete sliding window path diagram, and (f) is a display of three cut blocks in the complete sliding window path diagram;
[0050] Figure 5 A schematic diagram of target detection results based on deep learning in one embodiment;
[0051] Figure 6 A schematic diagram of a new block result of making a mask in one embodiment;
[0052] Figure 7 A schematic diagram of a detection result after optimization processing in one embodiment;
[0053] Figure 8 A schematic diagram of the fitting results of a ring and a circle center in one embodiment;
[0054] Fig. 9 A schematic diagram of a comparison of the target surface center and the true circle center obtained by digital detection and traditional methods in one embodiment;
[0055] Fig.10 A schematic diagram of bullet holes and circular ring radius results in a target surface image in one embodiment;
[0056] Fig.11 It is a structural block diagram of a vision-based automatic target reporting device for shooting in one embodiment;
[0057] Fig.12 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0059] In one embodiment, Figure 1 As shown, a vision-based automatic shooting target reporting method is provided, comprising the following steps:
[0060] Step 102, obtaining the captured target paper image; calculating the image gradient of the target paper image, screening out pixels with the same or similar image gradient direction, connecting the pixels to form specific line segments, performing angle screening on the specific line segments, and using the convex hull algorithm to find the minimum convex polygon that can surround all the pixels; performing perspective transformation on the minimum convex polygon to obtain a corrected image.
[0061] First, the image gradient of the target paper image is calculated to identify and screen out pixels with the same or similar gradient direction, and then these points are effectively connected to form line segments. Compared with traditional edge detection methods, this application has significant advantages, especially good at capturing slender line segments in images, and realizes more comprehensive and detailed recognition of image line segments. Then, by combining length and angle, the specific line segments are screened for angles, which can accurately fit to the boundaries of the target paper image.
[0062] In the process of polygon fitting, the convex hull algorithm is used to find the smallest convex polygon that can enclose all points. Then, this convex polygon is used to approximate the target area in the original image. The mathematical expression of polygon fitting can be expressed as:
[0063]
[0064] in, is a polygon, are the vertices of the polygon, is the number of vertices.
[0065] In perspective transformation, the vertices of the polygon are first sorted to ensure that they are arranged in a specific order (upper left, upper right, lower right, lower left). Subsequently, the original image is perspective transformed according to these sorted vertices to obtain a corrected image. The process of perspective transformation can be expressed as:
[0066]
[0067] in, is a point in the original image, is the transformed point, arrive are the parameters of the transformation matrix, which can be calculated from the four vertices in the original image and the corresponding target vertices.
[0068] The calibration results are as follows Figure 2 As shown, the distorted target surface image correction method designed in this application can not only effectively handle the tilt of the target surface image, but also cope with challenges in different environments. Figure 2 In the figure, (a) and (c) show the target surface images under different background and illumination conditions. It can be clearly seen from these images that the distorted target surface image correction method designed in this application can robustly correct the tilt in the image and is not affected by environmental factors. This shows that the method of this application has strong adaptability and robustness, and can maintain efficient correction effects under various shooting conditions, providing a reliable basis for subsequent data analysis and accurate measurement.
[0069] Step 104, setting sliding windows and overlapping areas on the corrected image to perform image cutting to obtain multiple small-block images; performing target detection on the small-block images according to the YoLoV5-S target detection model, if a target is detected, marking the corresponding window as the target area and processing the overlapping window by the non-maximum suppression method so that each target is detected only once.
[0070] This application uses the YoLov5 model to perform the target surface bullet hole detection task. By taking the target surface bullet holes as the detection target, YoLoV5-S can quickly and accurately identify the location of the bullet holes in the target paper, providing data support for the subsequent shooting scoring task. The number of target pixels of bullet holes in the image only accounts for a very small proportion of the entire image. The problem of information loss is prone to occur during the downsampling of the feature map of the YoLoV5-S detection model. To address this problem, this application performs sliding window cutting on the entire target paper image and divides it into multiple small images, which can reduce the proportion of bullet hole targets in each small image, thereby improving the significance of the target in the feature map.
[0071] Then, bullet hole detection is performed on each small image. By processing each small image individually, the present application can more accurately locate and identify the bullet hole target. After the detection is completed, the detection results of each small image are restored and spliced onto the original large image to restore the complete target paper image and remove any overlapping parts of the detection results. This method effectively solves the problem of bullet hole target information loss and improves the accuracy and robustness of the detection model. Figure 3 As shown, the picture clearly shows that the bullet holes are very small compared to the target paper.
[0072] By sliding a fixed window of a preset size on the image at a uniform speed, the target detection work of the image area within the window coverage is realized. Specifically, it is generally carried out in 4 steps. First, determine the size of the window and the overlapping area. The size of the window is generally a power of 2, such as 128 pixels × 128 pixels, 256 pixels × 256 pixels, etc., which is determined according to the image to be cut. Here we choose 512 pixels × 512 pixels, and the overlapping area size is 128 pixels. The overlapping area is set to prevent the bullet hole target from being cut off during the sliding window cutting process; then slide the window. Start the window from the upper left corner of the image and slide it along the image row by row or column by column. The starting position of each sub-window can be calculated using the following formula.
[0073]
[0074]
[0075] This ensures that the window slides on the image with a certain step size to cover the entire image. The small block image obtained by sliding the window is as follows Figure 4 (a)- Figure 4 (f) As shown; Next is target detection. Target detection is performed on the image in each window. If a target is detected, the window is marked as the target area; Finally, the overlapping windows are processed. During the sliding process, multiple windows may detect the same target. These overlapping windows are processed by the non-maximum suppression method to ensure that each target is detected only once. Figure 4 As shown in the figure, the original image size is 2600 pixels × 2688 pixels. According to the calculation, the last column (except the last one) is 296 pixels × 384 pixels; the last row (except the last one) is 296 pixels × 384 pixels; the last block of the whole image, that is, the lower right corner of the image, is 296 × 384 pixels. (a) The sliding window used is 512 pixels × 512 pixels in size. The size of the last block is calculated; (b) The path diagram of the sliding window for cutting the first column of the image, with an overlap area of 128 pixels between adjacent blocks; (c) The path diagram of the sliding window for cutting the first two columns of the image, with an overlap area of 128 pixels between columns; (d) The path diagram of the sliding window for cutting the last column, the size of the last column is calculated; (e) The complete sliding window path diagram is shown, with a total of 49 blocks; (f) The diagram shows three of the blocks.
[0076] Since the bullet hole target accounts for a small proportion of pixels in the complete target paper image and the features are seriously lost during the downsampling process, it is difficult to directly detect the bullet hole target on the complete target paper image, the detection rate is low, and the confidence of the detected target is low. By adopting the sliding window cutting preprocessing method, the complete large image is decomposed into a series of small images, and these small images are detected separately. Subsequently, the detection results are precisely spliced, which significantly improves the detection accuracy and ensures that the bullet hole target can be detected accurately.
[0077] Step 106, determine the ring value of the bullet hole in the target area, detect the target area according to the deep learning target detection algorithm, obtain the coordinate bounding box of the bullet hole and the coordinate bounding box of the ring value number; make a mask for the digital part of the coordinate bounding box and then use the mask to obtain a new frame.
[0078] In order to further improve the quality of target reporting and prevent environmental factors in extreme environments and improper use of target paper from affecting the correction of target paper, so that the target paper is not a perfect square after correction, this application proposes an algorithm based on circular ring fitting to dynamically detect the center of the circle in real time. The traditional center of the circle estimation directly places a theoretical circular ring coordinate system on the target paper image. This has poor robustness. If there are slight deviations in other steps such as target paper correction, the entire circle may be offset. In order to effectively address this problem, this application proposes a dynamic target paper center detection method based on digital detection technology. In view of the fact that the same numbers on the target paper are symmetrically distributed based on the center point, the center coordinates of the ring value of the number can be used to accurately calculate the specific coordinates of the center point of the target paper. In order to obtain the center coordinates of the ring value numbers, a target detection algorithm based on deep learning is used to detect the numbers on the target surface image to obtain the coordinate bounding boxes of these numbers. The detection results are as follows. Figure 5 As shown in , the obtained coordinate bounding box does not fit the digital outline well, which affects the fitting effect of the diameter and center of the target ring. To solve this problem, a mask is first made for the digital part of the obtained frame, and then a new frame is obtained using the made mask. Figure 6 As shown in the figure, firstly, a mask of the digital part in the original box is made, and then a new box is made using the obtained mask. This outline can more accurately represent the shape and position of the number, thereby improving the accuracy of subsequent processing. The obtained rectangular bounding box can perfectly fit the digital outline on the target surface. The detection result after optimization processing is as follows Figure 7 shown.
[0079] Step 108, calculate the coordinates of the center point of the target paper according to the center coordinates of the ring value numbers in the new frame; calculate the radius of the ring of each score and the radius of the center circle according to the distance from the coordinates of the center point of the target paper to the center coordinates of the ring value numbers; set the ring line according to the radius of the ring of each score and the radius of the center circle.
[0080] The center coordinates of the ring values 6, 7, 8, and 9 on both sides ,in The value of is 1 to 8. By performing a linear fit on these coordinates, we can get the equation of a fitted line:
[0081]
[0082] Since the same number is symmetrical about the center point of the target paper, the obtained straight line overlaps with all the diameters of the target surface ring. In addition, the coordinates of the center point of the target paper can be obtained through the center coordinates of the ring value number. In order to reduce the error, the center coordinates of the ring value number are mapped to the fitted straight line, and the obtained center coordinates are ,in The value of is 1 to 8. Then, the coordinates of the center point of the target paper are It can be calculated by the following formula:
[0083]
[0084]
[0085] According to the distance from the center point coordinates to the center coordinates of the ring value number, the radius of the ring of each score and the radius of the center circle of 10 points can be calculated, so as to draw the ring line. The result is as follows Figure 8 As shown in the figure, Circle Center is the center of the circle, and Point is the center of the ring value.
[0086] In some methods, since the shape and center position of the chest ring target are fixed, a fixed mathematical model is usually used directly to calculate the target center coordinates and the ring radius. However, this method has certain problems. Since the results of the target paper during the calibration process are not completely consistent, directly using the center point coordinates of the theoretical model may cause errors in the fitting process. The present application uses digital detection to obtain the center point coordinates and the ring radius, and its accuracy is better than the method of directly using the theoretical model. There is an error between the center point coordinates obtained by digital detection and the center point coordinates directly using the traditional method. This error can actually make the ring closer to the actual situation, thereby improving accuracy. All 18 images of the test set were selected, and the absolute distance between the center point of the target surface obtained by the method of this application and the actual center point of the target surface, as well as the absolute distance between the center point of the target surface obtained based on the traditional ring detection method and the actual center point of the target surface were calculated. These error values are used to draw the line graph in the figure below. From Fig. 9 It can be seen that the method of the present application performs a certain distance correction when determining the position of the target surface center point compared to the traditional method, thereby achieving higher accuracy. This shows that the method of the present application has better adaptability and accuracy when dealing with practical problems.
[0087] Step 110, calculating the distance between the center coordinates of the bullet hole in the coordinate boundary box and the coordinates of the center point of the target paper, comparing the distance with the ring line, and obtaining the ring value of the bullet hole.
[0088] After obtaining the center coordinates of the bullet hole in the coordinate bounding box. Fig.10 As shown, by further calculating the distance between the bullet hole coordinates and the center point coordinates and comparing them with the preset ring radius, the ring value of the bullet hole can be accurately determined. The present application can achieve accurate ring value determination, effective bullet hole detection and shooting result scoring, and the calculation cost is low.
[0089] In the above-mentioned vision-based automatic target reporting method for shooting, the present application detects and extracts line segments of a specific length from the target paper image based on a straight line segment detection algorithm, and then finds the contour with the largest area based on these line segments, and corrects the original image through polygon fitting and perspective transformation to eliminate the distortion in the image and the tilt correction of the target surface image, so that the target paper image is more in line with the actual situation, thereby improving the accuracy of subsequent target detection. Based on the YoLoV5-S model, a sliding window cutting technology is proposed to cut the large-scale target surface image into small pieces, thereby realizing accurate detection of bullet hole targets in high-resolution target surface images; finally, a method based on digital detection of target surface ring value is proposed to determine the ring value, and the ring value is determined by fitting the center and radius of the target surface ring, and then the bullet hole score calculation is realized in combination with the center coordinates of the bullet hole target, which greatly reduces the bullet hole score calculation cost.
[0090] In one embodiment, threshold segmentation is performed on the target paper image to convert the original image into a binary image; expansion and erosion operations are performed on the binary image to obtain an eroded image;
[0091] Perform edge detection on the eroded image according to the candy function and the sorted function to obtain the maximum edge of the target surface; fill the maximum edge of the target surface with white, and the obtained filled area is the target surface area;
[0092] Determine whether the center coordinates of the coordinate bounding box of the detected bullet hole are on the target surface area. If the bullet hole coordinates are not on the target surface area, the score is counted as 0.
[0093] In a specific embodiment, based on the result of bullet hole detection, the bullet holes on the target paper are scored. There are two cases, one is that the bullet hole is located on the target surface of the target paper, and the other is that the bullet hole is off-target and located in the white background of the target paper. When scoring off-target, since there is a significant difference in color between the target surface area and the background area of the target paper, the color of the target surface area is gray, and the color of the background area is white, the target surface image can be preliminarily screened by threshold segmentation, and further improved by image processing. The specific operation steps are as follows: First, the OTSU method is used to perform threshold segmentation processing on the image, aiming to convert the original image into a binary image. This step is a key link in the image processing process. Through precise calculation, the key information in the image can be effectively extracted. Here, the edge size is defined as 12 pixels, and white is used for filling. This step is intended to determine the foreground and background of the image by adaptive thresholding for subsequent processing. Secondly, the binary image is expanded and eroded to remove the influence of the circular white edge on the segmentation result. This operation helps to smooth the image and eliminate noise, making the subsequent edge detection more accurate. Here, the method in this article uses the candy function for edge detection with thresholds of 100 and 200. Next, find the maximum edge in the image, which should be the edge of the target surface. In the method described in this article, the cv2.findContours function is used to detect contour information in the image. Subsequently, in order to ensure that the acquired contours meet specific requirements, the sorted function is used to accurately filter these contours. Then, fill the maximum edge with white, and the resulting filled area is the target surface area. Overlap the mask with the original image and set the mask to 50% opacity. It can be clearly seen that the mask has a good screening ability for the human-shaped area on the target surface. For bullet holes that are not on the target surface, the maximum inter-class variance method threshold segmentation technique is used to extract the target surface area, which effectively eliminates bullet holes in non-target areas. Finally, the center coordinates of the bounding box of the detected bullet holes are , to determine whether the coordinate is on the target surface area. If the bullet hole coordinate is not on the target surface area, then the score is counted as 0.
[0094] In one embodiment, calculating the image gradient of the target paper image includes:
[0095] The image gradient of the target paper image is calculated and the image gradient is obtained as
[0096]
[0097] in, and The images are exist Direction and Direction gradient.
[0098] In one embodiment, the calculation formula for the starting position of the sliding window is:
[0099]
[0100] in, x , y are the starting position coordinates of the sliding window, corresponding to the width and height respectively, Indicates the width of the original image. and m Represents the row and column information of the sliding window, represents the size of the sliding window, represents the overlapping part between sliding windows, represents a natural number, Indicates the height of the original image. Represents an integer.
[0101] In one embodiment, the coordinates of the center point of the target paper are calculated based on the center coordinates of the ring value numbers in the new frame, including:
[0102] The coordinates of the center point of the target paper are calculated based on the center coordinates of the ring value numbers in the new frame:
[0103]
[0104]
[0105] in, represents the coordinates of the center point of the target paper, Indicates the center coordinates of the ring value number.
[0106] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0107] In one embodiment, Fig.11As shown, a vision-based automatic target reporting device for shooting is provided, comprising: an image preprocessing module 1101, an image detection module 1102, a boundary box extraction module 1103, a loop setting module 1104 and a bullet hole ring value determination module 1105, wherein:
[0108] The image preprocessing module 1101 is used to obtain the captured target paper image; calculate the image gradient of the target paper image, filter out the pixels with the same or similar image gradient direction, connect the pixels to form a specific line segment, filter the angle of the specific line segment, and use the convex hull algorithm to find the minimum convex polygon that can surround all the pixels; perform perspective transformation on the minimum convex polygon to obtain a corrected image;
[0109] The image detection module 1102 is used to set a sliding window and an overlapping area on the corrected image to perform image cutting to obtain multiple small-block images; perform target detection on the small-block images according to the YoLoV5-S target detection model, and if a target is detected, mark the corresponding window as a target area and process the overlapping window by a non-maximum suppression method so that each target is detected only once;
[0110] The bounding box extraction module 1103 is used to determine the ring value of the bullet hole in the target area, detect the target area according to the deep learning target detection algorithm, obtain the coordinate bounding box of the bullet hole and the coordinate bounding box of the ring value number; make a mask for the digital part of the coordinate bounding box and then use the mask to obtain a new frame;
[0111] The loop line setting module 1104 is used to calculate the coordinates of the center point of the target paper according to the center coordinates of the ring value numbers in the new frame; calculate the radius of the ring of each score and the radius of the center circle according to the distance from the coordinates of the center point of the target paper to the center coordinates of the ring value numbers; and set the loop line according to the radius of the ring of each score and the radius of the center circle;
[0112] The bullet hole ring value determination module 1105 is used to calculate the distance between the center coordinates in the coordinate boundary box of the bullet hole and the coordinates of the center point of the target paper, and compare the distance with the ring line to obtain the ring value of the bullet hole.
[0113] For the specific definition of the vision-based automatic target reporting device for shooting, please refer to the definition of the vision-based automatic target reporting method for shooting above, which will not be repeated here. Each module in the above-mentioned vision-based automatic target reporting device for shooting can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0114] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.12 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, 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 and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for automatically reporting a target in shooting based on vision is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0115] Those skilled in the art will understand that Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0116] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0117] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0118] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A vision-based automatic target reporting method for shooting, characterized in that: The method comprises: Acquire the captured target paper image; calculate the image gradient of the target paper image, screen out pixel points with the same or similar image gradient direction, connect the pixel points to form a specific line segment, perform angle screening on the specific line segment and use the convex hull algorithm to find the minimum convex polygon that can surround all the pixel points; perform perspective transformation on the minimum convex polygon to obtain a corrected image; Setting a sliding window and an overlapping area on the corrected image to perform image cutting to obtain a plurality of small-block images; performing target detection on the small-block images according to the YoLoV5-S target detection model, and if a target is detected, marking the corresponding window as a target area and processing the overlapping window by a non-maximum suppression method so that each target is detected only once; The ring value of the bullet hole in the target area is determined, and the target area is detected according to the deep learning target detection algorithm to obtain the coordinate bounding box of the bullet hole and the coordinate bounding box of the ring value number; a mask is made for the digital part of the coordinate bounding box and then a new frame is obtained by using the mask; the new frame can fit the digital contour on the target surface; The coordinates of the center point of the target paper are calculated according to the center coordinates of the ring value numbers in the new frame; the radius of the ring of each score and the radius of the center circle are calculated according to the distance from the coordinates of the center point of the target paper to the center coordinates of the ring value numbers; and the ring line is set according to the radius of the ring of each score and the radius of the center circle; The distance between the center coordinates in the coordinate boundary box of the bullet hole and the coordinates of the center point of the target paper is calculated, and the distance is compared with the ring line to obtain the ring value of the bullet hole.
2. The method for automatic target reporting based on vision according to claim 1, characterized in that: The method further comprises: Performing threshold segmentation processing on the target paper image to convert the original image into a binary image; performing expansion and corrosion operations on the binary image to obtain a corroded image; Perform edge detection on the eroded image according to the candy function and the sorted function to obtain the maximum edge of the target surface; fill the maximum edge of the target surface with white, and the obtained filled area is the target surface area; Determine whether the center coordinates of the coordinate bounding box of the detected bullet hole are on the target surface area. If the bullet hole coordinates are not on the target surface area, the score is counted as 0.
3. The vision-based automatic shooting target reporting method according to claim 1, characterized in that: Calculating the image gradient of the target paper image includes: The image gradient of the target paper image is calculated to obtain the image gradient: in, and The images are exist Direction and Direction gradient.
4. The method for automatic target reporting based on vision according to claim 1, characterized in that: The calculation formula for the starting position of the sliding window is: in, x , y are the starting position coordinates of the sliding window, corresponding to the width and height respectively, Indicates the width of the original image. and m Represents the row and column information of the sliding window, represents the size of the sliding window, represents the overlapping part between sliding windows, represents a natural number, Indicates the height of the original image. Represents an integer.
5. The vision-based automatic shooting target reporting method according to claim 1, characterized in that: The coordinates of the center point of the target paper are calculated according to the center coordinates of the ring value numbers in the new frame, including: The coordinates of the center point of the target paper are calculated based on the center coordinates of the ring value numbers in the new frame: in, represents the coordinates of the center point of the target paper, Indicates the center coordinates of the ring value number.
6. A vision-based automatic target reporting device for shooting, characterized in that: The device comprises: An image preprocessing module is used to obtain a captured target paper image; calculate the image gradient of the target paper image, screen out pixels with the same or similar image gradient direction, connect the pixels to form a specific line segment, perform angle screening on the specific line segment, and use a convex hull algorithm to find the minimum convex polygon that can surround all the pixels; perform perspective transformation on the minimum convex polygon to obtain a corrected image; An image detection module is used to set a sliding window and an overlapping area on the corrected image to perform image cutting to obtain multiple small images; perform target detection on the small images according to the YoLoV5-S target detection model, and if a target is detected, mark the corresponding window as a target area and process the overlapping window by a non-maximum suppression method so that each target is detected only once; A bounding box extraction module is used to determine the ring value of the bullet hole in the target area, detect the target area according to the deep learning target detection algorithm, obtain the coordinate bounding box of the bullet hole and the coordinate bounding box of the ring value number; make a mask for the digital part of the coordinate bounding box and then use the mask to obtain a new frame; the new frame can fit the digital contour on the target surface; A loop line setting module, used to calculate the coordinates of the center point of the target paper according to the center coordinates of the ring value numbers in the new frame; calculate the radius of the ring of each score and the radius of the center circle according to the distance from the coordinates of the center point of the target paper to the center coordinates of the ring value numbers; set the loop line according to the radius of the ring of each score and the radius of the center circle; The bullet hole ring value determination module is used to calculate the distance between the center coordinates in the coordinate boundary box of the bullet hole and the coordinates of the center point of the target paper, and compare the distance with the ring line to obtain the ring value of the bullet hole.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the vision-based automatic shooting target reporting method described in any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the vision-based automatic shooting target reporting method according to any one of claims 1 to 5 are implemented.
Citation Information
Cited By
Laser simulation shooting multi-mode intelligent automatic target scoring judgment method and system
CN122129941A
