Underwater target distance measuring device and distance measuring method based on power adjustable laser projection

Through an underwater target ranging device based on power-adjustable laser projection, image enhancement and neural network detection are used to solve the problems of low underwater ranging accuracy and the influence of water quality, and realize a high-precision and adaptable underwater ranging method. .

CN117970305BActive Publication Date: 2024-09-06STATE OCEANIC ADMINISTRATION SOUTH CHINA SEA SURVEY TECH CENT (SOUTH CHINA SEA BUOY CENT STATE OCEANIC ADMINISTRATION) +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410302916.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-18
Publication Date
2024-09-06
Estimated Expiration
2044-03-18

AI Technical Summary

Technical Problem

Existing underwater ranging methods have problems such as low ranging accuracy, blind detection zones, and optical measurement effects affected by water turbidity and illumination. The ranging error increases especially at close range and under water quality attenuation conditions.

Method used

An underwater target ranging device based on power-adjustable laser projection is used, including 4 lasers, laser drive module, camera, image enhancement module, light spot identification module and display control module. By forming light spot patterns, image enhancement and neural network detection, calculation The perimeter of the light spot is used to measure the target distance, and the spot brightness is adjusted through the laser drive module to adapt to different water quality conditions.

Benefits of technology

It improves the detection accuracy of the pixels in the center of the light spot, improves the ranging accuracy, simplifies the operation, adapts to various water quality environments, and reduces the ranging error.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117970305B
    Figure CN117970305B
Patent Text Reader

Abstract

The present invention belongs to the field of underwater optical measurement. It is an underwater target distance measuring device and distance measuring method based on power adjustable laser projection, which solves the problem that the distance of underwater target objects cannot be accurately measured. The device includes 4 lasers, 4 laser driving modules, a camera, an image enhancement module, a light spot recognition module, a distance measuring module and a display control module. The original light spot image of the camera is enhanced and optimized by the image enhancement module, and the neural network model is trained using the enhanced image in the light spot recognition module to obtain the coordinates of the central pixel points of the 4 light spots in each enhanced image; the perimeter of the quadrilateral surrounded by the central pixel points of the 4 light spots is calculated in the distance measuring module, and a mapping relationship between the perimeter and the distance is established. The distance measuring method uses the distance measuring device to predict the distance between the target to be measured and the camera through the original image of the target to be measured. The method is simple to operate and has high prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of underwater optical measurement, and in particular relates to an underwater target distance measuring device and a distance measuring method based on power adjustable laser projection. Background Art

[0002] Robots such as underwater remotely operated vehicles (ROVs), underwater manned vehicles (HOVs), and underwater autonomous vehicles (AUVs) are widely used in engineering fields such as marine pipeline inspections, deep-sea engineering operations, lake dam monitoring, and underwater bridge pier inspections. In the actual construction process, since underwater robots need to master the distance information of the measurement target, ranging technology is crucial. At present, the commonly used underwater ranging methods mainly rely on acoustic methods and optical methods. Acoustic ranging is the use of sonar to measure the distance to the target object. It has the characteristics of long measurement distance and is the main means of underwater ranging. However, due to the low frequency of sound waves, the ranging accuracy of this method of acoustic ranging is low, and there is also a detection blind spot when working at close range.

[0003] The optical underwater distance measurement methods mainly include the time of flight (TOF) measurement method, the underwater binocular measurement method, the underwater active laser dot matrix projection imaging measurement method, etc. The TOF measurement method obtains the distance information by measuring the time difference between laser emission and echo detection. This method is easily affected by the backscattering of seawater, which limits the application scope of this technology. The underwater binocular measurement method is to establish the three-dimensional structure of the target through stereo vision, and then obtain the depth information of the target (Zhang Honglong, Chen Tao, Zhuang Peiqin, etc., "Research on Underwater Three-Dimensional Measurement System Based on Stereo Vision"). The measurement effect of this method is greatly affected by the turbidity of the water body and the light intensity in the water, so the measurement distance and stability are limited. The underwater laser dot matrix projection imaging measurement method mainly includes a measurement system composed of mutually parallel array lasers and cameras. When working, the array laser projects a dot matrix composed of laser points into the water, and the dot matrix features are extracted by the camera to obtain the distance information of the target (Yang Mengning, Han Biao, Zhang Bing, etc., "An Underwater Measurement Equipment and Underwater Measurement Method"). This method helps to achieve the size measurement of distant targets, but the measurement accuracy is highly correlated with the recognition accuracy of the light spot captured by the camera; when the ranging distance decreases or the water quality attenuation coefficient decreases, the brightness of the light spot captured by the camera will become saturated, which will reduce the light spot detection accuracy and cause the ranging error to increase. Summary of the invention

[0004] In view of the above problems existing in the prior art, the technical problem to be solved by the present invention is: how to accurately measure the distance of an underwater target object.

