Light spot detection method and device, terminal and storage medium

By directly determining the outer boundary pixel coordinate set of spots in virtual reality devices based on the pixel grayscale value and preset threshold of the grayscale image, the problem of spot detection in the prior art requires binary processing, and the detection efficiency and accuracy are improved.

CN120013847APending Publication Date: 2025-05-16BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311532433.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-16
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

The light spot detection method of existing virtual reality interactive devices requires binary processing of the original grayscale image, resulting in complex image processing and inefficient efficiency.

Method used

By acquiring the grayscale image, the pixel coordinate set of the outer boundary of the light spot is directly determined based on the grayscale value of the pixel and the preset threshold value, without binarization processing. The method forms a pixel coordinate set to determine the spot parameter by determining the grayscale value of the pixel to be analyzed and looking for pixels greater than the threshold from its eight neighborhood range until it returns to the starting pixel.

Benefits of technology

The image processing process is reduced, the efficiency and accuracy of spot detection are improved, and the outer boundary pixel coordinate set of the spot can be directly obtained and the parameter information of the spot can be calculated.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120013847A_ABST
    Figure CN120013847A_ABST
Patent Text Reader

Abstract

The invention provides a light spot detection method and device, a terminal and a storage medium. The light spot detection method comprises the following steps: acquiring a grayscale image; determining a pixel coordinate set of the outer boundary of the light spot based on the gray value of the pixel of the gray image and a preset threshold; and determining parameter information of the light spot based on the pixel coordinate set. According to the invention, the pixel coordinate set of the outer boundary of the light spot is obtained based on the gray value of the pixel of the gray image and the preset threshold value, binarization processing does not need to be carried out on the original gray image, the image processing process is reduced, and the light spot detection efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of information technology, and in particular to a light spot detection method and device, a terminal and a storage medium. Background Art

[0002] At present, most of the human-computer interaction in virtual reality devices is achieved through the handle. The positioning detection algorithm for the handle is mainly visual processing. The handle itself has multiple LED light sources. The camera on the virtual reality device can capture the light spots formed by the light sources on the handle on the camera image. According to the light spot information on the image and the light source on the handle, the position and posture of the handle can be obtained, so it is particularly important to detect the light spot of the handle to obtain the light spot information.

[0003] The spot detection of traditional virtual reality interactive devices first performs binarization processing on the grayscale image collected by the virtual reality device according to the set pixel threshold, and converts the original grayscale image into a binary image of 0 and 1 (or 0 and 255). Then, the spot contour is extracted from the binary image, the unsigned binary image is converted into a signed binary image, and 2 and -2 are introduced as marking values ​​to judge the effectiveness of the spot threshold detection, and finally the boundary pixel coordinates of the outer layer of the handle spot contour are obtained. Finally, according to the outer layer pixel coordinate set of the spot contour, the relevant information of the spot can be obtained, such as the center point, area, radius, roundness, etc. Summary of the invention

[0004] In order to solve the existing problems, the present disclosure provides a light spot detection method and device, a terminal and a storage medium.

[0005] The present disclosure adopts the following technical solutions.

[0006] An embodiment of the present disclosure provides a light spot detection method, which includes: acquiring a grayscale image; determining a pixel coordinate set of an outer boundary of a light spot based on the grayscale values ​​of pixels of the grayscale image and a preset threshold, wherein determining the pixel coordinate set of the outer boundary of the light spot includes: determining the grayscale value of a pixel to be analyzed, and when a first pixel whose grayscale value is greater than the preset threshold appears, changing the grayscale value of the first pixel to a first value; taking the first pixel as a center point, and determining the next pixel whose grayscale value is greater than the preset threshold from an eight-neighborhood range of the first pixel; each time taking the next pixel whose grayscale value is greater than the preset threshold as the center point, determining the next pixel whose grayscale value is greater than the preset threshold from an eight-neighborhood range of the next pixel, until returning to the first pixel, wherein the pixel coordinate set includes the coordinates of all the pixels serving as the center points; and determining parameter information of the light spot based on the pixel coordinate set.

