Method, device and electronic equipment for detecting a laser spot
By detecting suspected laser spots in the image to be tested and combining multi-dimensional judgments of image similarity and pixel values, the problem of low accuracy in laser spot detection in existing technologies has been solved, achieving higher detection accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- UNILUMIN GRP
- Filing Date
- 2026-01-20
- Publication Date
- 2026-06-09
AI Technical Summary
Existing laser spot detection methods have low accuracy and are prone to misidentifying noise points or reflection points as laser spots.
By detecting suspected laser points in the image to be tested, the region where the suspected laser points are located is extracted, and the image similarity and pixel value are calculated. A multi-dimensional judgment is made on whether it is a laser point, including image similarity, pixel value of the first suspected laser point image block, and pixel value of the second suspected laser point image block in the difference image.
This improves the accuracy of laser spot detection, avoids misidentifying reflection points and high-brightness noise as laser spots, and enhances the accuracy of detection results.
Smart Images

Figure CN122176348A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of image processing technology, and in particular relates to methods, devices, electronic equipment, computer-readable storage media, and computer program products for detecting laser spots. Background Technology
[0002] A laser pointer is a handheld electronic device primarily used for indicating the location of a target from a distance in presentations, teaching, and other similar scenarios. It emits a visible laser beam to create a bright laser dot on a projection screen or wall.
[0003] During the demonstration, a camera captures an image of the projection screen or wall, potentially containing laser beams. This image is then detected by a multimedia presentation host, which performs corresponding actions based on the detected laser beams. Current methods for detecting laser beams typically rely on the shape of the suspected area, resulting in low detection accuracy.
[0004] Therefore, a new method is needed to solve the problem of low detection accuracy of laser spot. Summary of the Invention
[0005] This application provides a method, apparatus, and electronic device for detecting laser spots, which can solve the problem of low accuracy of existing laser spot detection results.
[0006] In a first aspect, embodiments of this application provide a method for detecting laser spots, including: Detect suspected laser spots in the image to be tested; If the outline of a suspected laser spot is detected, the area where the suspected laser spot is located is cropped from the image to be detected based on the outline to obtain a first suspected laser spot image block; Determine the image similarity between the first suspected laser spot image block and a preset laser spot template image; determine the pixel value of the first suspected laser spot image block; and / or, extract the region where the suspected laser spot is located from the differential image of the image to be detected to obtain a second suspected laser spot image block, and determine the pixel value of the second suspected laser spot image block; Based on the image similarity, determine whether the first suspected laser spot image block passes the similarity detection; based on the pixel value of the first suspected laser spot image block, determine whether the first suspected laser spot image block passes the first type of pixel value detection; and / or, based on the pixel value of the second suspected laser spot image block, determine whether the second suspected laser spot image block passes the second type of pixel value detection. When the similarity detection is passed, and when the pixel value detection of the first type and / or the pixel value detection of the second type is passed, the suspected laser spot is determined to be a laser spot.
[0007] The beneficial effects of the embodiments of this application compared with the prior art are: In this embodiment, a suspected laser spot is detected in the image to be detected. If the outline of the suspected laser spot is detected, the area where the suspected laser spot is located is cropped from the image to be detected to obtain a first suspected laser spot image block. The image similarity between the first suspected laser spot image block and a preset laser spot template image is determined, and the pixel value of the first suspected laser spot is determined. And / or, the area where the suspected laser spot is located is cropped from the difference image of the image to be detected to obtain a second suspected laser spot image block, and the pixel value of the second suspected laser spot image block is determined. Finally, based on the above image similarity, the pixel value of the first suspected laser spot and / or the pixel value of the second suspected laser spot image block, it is determined whether the suspected laser spot is a laser spot. Since image similarity reflects the similarity between the first suspected laser spot image block and the preset laser spot template image, the pixel value of the first suspected laser spot image block can reflect the brightness of the suspected laser spot in the original image, and the pixel value of the second suspected laser spot image block can reflect the brightness of the suspected laser spot in the differential image. Therefore, when only the image similarity meets the requirements, the suspected laser spot may be a reflection point (the pixel value of a reflection point usually does not meet the brightness requirements of a laser spot), while when only the pixel value meets the requirements, the suspected laser spot may be a bright noise (bright noise is usually dissimilar to the laser spot template image). Therefore, when judging whether the suspected laser spot is a laser spot based on the image similarity, the pixel value of the first suspected laser spot image block and / or the pixel value of the second suspected laser spot image block, it is possible to avoid judging reflection points and bright noise as laser spots, thereby improving the accuracy of the judgment result, that is, improving the accuracy of the detection result of laser spots detected from the image to be detected.
[0008] Secondly, embodiments of this application provide a laser spot detection device, comprising: The spot detection module is used to detect suspected laser spots in the image to be inspected; The first suspected laser spot image block cropping module is used to crop the area where the suspected laser spot is located from the image to be detected based on the outline of the detected laser spot if the outline of the suspected laser spot is detected, so as to obtain the first suspected laser spot image block. The parameter determination module is used to determine the image similarity between the first suspected laser spot image block and the preset laser spot template image; determine the pixel value of the first suspected laser spot image block; and / or, extract the region where the suspected laser spot is located from the differential image of the image to be detected to obtain a second suspected laser spot image block, and determine the pixel value of the second suspected laser spot image block. The multidimensional detection module is used to determine whether the first suspected laser spot image block passes the similarity detection based on the image similarity, to determine whether the first suspected laser spot image block passes the first type of pixel value detection based on the pixel value of the first suspected laser spot image block, and / or, to determine whether the second suspected laser spot image block passes the second type of pixel value detection based on the pixel value of the second suspected laser spot image block. The laser spot determination module is used to determine that the suspected laser spot is a laser spot when the similarity detection, the first type of pixel value detection and / or the second type of pixel value detection are passed.
[0009] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect.
[0010] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect.
[0011] Fifthly, embodiments of this application provide a computer program product that, when run on an electronic device, causes the electronic device to perform the method described in the first aspect.
[0012] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0013] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0014] Figure 1 This is a schematic flowchart of a laser spot detection method provided in an embodiment of this application; Figure 2 This is a schematic diagram of a laser dot template image provided in an embodiment of this application; Figure 3This is a schematic diagram of a preset event being triggered according to an embodiment of this application; Figure 4 This is a schematic diagram of the operation of a laser navigation system according to an embodiment of this application; Figure 5 This is a schematic flowchart of another laser spot detection method provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of a laser spot detection device provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0015] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0016] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0017] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0018] Furthermore, in the description of this application and the appended claims, the terms "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0019] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.
[0020] Currently, when using laser pointers for multimedia presentations, a camera is typically used to capture images of the object being tested. If a laser spot emitted by the laser pointer onto the object is detected in the captured image, a corresponding event is triggered, such as playing a video related to the object being tested.
[0021] When detecting laser spots, if the determination of whether a suspected laser spot is a real laser spot is based solely on whether its shape meets the preset shape requirements, noise points or reflection points (such as point-like reflective areas generated by non-laser light sources but with similar high-brightness characteristics to lasers) may be misjudged as laser spots, resulting in low detection accuracy.
[0022] To improve the accuracy of laser spot detection, this application provides a method for detecting laser spots.
[0023] In this detection method, after detecting information about a suspected laser spot, the area where the suspected laser spot is located is cropped from the image to be detected to obtain a first suspected laser spot image block. The image similarity between the first suspected laser spot image block and a preset laser spot template image is calculated, and whether the suspected laser spot is a laser spot is determined based on the image similarity and the pixel value of the suspected laser spot.
[0024] Because the judgment of suspected laser spots is based on multiple dimensions, it helps to improve the accuracy of the detection results.
[0025] The laser spot detection method provided in the embodiments of this application is described below with reference to the accompanying drawings.
[0026] Figure 1 A schematic flowchart of a laser spot detection method provided in an embodiment of this application is shown. This detection method can be applied to electronic devices, and is described in detail below: S11, detect suspected laser spots in the image to be detected.
[0027] The aforementioned image to be detected can be the original image obtained by the camera capturing the object to be detected. Optionally, considering that the original image captured by the camera contains other information besides the object to be detected, the aforementioned image to be detected can also be an image containing only the object to be detected. Specifically, when the spatial relative position of the camera and the object to be detected is fixed, one or more regions of interest can be preset, which typically contain only the object to be detected. After the camera captures the original image, the region corresponding to the region of interest can be cropped from the original image to obtain the aforementioned image to be detected. Since the image to be detected is cropped from the original image, the amount of data contained in the image to be detected is less than that contained in the original image. Therefore, compared with directly detecting suspected laser points in the original image, the detection speed of detecting suspected laser points in the image to be detected is faster.
[0028] Optionally, the objects to be detected include projection screens, interactive whiteboards, walls (such as honor walls), and displayed products, etc.
[0029] In this embodiment of the application, to improve the accuracy of the laser spot detection results, suspected laser spots can be detected by combining images adjacent to the image to be detected captured by the camera. That is, the above-mentioned detection of suspected laser spots in the image to be detected includes: A1. Determine the difference image of the above image to be detected.
[0030] In this embodiment, the camera captures images of the object to be detected at a preset frame rate (e.g., 15fps), obtaining a corresponding image frame sequence. When detecting a suspected laser point in a certain image frame, the previous frame is retrieved from the image frame sequence captured by the camera. The current image to be detected is compared with the previous image at pixel level, and the absolute value of the result is taken. This operation can effectively separate the dynamically changing parts of the scene (such as newly appearing laser points, fast-moving objects, etc.) while almost completely eliminating static backgrounds (such as wall patterns, projected content), thereby significantly improving the detection sensitivity of dynamic points in subsequent steps.
[0031] Optionally, before determining the difference image, Gaussian filtering can be applied to both the current and previous images of the image to be detected. Specifically, a Gaussian low-pass filter is applied to the two images. The standard deviation (σ) of the Gaussian kernel of this low-pass filter is an adjustable parameter used to balance noise suppression strength and overall smoothness. Applying the low-pass filter can suppress image sensor noise and remove fine-grained texture interference.
[0032] A2. Apply the Laplacian operator to the above difference image to perform convolution operation in order to extract the edge features of the above difference image.
[0033] The Laplacian operator described above is a second-order differential operator that has a very high response to regions in an image where gray levels change drastically (such as edges), and can generate an image that highlights the contours of light points. Compared to first-order operators (such as Sobel), it can produce finer, more continuous edges, which is beneficial for subsequent contour closure.
[0034] A3. Based on the aforementioned edge features, detect suspected laser spots in the differential image.
[0035] In this embodiment, the difference image is thresholded based on the extracted edge features to convert it into a binary image. Optionally, an adaptive threshold is used for thresholding. Specifically, the optimal threshold is automatically calculated based on the local grayscale distribution of the difference image, thereby overcoming the problem that a fixed threshold performs poorly when there is uneven lighting or background changes, ensuring that potential laser points can be completely segmented in different environments.
[0036] After converting the difference image into a binary image, a contour extraction algorithm (such as OpenCV's findContours function) is executed on the binary image to obtain the set of boundary pixels of all connected regions. Subsequently, contours with closed boundaries in the boundary pixel set can be initially screened based on geometric features such as the area, perimeter, and aspect ratio of the circumscribed rectangle to filter out noise contours that are significantly too small, too large, or extremely irregular in shape, retaining the candidate contours most likely to be laser points. For example, an area range can be set based on the area of a preset laser point template image, or a perimeter range based on the perimeter of the preset laser point template image, or an aspect ratio range based on the aspect ratio of the preset laser point template image. The area of the contour in the boundary pixel set is compared with the set area range. If the area of the contour is less than the minimum value of the set area range, or greater than the maximum value of the set area range, then the contour is determined to be a noise contour. The determination of perimeter and aspect ratio of the circumscribed rectangle is similar to the determination of area, and will not be elaborated here.
[0037] The aforementioned preset laser spot template image can be a standard image captured during testing in a real-world scenario. This laser spot template image can be as follows: Figure 2 As shown.
[0038] Optionally, after initial screening, the roundness of the selected contours can be identified, and the contours that pass the roundness identification can be determined as the contours corresponding to the suspected laser spot.
[0039] The roundness recognition method is used to determine whether a target object is circular or approximately circular based on its geometric features. Specifically, the area of the contour to be judged and the square of its perimeter are calculated. The ratio of the area to the square of the perimeter is then calculated. If the ratio is close to a preset ratio threshold (e.g., the difference between the area and the preset ratio threshold is less than a preset difference), the contour to be judged is determined to pass the roundness recognition; otherwise, the contour to be judged is determined to fail the roundness recognition.
[0040] S12, if the outline of a suspected laser spot is detected, the area where the suspected laser spot is located is extracted from the image to be detected based on the outline to obtain a first suspected laser spot image block.
[0041] In this embodiment, the first suspected laser point image block is the region corresponding to the suspected laser point cropped from the image to be detected. Specifically, the region where the suspected laser point is located can be cropped according to the outline of the suspected laser point. Alternatively, the bounding box of the outline of the suspected laser point can be determined first, and then the corresponding region can be cropped according to the bounding box as the region where the suspected laser point is located, to ensure that the cropped region can completely contain the entire suspected laser point.
[0042] Optionally, the bounding box can be a rectangle or a square. For example, if the bounding box is a square, and the preliminary screening has identified the outer rectangle of the suspected laser spot, then the larger of the length and width of the outer rectangle is taken. Then, the side length of the square corresponding to the outer rectangle of the suspected laser spot is constructed based on a multiple of the average of the length and width. Finally, the corresponding area is cropped from the image to be detected based on the constructed square as the area where the suspected laser spot is located, to ensure that the cropped area can completely contain the entire suspected laser spot.
[0043] S13, determine the image similarity between the first suspected laser spot image block and the preset laser spot template image, and determine the pixel value of the first suspected laser spot image block; and / or, extract the region where the suspected laser spot is located from the differential image of the image to be detected to obtain the second suspected laser spot image block, and determine the pixel value of the second suspected laser spot image block.
[0044] The aforementioned preset laser spot template image can be a standard image captured from actual scene testing.
[0045] The image similarity mentioned above can be represented by dimensions such as the difference in pixel values, brightness, and contrast, or by the zero-mean normalized cross-correlation coefficient.
[0046] When image similarity is expressed through dimensions such as brightness and contrast, the above determination of the image similarity between the first suspected laser spot image block and the preset laser spot template image includes: B1. Determine the similarity between the first suspected laser spot image block and the preset laser spot template image in at least two dimensions, and obtain the dimensional similarity in at least two dimensions: brightness, contrast and structure.
[0047] The aforementioned brightness-corresponding dimension similarity (hereinafter referred to as brightness similarity) refers to evaluating the similarity between two images (i.e., the first suspected laser spot image block and the preset laser spot template image) by quantifying the degree of consistency in overall brightness or gray level distribution. Its core lies in capturing the consistency of the illumination features of the images.
[0048] The similarity of the dimensions corresponding to the brightness can be calculated using the following methods: (1) Overall brightness level comparison. Directly calculate the average gray value or average brightness component of all pixels in the two images, and judge the similarity by comparing the difference between these two averages. If the averages of the two images are close, it means that they are consistent in macroscopic brightness and darkness. This method is simple to calculate, has a fast response, and is suitable for scenes with stable lighting conditions. (2) Gray-level histogram distribution comparison. For each image, divide the gray-level range of the image into several intervals (e.g., 0-255 divided into 16 or 32 intervals), count the frequency of pixel occurrence in each gray-level interval, and form a histogram distribution curve. Calculate the overlapping area of the two histogram distribution curves corresponding to the two images using the histogram intersection method. The larger the overlapping area, the more similar the two images are in terms of brightness and darkness distribution. This method is not affected by the spatial position shift of the image, can effectively cope with slight displacement or deformation, and has higher robustness.
[0049] Because real laser beams in images exhibit a sharp increase in brightness in localized areas, the grayscale value at the center of the beam is typically close to saturation (e.g., 255), while the surrounding background pixels have lower values, creating a significant grayscale banding. This concentrated high-brightness distribution appears as a high-grayscale tail far from the main peak on the histogram, or as an abnormally high average brightness value. Therefore, by comparing brightness similarity, target areas with typical laser beam highlight characteristics can be effectively screened out, eliminating interference from ordinary reflected or diffuse light sources.
[0050] The dimensional similarity corresponding to the contrast mentioned above (hereinafter referred to as contrast similarity) is also called gradient similarity. It assesses the similarity between two images by measuring the degree of intensity of brightness changes and the consistency of distribution patterns. Its core lies in capturing the feature matching degree of local contrast intensity of the images.
[0051] The intensity of brightness variations in an image can be quantified through gradient calculations: for each pixel, the grayscale difference between it and its neighboring pixels is calculated; a larger difference indicates a sharper edge and stronger contrast at that location. The gradient values of all pixels are aggregated to form a gradient magnitude histogram, which reflects the statistical distribution of different contrast intensities in the image. By measuring the morphological similarity of the gradient magnitude histograms of two images (e.g., whether the peak position and distribution width are consistent) using histogram intersection or chi-square distance, it can be determined whether their visual features, such as texture complexity and edge sharpness, are similar. Contrast similarity filtering can effectively identify targets with typical abrupt attenuation characteristics of laser light spots, excluding ordinary light sources or reflective areas with gradual grayscale changes, thus improving detection specificity.
[0052] Optionally, considering that gradient quantization reflects the degree of difference between each pixel and its neighboring pixels, i.e., it reflects the local features of the image, and when an image contains suspected laser spots, its grayscale standard deviation should be higher than a preset standard deviation threshold. Therefore, it can be determined first whether the image's grayscale standard deviation is higher than the preset threshold. If so, it indicates that the image may have bright areas, and only then is gradient quantization performed on the image. Since the computational cost of grayscale standard deviation is less than that of gradient quantization, calculating the grayscale standard deviation first, and then performing gradient quantization on the image only after the grayscale standard deviation meets the requirements, can quickly eliminate images without bright areas, thus saving computational resources. Simultaneously, since gradients are extremely sensitive to image noise, confirming sufficient overall contrast through grayscale standard deviation first can avoid wasting computational resources on noisy images later.
[0053] Because the actual laser spot in the image is not a uniform bright spot, but rather exhibits a radial gradient distribution that is extremely bright at the center and rapidly decays outward: the gray value in the central region of the spot is close to saturation (255), while it rapidly drops to the background level within a distance of 1 to 2 pixels, forming a high-contrast ring-shaped boundary. This steep gradient distribution appears as an isolated peak with a high gradient value on the gradient histogram, far exceeding the smooth transition characteristics of ordinary diffuse reflection light sources.
[0054] The aforementioned structural similarity (hereinafter referred to as structural similarity) determines whether an object conforms to the morphological characteristics of a laser point by comparing the structural consistency between two images. Specifically, the gray-level covariance matrix of the two images in corresponding regions is calculated, and after normalization, a correlation coefficient is obtained. This correlation coefficient directly reflects the degree of matching between the two images in terms of radial symmetry structure and edge transition patterns.
[0055] Since the perfect radially symmetrical structure of laser spot exhibits a specific pattern of uniform decay from the center to the surrounding area in the covariance matrix, while structural distortion (such as being elongated into an ellipse or broken into multiple points) will cause the covariance distribution to be disordered, resulting in a significant decrease in the correlation coefficient (usually <0.7), by setting a structural matching threshold, it is possible to verify whether the first suspected laser spot image block is a suspected laser spot with a good shape.
[0056] B2. Determine the image similarity between the first suspected laser spot image block and the preset laser spot template image based on the similarity of each of the above dimensions.
[0057] Assuming image similarity is represented by α, brightness similarity by α1, contrast similarity by α2, and structure similarity by α3, if image similarity is determined based on brightness similarity, contrast similarity, and structure similarity, then α can be equal to the weighted sum of α1, α2, and α3, or it can be equal to a rule-based combination. This rule-based combination can include hard constraint rules, priority progression rules, dynamic weight rules, and so on.
[0058] The above description introduced the process of calculating image similarity based on similarity dimensions such as brightness and contrast. The following will introduce the process of calculating image similarity using zero-mean normalized cross-correlation coefficients.
[0059] Optionally, when image similarity is represented by zero-mean normalized cross-correlation, determining the image similarity between the first suspected laser spot image block and the preset laser spot template image includes: B1' Calculate the zero-mean normalized cross-correlation coefficient between the first suspected laser spot image block and the preset laser spot template image.
[0060] In this embodiment of the application, the zero-mean normalized cross-correlation coefficient between two images (i.e., the first suspected laser spot image block and the aforementioned preset laser spot template image) can be calculated through the following steps: (1) Mean zeroing treatment Calculate the arithmetic mean of all pixels in both images. Subtract the mean of the corresponding image from each pixel value in each image to obtain two zero-mean images. This operation eliminates the baseline difference between the two images caused by overall brightness or darkness, allowing subsequent comparisons to focus on relative changes rather than absolute intensity.
[0061] (2) Correlation Quantification The corresponding pixels of the two zero-mean images are multiplied point by point, and all the product results are summed to obtain the correlation sum. The larger the correlation sum, the higher the consistency between the first suspected laser spot image block and the preset laser spot template image in terms of pixel-level variation trend: that is, the bright area of one image corresponds to the bright area of the other image, and the dark area corresponds to the dark area.
[0062] (3) Normalization scale unification Calculate the standard deviation of each of the two zero-mean images, and multiply the two standard deviations to obtain a normalization factor. Use this normalization factor to scale the correlation and values mentioned above by division, so that the final result falls within a fixed range of [-1, 1]. Here, 1 represents a perfect structural match, -1 represents a perfect reverse match, and 0 represents no correlation.
[0063] B2' Determine the image similarity between the first suspected laser spot image block and the preset laser spot template image based on the zero-mean normalized cross-correlation coefficient.
[0064] In this embodiment of the application, the zero-mean normalized cross-correlation coefficient can be directly used as the above-mentioned image similarity. Of course, the zero-mean normalized cross-correlation coefficient can also be processed and the above-mentioned image similarity can be determined based on the processing result. This is not limited here.
[0065] In this embodiment, brightness deviation is eliminated by zero-mean normalization and contrast difference is eliminated by normalization, so that the final determined image similarity can reflect the similarity of structural features such as object contours and texture distribution, which is particularly suitable for laser spot detection scenarios with unstable lighting conditions. In this embodiment, in addition to determining the image similarity, it is also necessary to determine the pixel values of the first suspected laser spot image block and / or the pixel values of the second suspected laser spot image block.
[0066] When determining the pixel values of the first suspected laser spot image block, the maximum pixel value and / or average pixel value of the first suspected laser spot image block can be determined. The maximum pixel value of the first suspected laser spot image block refers to the maximum value of all pixel values within the first suspected laser spot image block.
[0067] When determining the pixel values of the second suspected laser spot image block, the maximum pixel value and / or average pixel value of the second suspected laser spot image block can be determined.
[0068] Since the largest pixel value reflects the brightest pixel and is not affected by the surrounding dark pixels, it has high sensitivity when used to identify suspected laser spots. The average pixel value smooths out random noise, making the subsequent identification of suspected laser spots based on the average pixel value more stable and reliable. Therefore, when identifying suspected laser spots based on the largest pixel value and / or the average pixel value, both sensitivity and reliability can be balanced.
[0069] S14, determine whether the first suspected laser spot image block passes the similarity detection, determine whether the first suspected laser spot image block passes the first type of pixel value detection based on the pixel value of the first suspected laser spot image block, and / or, determine whether the second suspected laser spot image block passes the second type of pixel value detection based on the pixel value of the second suspected laser spot image block.
[0070] In this embodiment, it is determined whether a first suspected laser spot image passes a similarity detection, and whether the first suspected laser spot image block passes a first type of pixel value detection. Alternatively, it is determined whether a first suspected laser spot image passes a similarity detection, and whether a second suspected laser spot image block passes a second type of pixel value detection. Alternatively, it is determined whether a first suspected laser spot image passes a similarity detection, whether the first suspected laser spot image block passes a first type of pixel value detection, and whether the second suspected laser spot image block passes a second type of pixel value detection.
[0071] In this embodiment of the application, when determining whether the first suspected laser spot image passes the similarity detection, the image similarity can be compared with a preset image similarity threshold. If the image similarity is greater than or equal to the preset image similarity threshold, the suspected laser spot is determined to pass the image similarity detection.
[0072] In this embodiment of the application, when determining whether the first suspected laser spot image block passes the first type of pixel value detection, the pixel value (maximum pixel value and / or average pixel value) of the first suspected laser spot image block is compared with a preset first pixel value threshold. If the pixel value of the first suspected laser spot image block is greater than or equal to the preset first pixel value threshold, then the first suspected laser spot image block is determined to have passed the first type of pixel value detection.
[0073] In some embodiments, the first pixel threshold can be determined based on the average pixel value of the first suspected laser spot image block. In this case, the pixel value of the first suspected laser spot image block includes the maximum pixel value and the average pixel value. Optionally, the first pixel value threshold can be calculated as follows: for each first suspected laser spot image block, calculate the average pixel value of the first suspected laser spot image block, take the logarithm of the average pixel value to the base 10, and multiply the resulting value by the natural number 105 to obtain the first pixel value threshold of the first suspected laser spot image block (105*lg(average pixel value)). By setting the maximum pixel value threshold by taking the logarithm, it is equivalent to mapping the brightness to an approximate perceptual linear space. Therefore, the slope of the high-brightness segment increases sharply. Under the premise that the original linear gray-scale signal-to-noise ratio remains unchanged, the separation distance between the laser spot and the background is amplified, thereby adaptively improving the segmentation margin and reducing false alarms due to reflection. Furthermore, since the difference between the first pixel value threshold and the average pixel value is small in high-brightness images (such as the first suspected laser spot image block), and a large difference between the second pixel value threshold and the average pixel value in low-brightness images (such as the second suspected laser spot image block), and since the upper limit of the first pixel value threshold cannot exceed 255, the most suitable method is to determine the first pixel value threshold by taking the logarithm. This ensures that when the average pixel value is 255, the first pixel value threshold will not exceed 255. In other words, this method helps improve the accuracy of the determined first pixel value threshold.
[0074] In this embodiment of the application, when determining whether the second suspected laser spot image block passes the second type of pixel value detection, the pixel value (maximum pixel value and / or average pixel value) of the second suspected laser spot image block is compared with a preset second pixel value threshold. If the pixel value of the second suspected laser spot image block is greater than or equal to the preset second pixel value threshold, then the second suspected laser spot image block is determined to have passed the second type of pixel value detection.
[0075] In some embodiments, the second pixel threshold can be determined based on the average pixel value of the second suspected laser spot image block. In this case, the pixel value of the second suspected laser spot image block includes the maximum pixel value and the average pixel value. Optionally, the second pixel threshold can be calculated in the following manner: For each second suspected laser spot image block, the average pixel value of the second suspected laser spot image block is calculated. The average pixel value of the second suspected laser spot image block is multiplied by a preset value (e.g., 20), and the resulting value is used as the aforementioned second pixel value threshold. Since the second suspected laser spot image block is extracted from a differential image, and the overall pixel value of the differential image is relatively low, but the pixel value of the laser spot is much higher than the average pixel value, determining the threshold in the above manner helps to improve the accuracy of the determined second pixel value threshold.
[0076] S15, when the above similarity detection is passed, and the above first type of pixel value detection and / or the above second type of pixel value detection is passed, the above suspected laser spot is determined to be a laser spot.
[0077] In this embodiment, when a suspected laser point passes both similarity detection and the first type of pixel value detection, the suspected laser point is determined to be a laser point. Alternatively, when a suspected laser point passes both similarity detection and the second type of pixel value detection, the suspected laser point is determined to be a laser point. Alternatively, when a suspected laser point passes similarity detection, the first type of pixel value detection, and the second type of pixel value detection, the suspected laser point is determined to be a laser point. Otherwise, when a suspected laser point passes only one of the above detections, or fails any of the above detections, the suspected laser point is determined not to be a laser point.
[0078] In this embodiment of the application, a suspected laser spot is detected in the image to be detected. If the outline of the suspected laser spot is detected, the area where the suspected laser spot is located is cropped from the image to be detected to obtain a first suspected laser spot image block. The image similarity between the first suspected laser spot image block and a preset laser spot template image is determined, and the pixel value of the first suspected laser spot is determined. And / or, the area where the suspected laser spot is located is cropped from the difference image of the image to be detected to obtain a second suspected laser spot image block. The pixel value of the second suspected laser spot image block is determined. Finally, based on the above image similarity, the pixel value of the first suspected laser spot and / or the pixel value of the second suspected laser spot image block, it is determined whether the suspected laser spot is a laser spot. Since image similarity reflects the similarity between the first suspected laser spot image block and the preset laser spot template image, the pixel value of the first suspected laser spot image block can reflect the brightness of the suspected laser spot in the original image, and the pixel value of the second suspected laser spot image block can reflect the brightness of the suspected laser spot in the differential image. Therefore, when only the image similarity meets the requirements, the suspected laser spot may be a reflection point (the pixel value of a reflection point usually does not meet the brightness requirements of a laser spot), while when only the pixel value meets the requirements, the suspected laser spot may be a bright noise (bright noise is usually dissimilar to the laser spot template image). Therefore, when judging whether the suspected laser spot is a laser spot based on the image similarity, the pixel value of the first suspected laser spot image block and / or the pixel value of the second suspected laser spot image block, it is possible to avoid judging reflection points and bright noise as laser spots, thereby improving the accuracy of the judgment result, that is, improving the accuracy of the detection result of laser spots detected from the image to be detected.
[0079] In some embodiments, considering the potential jitter and misjudgment when detecting a single image frame, to improve the accuracy of triggering the preset event, the preset event can be triggered only after a continuous and stable laser spot is detected. The preset event can be set according to actual conditions. For example, the preset event may include: playing an audio stream and / or video stream corresponding to the current position of the laser spot, and / or performing a speed measurement action, and / or performing a distance measurement action, etc. That is, after determining that the suspected laser spot is a laser spot, the following steps are also included: C1. Continue to determine whether the laser spot exists in multiple image frames following the image to be detected.
[0080] Optionally, the aforementioned multiple image frames are multiple consecutive image frames that are in the same image frame sequence as the image to be detected, and that occur after the image to be detected and within a preset time period. This setting avoids the possibility of detecting multiple laser points within an infinite time period, which could lead to false triggering of the preset event, thereby improving the accuracy of subsequent preset event triggering.
[0081] C2. If the number of images containing the laser spot in multiple image frames following the image to be detected is greater than a preset threshold, a preset event is triggered.
[0082] In this embodiment, the preset event is triggered only after the laser spot is detected in multiple image frames, thus improving the accuracy of the preset event being triggered.
[0083] refer to Figure 3 , Figure 3 This illustration shows a flowchart of a preset event being triggered according to an embodiment of this application.
[0084] S301, Initialization: Create a queue of length n filled with zeros, with the trigger state set to false and the zero counter set to 0.
[0085] For each image to be detected, a First-In-First-Out (FIFO) binary queue is created with a fixed length of n (e.g., n=8, corresponding to a video frame sequence of approximately 0.8 seconds at a video frame rate of 10fps), and initialized to all zeros. Simultaneously, a trigger status flag (initially false) and a continuous no-light counter are initialized for the region corresponding to the image to be detected.
[0086] S302, Detect laser spot in the next frame of the image to be detected.
[0087] Wait for the next frame of the image to be detected, and then perform laser spot detection on the waiting image.
[0088] S303, determine if the trigger state is false. If yes, execute S309; otherwise, execute S304.
[0089] S304, determine if the laser spot exists. If it exists, proceed to S305; otherwise, proceed to S306.
[0090] S305, Enqueue 1.
[0091] When it is determined that there is a laser spot in the image to be detected, the first-in-first-out binary queue enters 1.
[0092] S306, queue entry 0.
[0093] When it is determined that there are no laser spots in the image to be detected, the first-in-first-out binary queue enters 0.
[0094] S307, determine if the number of 1s in the queue is greater than or equal to n / 2. If yes, execute S308; otherwise, execute S302.
[0095] The n / 2 mentioned above can be adjusted according to the actual situation, and its value is usually set to be greater than or equal to n / 2.
[0096] S308, preset event trigger, trigger status is set to true.
[0097] The system calculates the cumulative number of '1's in the queue in real time. When this number exceeds a preset trigger threshold (e.g., ≥ n / 2 or ≥ 0.7 * n), the system considers a continuous and stable laser spot to have appeared, triggers a preset event, and sets the trigger status of the corresponding region of the image to be detected to true. This status is used to prevent repeated triggering during the same interactive action.
[0098] Once triggered, the system enters an "immune" state. The trigger state will only be reset to false if the queue in that area does not detect any laser spot for several consecutive frames (e.g., the queue becomes all 0 again and remains so for t seconds).
[0099] This reset mechanism ensures that after a valid trigger action is completed, the system must undergo a clear "cooling-off period" before it can be ready to respond to the next possible trigger, thus effectively avoiding multiple false triggers caused by the laser spot briefly jittering or disappearing and then immediately reappearing.
[0100] S309: Determine if the laser spot exists. If it exists, proceed to S310; otherwise, proceed to S311.
[0101] S310, device set to 0.
[0102] Specifically, setting the counter to 0 indicates that there is no valid data in the current queue.
[0103] S311, counter 0 +1.
[0104] S312, determine if the counter is greater than or equal to 2n. If yes, execute S313; otherwise, execute S302.
[0105] The 2n mentioned above can be set according to the actual situation, and it is usually a value greater than n.
[0106] S313, the trigger state is set to false.
[0107] To more clearly describe the laser spot detection method provided in the embodiments of this application, the following description is based on specific application scenarios.
[0108] refer to Figure 4 , Figure 4 A schematic diagram of the operation of a laser-guided tour system provided in an embodiment of this application is shown.
[0109] exist Figure 4In the middle, the guide holds a laser pointer, and the laser spot of the pointer is on "object 2".
[0110] The guide camera takes pictures of "object 1", "object 2", "object 3", "object 4", "sign 1", "sign 2" and "sign 3", and obtains the corresponding image to be detected based on the original image captured by the guide camera and the preset region of interest.
[0111] The navigation system detects the presence of laser spots in the image to be inspected. The detection process can be found in the following reference. Figure 5 .
[0112] Figure 5 A flowchart illustrating another laser spot detection method provided in this application embodiment.
[0113] exist Figure 5 middle: S501, read the raw image frame.
[0114] S502, the region of interest of the original image frame is cropped according to the preset region of interest to obtain the image to be detected.
[0115] S503 performs Gaussian filtering on the image to be detected.
[0116] S504 performs differential processing on the Gaussian-filtered image to obtain a differential image.
[0117] S505 extracts edge features from the difference image.
[0118] S506, Based on the extracted edge features, the difference image is adaptively binarized to obtain a binary image.
[0119] S507, extract the contour of the binary image.
[0120] S508, Perform preliminary screening of the outline, which includes screening for size and roundness.
[0121] S509 sets a square cutout frame based on the size of the position of the filtered outline.
[0122] S510, based on the square cropping box, the corresponding regions are cropped in the image to be detected and the difference image respectively.
[0123] S511, calculate the image similarity α between the first suspected laser spot image block and the preset laser spot template image.
[0124] S512, Calculate the maximum pixel value γ of the first suspected laser spot image block. S513, determine whether α>N is true.
[0125] Where N is a preset image similarity threshold.
[0126] S514, determine whether γ>K is true.
[0127] Where K is the preset threshold value for the first pixel. S515, calculate the maximum pixel value β of the second suspected laser spot image block. S516, determine whether B>M is true.
[0128] Where M is the preset threshold value for the second pixel.
[0129] S517, if α>N, γ>K and B>M, then it is determined to be a laser spot.
[0130] exist Figure 5 In this process, suspected laser spots that pass three types of detection will be identified as laser spots. In practice, suspected laser spots that pass two types of detection can also be identified as laser spots, which will not be elaborated here.
[0131] Once it is determined that there are laser spots in the multi-frame detection images corresponding to "Object 2", the audio corresponding to "Object 2" can be played through the guide speakers, and / or, the video corresponding to "Object 2" can be displayed on a single LED screen controlled by the central control host in the exhibition hall, and / or, one or more LED screens can be displayed on one or more LED screens controlled by the central control host in the exhibition hall.
[0132] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0133] Corresponding to the laser spot detection method described in the above embodiments, Figure 6 This diagram illustrates a structural block diagram of a laser spot detection device provided in an embodiment of this application. For ease of explanation, only the parts related to the embodiment of this application are shown.
[0134] Reference Figure 6 The laser spot detection device 6 is applied to electronic equipment and includes: a spot detection module 61, a first suspected laser spot image block capture module 62, a judgment parameter determination module 63, a multi-dimensional detection module 64, and a laser spot determination module 65. Wherein: The spot detection module 61 is used to detect suspected laser spots in the image to be tested.
[0135] The first suspected laser spot image block cropping module 62 is used to crop the area where the suspected laser spot is located from the image to be detected based on the outline of the suspected laser spot if the outline of the suspected laser spot is detected, so as to obtain the first suspected laser spot image block.
[0136] The parameter determination module 63 is used to determine the image similarity between the first suspected laser spot image block and the preset laser spot template image; determine the pixel value of the first suspected laser spot image block; and / or, extract the region where the suspected laser spot is located from the differential image of the image to be detected to obtain the second suspected laser spot image block, and determine the pixel value of the second suspected laser spot image block.
[0137] The multidimensional detection module 64 is used to determine whether the first suspected laser spot image block passes the similarity detection based on the image similarity, to determine whether the first suspected laser spot image block passes the first type of pixel value detection based on the pixel value of the first suspected laser spot image block, and / or to determine whether the second suspected laser spot image block passes the second type of pixel value detection based on the pixel value of the second suspected laser spot image block.
[0138] The laser spot determination module 65 is used to determine the suspected laser spot as a laser spot when the above-mentioned similarity detection, the above-mentioned first type of pixel value detection and / or the above-mentioned second type of pixel value detection are passed.
[0139] In this embodiment, since image similarity reflects the similarity between the first suspected laser point image block and the preset laser point template image, the pixel value of the first suspected laser point image block can reflect the brightness of the suspected laser point in the original image, and the pixel value of the second suspected laser point image block can reflect the brightness of the suspected laser point in the differential image. Therefore, when only the image similarity meets the requirements, the suspected laser point may be a reflection point (the pixel value of a reflection point usually does not meet the brightness requirements of a laser point), while when only the pixel value meets the requirements, the suspected laser point may be a bright noise (bright noise is usually dissimilar to the laser point template image). Therefore, when judging whether the suspected laser point is a laser point based on the image similarity, the pixel value of the first suspected laser point image block, and / or the pixel value of the second suspected laser point image block, it is possible to avoid judging reflection points and bright noise as laser points, thereby improving the accuracy of the judgment result, that is, improving the accuracy of the detection result of laser points detected from the image to be detected.
[0140] Optionally, when determining the image similarity between the first suspected laser spot image block and the preset laser spot template image, the aforementioned judgment parameter determination module 63 is specifically used for: The similarity between the first suspected laser spot image block and the preset laser spot template image is determined in at least two dimensions, resulting in at least two dimensions of dimensional similarity: brightness, contrast, and structure. The image similarity between the first suspected laser spot image block and the preset laser spot template image is determined based on the similarity of each of the above dimensions.
[0141] Optionally, when determining the image similarity between the first suspected laser spot image block and the preset laser spot template image, the aforementioned judgment parameter determination module 63 is specifically used for: Calculate the zero-mean normalized cross-correlation coefficient between the first suspected laser spot image block and the preset laser spot template image. The image similarity between the first suspected laser spot image block and the preset laser spot template image is determined based on the zero-mean normalized cross-correlation coefficient.
[0142] Optionally, the aforementioned spot detection module 61 is specifically used for: The image to be detected is taken as the current frame image, and the previous frame image of the current frame image is obtained; Determine the difference image between the current frame image and the previous frame image of the current frame image; The Laplacian operator is applied to the above difference image for convolution operation to extract the edge features of the above difference image; Based on the aforementioned edge features, the differential image is used to detect suspected laser spots.
[0143] Optionally, when determining the pixel value of the first suspected laser spot image block, the aforementioned judgment parameter determination module 63 is specifically used for: Determine the maximum and average pixel values of the first suspected laser point image block mentioned above; Correspondingly, when the multidimensional detection module 64 determines whether the first suspected laser spot image block passes the first type of pixel value detection based on the pixel value of the first suspected laser spot image block, it is specifically used for...
[0144] Optionally, when determining the pixel value of the second suspected laser spot image block, the aforementioned parameter determination module 63 is specifically used for: Determine the maximum and average pixel values of the second suspected laser point image block mentioned above; Correspondingly, when the multi-dimensional detection module 64 determines whether the second suspected laser spot image block passes the second type of pixel value detection based on the pixel value of the second suspected laser spot image block, it is specifically used to: determine a second pixel value threshold based on the average pixel value of the second suspected laser spot image block, compare the maximum pixel value of the second suspected laser spot image block with the second pixel value threshold, and if the maximum pixel value of the second suspected laser spot image block is greater than the second pixel value threshold, then determine that the second suspected laser spot image block passes the second type of pixel value detection.
[0145] Optionally, the laser spot detection device 6 provided in this application embodiment further includes: The preset event triggering module is used to determine whether the laser spot exists in multiple image frames after the image to be detected after determining that the suspected laser spot is a laser spot; if the number of images with the laser spot in multiple image frames after the image to be detected is greater than a preset number threshold, then the preset event is triggered.
[0146] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0147] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 7 As shown, the electronic device 7 of this embodiment includes: at least one processor 70 ( Figure 7 The diagram shows only one processor, a memory 71, and a computer program 72 stored in the memory 71 and executable on the at least one processor 70, wherein the processor 70 executes the computer program 72 to implement the steps in any of the above method embodiments.
[0148] The electronic device 7 can be a desktop computer, laptop, handheld computer, or cloud server, etc. This electronic device may include, but is not limited to, a processor 70 and a memory 71. Those skilled in the art will understand that... Figure 7 This is merely an example of electronic device 7 and does not constitute a limitation on electronic device 7. It may include more or fewer components than shown, or combine certain components, or different components, such as input / output devices, network access devices, etc.
[0149] The processor 70 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0150] In some embodiments, the memory 71 may be an internal storage unit of the electronic device 7, such as a hard disk or memory of the electronic device 7. In other embodiments, the memory 71 may be an external storage device of the electronic device 7, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the electronic device 7. Furthermore, the memory 71 may include both internal and external storage units of the electronic device 7. The memory 71 is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory 71 can also be used to temporarily store data that has been output or will be output.
[0151] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0152] This application also provides a network device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor executes the computer program to implement the steps in any of the above method embodiments.
[0153] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps in the above-described method embodiments.
[0154] This application provides a computer program product that, when run on an electronic device, enables the electronic device to implement the steps described in the various method embodiments above.
[0155] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographic device / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0156] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0157] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0158] In the embodiments provided in this application, it should be understood that the disclosed apparatus / network devices and methods can be implemented in other ways. For example, the apparatus / network device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0159] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0160] It should be noted that the information collection process (such as the facial image collection process, fingerprint information collection process, etc.) / feature extraction process involved in this application is carried out with the user's knowledge and permission. That is, the information collection process / feature extraction process complies with the requirements of laws and regulations and does not constitute an act that harms the public interest.
Claims
1. A method for detecting laser spots, characterized in that, include: Detect suspected laser spots in the image to be tested; If the outline of a suspected laser spot is detected, the area where the suspected laser spot is located is cropped from the image to be detected based on the outline to obtain a first suspected laser spot image block; Determine the image similarity between the first suspected laser spot image block and a preset laser spot template image; determine the pixel value of the first suspected laser spot image block; and / or, extract the region where the suspected laser spot is located from the differential image of the image to be detected to obtain a second suspected laser spot image block, and determine the pixel value of the second suspected laser spot image block; Based on the image similarity, determine whether the first suspected laser spot image block passes the similarity detection; based on the pixel value of the first suspected laser spot image block, determine whether the first suspected laser spot image block passes the first type of pixel value detection; and / or, based on the pixel value of the second suspected laser spot image block, determine whether the second suspected laser spot image block passes the second type of pixel value detection. When the similarity detection is passed, and when the pixel value detection of the first type and / or the pixel value detection of the second type is passed, the suspected laser spot is determined to be a laser spot.
2. The laser spot detection method as described in claim 1, characterized in that, Determining the image similarity between the first suspected laser spot image block and the preset laser spot template image includes: The similarity between the first suspected laser spot image block and the preset laser spot template image is determined in at least two dimensions, resulting in at least two dimensions of dimensional similarity: brightness, contrast, and structure. The image similarity between the first suspected laser spot image block and the preset laser spot template image is determined based on the similarity of each of the aforementioned dimensions.
3. The laser spot detection method as described in claim 1, characterized in that, Determining the image similarity between the first suspected laser spot image block and the preset laser spot template image includes: Calculate the zero-mean normalized cross-correlation coefficient between the first suspected laser spot image block and the preset laser spot template image; The image similarity between the first suspected laser spot image block and the preset laser spot template image is determined based on the zero-mean normalized cross-correlation coefficient.
4. The laser spot detection method as described in claim 1, characterized in that, The detection of suspected laser spots in the image to be detected includes: Determine the difference image of the image to be detected; The Laplacian operator is applied to the difference image to perform convolution operation in order to extract the edge features of the difference image; The differential image is used to detect suspected laser spots based on the edge features.
5. The laser spot detection method as described in claim 1, characterized in that, Determining the pixel values of the first suspected laser spot image block includes: Determine the maximum and average pixel values of the first suspected laser point image block; The step of determining whether the first suspected laser spot image block passes the first type of pixel value detection based on the pixel value of the first suspected laser spot image block includes: A first pixel value threshold is determined based on the average pixel value of the first suspected laser spot image block. The maximum pixel value of the first suspected laser spot image block is compared with the first pixel value threshold. If the maximum pixel value of the first suspected laser spot image block is greater than the first pixel value threshold, it is determined that the first suspected laser spot image block has passed the first type of pixel value detection.
6. The laser spot detection method as described in claim 1, characterized in that, Determining the pixel values of the second suspected laser spot image block includes: Determine the maximum and average pixel values of the second suspected laser point image block; The step of determining whether the second suspected laser spot image block passes the second type of pixel value detection based on the pixel values of the second suspected laser spot image block includes: A second pixel value threshold is determined based on the average pixel value of the second suspected laser spot image block. The maximum pixel value of the second suspected laser spot image block is compared with the second pixel value threshold. If the maximum pixel value of the second suspected laser spot image block is greater than the second pixel value threshold, then the second suspected laser spot image block is determined to have passed the second type of pixel value detection.
7. The laser spot detection method according to any one of claims 1 to 6, characterized in that, After determining that the suspected laser spot is a laser spot, the method further includes: Continue to determine whether the laser spot exists in multiple image frames following the image to be detected; If the number of images containing the laser spot in multiple image frames following the image to be detected is greater than a preset threshold, a preset event is triggered.
8. A laser spot detection device, characterized in that, include: The spot detection module is used to detect suspected laser spots in the image to be inspected; The first suspected laser spot image block cropping module is used to crop the area where the suspected laser spot is located from the image to be detected based on the outline of the detected laser spot if the outline of the suspected laser spot is detected, so as to obtain the first suspected laser spot image block. The parameter determination module is used to determine the image similarity between the first suspected laser spot image block and the preset laser spot template image; determine the pixel value of the first suspected laser spot image block; and / or, extract the region where the suspected laser spot is located from the differential image of the image to be detected to obtain a second suspected laser spot image block, and determine the pixel value of the second suspected laser spot image block. The multidimensional detection module is used to determine whether the first suspected laser spot image block passes the similarity detection based on the image similarity, to determine whether the first suspected laser spot image block passes the first type of pixel value detection based on the pixel value of the first suspected laser spot image block, and / or, to determine whether the second suspected laser spot image block passes the second type of pixel value detection based on the pixel value of the second suspected laser spot image block. The laser spot determination module is used to determine that the suspected laser spot is a laser spot when the similarity detection, the first type of pixel value detection and / or the second type of pixel value detection are passed.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 7.
11. A computer program product, characterized in that, Includes a computer program, which, when run, causes the electronic device to perform the method according to any one of claims 1 to 7.