[0005] To solve the above technical problems, the present invention adopts the following technical solution: an underwater target ranging device based on power-adjustable laser projection, comprising 4 lasers, 4 laser driving modules, a camera, an image enhancement module, a light spot recognition module, a ranging module and a display control module.

[0006] The four lasers are used to emit collimated laser beams in the visible light band. The laser beams are parallel to each other. When the four laser beams are irradiated onto the target in the water, four light spots are formed in a one-to-one correspondence. The four light spots constitute a light spot pattern.

[0007] The four laser driving modules are respectively used to control the four lasers to generate collimated laser beams of set power, and the set power generated by the lasers is achieved by changing the output current of the laser driving modules;

[0008] The camera is used to capture the spot pattern to obtain an original spot image, wherein the original spot image includes four spots generated by four lasers and four light columns formed by four laser beams due to backscattering of water, and the optical axis of the camera is parallel to the directions of the four lasers;

[0009] The image enhancement module is used to enhance and optimize the original spot image to obtain an enhanced image;

[0010] The light spot recognition module uses the enhanced images to train the neural network model, and then inputs the enhanced images into the trained neural network model to obtain the central pixel coordinates of the four light spots in each enhanced image;

[0011] The distance measurement module is used to calculate the perimeter of the quadrilateral surrounded by the central pixel points of the four light spots in each enhanced image, and establish a mapping relationship between the perimeter and the distance, which refers to the distance between the target corresponding to the enhanced image and the camera;

[0012] The display control module is used to display the original spot image obtained by the camera, the enhanced image, and the measured distance between the camera and the target. The display control module can also sample the local area in the original spot image and send instructions to control the output current of the laser driving module.

[0013] A method for measuring distance of underwater targets based on power adjustable laser projection, using the above-mentioned device for measuring distance of underwater targets based on power adjustable laser projection, comprises the following steps:

[0014] S1: The display control module sends a control command to the laser drive module. The four laser drive modules control the four lasers to emit collimated lasers to the underwater target to form four light spots. The target in the water is at the jth distance H in front of the camera. j When the camera is used to collect several original spot images, each original spot image isj One-to-one correspondence, the original spot image with the best brightness is selected from several original spot images to form a training set;

[0015] S2: Use the image enhancement module to enhance and optimize each original spot image in the training set described in S1 to obtain the corresponding enhanced image. All enhanced images constitute the image enhancement training set, and record the H corresponding to the enhanced image. j ;

[0016] S3: In the spot recognition module, the YOLOv5_obb neural network is trained using the image enhancement training set obtained in S2. The trained YOLOv5_obb neural network is defined as an automatic detection model.

[0017] S4: Input all enhanced images in the image enhancement training set into the automatic detection model to obtain the central pixel coordinates of the four light spots in the enhanced image (A i , B i ), i = 1, 2, 3, 4, use the following formula to calculate the perimeter L of the quadrilateral surrounded by the four light spots in the jth enhanced image j ;

[0018]

[0019] S5: In the ranging module, the least square method is used to establish the mapping relationship between L and H according to formula (2):

[0020] H=a×L b +c (2);

[0021] Where L represents the perimeter of the quadrilateral surrounded by the four light spots in the enhanced image, H represents the distance between the underwater target and the camera corresponding to the enhanced image, and a, b, and c are the fitting parameters respectively.

[0022] S6: Sending control instructions to the laser driving module through the display control module, the four laser driving modules respectively control the four lasers to emit collimated lasers to the target to be measured in the water to form four light spots, and using the camera to collect the original light spot image of the target to be measured;

[0023] Using the method described in S2, the original spot image of the target to be measured is enhanced and optimized by the image enhancement module to obtain an enhanced image of the target to be measured;

[0024] The enhanced image of the target to be measured is input into the automatic detection model to obtain the coordinates of the four center pixels of the enhanced image of the target to be measured (A iM , B iM ), i = 1, 2, 3, 4, and use the coordinates of the center pixel of the spot (A iM , B iM), and substitute into formula (1) to obtain the perimeter L of the quadrilateral surrounded by the four light spots M ;

[0025] In the ranging module, L M Substitute into formula (2) to obtain the distance H from the target to the camera. M .

[0026] Preferably, the method of selecting the original spot image with the best brightness from a plurality of original spot images to form a training set in S1 is:

[0027] S1-1: The display control module samples the four spots of the original spot image respectively to obtain four different images. The i-th image is recorded as Q i , i=1,2,3,4, where Q i Only one spot is included;

[0028] S1-2: Calculate Q i The RGB channel values ​​of all pixels in the image, and find out Q i The maximum value H among all pixel RGB channel values max ;

[0029] H max =max(R,G,B) (3);

[0030] S1-3: Q i The RGB channel values ​​of the pixel point in H max =255 is defined as a saturated pixel, and the number of saturated pixels N is counted;