[0007] Another embodiment of the present disclosure provides a light spot detection device, which includes: an image acquisition module, configured to acquire a grayscale image; a coordinate set acquisition module, configured to determine a pixel coordinate set of an outer boundary of the light spot based on the grayscale value of the pixels of the grayscale image and a preset threshold, wherein determining the pixel coordinate set of the outer boundary of the light spot includes: determining the grayscale value of the pixel to be analyzed, and when the first pixel with a grayscale value greater than the preset threshold appears, changing the grayscale value of the first pixel to a first value; taking the first pixel as a center point, and determining the next pixel with a grayscale value greater than the preset threshold from an eight-neighborhood range of the first pixel; each time taking the next pixel with a grayscale value greater than the preset threshold as the center point, determining the next pixel with a grayscale value greater than the preset threshold from the eight-neighborhood range of the next pixel, until returning to the first pixel, wherein the pixel coordinate set includes the coordinates of all the pixels as the center points; a parameter information acquisition module, configured to determine parameter information of the light spot based on the pixel coordinate set.

[0008] In some embodiments, the present disclosure provides a terminal, comprising: at least one memory and at least one processor; wherein the memory is used to store program codes, and the processor is used to call the program codes stored in the memory to execute the above-mentioned light spot detection method.

[0009] In some embodiments, the present disclosure provides a storage medium, wherein the storage medium is used to store program codes, and the program codes are used to execute the above-mentioned light spot detection method.

[0010] The present invention obtains a pixel coordinate set of the outer boundary of a light spot based on the grayscale value of a pixel of a grayscale image and a preset threshold, without the need to perform binarization processing on the original grayscale image, thereby reducing the image processing process. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.

[0012] Figure 1 is a flow chart of a light spot detection method according to an embodiment of the present disclosure.

[0013] Figure 2 A flowchart of acquiring a pixel coordinate set of an outer boundary of a light spot in a light spot detection method according to an embodiment of the present disclosure is provided.

[0014] Figure 3 A schematic diagram showing a process of determining the outer boundary of a light spot according to some embodiments of the present disclosure is shown.

[0015] Figure 4 Some embodiments of the present disclosure are shown Figure 3 Schematic diagram of the marking values ​​corresponding to the outer boundary of the light spot.

[0016] Figure 5 A schematic diagram of an eight-neighborhood according to some embodiments of the present disclosure is shown.

[0017] Figure 6 A schematic flowchart of state value setting of some embodiments of the present disclosure is shown.

[0018] Figure 7 A schematic flow chart of entry detection of the outer boundary of a light spot according to some embodiments of the present disclosure is shown.

[0019] Figure 8 A schematic flowchart of detecting an eight-neighborhood range of a pixel according to some embodiments of the present disclosure is shown.

[0020] Fig. 9 A schematic flowchart of outer boundary detection of a light spot according to some embodiments of the present disclosure is shown.

[0021] Fig.10 It is a partial module of the light spot detection device of another embodiment of the present disclosure.

[0022] Fig.11 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0023] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0024] It should be understood that the various steps described in the method embodiments of the present disclosure can be performed in sequence and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0025] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0026] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0027] It should be noted that the modification of “one” mentioned in the present disclosure is illustrative rather than restrictive, and those skilled in the art should understand that it should be understood as “one or more” unless otherwise clearly indicated in the context.

[0028] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0029] The present disclosure first obtains a grayscale image, for example, a grayscale image of a light spot projected by an LED light source with a handle captured by a camera of a virtual reality device. Then, according to a preset threshold, a pixel coordinate set of the outer boundary of the light spot outline on the original light spot grayscale image is extracted. Finally, according to the detected pixel coordinate set of the outer boundary of the light spot, the parameter information of the light spot, such as the center point, the angle, the radius, the circularity and the confidence of the light spot, is calculated for subsequent light spot screening.

[0030] Figure 1 A flow chart of a light spot detection method according to an embodiment of the present disclosure is provided. Figure 2 A flow chart of obtaining a pixel coordinate set of an outer boundary of a light spot of a light spot detection method of an embodiment of the present disclosure is provided. The light spot detection method of the present disclosure may include step S101, obtaining a grayscale image. In some embodiments, the grayscale image is a grayscale image captured by a head-mounted device (e.g., virtual reality glasses), wherein a light source (e.g., an LED light source) may exist on the captured component (e.g., a handle, etc.), and thus a corresponding light spot may exist on the grayscale image.

[0031] In some embodiments, the method of the present disclosure may further include step S102, determining a pixel coordinate set of the outer boundary of the light spot based on the grayscale value of the pixel of the grayscale image and a preset threshold. In some embodiments, the present disclosure does not need to perform binarization processing on the original grayscale image, and directly determines the pixel coordinate set of the outer boundary of the light spot based on the grayscale value of the pixel of the grayscale image and the preset threshold. In some embodiments, the grayscale value ranges from 0 to 255, but in practice, the grayscale value of the pixel is usually 4 to 255, and is basically not less than 3. In some embodiments, the preset threshold can be preset according to the characteristics of the light spot, for example, 70, 80, etc.

