Target light spot positioning method and device, equipment, medium and program product
By using historical spot information to track the target spot in the photodeflector, combined with grayscale and area threshold screening, the problems of weak anti-interference ability and large calculation amount in the photodeflector measurement are solved, and efficient and accurate target spot positioning is achieved.
Patent Information
- Application Number
- CN202510471139.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2025-07-25
AI Technical Summary
When measuring bridge deflection, existing photoelectric deflectors have weak anti-interference ability, low measurement accuracy and large calculation amount, resulting in low measurement efficiency.
By obtaining the historical spot information in the previous spot image, the starting coordinates of the target spot image are tracked using the historical spot center coordinates, and the target spot spot is screened based on the grayscale threshold and the spot area threshold to achieve rapid positioning.
It realizes rapid positioning of the target spot, has small calculation amount, strong anti-interference ability, high measurement accuracy, and improves measurement efficiency and accuracy.
Smart Images

Figure CN120368846A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention belong to the technical field of industrial measurement, and particularly relate to a method, device, equipment, medium and program product for positioning a target light spot. Background Art
[0002] An electro-deflectometer is an industrial device used for measuring the static and dynamic deflections of various bridges. The electro-optical deflectometer fixes a special electro-optical target on the measured point of the bridge to be measured, rigidly connects the bridge with the measured structure, converts the bridge vibration into the vibration of a light source with a specific wavelength, conducts the measured optical signal to a special high-precision industrial CCD through an optical imaging system, and precisely measures the longitudinal and lateral displacements and their response curves over time generated by the measured bridge under the action of a load by detecting the change in the central coordinates of the target image on the CCD. The K value (Kx, Ky) of the system, that is, the actual displacement value represented by each pixel on the CCD, can be calibrated before measurement.
[0003] Existing electro-optical deflectometers mostly calculate the center of the target by methods such as the gray centroid method and the edge contour detection algorithm. The gray centroid method directly traverses the ROI region of the image, accumulates the product of the gray value and the coordinate, and then performs weighted averaging to obtain the center of the light spot. The edge contour detection algorithm first extracts the point set of the edge contour of the light spot, and then calculates its centroid as the center of the light spot according to the edge contour. However, when the ROI region is too small in the gray centroid method, the target occupies a relatively large proportion in the ROI region, and the anti-interference ability is strong, but the measurement range is small. After expanding the ROI region, the proportion of the target in the ROI region becomes smaller, and the measurement result is greatly affected by the brightness change of the non-target part in the ROI region, affecting the measurement accuracy. The edge contour detection algorithm will ignore the gray value information of the light spot, and there are fluctuations in the edge contour of the light spot, resulting in low measurement accuracy, and there are also problems of large computational amount and affecting the measurement frequency. Summary of the Invention
[0004] The present invention provides a method for positioning a target light spot, including: obtaining historical light spot information of the target light spot in the previous light spot image, where the target light spot is the light spot formed by an electro-optical deflectometer on a target target; determining the historical light spot center coordinates of the target light spot in the previous light spot image according to the historical light spot information; determining the tracking start coordinates of the target light spot in the target light spot image according to the historical light spot center coordinates, where the target light spot image and the previous light spot image are two temporally adjacent light spot images of the target target; and positioning the current light spot position of the target light spot in the target light spot image according to the tracking start coordinates. At least solves the problems of weak anti-interference ability, low measurement accuracy, large computational amount and low measurement efficiency in the prior art, can realize fast positioning of the target light spot, requires small computational amount, fast calculation, and has high measurement accuracy and strong anti-interference ability.
[0005] To solve the above technical problems, the present application proposes five aspects.
[0006] In a first aspect, the present application provides a method for positioning a target light spot, including: obtaining historical light spot information of the target light spot in the previous light spot image, where the target light spot is the light spot formed by an optoelectronic deflection meter on a target; determining the historical light spot center coordinates of the target light spot in the previous light spot image according to the historical light spot information; determining the tracking start coordinates of the target light spot in the target light spot image according to the historical light spot center coordinates, where the target light spot image and the previous light spot image are two temporally adjacent light spot images of the target; and positioning the current light spot position of the target light spot in the target light spot image according to the tracking start coordinates.
[0007] In some embodiments, positioning the current light spot position of the target light spot in the target light spot image according to the tracking start coordinates includes: obtaining a preset gray threshold; placing the pixel points of the target light spot image in a preset first set; determining a central pixel point in the first set according to the tracking start coordinates; obtaining the current gray value of the pixel points adjacent to the central pixel point, and deleting the pixel points adjacent to the central pixel point from the first set; taking the pixel points with the current gray value greater than or equal to the gray threshold as target pixel points and placing them in a preset second set; using the target pixel points as new central pixel points in the first set, and performing the operations of obtaining the current gray value of the pixel points adjacent to the central pixel point and deleting the pixel points adjacent to the central pixel point from the first set; stopping the execution when the current gray values of all the pixel points adjacent to the central pixel point are less than the gray threshold; determining the current light spot information of the target light spot image according to the pixel points in the second set; and determining the current light spot position of the target according to the current light spot information.
[0008] In some embodiments, when obtaining the historical light spot information of the target in the previous light spot image, the method further includes: detecting whether there is historical light spot information; when it is determined that there is no historical light spot information, obtaining a light spot image sequence of the target; selecting, as the target light spot image, the light spot image in which the light spot first appears in the light spot image sequence; performing light spot search on the target light spot image to obtain a search result; determining the current light spot information of the target light spot in the target light spot image according to the search result; and determining the current light spot position of the target according to the current light spot information.
[0009] In some embodiments, the method further includes: obtaining a preset spot area threshold; determining the current spot area of the target spot in the target spot image according to the current spot information; determining whether the target spot is the target spot according to the current spot area and the spot area threshold; when the current spot area is less than the spot area threshold, determining that the target spot is not the target spot; performing spot search on the target spot image to obtain a search result; and determining the current spot information of the target spot in the target spot image according to the search result.
[0010] In some embodiments, the performing spot search on the target spot image to obtain a search result includes: obtaining a preset gray threshold; placing all pixel points of the target spot image in a preset third set; traversing all pixel points in the third set, and placing the pixel points whose gray values are greater than or equal to the gray threshold in a preset fourth set; and after all pixel points in the third set are traversed, taking the fourth set as the search result.
[0011] In some embodiments, the determining the current spot information of the target spot in the target spot image according to the search result includes: obtaining the actual spot areas of the spots in the fourth set; determining the spot with the largest actual spot area as the target spot; and obtaining the current spot information of the target spot from the fourth set.
[0012] In a second aspect, the present application provides a positioning device for a target spot, including: a first obtaining module, configured to obtain historical spot information of the target spot in the previous spot image, where the target spot is a spot formed by an optoelectronic deflection meter on a target; a first determining module, configured to determine the historical spot center coordinates of the target spot in the previous spot image according to the historical spot information; a second determining module, configured to determine the tracking start coordinates of the target spot in the target spot image according to the historical spot center coordinates, where the target spot image and the previous spot image are two temporally adjacent spot images of the target; and a first positioning module, configured to position the current spot position of the target spot in the target spot image according to the tracking start coordinates.
[0013] In a third aspect, the present application provides a computer electronic production device, including a memory, a processor, and a computer program stored on the memory, where the processor executes the computer program to implement the steps of the method according to any one of the first aspect.
[0014] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method according to any one of the first aspect are implemented.
[0015] In a fifth aspect, the present application provides a computer program product, including a computer program / instructions, which when executed by a processor, implement the steps of the method described in any one of the first aspects.
[0016] The present invention relates to a method for positioning a target light spot, including: obtaining historical light spot information of the target light spot in the previous light spot image, where the target light spot is the light spot formed by an optoelectronic deflection meter on a target; determining the historical light spot center coordinates of the target light spot in the previous light spot image according to the historical light spot information; determining the tracking start coordinates of the target light spot in the target light spot image according to the historical light spot center coordinates, where the target light spot image and the previous light spot image are two temporally adjacent light spot images of the target; and positioning the current light spot position of the target light spot in the target light spot image according to the tracking start coordinates. It solves at least the problems of weak anti-interference ability, low measurement accuracy, large calculation amount and low measurement efficiency in the prior art, can achieve fast positioning of the target light spot, requires a small amount of calculation, fast calculation, high measurement accuracy and strong anti-interference ability. Description of the Drawings
[0017] One or more embodiments are exemplarily illustrated by pictures in the corresponding drawings, and these exemplary illustrations do not constitute a limitation on the embodiments.
[0018] Figure 1 It is the main flowchart of a method for positioning a target light spot provided by an embodiment of the present application;
[0019] Figure 2 It is the real light spot image of the target provided by an embodiment of the present application;
[0020] Figure 3 It is the implementation flowchart of a method for positioning a target light spot provided by an embodiment of the present application;
[0021] Figure 4 It is the main structural block diagram of a device for positioning a target light spot provided by an embodiment of the present application. Detailed Embodiments
[0022] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the following will elaborate on each embodiment of this application in conjunction with the accompanying drawings. However, those of ordinary skill in the art can understand that in each embodiment of this application, many technical details are presented to help readers better understand this application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in this application can still be implemented. The division of the following embodiments is for convenience of description and should not impose any limitation on the specific implementation of this application. The various embodiments can be combined and cross-referenced with each other on the premise of not being contradictory.
[0023] An electro-optical deflection meter is an industrial device used for measuring the static and dynamic deflections of various bridges. The electro-optical deflection meter fixes a special electro-optical target at the measured point of the bridge to be measured, rigidly connects the bridge with the measured structure, converts the bridge vibration into the vibration of a light source with a specific wavelength, conducts the measured optical signal to a special high-precision industrial CCD through an optical imaging system, and precisely measures the longitudinal and lateral displacements generated by the measured bridge under the action of load and its response curve over time by detecting the change in the central coordinate of the target's image on the CCD. The K value (Kx, Ky) of the system, that is, the actual displacement value represented by each pixel on the CCD, can be calibrated before measurement.
[0024] Existing electro-optical deflection meters mostly calculate the center of the target using methods such as the gray centroid method and the edge contour detection algorithm. The gray centroid method directly traverses the ROI region of the image, accumulates the product of the gray value and the coordinate, and then performs weighted averaging to obtain the center of the light spot. The edge contour detection algorithm first extracts the point set of the edge contour of the light spot, and then calculates its centroid based on the edge contour as the center of the light spot. However, when the ROI region is too small in the gray centroid method, the target occupies a relatively large proportion in the ROI region, with strong anti-interference ability, but the measurement range is small. After expanding the ROI region, the proportion of the target in the ROI region becomes smaller, and the measurement result is greatly affected by the brightness change of the non-target part in the ROI region, affecting the measurement accuracy. The edge contour detection algorithm will ignore the gray value information of the light spot, and there are fluctuations in the edge contour of the light spot, resulting in low measurement accuracy and large computational complexity, which affects the measurement frequency.
[0025] To solve the above technical problems, the present invention proposes a method for positioning the target light spot. The following specifically describes the implementation details of the method for determining the bandwidth of this embodiment. The following content is only implementation details provided for convenient understanding and is not necessary for implementing this solution.
[0026] Embodiment 1:
[0027] As Figure 1As shown in the figure, the present application provides a method for positioning a target light spot. The method is applicable to electronic production equipment, which can be a server, a mobile terminal, a computer, a cloud platform, etc. The functions realized by the production equipment data processing provided in the embodiments of the present application can be implemented by a processor of the electronic production equipment calling program codes, wherein the program codes can be stored in a computer storage medium. The method for positioning the target light spot includes:
[0028] When measuring with an optoelectronic deflection instrument, mainly fix the deflection instrument at a fixed position, then set the target target at the position to be tested, and the optoelectronic deflection instrument will emit laser light, which will irradiate on the target target, and then form a target light spot on the target target. If the longitudinal and lateral displacements generated by the measured bridge, etc. under the action of load cause the position of the target light spot on the target target to move, it will inevitably lead to the movement of the center point of the target light spot. Therefore, in order to measure the longitudinal and lateral displacements generated by the bridge, etc. under the action of load and their response curves with respect to time, it is necessary to obtain the light spot images of the target target at each moment, and then correlate the center positions of the target light spots in each light spot image according to the timing of each light spot image, so as to form a response curve.
[0029] However, in addition to the light spot directly irradiated by the deflection instrument on the target target, there will be other interfering light sources or interfering light spots generated due to the refraction of the lens on the light spot of the target target. Therefore, to determine the center position of the target light spot in the target target, it is necessary to first determine the light spots in each image, screen out the target light spots from these light spots, and then the center positions of each target light spot can be obtained, so as to realize the measurement of the bridge, etc. However, such processing is required for each light spot image, which will inevitably lead to low efficiency and large computational complexity. Generally speaking, the moving range of the center point of the target light spot will be within the light spot range of the target light spot. Therefore, in the present application, the center position of the target light spot in the previous light spot image can be used to track the target light spot in the next light spot image, so as to quickly obtain the light spot position of the target light spot in the next light spot image, saving a large amount of computational complexity and greatly improving the efficiency.
[0030] Step S1: Obtain the historical light spot information of the target light spot in the previous light spot image, where the target light spot is the light spot formed by the optoelectronic deflection instrument on the target target.
[0031] In some embodiments, before step S1 "Obtain the historical light spot information of the target light spot in the previous light spot image", the method further includes:
[0032] Step S11: Detect whether there is historical light spot information.
[0033] Step S12: When it is determined that there is no historical light spot information, obtain the light spot image sequence of the target target.
[0034] Step S13: Select the spot image with the first appearance of a spot in the sequence of spot images as the target spot image.
[0035] Step S14: Perform spot search on the target spot image to obtain a search result.
[0036] To determine the position of the target spot in the target spot image based on the position of the target spot in the previous spot image, there must be a target spot in the previous spot image. However, if the measurement has just started and no target spot in any spot image has been determined yet, then a target spot in a spot image needs to be determined first. Since there is a temporal relationship between spot images, in this application, spot search operation is first performed on the spot image with the first appearance of a spot, and then the target spot in this spot image is determined based on the search result.
[0037] Therefore, in some embodiments, the "perform spot search on the target spot image to obtain a search result" in step S14 includes:
[0038] Step S141: Obtain a preset gray-scale threshold.
[0039] Step S142: Place all pixel points of the target spot image in a preset third set.
[0040] Step S143: Traverse all pixel points in the third set, and place the pixel points with gray-scale values greater than or equal to the gray-scale threshold in a preset fourth set.
[0041] Step S144: After all pixel points in the third set have been traversed, use the fourth set as the search result.
[0042] Step S15: Determine the current spot information of the target spot in the target spot image according to the search result.
[0043] In this application, a traversal method is used to traverse the pixel points with gray-scale values greater than the preset gray-scale threshold in the third set storing all pixel points of the target spot image, and place the pixel points with gray-scale values greater than the preset gray-scale threshold in the fourth set. When the traversal of the third set is completed, the pixel points in the fourth set are all pixel points with gray-scale values greater than or equal to the preset gray-scale threshold, and these pixel points will gather in different central coordinates, that is, multiple spots with different positions are formed. At this time, since there may be interfering spots in the target spot image, the real spot image is as Figure 2 shown. Therefore, we still need to screen each spot in the search result to screen out the spot information of the target spot.
[0044] Therefore, in some embodiments, "determining the current spot information of the target spot in the target spot image according to the search result" in step S15 includes:
[0045] Step S151: Obtain the actual spot area of each spot in the fourth set.
[0046] Step S152: Determine the spot with the largest actual spot area as the target spot.
[0047] Step S153: Obtain the current spot information of the target spot from the fourth set.
[0048] Due to the measurement characteristics of the photoelectric deflection instrument, in the target spot image, the area of the target spot is the largest among them. Therefore, in this application, the spot with the largest area can be determined as the target spot according to the actual spot area of each spot in the fourth set. After determining the target spot, the spot information of the target spot can be obtained from the fourth set.
[0049] Step S16: Determine the current spot position of the target target according to the current spot information.
[0050] Step S2: Determine the historical spot center coordinates of the target spot in the previous spot image according to the historical spot information.
[0051] The spot information of the target spot includes the coordinate information of the boundary pixel points of the target spot. Therefore, the maximum abscissa, minimum abscissa, maximum ordinate, and minimum ordinate of the target spot can be obtained. And since the spot is circular, the center position and spot radius of the target spot can be obtained. Therefore, after obtaining the historical spot information, the historical spot center coordinates of the historical spot can be determined according to the historical spot information.
[0052] Step S3: Determine the tracking start coordinates of the target spot in the target spot image according to the historical spot center coordinates, where the target spot image and the previous spot image are two sequentially adjacent spot images of the target target.
[0053] Step S4: Locate the current spot position of the target spot in the target spot image according to the tracking start coordinates.
[0054] Generally, the movement range of the center point of the target spot will be within the spot range of the target spot. Therefore, in this application, the center position of the target spot in the previous spot image can be used to track the target spot in the next spot image, that is, the historical spot center coordinates are very likely to be located in the target spot in the target spot image. Therefore, the historical spot center coordinates can be used as the tracking start coordinates to traverse in the target spot image.
[0055] Therefore, in some embodiments, step S4, "locating the current spot position of the target spot in the target spot image according to the tracking start coordinates", includes:
[0056] Step S41: Obtain a preset gray threshold.
[0057] Step S42: Place the pixel points of the target spot image in a preset first set.
[0058] Step S43: Determine the central pixel point in the first set according to the tracking start coordinates.
[0059] Step S44: Obtain the current gray value of the pixel points adjacent to the central pixel point, and delete the pixel points adjacent to the central pixel point from the first set.
[0060] Step S45: Take the pixel points whose current gray value is greater than or equal to the gray threshold as target pixel points and place them in a preset second set.
[0061] Step S46: Use the target pixel points as new central pixel points in the first set, execute obtaining the current gray value of the pixel points adjacent to the central pixel point, and delete the pixel points adjacent to the central pixel point from the first set.
[0062] Step S47: Stop execution when the current gray values of all the pixel points adjacent to the central pixel point are less than the gray threshold.
[0063] Step S48: Determine the current spot information of the target spot image according to the pixel points in the second set.
[0064] Step S49: Determine the current spot position of the target target according to the current spot information.
[0065] When performing spot tracking, the traversal method is still used to traverse the target spot image, but the traversal at this time does not need to traverse the entire target spot image. Since the pixels in the target spot area whose grayscale values are greater than the preset grayscale threshold are continuous, the present application only needs to traverse the relationship between the grayscale value and the grayscale threshold of the surrounding pixels with a certain pixel as the center similarity, and the boundary coordinate information of the target spot can be easily found. Therefore, when the tracking is just started, the tracking starting coordinate is first used as the center pixel point, and then the relationship between the grayscale value and the grayscale threshold of the 8 pixels adjacent to the center pixel point is traversed, and the traversed pixels are deleted from the first set to prevent the pixels from being traversed repeatedly, and the pixels in the adjacent pixels that are greater than or equal to the preset grayscale threshold are placed in the second set, and the adjacent pixels are traversed again with these pixels as the center pixels, until the grayscale values of the adjacent pixels of the center pixel point are all less than the preset grayscale threshold, indicating that the traversal of the spot has been completed. This traversal of only a single light spot greatly improves the efficiency of the subsequent light spot tracking process and greatly reduces the amount of calculation required for light spot tracking.
[0066] Although it is feasible and valid to assume that the center position of the spot in the previous spot image is in the target spot of the target spot image in most cases, there may be some unexpected events. For example, human factors may cause some shaking of the target position or the photoelectric deflectometer position, which will make this assumption invalid and lead to tracking errors. Therefore, in order to avoid this situation in the present application, after completing the acquisition of the spot information of the target spot in the target spot image, the spot information needs to be verified to determine that the spot information is the target spot of the target target and not other interference, or it is not in the spot area.
[0067] Therefore, in some embodiments, the method further comprises:
[0068] Step S51: obtaining a preset light spot area threshold.
[0069] Step S52: determining the current light spot area of the target light spot in the target light spot image according to the current light spot information.
[0070] Step S53: determining whether the target light spot is the target light spot according to the current light spot area and the light spot area threshold.
[0071] Step S54: when the current light spot area is smaller than the light spot area threshold, determining that the target light spot is not the target light spot.
[0072] Similarly, since the size of the target light spot is determined and it is the largest in the light spot image, a light spot area threshold is preset in this application. The light spot area is used to determine whether the tracked light spot information is the light spot information of the target light spot. If the area of the tracked light spot is greater than or equal to the light spot area threshold, it indicates that the current tracking is correct. If the area of the tracked light spot is less than the light spot area threshold, it indicates that an accident has occurred. At this time, it is necessary to search in the target light spot image to find the true position of the target light spot in the light spot pattern.
[0073] Step S55: Perform a light spot search on the target light spot image to obtain a search result.
[0074] Therefore, in some embodiments, the "performing a light spot search on the target light spot image to obtain a search result" in step S55 includes:
[0075] Step S551: Obtain a preset gray-scale threshold.
[0076] Step S552: Place all pixel points of the target light spot image in a preset third set.
[0077] Step S553: Traverse all pixel points in the third set, and place the pixel points whose gray-scale values are greater than or equal to the gray-scale threshold in a preset fourth set.
[0078] Step S554: After all pixel points in the third set have been traversed, use the fourth set as the search result.
[0079] This application uses a traversal method to traverse the pixel points with gray-scale values greater than the preset gray-scale threshold in the third set storing all pixel points of the target light spot image, and place the pixel points with gray-scale values greater than the preset gray-scale threshold in the fourth set. When the traversal of the third set is completed, the pixel points in the fourth set are all pixel points with gray-scale values greater than or equal to the preset gray-scale threshold, and these pixel points will gather in different central coordinates, that is, multiple light spots with different positions are formed. Of course, the processes of steps S551 - S554 are the same as those of steps S141 - S144, which are all to perform a light spot search on the target light spot image to obtain the light spot information of each light spot in the target light spot image.
[0080] Step S56: Determine the current light spot information of the target light spot in the target light spot image according to the search result.
[0081] At this time, since there may be interference light spots in the target light spot image, we also need to screen each light spot in the search result to screen out the light spot information of the target light spot.
[0082] In some embodiments, "determining the current spot information of the target spot in the target spot image according to the search result" in step S56 includes:
[0083] Step S561: Obtain the actual spot area of each spot in the fourth set.
[0084] Step S562: Determine the spot with the largest actual spot area as the target spot.
[0085] Step S563: Obtain the current spot information of the target spot from the fourth set.
[0086] Due to the measurement characteristics of the photoelectric deflection meter, in the target spot image, the area of the target spot is the largest among them. Therefore, in this application, the spot with the largest area can be determined as the target spot according to the actual spot area of each spot in the fourth set. After determining the target spot, the spot information of the target spot can be obtained from the fourth set. Of course, the process of steps S561 - S563 is the same as the process of steps S151 - S153, which is to screen the searched spots to screen the target spot, and then determine the spot information of the target spot.
[0087] For easy understanding, as Figure 3 shown, this application sorts out the above method step by step from the beginning as follows:
[0088] I. Search process
[0089] 1) When the program is initialized, it is in the search state.
[0090] 2) Create an alternative spot set C for storing all possible spot subsets
[0091] 3) Store all pixels in the ROI area of the picture into set A. Traverse all pixels in set A and compare their gray value g with the gray threshold δ. If g < δ, it means that its gray value does not meet the requirements, delete it from set A, and re - execute step 1). If g ≥ δ, then proceed to step 4);
[0092] 4) Create a spot pixel coordinate set B, store the coordinate of pixel i into B, and then sequentially traverse the 8 neighboring pixels j of pixel i, and perform gray value judgment. If the gray value g ≥ δ, then store the coordinate of its neighboring pixel j into set B, and continue to sequentially traverse the neighboring pixels of neighboring pixel j, repeating this traversal until the gray values of all its neighboring pixels do not meet the requirements, obtaining a spot pixel coordinate set. Store it into the alternative spot set C. Note: For the traversed pixels, whether they meet the gray value requirements or not, delete them from set A.
[0093] 5) Repeat steps 3) and 4) to find all the spot clusters in the ROI of the image.
[0094] 6) Traverse the alternative spot cluster set C. The set of pixel coordinates of the spot with the largest number of pixels in the set of spot pixel coordinates is the set of pixel coordinates of the spot formed by the target.
[0095] 7) Use the gray centroid method to calculate the center of the spot for this set of spot pixel coordinates, denoted as (x0, y0).
[0096] 8) Set the tracking coordinates as x_track = x0, y_track = y0.
[0097] 9) Set the spot query threshold range:
[0098] x 上限 = x0, x 下限 = x0, y 上限 = y0, y 下限 = y0
[0099] 10) Take the maximum and minimum values of the x coordinates in the set of spot pixel coordinates and denote them as x max , x min
[0100] 11) Take the maximum and minimum values of the y coordinates in the set of spot pixel coordinates and denote them as y max , y min
[0101] 12) Denote the radius of the spot in the x direction: X 半 = (x max - x min ) / 2
[0102] 13) Denote the radius of the spot in the y direction: Y 半 = (y max - y min ) / 2
[0103] 14) Enter the tracking state.
[0104] II. Tracking Process
[0105] 1) Judge the gray value g of the tracking coordinates 跟 , if g 跟 ≥δ, proceed to step 2). Otherwise, enter the query state.
[0106] 2) Traverse the 8 neighboring pixels k of the tracking coordinates in sequence and perform grayscale value judgment. If the grayscale value g ≥ δ, store the coordinates of its neighboring pixel point k in the set D, and continue to traverse the neighboring pixels of the neighboring pixel point k in sequence. Repeat this traversal until the grayscale values of its neighboring pixels do not meet the requirements, obtaining a set of spot pixel point coordinates. This set is the set of spot pixel point coordinates formed by the target.
[0107] 3) Use the grayscale centroid method to calculate the center of the spot for the set D of spot pixel point coordinates, denoted as (x1, y1).
[0108] 4) Set the tracking coordinates as x1 = x0, y1 = y0.
[0109] 5) Compare (x1, y1) with the upper and lower limits of the spot query threshold range.
[0110] If x1 < x 下限 , x 下限 = x1
[0111] If x1 > x 上限 , x 上限 = x1
[0112] If y1 < y 下限 , y 下限 = y1
[0113] If y1 > y 上限 , y 上限 = y1
[0114] 6) Save the tracking state
[0115] III. Judgment of Tracking Results
[0116] Compare the area of the spot obtained by tracking with the preset spot area threshold. If the area of the spot obtained by tracking is less than the spot area threshold, perform a search process on the current tracked spot image. If the spot area is greater than or equal to the spot area threshold, perform a tracking process on the next spot image with the current tracking result.
[0117] In summary, the method of the present application solves the problem that it is impossible to have both anti-interference ability and measurement accuracy in the existing grayscale centroid method, and also solves the problems of large computational complexity and low measurement accuracy existing in the edge contour detection algorithm, realizing fast tracking of the target spot in the target spot, and having strong anti-interference ability, small computational complexity, and high processing efficiency during the tracking process. In the application scenario of bridge deflection measurement, this method mainly runs the tracking state, and the search speed of the spot pixel point set is extremely fast, occupying little CPU. It can achieve 2K@60fps on embedded devices, and simultaneously track and perform real-time center calculation for up to 20 spots in each image.
[0118] Example 2:
[0119] Based on the foregoing embodiments, an embodiment of the present application provides a positioning device for a target light spot. Each module included in the device, as well as each unit included in each module, can be implemented by a processor in a computer device; of course, it can also be implemented by specific logic circuits; during implementation, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0120] As Figure 4 shown, a positioning device for a target light spot includes: a first acquisition module 1, a first determination module 2, a second determination module 3, and a first positioning module 4.
[0121] The first acquisition module 1 is configured to acquire historical light spot information of the target light spot in the previous light spot image, where the target light spot is a light spot formed by an optoelectronic deflection meter on a target. The first determination module 2 is configured to determine the historical light spot center coordinates of the target light spot in the previous light spot image according to the historical light spot information. The second determination module 3 is configured to determine the tracking start coordinates of the target light spot in the target light spot image according to the historical light spot center coordinates, where the target light spot image and the previous light spot image are two temporally adjacent light spot images of the target. The first positioning module 4 is configured to locate the current light spot position of the target light spot in the target light spot image according to the tracking start coordinates.
[0122] Each module in the above-mentioned positioning device for a target light spot can be implemented in whole or in part by software, hardware, and their combination. The above-mentioned modules can be embedded in or independent of the processor in the device in hardware form, or stored in the memory in the processing device in software form, so as to facilitate the processor to call and execute the operations corresponding to the above-mentioned modules. It should be noted that the division of modules in the embodiments of the present application is illustrative, and is only a logical function division. In actual implementation, there may be other division methods.
[0123] Example 3:
[0124] In a third aspect, the present application provides a computer electronic production device, including a memory, a processor, and a computer program stored on the memory. The processor executes the computer program to implement the steps of the method according to any one of the first aspects.
[0125] Among them, the memory and the processor are connected in a bus manner. The bus can include any number of interconnected buses and bridges, which connect various circuits of one or more processors and the memory together. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits, etc. These are well known in the art, so they will not be further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single component or multiple components, such as multiple receivers and transmitters, and provides a unit for communicating with various other devices over a transmission medium. The data processed by the processor is transmitted over a wireless medium via an antenna. Further, the antenna also receives data and transmits the data to the processor.
[0126] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. The memory can be used to store the data used by the processor when performing operations.
[0127] Embodiment 4:
[0128] In a fourth aspect, the present application proposes a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in any one of the first aspects are implemented.
[0129] Embodiment 5:
[0130] In a fifth aspect, the present application proposes a computer program product, including a computer program / instructions. When the computer program is executed by a processor, the steps of the method described in any one of the first aspects are implemented.
[0131] Those skilled in the art can understand that all or part of the steps of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a program. The program is stored in a storage medium, including several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs that can store program codes.
[0132] Those of ordinary skill in the art can understand that the above embodiments are specific embodiments for implementing the present application, and in practical applications, various changes can be made in form and details without departing from the spirit and scope of the present application.
Claims
1. A method for positioning a target light spot, characterized in that, Including: Obtain the historical spot information of the target spot in the previous spot image, where the target spot is the spot formed by the photoelectric deflection instrument on the target target; Determine the historical spot center coordinates of the target spot in the previous spot image according to the historical spot information; Determine the tracking start coordinates of the target spot in the target spot image according to the historical spot center coordinates, where the target spot image and the previous spot image are two temporally adjacent spot images of the target target; Locate the current spot position of the target spot in the target spot image according to the tracking start coordinates.
2. The method according to claim 1, wherein The locating the current spot position of the target spot in the target spot image according to the tracking start coordinates includes: Obtain a preset gray threshold; Place the pixel points of the target spot image in a preset first set; Determine the central pixel point in the first set according to the tracking start coordinates; Obtain the current gray value of the pixel points adjacent to the central pixel point, and delete the pixel points adjacent to the central pixel point from the first set; Take the pixel points whose current gray value is greater than or equal to the gray threshold as target pixel points and place them in a preset second set; Use the target pixel points as new central pixel points in the first set, execute obtaining the current gray value of the pixel points adjacent to the central pixel point, and delete the pixel points adjacent to the central pixel point from the first set; When the current gray values of all pixel points adjacent to the central pixel point are less than the gray threshold, stop execution; Determine the current spot information of the target spot image according to the pixel points in the second set; Determine the current spot position of the target target according to the current spot information.
3. The method according to claim 1, wherein Before obtaining the historical spot information of the target target in the previous spot image, the method further includes: Detect whether there is historical spot information; When it is determined that there is no historical spot information, obtain the spot image sequence of the target target; Select the spot image where the spot first appears in the spot image sequence as the target spot image; Perform spot search on the target spot image to obtain a search result; Determine the current spot information of the target spot in the target spot image according to the search result; Determine the current spot position of the target target according to the current spot information.
4. The method according to claim 2, wherein The method further includes: Obtain a preset spot area threshold; Determine the current spot area of the target spot in the target spot image according to the current spot information; Determine whether the target spot is the target spot according to the current spot area and the spot area threshold; When the current spot area is less than the spot area threshold, determine that the target spot is not the target spot; Perform spot search on the target spot image to obtain a search result; Determine the current spot information of the target spot in the target spot image according to the search result.
5. The method according to any one of claims 3 or 4, characterized in that, The performing spot search on the target spot image to obtain a search result includes: Obtain a preset gray threshold; Place all pixel points of the target spot image in a preset third set; Traverse all pixel points in the third set, and place the pixel points whose gray values are greater than or equal to the gray threshold in a preset fourth set; After all pixel points in the third set have been traversed, take the fourth set as the search result.
6. The method according to claim 5, wherein The determining the current spot information of the target spot in the target spot image according to the search result includes: Obtain the actual spot area of each spot in the fourth set; Determine the spot with the largest actual spot area as the target spot; Obtain the current spot information of the target spot from the fourth set.
7. A positioning device for a target light spot, characterized in that, Includes: A first acquisition module, configured to acquire historical spot information of a target spot in a previous spot image, where the target spot is a spot formed by an optoelectronic deflection instrument on a target target; A first determination module, configured to determine the historical spot center coordinates of the target spot in the previous spot image according to the historical spot information; A second determination module, configured to determine the tracking start coordinates of the target spot in the target spot image according to the historical spot center coordinates, where the target spot image and the previous spot image are two temporally adjacent spot images of the target target; A first positioning module, configured to locate the current spot position of the target spot in the target spot image according to the tracking start coordinates.
8. A computer electronic production device, characterized in that, Includes a memory, a processor, and a computer program stored on the memory, and the processor executes the computer program to implement the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 6.