[0031] S1-4: Preset the maximum number of saturated pixels N Max and the minimum number of saturated pixels N min , where N min <N Max ;

[0032] When N min <N<N Max When i The light spot in the middle is the best brightness;

[0033] When N ≥ N Max When the Q i The output current of the corresponding laser driver module is N <N Max ;

[0034] When N≤N min When Q i The corresponding output current of the laser driver module in the min .

[0035] S1-5: When the light spots in the corresponding four images in the original light spot image are all of optimal brightness, the original light spot image is an original light spot image of optimal brightness.

[0036] Preferably, the method for performing enhancement optimization on each original spot image in the S2 training set to obtain the corresponding enhanced image is:

[0037] S2-1: Use formula (4) to adjust the color scale of the original spot image:

[0038] out=Power(image / 255, (100 / (Midtones+1)))*255 (4);

[0039] Where image is the pixel value of the original image, Power is the power multiplication function, Midtones is the adjustment degree of the input (the value range is 0 to 100), and out is the adjusted pixel value;

[0040] The image enhancement module adjusts the R, G, and B channels of the original spot image separately to obtain a first-order spot image.

[0041] S2-2: Defogging the first-order spot image obtained in S2-1 to obtain a second-order spot image;

[0042]

[0043]

[0044] L(x j )=min(min(ρm av ,0.9)M ave (x j ),M(x j )) (7);

[0045]

[0046]

[0047] Among them, M(x j ) is the minimum value of the three color channels of the input image, L(x j ) is the ambient light, A is the global atmospheric light, and ρ is an adjustable parameter 0≤ρ≤1 / m av , M ave (x) represents the filtered mean of M(x), m av represents the mean of all elements in M(x), H(x j ) represents the first-order spot image, H c (x j) represents the first-order spot image of the input c channel, H c (x j ), c=1,2,3 three channels are combined to get H(x j ), F(x j ) represents the second-order spot image obtained by defogging, F(x j ) and H j Corresponding.

[0048] S2-3: Use the createCLAHE method in the Opencv library to perform adaptive histogram equalization on the second-order spot image obtained in S2-2, and then perform bilinear interpolation on the image edge to obtain the third-order spot image.

[0049] S2-4: For the third-order spot image obtained in S2-3, first calculate the qth quantile of the pixel, where q is the quantile sequence, and then limit the pixel value of the third-order spot image to the upper and lower limits of the qth quantile; finally, obtain the maximum value max_p and the minimum value min_p of the pixel in the third-order spot image channel, and reconstruct the pixel value according to the following formula:

[0050] out_ch=(img_ch-min_p)*255 / (max_p-min_p) (10);

[0051] Among them, img_ch is the single-channel pixel value of the third-order spot image, and out_ch is the single-channel pixel value of the processed third-order spot image.

[0052] Finally, the three channels are merged to obtain the processed image, which is the enhanced image.

[0053] Preferably, the process of training the YOLOv5_obb neural network using the image enhancement training set obtained in S2 in S3 is:

[0054] S3-1: Mark the positions of all pixels of each enhanced image in the image enhancement training set, establish a two-dimensional coordinate system with the upper left corner of each image as the origin, and obtain the coordinates of each pixel in the enhanced image;

[0055] S3-2: According to the enhanced images marked in S3-1, label each enhanced image. The label includes the position information of the four light spots in each enhanced image and the corresponding light column direction information, which is recorded as: x i1 ,y i1 ,x i2 ,y i2 ,x i3 ,y i3 ,x i4 ,y i4,category,difficult(i=1,2,3,4), where, x i1 ,y i1 ,x i2 ,y i2 ,x i3 ,y i3 ,x i4 ,y i4 are the coordinates of the four vertices of each light spot rectangular detection box in the enhanced image. The vertices of the rectangular detection box indicate the direction of the light column corresponding to the light spot. category is the category of the object in the detection box, and difficult indicates the difficulty of label detection.

[0056] S3-3: Each enhanced image labeled by the S3-2 method and its corresponding label constitutes the data set;

[0057] S3-4: Perform data enhancement on the enhanced images in the data set described in S3-3, that is, perform counterclockwise rotation, counterclockwise rotation, add Gaussian random noise, and change the image brightness on each enhanced image in the data set to obtain an enhanced data set.

[0058] S3-5: The enhanced data set obtained in S3-4 is used as the input of the YOLOv5_obb model. The output of the YOLOv5_obb model is X i1 ,Y i1 ,X i2 ,Y i2 ,X i3 ,Y i3 ,X i4 ,Y i4 confidence,Category(i=1,2,3,4), where X i1 ,Y i1 ,X i2 ,Y i2 ,X i3 ,Y i3 ,X i4 ,Y i4 is the predicted coordinates of the four vertices of each spot rectangular detection box in the enhanced image, confidence represents the prediction confidence, and Category is the predicted category of the object in the detection box. When the preset maximum number of training rounds is reached, the trained YOLOv5_obb model is obtained.