[0032] like Figure 2As shown, step 102 includes step 1021, step 1022 and step 1023. In step 1021, the grayscale value of the pixel to be analyzed is determined, and when the first pixel with a grayscale value greater than a preset threshold appears, the grayscale value of the first pixel is changed to a first value. In some embodiments, the first value is 0. Figure 3 The numbers 1-40 shown are the numbers of the pixels of the outer boundary of the light spot, not the grayscale values ​​of the pixels, from 1 to 40, and end when it returns from 40 to 1. The pixel corresponding to number 1 is the first pixel whose grayscale value is greater than the preset threshold, and the grayscale value of the pixel is changed to the first value (such as Figure 4 0 in ).

[0033] In step 1022, the first pixel 1 is taken as the center point, and the next pixel whose grayscale value is greater than the preset threshold is determined from the eight neighborhoods of the first pixel 1 (for example, Figure 3 Pixels in 2). Figure 5 Assume that the first pixel 1 is the center point ( Figure 5 ), then the eight-neighborhood of the first pixel 1 is the eight surrounding pixels, Figure 5 0-7 are schematically used to indicate the positions of the eight pixels, for example, position 4 indicates the left side of the center point, position 2 indicates the top side of the center point, position 5 indicates the lower left corner of the center point, etc. Therefore, the first pixel 1 is taken as the starting point and the center point, and the next pixel whose gray value is greater than the preset threshold is determined from the eight neighborhoods of the first pixel 1. It is found that the gray value of pixel 2 is greater than the preset threshold, that is, the second pixel 2 of the outer boundary of the light spot is obtained.

[0034] In step 1023, the next pixel whose grayscale value is greater than the preset threshold is determined as the center point each time, and the next pixel whose grayscale value is greater than the preset threshold is determined from the eight-neighborhood range of the next pixel, until returning to the first pixel. For example, the determined pixel 2 is taken as the center point, and the pixel 3 whose grayscale value is greater than the preset threshold is determined from the eight-neighborhood range of pixel 2. Similarly, the determined pixel 3 is taken as the center point, and the pixel 4 whose grayscale value is greater than the preset threshold is determined from the eight-neighborhood range of pixel 3... In this way, the determined pixel 40 is taken as the center point, and the pixel 1 whose grayscale value is greater than the preset threshold is determined from the eight-neighborhood range of pixel 40. This ends here, and the pixels of the outer boundary of the light spot are determined. In some embodiments, the pixel coordinate set includes the coordinates of all pixels used as center points. For example, Figure 3 The coordinates of pixels 1-40 (all of which were once used as the center point) in are added to the pixel coordinate set. In this way, the pixel coordinate set of the outer boundary of the light spot is obtained.

[0035] In some embodiments, the method of the present disclosure may further include step S103, determining parameter information of the light spot based on the pixel coordinate set. In some embodiments, after obtaining the pixel coordinate set of the outer boundary of the light spot, some relevant parameters of the light spot can be easily determined.

[0036] The present invention obtains a pixel coordinate set of the outer boundary of a light spot based on the grayscale value of pixels of a grayscale image and a preset threshold, without binarizing the original grayscale image, thus reducing the image processing process and improving the efficiency of determining the outer boundary of the light spot.

[0037] In some embodiments, for each row of pixels, the grayscale value of the pixel where the starting point of the light spot is located is changed to a first value, and the grayscale value of the pixel where the end point of the light spot is located is changed to a second value, and the first value and the second value are less than another preset threshold and are not the same. In some embodiments, the other preset threshold is, for example, 4. In some embodiments, the first value is 0 and the second value is 1. Since the grayscale value of the pixel in the grayscale image captured in reality is usually between 4 and 255, the first value and the second value of the marking value less than the other preset threshold will not be confused with the grayscale value of the pixel itself, and can play a good marking role, and then by recording the coordinates of the marked pixels, the pixel coordinate set of the outer boundary of the light spot can be determined. In addition, the present disclosure directly uses an unsigned grayscale image, and by introducing the first value and the second value of the marking value, it is realized whether the next pixel threshold judgment is valid.

[0038] In some embodiments, the parameter information of the light spot includes at least one of the center position point, area, radius, and circularity of the light spot. In some embodiments, after obtaining the pixel coordinate set of the outer boundary of the light spot, the center position point, area, radius, circularity and other parameters of the light spot can be easily obtained.

