Disclosure of Invention
In view of the foregoing technical problems, an embodiment of the present invention provides a method for denoising an image based on triangulation ranging, which is used to solve at least one of the above technical problems.
The technical scheme adopted by the embodiment of the application is as follows:
the embodiment of the application provides a denoising method of an image based on triangular ranging, which comprises the following steps:
s100, emitting a laser beam to a measuring surface of a measured object by using a laser emitter; the object to be measured is made of a transparent material, the laser beam forms n times of reflection in the object to be measured, and n is more than or equal to 2;
s200, acquiring n laser spots formed after n times of reflection by using a linear array image sensor;
s300, acquiring the position and voltage value of each pixel in the n light spots on the linear array image sensor, and respectively forming a pixel position set to form S = (S)1,S2,S3,……,Sm) And a corresponding set of voltage values U = (U)1,u2,u3,……,um),SiThe value of i is 1 to m, and m is the number of pixels in n light spots; u. ofiIs SiA corresponding voltage value;
s400, traversing U, and acquiring n voltage value groups U based on K11,U2,…,UnWherein, UjSet of voltage values, U, corresponding to jth spotj=(u1 j,u2 j,…,ukj j),ut jIs UjT-th voltage value of (1), ut jK1, t is 1 to kj, and kj is UjThe number of voltage values in (1) and j is from 1 to n, and K1 is a first set voltage threshold;
s500, acquiring a target voltage value group UT=(u1 0,u2 0,…,up 0,u1 1,u2 1,…,uk1 1,u1 2,u2 2,…,up 2) Wherein u is1 0,u2 0,…,up 0Is located in U in U1 1The previous p voltage values are all greater than or equal to K21 2,u2 2,…,up 2Is located in U in Uk1 1The subsequent p voltage values are all larger than or equal to K2; k2 is a second set voltage threshold, K2 < K1;
s600, based on UTAcquiring a corresponding pixel position group, and calculating a corresponding centroid position based on the acquired pixel position group;
and S700, acquiring the distance between the laser transmitter and the measuring surface of the measured object based on the calculated centroid position and the triangulation principle.
The embodiment of the application provides a noise processing method for a ranging image, which includes the steps of firstly dividing a voltage value set U corresponding to a laser spot on a linear array image sensor into n voltage value sets with disconnected data by using a first set voltage threshold, and then acquiring a plurality of voltage values adjacent to voltage values at two ends of the first voltage value set from U by using a second set voltage threshold, so that voltages in the first voltage value set are as complete as possible, and therefore measurement data can be as accurate as possible under the condition that interference data are eliminated.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a schematic flowchart of an image denoising method based on triangulation distance measurement according to an embodiment of the present disclosure. Fig. 2 is a schematic measurement diagram according to an embodiment of the present application.
As shown in fig. 1 (referring to fig. 2 at the same time), the noise processing method for a ranging image according to an embodiment of the present invention may include the following steps:
s100, emitting a laser beam to a measuring surface of a measured object 1 by using a laser emitter 2; the measured object is made of transparent materials, the laser beam forms n reflections in the measured object, and n is larger than or equal to 2.
In the embodiment of the present application, the laser emitter 2 may be an existing structure, and for example, includes a laser emitting tube for emitting laser light, and a lens through which the laser light is focused and then transmitted to the object to be measured. The laser beam emitted by the laser emitter to the measured object is vertical to the measuring surface.
In the embodiment of the present application, the object to be measured 1 is made of a transparent material, i.e. an object with a certain transparency, and when the laser beam is incident on the measuring surface of the object to be measured, n reflections are formed. In a preferred embodiment, the object 1 to be measured is glass.
In an exemplary embodiment, the object to be measured may be a single layer of glass, and may include a first surface and a second surface that are disposed in parallel, the first surface being the measuring surface, and the first surface and the second surface having different reflectivities such that the laser beam is reflected 2 times by the first surface and the second surface, respectively. For example, in one example, the reflectivity of the first surface may be greater than the reflectivity of the second surface, and in another example, the emissivity of the second surface may be greater than the emissivity of the first surface.
In another exemplary embodiment, the object under test 1 comprises n-1 layers of substrates stacked on top of each other, i.e. the object under test is n-1 layers of glass, and the reflectivity of the n layers of substrates is set such that the laser beam forms n reflections in the object under test. The thickness of the n-1 layer substrate may be the same. Or the thickness of at least one substrate in the n-1 layer of substrates is different from the thickness of other substrates. Thus, the n light spots reflected to the linear array image sensor are continuous light spots or discontinuous light spots.
In another exemplary embodiment, the object to be measured is a single layer of glass and is placed on a support carrier having a transparency less than the object to be measured. In this way, 2 reflections can be formed at the front and back surfaces of the single layer of glass.
And S200, acquiring n laser spots formed after n times of reflection by using the linear array image sensor 3.
In the embodiment of the present application, the line array image sensor may be an existing structure, and for example, may be a line array image sensor. The light beam emitted by the measured object forms laser light spots on the linear array of the linear array image sensor, and each light spot is provided with a convergence center. The n laser spots are distributed at corresponding positions of the linear array image sensor according to the distance between the reflecting surface of the object to be measured and the laser emitter, for example, the n laser spots are sequentially arranged from the left side to the right side of the linear array image sensor or sequentially arranged from the right side to the left side of the linear array image sensor according to the distance from the near side to the far side. In the embodiment of the present application, as shown in fig. 2, the light spots are sequentially arranged from the left side to the right side of the line image sensor from the near side to the far side, that is, the light spot formed by the light beam reflected by the frontmost reflecting surface of the object to be measured is located at the leftmost side of the line image sensor, and the light spot formed by the light beam reflected by the rearmost reflecting surface of the object to be measured is located at the rightmost side of the line image sensor. The n laser spots may be consecutive spots, i.e. two adjacent spots have an intersection area. The n laser spots may also be partially consecutive spots, i.e. with an intersection area between partial spots. The n laser spots may also be independent n spots, i.e. there is no intersection area between any two spots.
S300, acquiring the position and voltage value of each pixel in the n light spots on the linear array image sensor, and respectively forming a pixel position set to form S = (S)1,S2,S3,……,Sm) And a corresponding set of voltage values U = (U)1,u2,u3,……,um),SiThe value of i is 1 to m, and m is the number of pixels in n light spots; u. ofiIs SiThe corresponding voltage value.
In this embodiment of the application, the linear array image sensor may obtain a position and a voltage value of each pixel point on the linear array according to the obtained light intensity of the light spot, and send the position and the voltage value to a signal processing device, such as a processor, and the signal processing device may store the position of each pixel point, that is, the number and the voltage value of each pixel point, in an index manner, that is, the voltage value set U may correspond to the pixel position set S = (S)1,S2,S3,……,Sm),SiIs the position of the ith pixel, wherein S1<S2<S3,……<Sm. The position of each pixel is determined based on the line size of the line image sensor.
S400, traversing U, and acquiring n voltage value groups U based on K11,U2,…,UnWherein, UjSet of voltage values, U, corresponding to jth spotj=(u1 j,u2 j,…,ukj j),ut jIs UjT-th voltage value of (1), ut jK1, t is 1 to kj, and kj is UjJ is 1 to n, and K1 is a first set voltage threshold.
In the embodiment of the present application, K1 is set so that the voltage value group for each spot is obtained from the n spots formed, and the voltage value group for each spot is the voltage value group from which noise is removed. In a specific example, a voltage pixel graph may be plotted based on S and U, where the ordinate of the voltage pixel graph is the voltage value and the abscissa is the pixel position, such that a curve of n spots may be obtained, the curve including peak and valley regions. To find the actually required curve segment, the application sets K1 so that there is a break-off area between the curves of the individual spots, resulting in an effective curve segment for each spot.
In one exemplary embodiment of the present invention,
wherein, U
sc pc∈U
pc=(U
1 pc,U
2 pc,…,U
ac pc) The value of sc is 1 to ac, and ac is U
pcC is 1 to n; u shape
pcFitting a peak voltage subset of the c-th peak in a curve for the voltage obtained based on U and S; u shape
wd vd∈U
Ud=(U
1 vd,U
2 vd,…,U
bd vd) The value of wd is 1 to bd, bd is U
vdThe value of d is 1 to n-1, U
wd vdA subset of the trough voltages of the d trough in the voltage fit curve is fitted.
In the embodiment of the present application, the abscissa of the voltage fitting curve is the pixel position of each pixel point, and the abscissa is the corresponding voltage value. A voltage fitting curve obtained based on U and S comprises n wave crests and n-1 wave troughs.
Those skilled in the art will appreciate that the acquisition of n subsets of peak voltages and n-1 subsets of valley voltages may be performed using known techniques, such as binning. Since the measurement may have fluctuations that may cause fluctuations in the peak and valley regions, calculating K1 based on the peak voltage subset and the valley voltage subset may enable the obtained K1 to better break off two spot images.
When each voltage value group is obtained, each voltage value in U can be compared with K1, and because the curve corresponding to the voltage value in U has peak and valley regions, n voltage value groups larger than K1 can be obtained.
S500, obtaining a target voltage value UT=(u1 0,u2 0,…,u p 0,u1 1,u2 1,…,uk1 1,u1 2,u2 2,…,u p 2) Wherein u is1 0,u2 0,…,up 0Is located in U in U1 1The previous p voltage values are all greater than or equal to K21 2,u2 2,…,up 2Is located in U in Uk1 1The subsequent p voltage values are all larger than or equal to K2; k2 is the second set voltage threshold, K2 < K1.
In the present embodiment, p is determined based on K2. In one example, since the range of the line image sensor gray scale values is 0-N, the highest output voltage is M, and P ≦ (K1-K2) N/M.
In this embodiment of the present application, since K1 is to find the peak region segments of n light spots, the value of K1 is set to be relatively large, which may cause the data of each light spot to be incomplete, and further may cause the calculation result to be inaccurate, and therefore, in order to make the data of each light spot as complete as possible, the second setting threshold K2 is used in this embodiment of the present application, so that the data of each light spot is complete as possible, and meanwhile, the interference caused by noise can be avoided.
In an exemplary embodiment of the present application, K2 > max (U)
0max,
),f>1,U
0max is the maximum voltage value in the set of voltage values obtained on the line image sensor with the laser transmitter turned off. In the case where the laser transmitter is turned off, since a spot image is formed on the line image sensor due to ambient light and noise light such as dark current in the line image sensor, and a voltage value may exist, K2 is set to be greater than max (U)
0max,
) That is, the first spot image can be separated from the adjacent spot images while avoiding interference by the noise light.
Because this application is for measuring the distance of the measuring face of laser emitter and testee, consequently, only need supplement complete as far as possible with the data of first voltage value group can.
S600, acquiring a corresponding pixel position group based on the target voltage value group, and calculating a corresponding centroid position based on the acquired pixel position group.
Those skilled in the art know that it is prior art to obtain the corresponding pixel position group based on the target voltage value group, for example, a weighted centroid algorithm may be used to enhance the pixels in the central portion of the light spot, so that the calculated centroid is more accurate, and besides the weighted centroid algorithm, the prior art such as a grayscale centroid algorithm, a threshold centroid algorithm may also be used to calculate the centroid position of the light spot.
And S800, acquiring the distance between the laser transmitter and the measuring surface of the measured object based on the calculated centroid position and the triangulation principle.
Those skilled in the art know that it is prior art to calculate the distance between the laser transmitter and the object to be measured according to the centroid position of the first light spot and the principle of triangulation.
In the embodiment of the present application, the above-mentioned S100 to S800 may be executed in a processor communicatively connected to the laser emitter and the line image sensor. The processor may be an existing device.
Embodiments of the present application also provide a non-transitory computer-readable storage medium that can be disposed in an electronic device to store at least one instruction or at least one program for implementing a method of the method embodiments, where the at least one instruction or the at least one program is loaded into and executed by a processor to implement the method provided by the above embodiments.
Embodiments of the present application also provide an electronic device comprising a processor and the aforementioned non-transitory computer-readable storage medium.
Embodiments of the present application further provide a computer program product comprising program code means for causing an electronic device to carry out the steps of the method according to various exemplary embodiments of the present application described above in this description, when said program product is run on the electronic device.
Although some specific embodiments of the present application have been described in detail by way of illustration, it should be understood by those skilled in the art that the above illustration is only for purposes of illustration and is not intended to limit the scope of the present application. It will also be appreciated by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present application. The scope of the present application is defined by the appended claims.