[0059] Preferably, the method of inputting all enhanced images in the image enhancement training set into the automatic detection model to obtain the coordinates of the central pixels of the four light spots in each enhanced image in S4 is:

[0060]

[0061] Where fix(·) represents the rounding operation.

[0062] Compared with the prior art, the present invention has at least the following advantages:

[0063] 1. The present invention provides an underwater target ranging device based on power-adjustable laser projection, which includes an image enhancement module and a laser driving module. When the test distance and the optical attenuation coefficient of the water body are different, the laser driving module can be controlled to adjust the brightness of the light spot formed by the laser on the target surface to avoid the detection deviation of the center pixel of the light spot caused by the saturation of the light spot; when the turbidity of the water body causes the original light spot image taken by the camera to be blurred, the image enhancement module can be used to optimize the original light spot image to avoid the detection deviation of the center pixel of the light spot caused by the blurring of the original light spot image. Through these two optimizations, the detection accuracy of the center pixel of the light spot can be increased, thereby improving the ranging accuracy.

[0064] 2. The present invention provides an underwater target ranging method based on power-adjustable laser projection. During operation, the brightness of the light spot captured by the camera can be intuitively displayed through the display control module, and then the laser driving module can be controlled to adjust the brightness of the light spot formed by the laser on the target surface. The operation is simple, the prediction accuracy is high, and it is easy to promote and apply. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 It is a schematic diagram of the structure of the underwater target ranging device;

[0066] Figure 2 It is a schematic diagram of the device for measuring the distance of underwater targets during the experiment.

[0067] Figure 3 It is a flowchart of the experimental operation.

[0068] Figure 4 is the original light spot image captured by the camera;

[0069] Figure 5 It is the enhanced image after the original spot image is enhanced and optimized.

[0070] Figure 6 This is a schematic diagram of the spot detection model training data provided by the experiment. DETAILED DESCRIPTION

[0071] The present invention is described in further detail below.

[0072] See also Figure 1 , Embodiment 1: An underwater target ranging device based on power adjustable laser projection, comprising 4 lasers, 4 laser driving modules, a camera, an image enhancement module, a light spot recognition module, a ranging module and a display control module.

[0073] The four lasers are used to emit collimated laser beams in the visible light band. The laser beams are parallel to each other. When the four laser beams are irradiated onto the target in the water, four light spots are formed in one-to-one correspondence, and the four light spots constitute a light spot pattern.

[0074] The four laser driving modules are respectively used to control the four lasers to generate collimated laser beams of set power, and the set power generated by the lasers is achieved by changing the output current of the laser driving modules.

[0075] The camera is used to capture the spot pattern to obtain an original spot image, wherein the original spot image includes four spots generated by four lasers and four light columns formed by four laser beams due to backscattering of water, and the camera optical axis is parallel to the directions of the four lasers.

[0076] The image enhancement module is used to enhance and optimize the original spot image to obtain an enhanced image.

[0077] The light spot recognition module uses the enhanced images to train the neural network model, and then inputs the enhanced images into the trained neural network model to obtain the central pixel coordinates of the four light spots in each enhanced image.

[0078] The distance measurement module is used to calculate the perimeter of the quadrilateral surrounded by the central pixel points of the four light spots in each enhanced image, and establish a mapping relationship between the perimeter and the distance, which refers to the distance between the target corresponding to the enhanced image and the camera;

[0079] The display control module is used to display the original spot image obtained by the camera, the enhanced image, and the measured distance between the camera and the target. The display control module can also sample the local area in the original spot image and send instructions to control the output current of the laser driving module.

[0080] Embodiment 2: A method for measuring distance of underwater targets based on power-adjustable laser projection, using the device for measuring distance of underwater targets based on power-adjustable laser projection described in Embodiment 1, comprising the following steps:

[0081] S1: The display control module sends a control command to the laser drive module. The four laser drive modules control the four lasers to emit collimated lasers to the underwater target to form four light spots. The target in the water is at the jth distance H in front of the camera. j When the camera is used to collect several original spot images, each original spot image is j One-to-one correspondence is used to select the original spot image with the best brightness from several original spot images to form a training set.

[0082] S2: Use the image enhancement module to enhance and optimize each original spot image in the training set described in S1 to obtain the corresponding enhanced image. All enhanced images constitute the image enhancement training set, and record the H corresponding to the enhanced image. j .

[0083] S3: In the light spot recognition module, the YOLOv5_obb neural network is trained using the image enhancement training set obtained in S2. The trained YOLOv5_obb neural network is defined as an automatic detection model.

[0084] S4: Input all enhanced images in the image enhancement training set into the automatic detection model to obtain the central pixel coordinates of the four light spots in the enhanced image (A i , B i ), i = 1, 2, 3, 4, use the following formula to calculate the perimeter L of the quadrilateral surrounded by the four light spots in the jth enhanced image j .