[0039] In some embodiments, the light spot detection method of the present disclosure further includes: before determining the grayscale value of the pixel to be analyzed, determining that the grayscale value of the previous pixel of the pixel to be analyzed is a second value. That is, in the present disclosure, when the grayscale value of the previous pixel of the pixel to be analyzed is the second value (for example, 1), the grayscale value of the pixel to be analyzed is further determined and judged, and when the grayscale value of the previous pixel of the pixel to be analyzed is, for example, the first value, there is no need to further determine and judge the grayscale value of the pixel to be analyzed. In this way, the number of pixels to be determined can be minimized, and the efficiency of light spot detection can be improved.

[0040] In some embodiments, the light spot detection method of the present disclosure further includes: when it is determined that the grayscale value of the pixel is less than or equal to a preset threshold, the grayscale value of the pixel is maintained unchanged. That is, when it is determined that the grayscale value of the pixel is less than or equal to the preset threshold, the grayscale value of the pixel is not changed, and the pixel is not marked.

[0041] In some embodiments, see Figure 6 , the light spot detection method also includes: obtaining the gray value of each pixel row by row, and determining whether the gray value (also referred to as pixel value in this article) is a first value (for example, 0); when the gray value is determined to be the first value 0, setting the state variable of the pixel with the gray value of the first value 0 to the first state (for example, false); when the gray value is determined not to be the first value 0, determining whether the gray value is a second value (for example, 1); when the gray value is determined to be the second value 1, setting the state variable of the pixel with the gray value of the second value 1 to the second state (for example, true). In some embodiments, the first state false indicates that the judgment of the next gray value and the preset threshold is invalid, and the second state true indicates that the judgment of the next gray value and the preset threshold is valid. The judgment of the gray value and the first value 0 and the second value 1 is introduced to set the light spot edge pixel to 0 or 1 in the process of extracting the light spot, so as to ensure that the 0 of each row in the gray image is the starting position of the light spot, and the 1 is the end position of the light spot. Therefore, when a 0 pixel is detected, the next threshold detection is an invalid detection, and when the detection is 1, it is restored to a valid threshold detection. Combined with reference Figure 4 By combining the judgment of the first state and the second state, Figure 4 Pixels in the middle light spot that are not marked with 0 or 1 do not need to be detected, because 0 corresponds to the first state, and the subsequent judgment of the grayscale value and the preset threshold is invalid. In this way, the number of pixels that need to be detected is reduced, the detection efficiency of the outer boundary of the light spot is improved, and the efficiency of obtaining the pixel coordinate set is further improved.

[0042] In some embodiments, see Figure 7 , the light spot detection method also includes: obtaining the gray value of each pixel row by row, determining whether the state variable of the pixel is in the first state (the first state false is invalid); when the state variable of the pixel is in the first state, continuing to obtain the gray value of the next pixel, that is, jumping back to continue to obtain the gray value of the next pixel; when the state variable of the pixel is not in the first state (that is, the state variable of the pixel is in the second state true), determining whether the gray value of the pixel is greater than a preset threshold; when it is determined that the gray value of the pixel is less than or equal to the preset threshold, continuing to obtain the gray value of the next pixel; when it is determined that the gray value of the pixel is greater than the preset threshold, determining whether there is a pixel with a gray value of the first value 0 within the eight neighborhoods of the pixel, if there is, continuing to obtain the gray value of the next pixel, if not, entering the step of obtaining the pixel coordinate set of the outer boundary of the light spot. The judgment of whether there is a 0 pixel within the eight neighborhoods is introduced to achieve multi-entry detection of light spot detection. If the eight neighborhoods contain a 0 gray value, it means that the point is already the edge of a certain light spot detection; if the eight neighborhoods do not contain a 0 gray value, it means that the point is a light spot edge pixel to be detected.