[0085]

[0086] S5: In the ranging module, the least square method is used to establish the mapping relationship between L and H according to formula (2):

[0087] H=a×L b +c (2).

[0088] Where L represents the perimeter of the quadrilateral surrounded by the four light spots in the enhanced image, H represents the distance between the underwater target and the camera corresponding to the enhanced image, and a, b, and c are the fitting parameters respectively.

[0089] S6: Send control instructions to the laser driving module through the display control module, and the four laser driving modules respectively control the four lasers to emit collimated lasers to the target to be measured in the water to form four light spots, and use the camera to collect the original light spot image of the target to be measured.

[0090] Using the method described in S2, the original spot image of the target to be measured is enhanced and optimized by the image enhancement module to obtain an enhanced image of the target to be measured.

[0091] The enhanced image of the target to be measured is input into the automatic detection model to obtain the coordinates of the four center pixels of the enhanced image of the target to be measured (A iM , B iM ), i = 1, 2, 3, 4, and use the coordinates of the center pixel of the spot (A iM , B iM ), and substitute into formula (1) to obtain the perimeter L of the quadrilateral surrounded by the four light spots M .

[0092] In the ranging module, L MSubstitute into formula (2) to obtain the distance H from the target to the camera. M .

[0093] Specifically, the method of selecting the original spot image with the best brightness from a plurality of original spot images to form a training set in S1 is:

[0094] S1-1: The display control module samples the four spots of the original spot image respectively to obtain four different images. The i-th image is recorded as Q i , i=1,2,3,4, where Q i Only one light spot is included.

[0095] S1-2: Calculate Q i The RGB channel values ​​of all pixels in the image, and find out Q i The maximum value H among all pixel RGB channel values max .

[0096] H max =max(R,G,B) (3).

[0097] S1-3: Q i The RGB channel values ​​of the pixel point in H max The pixel point with value = 255 is defined as a saturated pixel point, and the number of saturated pixels N is counted.

[0098] S1-4: Preset the maximum number of saturated pixels N Max and the minimum number of saturated pixels N min , where N min <N Max .

[0099] When N min <N<N Max When i The light spot in the middle is the best brightness.

[0100] When N ≥ N Max When the Q i The output current of the corresponding laser driver module is N <N Max .

[0101] When N≤N min When Q i The corresponding output current of the laser driver module in the min .

[0102] S1-5: When the light spots in the corresponding four images in the original light spot image are all of optimal brightness, the original light spot image is an original light spot image of optimal brightness.

[0103] Specifically, the method for enhancing and optimizing each original spot image in the S2 training set to obtain the corresponding enhanced image is:

[0104] S2-1: Use formula (4) to adjust the color scale of the original spot image:

[0105] Underwater images usually have a blue or green color cast. The image enhancement module first adjusts the color scale of the original spot image to correct the tonal range and color balance of the original spot image and improve the clarity of the original spot image. The color scale adjustment is expressed by the following formula:

[0106] out=Power(image / 255, (100 / (Midtones+1)))*255 (4).

[0107] Where image is the pixel value of the original image, Power is the power multiplication function, Midtones is the adjustment degree of the input (the value range is 0 to 100), and out is the adjusted pixel value.

[0108] The image enhancement module adjusts the R, G, and B channels of the original spot image separately to obtain a first-order spot image.

[0109] S2-2: Defogging the first-order spot image obtained in S2-1 to obtain a second-order spot image; using a fast defogging method based on a single color image to further improve the visibility of the underwater image. The steps of the defogging algorithm are as follows:

[0110]

[0111]

[0112] L(x j )=min(min(ρm av ,0.9)M ave (x j ),M(x j )) (7).

[0113]

[0114]

[0115] Among them, M(x j ) is the minimum value of the three color channels of the input image, L(x j ) is the ambient light, A is the global atmospheric light, and ρ is an adjustable parameter 0≤ρ≤1 / m av , M ave (x) represents the filtered mean of M(x), m avrepresents the mean of all elements in M(x), H(x j ) represents the first-order spot image, H c (x j ) represents the first-order spot image of the input c channel, H c (x j ), c=1,2,3 three channels are combined to get H(x j ), F(x j ) represents the second-order spot image obtained by defogging, F(x j ) and H j Corresponding.

[0116] S2-3: Adopt the createCLAHE method in the Opencv library [createCLAHE method is the existing technology] to perform adaptive histogram equalization on the second-order spot image obtained in S2-2, and then perform bilinear interpolation [using the existing technology] to process the image edge to obtain the third-order spot image.

[0117] Adaptive histogram equalization of the second-order spot image obtained by S2-2 using the createCLAHE method in the Opencv library can suppress noise. The specific method is: first, the input second-order spot image is divided into non-overlapping sub-blocks of equal size; then the sub-block grayscale histogram is calculated, and the grayscale histogram uses the grayscale value as the horizontal coordinate and the vertical coordinate as the number / proportion of pixels corresponding to the grayscale value; then histogram equalization is performed to make the grayscale histogram distribution of the second-order spot image more uniform.

[0118] S2-4: Optimize contrast enhancement. For the third-order spot image obtained in S2-3, first calculate the qth quantile of the pixel, q is the quantile sequence, and q = [0.0416, 0.995] in this module; then limit the pixel value of the third-order spot image to the upper and lower limits of the qth quantile; finally, obtain the maximum value max_p and minimum value min_p of the pixel in the third-order spot image channel, and reconstruct the pixel value according to the following formula:

[0119] out_ch=(img_ch-min_p)*255 / (max_p-min_p) (10).

[0120] Among them, img_ch is the single-channel pixel value of the third-order spot image, and out_ch is the single-channel pixel value of the processed third-order spot image.

[0121] Finally, the three channels are merged to obtain the processed image, which is the enhanced image.

[0122] Specifically, the process of training the YOLOv5_obb neural network using the image enhancement training set obtained in S2 in S3 is:

[0123] S3-1: Mark the positions of all pixels of each enhanced image in the image enhancement training set, establish a two-dimensional coordinate system with the upper left corner of each image as the origin, and obtain the coordinates of each pixel in the enhanced image.

[0124] S3-2: According to the enhanced images marked in S3-1, label each enhanced image. The label includes the position information of the four light spots in each enhanced image and the corresponding light column direction information, which is recorded as: x i1 ,y i1 ,x i2 ,y i2 ,x i3 ,y i3 ,x i4 ,y i4 ,category,difficult(i=1,2,3,4), where, x i1 ,y i1 ,x i2 ,y i2 ,x i3 ,y i3 ,x i4 ,y i4 It is the coordinates of the four vertices of each light spot rectangular detection box in the enhanced image. The direction of the vertices of the rectangular detection box represents the direction information of the light column corresponding to the light spot. Category is the category of the object in the detection box, and difficult indicates the difficulty of label detection (1 means difficult, 0 means not difficult).

[0125] S3-3: Each enhanced image labeled using the S3-2 method and its corresponding label constitutes the data set.

[0126] S3-4: Perform data enhancement on the enhanced images in the data set described in S3-3, that is, perform counterclockwise rotation, counterclockwise rotation, add Gaussian random noise, and change the image brightness on each enhanced image in the data set to obtain an enhanced data set.

[0127] S3-5: The enhanced data set obtained in S3-4 is used as the input of the YOLOv5_obb model. The output of the YOLOv5_obb model is X i1 ,Y i1 ,X i2 ,Y i2 ,X i3 ,Y i3 ,X i4 ,Y i4 ,confidence,Category(i=1,2,3,4),where,X i1 ,Y i1 ,X i2 ,Yi2 ,X i3 ,Y i3 ,X i4 ,Y i4 is the predicted coordinates of the four vertices of each spot rectangular detection box in the enhanced image, confidence represents the prediction confidence, and Category is the predicted category of the object in the detection box. When the preset maximum number of training rounds is reached, the trained YOLOv5_obb model is obtained.

[0128] In the specific implementation, the resolution is set according to the camera parameters used, the batch size is 6, the initial learning rate is 0.01, and a total of 100 rounds of training are performed.

[0129] Specifically, the method of inputting all enhanced images in the image enhancement training set into the automatic detection model to obtain the coordinates of the central pixels of the four light spots in each enhanced image in S4 is:

[0130]

[0131] Where fix(·) represents the rounding operation.

[0132] Experimental analysis:

[0133] See also Figure 2-Figure 6 , the image enhancement module, the light spot recognition module, and the ranging module are integrated in a graphics processing circuit board.

[0134] First, the underwater target distance measurement device is calibrated at different distances H ranging from 0.5m to 7.5m. j Keep the laser incident on the target surface, j is a natural number, H j represents the jth distance between the target in the surface water and the camera, collected in H j When collecting the original spot image, first adjust the laser power so that the original spot image displayed in the display control module is at the best brightness, and collect 50 original spot images with the best brightness.

[0135] Then, according to the method of the present invention, 50 original spot images with optimal brightness are enhanced and optimized using an image enhancement module, and then the YOLOv5_obb neural network is trained, and finally the mapping relationship between L and H is established.

[0136] During the experiment, the original image and enhanced image were collected as follows: Figure 4 and Figure 5 The target distance and actual distance results obtained by the underwater target distance measurement method provided by the present invention are shown in Table 1. It can be seen that the ranging error is less than 0.05m in the range of 0.5m to 7.5m, which verifies the feasibility and accuracy of the method.

[0137] Table 1. Test results

[0138]

[0139]