[0043] In some embodiments, Figure 8 As shown, taking the first pixel as the center point, determining the next pixel whose grayscale value is greater than the preset threshold from the eight neighborhoods of the first pixel includes: determining the next pixel whose grayscale value is greater than the preset threshold from the pixels on the left side of the same row as the first pixel (for example, Figure 5 Starting from the pixel at position 4 in the image, determine the next pixel whose grayscale value is greater than the preset threshold from the eight neighborhoods of the first pixel in a counterclockwise direction. Figure 5 As shown, the order of determining the eight neighborhoods of the first pixel 1 is 4-5-6-7-0-1-2-3 (counterclockwise), and a pixel 2 with a grayscale value greater than a preset threshold is determined at position 5 of the first pixel 1. In some embodiments, if a point with a grayscale value greater than the threshold appears, the point is set as the end point b of the spot edge detection; if the grayscale value is not greater than the threshold, continue to determine whether the position of the point is the starting position 4 of the detection. If the position of the point is not the starting position 4, continue to determine the pixel at the next position.

[0044] In some embodiments, Figure 8 As shown, the light spot detection method also includes: when there is no pixel with a grayscale value greater than a preset threshold within the eight neighborhoods of the first pixel, the grayscale value of the first pixel is set to a second value (for example, 1). That is, when there is no pixel with a grayscale value greater than the preset threshold within the eight neighborhoods of the first pixel, it indicates that there is no pixel point exceeding the threshold within the eight neighborhoods of the point, and the point is an isolated point. The grayscale value of the point is modified to 1, the detection logic is jumped out, and the outer edge detection of the light spot is ended. In this way, tiny light spots in the image can be ignored, and the effectiveness of light spot detection is improved.

[0045] In some embodiments, each time the next pixel whose grayscale value is greater than the preset threshold is determined as the center point, determining the next pixel whose grayscale value is greater than the preset threshold from the eight-neighborhood range of the next pixel includes: each time the next pixel whose grayscale value is greater than the preset threshold is determined as the center point, starting from the last pixel whose grayscale value is greater than the preset threshold, determining the next pixel whose grayscale value is greater than the preset threshold from the eight-neighborhood range of the next pixel in a counterclockwise direction. Figure 3 , when pixel 2 is the center point, starting from pixel 1, pixel 3 with a grayscale value greater than the preset threshold is determined from the eight-neighborhood range of pixel 2 in a counterclockwise direction; when pixel 3 is the center point, starting from pixel 2, pixel 4 with a grayscale value greater than the preset threshold is determined from the eight-neighborhood range of pixel 3 in a counterclockwise direction; in this way, the outer boundary pixels 1-40 of the light spot are determined.

[0046] See also Fig. 9, showing the logic execution process. First, the starting edge point a (for example, pixel 1) of the light spot is obtained and set as the center point, and the ending edge point b (for example, pixel 2) is set as the state value point. In the counterclockwise direction, the state value (position 0-7) is accumulated to obtain the gray value of the state value point. Then it is determined whether the state value point is out of bounds. If it is out of bounds, continue to the next state value (i.e., the next position), otherwise continue. Then, it is determined whether the gray value of the state value point is greater than the threshold or equal to the first value 0 or the second value 1. If not, the next state value is determined. If it is established, the point is the edge point of the light spot, and the coordinate value is recorded. And according to the line of the image, if the point is the starting point of the light spot, the gray value is set to the first value 0, and if it is the ending point, it is set to the second value 1. Then, it is determined whether the center point is the ending point of the light spot (for example, pixel 40), and whether the state value point is the starting point a (for example, pixel 1). If it is, the detection of the light spot is terminated; if not, the state value point is set to the center point and the next round of edge detection is performed.

[0047] The present invention performs a threshold judgment on the basis of the original grayscale image for spot detection, and there is no need to perform a binarization process on the grayscale image, which reduces the image processing process and improves the speed and efficiency of spot detection. In addition, by introducing a first value (for example, 0) and a second value (for example, 1) of a marker value as a judgment of whether the threshold judgment is effective, the pixels inside the spot except the boundary of the spot do not need to be detected, which can further improve the efficiency of spot detection. In any row of the grayscale image of the present invention, the grayscale value of the starting point of the spot is 0, and the grayscale value of the ending point is 1. In addition, the spot detection method of the present invention can ignore tiny spots in the grayscale image and improve the effectiveness of spot detection.

[0048] The embodiment of the present disclosure further provides a light spot detection device 400 . Fig.10The light spot detection device 400 according to some embodiments is shown. The light spot detection device 400 includes an image acquisition module 401, a coordinate set acquisition module 402, and a parameter information determination module 403. In some embodiments, the image acquisition module 401 is configured to acquire a grayscale image. In some embodiments, the coordinate set acquisition module 402 is configured to determine the pixel coordinate set of the outer boundary of the light spot based on the grayscale value of the pixel of the grayscale image and a preset threshold, wherein determining the pixel coordinate set of the outer boundary of the light spot includes: determining the grayscale value of the pixel to be analyzed, and when the first pixel whose corresponding grayscale value is greater than the preset threshold appears, changing the grayscale value of the first pixel to the first value; taking the first pixel as the center point, determining the next pixel whose grayscale value is greater than the preset threshold from the eight neighborhoods of the first pixel; taking the next pixel whose grayscale value is greater than the preset threshold as the center point each time, determining the next pixel whose grayscale value is greater than the preset threshold from the eight neighborhoods of the next pixel, until returning to the first pixel, wherein the pixel coordinate set includes the coordinates of all pixels as the center point. In some embodiments, the parameter information determination module 403 is configured to determine the parameter information of the light spot based on the pixel coordinate set.

[0049] It should be understood that the contents described about the light spot detection method are also applicable to the light spot detection device 400 herein, and for the sake of simplicity, a detailed description is not given here.

[0050] In some embodiments, for each row of pixels, the grayscale value of the pixel where the starting point of the light spot is located is changed to a first value, and the grayscale value of the pixel where the ending point of the light spot is located is changed to a second value, and the first value and the second value are less than another preset threshold and are not the same. In some embodiments, the parameter information includes at least one of the center position point, area, radius, and roundness of the light spot. In some embodiments, the coordinate set acquisition module is further configured to: before determining the grayscale value of the pixel to be analyzed, determine that the grayscale value of the previous pixel of the pixel to be analyzed is a second value. In some embodiments, the coordinate set acquisition module is further configured to: when it is determined that the grayscale value of the pixel is less than or equal to the preset threshold, maintain the grayscale value of the pixel unchanged. In some embodiments, taking the first pixel as the center point, determining the next pixel whose grayscale value is greater than the preset threshold from the eight neighborhoods of the first pixel includes: starting from the pixel on the left side of the same row of the first pixel, and determining the next pixel whose grayscale value is greater than the preset threshold from the eight neighborhoods of the first pixel in a counterclockwise direction. In some embodiments, the coordinate set acquisition module is further configured to: when there is no pixel whose grayscale value is greater than the preset threshold within the eight neighborhoods of the first pixel, set the grayscale value of the first pixel to the second value. In some embodiments, each time the next pixel whose grayscale value is greater than a preset threshold is determined as the center point, determining the next pixel whose grayscale value is greater than the preset threshold from the eight-neighborhood range of the next pixel includes: each time the next pixel whose grayscale value is greater than the preset threshold is determined as the center point, starting from the last pixel whose grayscale value is greater than the preset threshold, determining the next pixel whose grayscale value is greater than the preset threshold from the eight-neighborhood range of the next pixel in a counterclockwise direction.

[0051] In addition, the present disclosure further provides a terminal, comprising: at least one memory and at least one processor; wherein the memory is used to store program codes, and the processor is used to call the program codes stored in the memory to execute the above-mentioned light spot detection method.

[0052] In addition, the present disclosure also provides a computer storage medium, which stores program codes, and the program codes are used to execute the above-mentioned light spot detection method.

[0053] The above describes the light spot detection method and device of the present disclosure based on the embodiments and application examples. In addition, the present disclosure also provides a terminal and a storage medium, which are described below.

[0054] Reference below Fig.11, which shows a schematic diagram of the structure of an electronic device (such as a terminal device or a server) 500 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.11 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0055] like Fig.11 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0056] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.11 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0057] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0058] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0059] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0060] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0061] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method of the present disclosure.

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