[0140] The above embodiments show that the underwater target distance measurement device and method based on power adjustable laser projection provided by the present invention is feasible, and has simple structure, convenient operation, low complexity, high measurement accuracy, can adapt to various water quality environments, and is easy to promote and apply.

[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.

Claims

1. A method for measuring distance of underwater targets based on power adjustable laser projection, characterized in that: A underwater target distance measuring device based on power adjustable laser projection is used, which includes 4 lasers, 4 laser driving modules, a camera, an image enhancement module, a light spot recognition module, a distance measurement module and a display control module; The four lasers are used to emit collimated laser beams in the visible light band. The laser beams are parallel to each other. When the four laser beams are irradiated onto the target in the water, four light spots are formed in a one-to-one correspondence. The four light spots constitute a light spot pattern. The four laser driving modules are respectively used to control the four lasers to generate collimated laser beams of set power, and the set power generated by the lasers is achieved by changing the output current of the laser driving modules; The camera is used to capture the spot pattern to obtain an original spot image, wherein the original spot image includes four spots generated by four lasers and four light columns formed by four laser beams due to backscattering of water, and the camera optical axis is parallel to the directions of the four lasers; The image enhancement module is used to enhance and optimize the original spot image to obtain an enhanced image; The light spot recognition module uses the enhanced images to train the neural network model, and then inputs the enhanced images into the trained neural network model to obtain the central pixel coordinates of the four light spots in each enhanced image; The distance measurement module is used to calculate the perimeter of the quadrilateral surrounded by the central pixel points of the four light spots in each enhanced image, and establish a mapping relationship between the perimeter and the distance, which refers to the distance between the target corresponding to the enhanced image and the camera; The display control module is used to display the original spot image obtained by the camera, the enhanced image, and the measured distance between the camera and the target. The display control module can also sample the local area in the original spot image and send instructions to control the output current of the laser driving module; The underwater target ranging method includes the following steps: S1: The display control module sends a control command to the laser drive module. The four laser drive modules control the four lasers to emit collimated lasers to the underwater target to form four light spots. The target in the water is at the jth distance H in front of the camera. j When the camera is used to collect several original spot images, each original spot image is j One-to-one correspondence, the original spot image with the best brightness is selected from several original spot images to form a training set; The method of selecting the original spot image with the best brightness from several original spot images to form a training set is: S1-1: The display control module samples the four spots of the original spot image respectively to obtain four different images. The i-th image is recorded as Q i , i=1,2,3,4, where Q i Only one spot is included; S1-2: Calculate Q i The RGB channel values ​​of all pixels in the image, and find out Q i The maximum value H among all pixel RGB channel values max ; H max =max(R,G,B) (3); S1-3: Q i The RGB channel values ​​of the pixels in the middle satisfy H max =255 is defined as a saturated pixel, and the number of saturated pixels N is counted; S1-4: Preset the maximum number of saturated pixels N Max and the minimum number of saturated pixels N min , where N min <N Max ; When N min <N<N Max When i The light spot in the middle is the best brightness; When N ≥ N Max When the Q i The output current of the corresponding laser driver module is N <N Max ; When N≤N min When Q i The corresponding output current of the laser driver module in the min ; S1-5: When the light spots in the corresponding four images in the original light spot image are all of optimal brightness, the original light spot image is the original light spot image of optimal brightness; S2: Use the image enhancement module to enhance and optimize each original spot image in the training set described in S1 to obtain the corresponding enhanced image. All enhanced images constitute the image enhancement training set, and record the H corresponding to the enhanced image. j ; S3: In the light spot recognition module, the YOLOv5_obb neural network is trained using the image enhancement training set obtained in S2. The trained YOLOv5_obb neural network is defined as an automatic detection model. S4: Input all enhanced images in the image enhancement training set into the automatic detection model to obtain the central pixel coordinates of the four light spots in the enhanced image (A i , B i ), i = 1, 2, 3, 4, use the following formula to calculate the perimeter L of the quadrilateral surrounded by the four light spots in the jth enhanced image j ; S5: In the ranging module, the least square method is used to establish the mapping relationship between L and H according to formula (2): H=a×L b +c (2); Where L represents the perimeter of the quadrilateral surrounded by the four light spots in the enhanced image, H represents the distance between the underwater target and the camera corresponding to the enhanced image, and a, b, and c are the fitting parameters respectively; S6: Sending control instructions to the laser driving module through the display control module, the four laser driving modules respectively control the four lasers to emit collimated lasers to the target to be measured in the water to form four light spots, and using the camera to collect the original light spot image of the target to be measured; Using the method described in S2, the original spot image of the target to be measured is enhanced and optimized by the image enhancement module to obtain an enhanced image of the target to be measured; The enhanced image of the target to be measured is input into the automatic detection model to obtain the coordinates of the four center pixels of the enhanced image of the target to be measured (A iM , B iM ), i = 1, 2, 3, 4, and use the coordinates of the center pixel of the spot (A iM , B iM ), and substitute into formula (1) to obtain the perimeter L of the quadrilateral surrounded by the four light spots M ; In the ranging module, L M Substitute into formula (2) to obtain the distance H from the target to the camera. M .

2. The method for measuring distance of underwater targets based on power adjustable laser projection according to claim 1, characterized in that: The method for enhancing and optimizing each original spot image in the S2 training set to obtain the corresponding enhanced image is: S2-1: Use formula (4) to adjust the color scale of the original spot image: out=Power(image / 255, (100 / (Midtones+1)))*255 (4); Where image is the pixel value of the original image, Power is the power multiplication function, Midtones is the adjustment degree of the input, and out is the pixel value after adjustment; The image enhancement module adjusts the R, G, and B channels of the original spot image separately to obtain a first-order spot image; S2-2: Defogging the first-order spot image obtained in S2-1 to obtain a second-order spot image; L(x j )=min(min(ρm av ,0.9)M ave (x j ),M(x j )) (7); Among them, M(x j ) is the minimum value of the three color channels of the input image, L(x j ) is the ambient light, A is the global atmospheric light, and ρ is an adjustable parameter 0≤ρ≤1 / m av , M ave (x) represents the filtered mean of M(x), m av represents the mean of all elements in M(x), H(x j ) represents the first-order spot image, H c (x j ) represents the first-order spot image of the input c channel, H c (x j ), c=1,2,3 three channels are combined to get H(x j ), F(x j ) represents the second-order spot image obtained by defogging, F(x j ) and H j corresponding; S2-3: Adopt the createCLAHE method in the Opencv library to perform adaptive histogram equalization on the second-order spot image obtained in S2-2, and then perform bilinear interpolation on the image edge to obtain the third-order spot image; S2-4: For the third-order spot image obtained in S2-3, first calculate the qth quantile of the pixel, where q is the quantile sequence, and then limit the pixel value of the third-order spot image to the upper and lower limits of the qth quantile; finally, obtain the maximum value max_p and the minimum value min_p of the pixel in the third-order spot image channel, and reconstruct the pixel value according to the following formula: out_ch=(img_ch-min_p)*255 / (max_p-min_p) (10); Among them, img_ch is the single-channel pixel value of the third-order spot image, and out_ch is the single-channel pixel value of the processed third-order spot image; Finally, the three channels are merged to obtain the processed image, which is the enhanced image.

3. The method for measuring distance of underwater targets based on power adjustable laser projection as claimed in claim 2, characterized in that: The process of training the YOLOv5_obb neural network using the image enhancement training set obtained in S2 in S3 is as follows: S3-1: Mark the positions of all pixels of each enhanced image in the image enhancement training set, establish a two-dimensional coordinate system with the upper left corner of each image as the origin, and obtain the coordinates of each pixel in the enhanced image; S3-2: According to the enhanced images marked in S3-1, label each enhanced image. The label includes the position information of the four light spots in each enhanced image and the corresponding light column direction information, which is recorded as: x i1 ,y i1 ,x i2 ,y i2 ,x i3 ,y i3 ,x i4 ,y i4 ,category,difficult(i=1,2,3,4), where, x i1 ,y i1 ,x i2 ,y i2 ,x i3 ,y i3 ,x i4 ,y i4 are the coordinates of the four vertices of each light spot rectangular detection box in the enhanced image. The vertices of the rectangular detection box indicate the direction of the light column corresponding to the light spot. category is the category of the object in the detection box, and difficult indicates the difficulty of label detection. S3-3: Each enhanced image labeled by the S3-2 method and its corresponding label constitutes the data set; S3-4: performing data enhancement on the enhanced images in the data set described in S3-3, that is, performing counterclockwise rotation, counterclockwise rotation, adding Gaussian random noise, and changing the image brightness on each enhanced image in the data set to obtain an enhanced data set; S3-5: The enhanced data set obtained in S3-4 is used as the input of the YOLOv5_obb model. The output of the YOLOv5_obb model is X i1 ,Y i1 ,X i2 ,Y i2 ,X i3 ,Y i3 ,X i4 ,Y i4 ,confidence,Category(i=1,2,3,4),where,X i1 ,Y i1 ,X i2 ,Y i2 ,X i3 ,Y i3 ,X i4 ,Y i4 It is the predicted coordinates of the four vertices of each light spot rectangular detection box in the enhanced image, confidence represents the prediction confidence, and Category is the predicted category of the object in the detection box; when the preset maximum number of training rounds is reached, the trained YOLOv5_obb model is obtained.

4. The method for measuring distance of underwater targets based on power adjustable laser projection as claimed in claim 3, characterized in that: The method of inputting all enhanced images in the image enhancement training set into the automatic detection model to obtain the central pixel coordinates of the four light spots in each enhanced image in S4 is: Where fix(·) represents the rounding operation.