[0063] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0064] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.

[0065] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0066] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0067] According to one or more embodiments of the present disclosure, a light spot detection method is provided, which includes: acquiring a grayscale image; determining a pixel coordinate set of an outer boundary of a light spot based on the grayscale values ​​of pixels of the grayscale image and a preset threshold, wherein determining the pixel coordinate set of the outer boundary of the light spot includes: determining the grayscale value of a pixel to be analyzed, and when a first pixel having a grayscale value greater than the preset threshold appears, changing the grayscale value of the first pixel to a first value; taking the first pixel as a center point, and determining the next pixel having a grayscale value greater than the preset threshold from an eight-neighborhood range of the first pixel; each time taking the next pixel having a grayscale value greater than the preset threshold as a center point, and determining the next pixel having a grayscale value greater than the preset threshold from an eight-neighborhood range of the next pixel, until returning to the first pixel, wherein the pixel coordinate set includes the coordinates of all the pixels serving as the center points; and determining parameter information of the light spot based on the pixel coordinate set.

[0068] According to one or more embodiments of the present disclosure, for each row of pixels, the grayscale value of the pixel where the starting point of the light spot is located is changed to the first value, and the grayscale value of the pixel where the ending point of the light spot is located is changed to the second value, and the first value and the second value are less than another preset threshold and are different.

[0069] According to one or more embodiments of the present disclosure, the parameter information includes at least one of the center position point, area, radius, and circularity of the light spot.

[0070] According to one or more embodiments of the present disclosure, before determining the grayscale value of the pixel to be analyzed, the light spot detection method further includes: determining that the grayscale value of a pixel preceding the pixel to be analyzed is the second value.

[0071] According to one or more embodiments of the present disclosure, the light spot detection method further includes: when it is determined that the grayscale value of the pixel is less than or equal to the preset threshold, maintaining the grayscale value of the pixel unchanged.

[0072] According to one or more embodiments of the present disclosure, the light spot detection method also includes: acquiring the grayscale value of each pixel row by row, and determining whether the grayscale value is the first value; when the grayscale value is determined to be the first value, setting the state variable of the pixel whose grayscale value is the first value to the first state; when it is determined that the grayscale value is not the first value, determining whether the grayscale value is the second value; when the grayscale value is determined to be the second value, setting the state variable of the pixel whose grayscale value is the second value to the second state.

[0073] According to one or more embodiments of the present disclosure, the light spot detection method also includes: acquiring the grayscale value of each pixel row by row to determine whether the state variable of the pixel is the first state; when the state variable of the pixel is the first state, continuing to acquire the grayscale value of the next pixel; when the state variable of the pixel is not the first state, determining whether the grayscale value of the pixel is greater than the preset threshold; when it is determined that the grayscale value of the pixel is less than or equal to the preset threshold, continuing to acquire the grayscale value of the next pixel; when it is determined that the grayscale value of the pixel is greater than the preset threshold, determining whether there is a pixel with a grayscale value of the first value within the eight-neighborhood range of the pixel, if so, continuing to acquire the grayscale value of the next pixel, if not, entering the step of acquiring the pixel coordinate set of the outer boundary of the light spot.

[0074] According to one or more embodiments of the present disclosure, taking the first pixel as the center point, determining the next pixel whose grayscale value is greater than the preset threshold from the eight-neighborhood range of the first pixel includes: starting from the pixel on the left side of the same row as the first pixel, and determining the next pixel whose grayscale value is greater than the preset threshold from the eight-neighborhood range of the first pixel in a counterclockwise direction.

[0075] According to one or more embodiments of the present disclosure, the light spot detection method further includes: when there is no pixel with a grayscale value greater than the preset threshold within the eight-neighborhood range of the first pixel, setting the grayscale value of the first pixel to the second value.

[0076] According to one or more embodiments of the present disclosure, each time the next pixel whose grayscale value is greater than the preset threshold is determined as the center point, determining the next pixel whose grayscale value is greater than the preset threshold from the eight-neighborhood range of the next pixel includes: each time the next pixel whose grayscale value is greater than the preset threshold is determined as the center point, starting from the last pixel whose grayscale value is greater than the preset threshold, determining the next pixel whose grayscale value is greater than the preset threshold from the eight-neighborhood range of the next pixel in a counterclockwise direction.

[0077] According to one or more embodiments of the present disclosure, a light spot detection device is provided, the light spot detection device comprising: an image acquisition module, configured to acquire a grayscale image; a coordinate set acquisition module, configured to determine a pixel coordinate set of an outer boundary of a light spot based on the grayscale values ​​of pixels of the grayscale image and a preset threshold, wherein determining the pixel coordinate set of the outer boundary of the light spot comprises: determining the grayscale value of a pixel to be analyzed, and when a first pixel having a grayscale value greater than the preset threshold appears, changing the grayscale value of the first pixel to a first value; taking the first pixel as a center point, and determining the next pixel having a grayscale value greater than the preset threshold from an eight-neighborhood range of the first pixel; each time taking the next pixel having a grayscale value greater than the preset threshold as a center point, and determining the next pixel having a grayscale value greater than the preset threshold from an eight-neighborhood range of the next pixel, until returning to the first pixel, wherein the pixel coordinate set comprises the coordinates of all the pixels serving as the center point; and a parameter information determination module, configured to determine parameter information of the light spot based on the pixel coordinate set.

[0078] According to one or more embodiments of the present disclosure, a terminal is provided, comprising: at least one memory and at least one processor; wherein the at least one memory is used to store program code, and the at least one processor is used to call the program code stored in the at least one memory to execute any one of the methods described above.

[0079] According to one or more embodiments of the present disclosure, a storage medium is provided, wherein the storage medium is used to store program code, and the program code is used to execute the above method.

[0080] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0081] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0082] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A light spot detection method, characterized in that: The light spot detection method comprises: Get grayscale image; Based on the grayscale values ​​of the pixels of the grayscale image and a preset threshold, a pixel coordinate set of the outer boundary of the light spot is determined, wherein determining the pixel coordinate set of the outer boundary of the light spot includes: Determine the grayscale value of the pixel to be analyzed, and when a first pixel whose grayscale value is greater than the preset threshold appears, change the grayscale value of the first pixel to a first value; Taking the first pixel as the center point, determining the next pixel whose grayscale value is greater than the preset threshold from the eight neighborhoods of the first pixel; Each time, the next pixel whose grayscale value is greater than the preset threshold is taken as the center point, and the next pixel whose grayscale value is greater than the preset threshold is determined from the eight-neighborhood range of the next pixel, until returning to the first pixel, wherein the pixel coordinate set includes the coordinates of all the pixels taken as the center point; Parameter information of the light spot is determined based on the pixel coordinate set.

2. The light spot detection method according to claim 1, characterized in that: For each row of pixels, the grayscale value of the pixel where the starting point of the light spot is located is changed to the first value, and the grayscale value of the pixel where the ending point of the light spot is located is changed to the second value, and the first value and the second value are less than another preset threshold and are different.

3. The light spot detection method according to claim 1, characterized in that: The parameter information includes at least one of the center position point, area, radius, and circularity of the light spot.

4. The light spot detection method according to claim 2, characterized in that: Before determining the grayscale value of the pixel to be analyzed, the method further includes: Determine that the grayscale value of a pixel preceding the pixel to be analyzed is the second value.

5. The light spot detection method according to claim 1, characterized in that: Also includes: When it is determined that the grayscale value of the pixel is less than or equal to the preset threshold, the grayscale value of the pixel is maintained unchanged.

6. The light spot detection method according to claim 1, characterized in that: Taking the first pixel as the center point, determining the next pixel whose grayscale value is greater than the preset threshold from the eight-neighborhood range of the first pixel includes: starting from the pixel on the left side of the same row as the first pixel, and determining the next pixel whose grayscale value is greater than the preset threshold from the eight-neighborhood range of the first pixel in a counterclockwise direction.

7. The light spot detection method according to claim 2, characterized in that: Also includes: When there is no pixel with a grayscale value greater than the preset threshold within the eight neighborhoods of the first pixel, the grayscale value of the first pixel is set to the second value.

8. The light spot detection method according to claim 1, characterized in that: Each time, taking the next pixel whose grayscale value is greater than the preset threshold as the center point, determining the next pixel whose grayscale value is greater than the preset threshold from the eight neighborhoods of the next pixel includes: Each time, the next pixel whose grayscale value is greater than the preset threshold is taken as the center point, and starting from the last pixel whose grayscale value is greater than the preset threshold, the next pixel whose grayscale value is greater than the preset threshold is determined from the eight-neighborhood range of the next pixel in a counterclockwise direction.

9. A light spot detection device, characterized in that: The light spot detection device comprises: An image acquisition module configured to acquire a grayscale image; A coordinate set acquisition module is configured to determine a pixel coordinate set of an outer boundary of the light spot based on the grayscale value of the pixel of the grayscale image and a preset threshold, wherein determining the pixel coordinate set of the outer boundary of the light spot includes: Determine the grayscale value of the pixel to be analyzed, and when a first pixel whose grayscale value is greater than the preset threshold appears, change the grayscale value of the first pixel to a first value; Taking the first pixel as the center point, determining the next pixel whose grayscale value is greater than the preset threshold from the eight neighborhoods of the first pixel; Each time, the next pixel whose grayscale value is greater than the preset threshold is taken as the center point, and the next pixel whose grayscale value is greater than the preset threshold is determined from the eight-neighborhood range of the next pixel, until returning to the first pixel, wherein the pixel coordinate set includes the coordinates of all the pixels taken as the center point; The parameter information determination module is configured to determine the parameter information of the light spot based on the pixel coordinate set.

10. A terminal, comprising: at least one memory and at least one processor; The at least one memory is used to store program codes, and the at least one processor is used to call the program codes stored in the at least one memory to execute the light spot detection method according to any one of claims 1 to 8. 11 . A storage medium, the storage medium being used to store program codes, the program codes being used to execute the light spot detection method according to any one of claims 1 to 8.