A visual positioning method for underwater robots
By acquiring and analyzing two grayscale images at the same location in the underwater environment, calculating adaptive gamma factors and performing image enhancement, this solves the problem that the gamma factors in the underwater environment cannot accurately reflect the overall situation of the image, and improves water quality. The accuracy of robot visual positioning and image enhancement effect.
Patent Information
- Application Number
- CN202410089268.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-23
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-01-23
AI Technical Summary
Factors such as water flow fluctuations and light refraction and reflection in the underwater environment affect the gamma factor and cannot accurately reflect the overall image, resulting in poor visual positioning image enhancement effects for underwater robots and affecting the accuracy of positioning information acquisition.
By acquiring two grayscale images at the same position, dividing them into image blocks, analyzing the grayscale change trend and texture information of the image blocks, calculating adaptive gamma factors, and enhancing the images to distinguish seawater and non-seawater areas and improve The accuracy of positioning information.
It improves the accuracy of underwater positioning information acquisition, makes non-seawater areas clearer through adaptive enhancement technology, enhances the visibility of useful information such as reefs and corals, and improves the accuracy and reliability of image enhancement.
Smart Images

Figure CN117934355B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of high-definition positioning, and in particular to a visual positioning method for an underwater robot. Background Art
[0002] As an important part of modern science and technology, underwater robot technology plays a key role in many fields such as ocean exploration, marine scientific research, search and rescue operations, etc. However, in practical applications, the special properties of the underwater environment will lead to poor image quality, which brings great challenges to the visual positioning of underwater robots.
[0003] When the prior art uses gamma transform to enhance the quality of underwater images, it often obtains the gamma factor based on the grayscale information in the image. However, due to the influence of factors such as underwater water flow fluctuations and light refraction and reflection, the gamma factor at this time cannot accurately reflect the overall situation in the image, resulting in poor image enhancement effect and affecting the accuracy of the final underwater robot positioning information acquisition. Summary of the invention
[0004] In order to solve the technical problem that due to the influence of underwater water flow fluctuations, light refraction and reflection, the gamma factor obtained according to the grayscale information in the image cannot accurately reflect the overall situation in the image, resulting in poor image enhancement effect and affecting the accuracy of the final underwater positioning information acquisition, the purpose of the present invention is to provide an underwater robot visual positioning method, and the technical scheme adopted is as follows:
[0005] Acquire two grayscale images at the same position collected by the underwater robot based on a preset time interval, select one as the image to be tested, and the other as a comparison image;
[0006] The image to be tested and the comparison image are evenly divided into image blocks according to the same division method, and any image block in the image to be tested is selected as the block to be tested, and the image block at the corresponding position of the block to be tested in the comparison image is selected as the comparison block; in the image to be tested, according to the grayscale distribution and grayscale difference between the block to be tested and other image blocks within a preset range centered on the block to be tested, the regional aggregation corresponding to the block to be tested is obtained;
[0007] The grayscale change trends of all pixels in the block to be tested and the comparison block are analyzed respectively to obtain the grayscale change trajectory; the possibility that the block to be tested is a non-seawater area is obtained according to the difference between the pixel position distribution on the grayscale change trajectory in the block to be tested and the comparison block and the regional aggregation corresponding to the block to be tested; the adaptive gamma factor corresponding to the block to be tested is obtained according to the grayscale distribution and texture information of the pixels in the block to be tested and the possibility that the block to be tested is a non-seawater area; the image to be tested is enhanced according to the adaptive gamma factors corresponding to all image blocks in the image to be tested to obtain an enhanced image;
[0008] The robot is positioned according to the enhanced image.
[0009] Furthermore, obtaining the regional aggregation corresponding to the block to be tested according to the grayscale distribution and grayscale difference between the block to be tested and other image blocks within a preset range centered on the block to be tested includes:
[0010] Other image blocks within a preset range centered on the block to be tested are used as analysis blocks, and similar blocks to the block to be tested are screened based on the overall grayscale difference between the block to be tested and all the analysis blocks;
[0011] The maximum grayscale value and the minimum grayscale value in the block to be tested and the corresponding maximum grayscale value and the minimum grayscale value in all similar blocks form a numerical sequence, calculate the difference between the values in the numerical sequence, take the maximum difference as the upper limit value, and the minimum difference as the lower limit value, to obtain the grayscale fluctuation range, and take all integer values in the grayscale fluctuation range as target values;
[0012] The grayscale difference of the pixel at the same position in the block to be tested and each similar block is taken as the difference factor of the corresponding pixel, the difference between the difference factor and each target value is calculated as the fluctuation amplitude, and the maximum fluctuation amplitude is taken as the fluctuation factor of the corresponding pixel; the mean value of the fluctuation factor corresponding to all the pixels in the block to be tested is negatively correlated and normalized, and the value is taken as the aggregation factor of the block to be tested and the similar blocks;
[0013] The average of the clustering factors of the block to be tested and all similar blocks is taken as the regional clustering corresponding to the block to be tested.
[0014] Further, the method of using other image blocks within a preset range centered on the block to be tested as analysis blocks, and the method of using other image blocks within a preset range centered on the block to be tested as analysis blocks, and screening out similar blocks of the block to be tested according to the overall grayscale difference between the block to be tested and all the analysis blocks, includes:
[0015] The difference between the grayscale mean of the block to be tested and each analysis block is calculated and normalized as the mean difference, and the analysis block corresponding to the mean difference less than the preset difference threshold is taken as a similar block to the block to be tested.
[0016] Furthermore, the grayscale change trend of all pixels in the block to be tested and the comparison block is analyzed to obtain the grayscale change trajectory, including:
[0017] In the block to be tested and the comparison block, the pixel point at the position of the centroid of the block to be tested and the pixel point at the corresponding position of the centroid of the block to be tested in the comparison block are taken as the changed pixel points. In the preset neighborhood centered on the changed pixel point, the neighborhood pixel point with the largest grayscale difference with the central pixel point is taken as the new changed pixel point. New changed pixel points are continuously determined until the new changed pixel point is the edge pixel point of the image block. All the changed pixel points are arranged in the order of appearance to obtain the grayscale change trajectory.
[0018] Further, the possibility of obtaining the block to be tested being a non-seawater area according to the difference between the pixel position distribution on the grayscale change trajectory in the block to be tested and the comparison block and the regional aggregation corresponding to the block to be tested includes:
[0019] On the grayscale change trajectories corresponding to the block to be tested and the comparison block, other pixels except the last pixel are taken as target points; each target point is taken as the starting point and the next pixel point adjacent to the target point is taken as the end point to obtain the grayscale change direction corresponding to the target point; the angle between the grayscale change direction corresponding to each target point and the preset first direction is calculated to obtain the angle value;
[0020] The difference in the mean angle values on the two grayscale change trajectories is negatively correlated and normalized, and the value obtained is used as the possible factor that the block to be tested is a non-seawater area; the value obtained by multiplying the possible factor that the block to be tested is a non-seawater area with the corresponding regional aggregation is used as the possibility that the block to be tested is a non-seawater area.
[0021] Furthermore, the step of obtaining the adaptive gamma factor corresponding to the block to be tested according to the grayscale distribution of pixels in the block to be tested, texture information, and the possibility that the block to be tested is a non-seawater area includes:
[0022] Calculate the sum of the differences between the grayscale values of all pixels in the block to be tested and the grayscale mean value corresponding to the block to be tested as the grayscale representation value;
[0023] In the block to be tested, take the central pixel as the starting point and obtain the ray in the direction of the eight-chain code; calculate the sum of the grayscale differences between all adjacent pixels on each ray as the difference sum value, and take the average of the difference sum values corresponding to all the strokes as the texture representation value;
[0024] Normalize the difference between the preset grayscale value and the grayscale mean value corresponding to the block to be tested to obtain a grayscale adjustment factor;
[0025] According to the grayscale expression value, texture expression value, grayscale adjustment factor and the possibility of being a non-seawater area corresponding to the block to be tested, an adaptive gamma factor corresponding to the block to be tested is obtained, and the grayscale expression value, texture expression value and the possibility of being a non-seawater area are all negatively correlated with the adaptive gamma factor, and the grayscale adjustment factor is positively correlated with the adaptive gamma factor.
[0026] Furthermore, the preset grayscale value is set to 128.
[0027] Further, positioning the robot according to the enhanced image includes:
[0028] The enhanced image is used as the input of the neural network, and the output result of the neural network is the positioning information of the underwater robot.
[0029] Furthermore, the neural network is a CNN neural network.
[0030] Furthermore, the preset first direction is a horizontal rightward direction.
[0031] The present invention has the following beneficial effects:
[0032] The present invention provides a visual positioning method for an underwater robot, the main purpose of which is to adaptively enhance the collected images, thereby improving the accuracy of underwater positioning information acquisition. Since the seawater area in the image provides less information for positioning than reefs, corals and other areas, it is necessary to perform image enhancement to different degrees on the areas in the image, so that the non-seawater area useful for positioning is clearer. First, two grayscale images at the same position adjacent in time are obtained, and they are used as the image to be tested and the comparison image respectively. Through comparative analysis, the seawater area and the non-seawater area are distinguished. Further, starting from the local area of the image, an image block is obtained. By analyzing the image block, the information contained in the local area can be more accurately analyzed, which is convenient for improving the accuracy of image enhancement. Because the refraction and reflection ability of the seawater area to light is stronger than that of the non-seawater area, the grayscale changes at various positions in the seawater area will be different. Based on this feature, the grayscale distribution difference between the image block and the image block within the preset range is analyzed to obtain the regional aggregation of the image block, which is used to preliminarily characterize the possibility that the image block is a non-seawater area. Since the credibility of determining whether an image block is a non-seawater area only based on the grayscale difference between the image block and the surrounding image blocks is low, and seawater is usually fluid, while the positions of reefs and corals are invariant, at different times, if the image block belongs to the seawater area, the grayscale change will be more obvious, and the grayscale change in the non-seawater area will be less obvious. Therefore, the grayscale change trend in the image blocks at the same position in the test image and the comparison image can be analyzed to obtain the grayscale change trajectory. The grayscale change trajectory can characterize the path where the grayscale change in the image block is more significant. Then, the position distribution difference of the pixel points on the two grayscale change trajectories is analyzed to characterize the relative change of the pixel points, which is then combined with the regional clustering of the image block to obtain the accurate possibility that the image block is a non-seawater area. Furthermore, because some image blocks may contain both seawater areas and reef areas, when determining the enhancement strength of the image block, it is necessary to obtain an adaptive gamma factor based on the texture information contained in the image block, so that the adaptive gamma factor is more consistent with the overall situation of the image block, so as to achieve different degrees of enhancement effects. Therefore, the grayscale analysis and texture of the pixels in the image block are analyzed, and the possibility of being a non-seawater area is combined to obtain an adaptive gamma factor. Finally, the image block is enhanced according to the adaptive gamma factor to obtain an enhanced image to improve the accuracy of underwater positioning information acquisition. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0034] Figure 1 A flow chart of a visual positioning method for an underwater robot provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0035] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the visual positioning method of an underwater robot proposed by the present invention, its specific implementation method, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0036] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0037] An embodiment of a visual positioning method for an underwater robot:
[0038] The specific scheme of the underwater robot visual positioning method provided by the present invention is described in detail below with reference to the accompanying drawings.
[0039] See also Figure 1 , which shows a method flow chart of a visual positioning method for an underwater robot provided by an embodiment of the present invention, the method comprising the following steps:
[0040] Step S1: two grayscale images collected by the underwater robot at the same position are acquired based on a preset time interval, one of which is selected as the image to be tested and the other as the comparison image.
[0041] Underwater robot technology is an important part of modern science and technology, and is widely used in the fields of ocean exploration, marine scientific research, search and rescue operations, etc. However, in practical applications, due to the absorption and scattering effects of water, underwater images often appear dark, low contrast, and blurred, which seriously affects the accuracy and reliability of visual positioning; in addition, low underwater visibility, light refraction and reflection, and seawater fluidity also further lead to poor image quality. Therefore, it is necessary to enhance the image before visual positioning analysis.
[0042] This embodiment provides an implementation method for visual positioning of an underwater robot, which obtains an adaptive image enhancement effect by enhancing different image information to different degrees, can better adapt to the complexity and variability of the underwater environment, and improve the accuracy and reliability of visual positioning.
[0043] When obtaining the positioning information of the underwater robot, since the seawater area contains less positioning information than the non-seawater areas such as reefs and corals, in order to improve the accuracy of positioning, it is necessary to perform a greater degree of image enhancement on the non-seawater area containing useful information to ensure that more positioning information is obtained. First, the underwater conditions are photographed by the underwater camera equipped by the underwater robot. Since the seawater has fluidity and the non-seawater area has position invariance, two grayscale images at the same position are obtained based on the preset time interval, and one is selected as the image to be tested and the other is selected as the comparison image. By comparison, the final division of the seawater area and the non-seawater area is achieved. It should be noted that the image acquisition device can be adjusted according to the implementation scenario, which is not limited here; the preset time interval is set to 5 seconds, and the specific time interval can also be adjusted according to the implementation scenario, which is not limited here; the method for graying the image can select average graying, weighted graying, maximum graying, etc., and they are all well-known operating means for those skilled in the art, which are not limited or elaborated here.
[0044] At this point, two grayscale images at the same underwater position separated by a certain period of time can be obtained, and the subsequent analysis process can be continued.
[0045] Step S2: The image to be tested and the comparison image are evenly divided into image blocks according to the same division method, and any image block in the image to be tested is selected as the block to be tested, and the image block at the corresponding position of the block to be tested in the comparison image is selected as the comparison block; in the image to be tested, the regional aggregation corresponding to the block to be tested is obtained according to the grayscale distribution and grayscale difference between the block to be tested and other image blocks within a preset range centered on the block to be tested.
[0046] Since the entire image contains seawater areas and non-seawater areas such as reefs and corals, in order to achieve different degrees of enhancement for different areas of the image to obtain clearer image information that is useful for robot positioning, we can start from the local area of the image and obtain image blocks. Then, by analyzing the image blocks, we can more accurately obtain the information contained in the local area. At the same time, in order to achieve effective comparison between the image to be tested and the comparison image, it is necessary to use the same division method to obtain the image blocks in the image to be tested and the comparison image when dividing the image blocks so that they can correspond one to one.
[0047] For example, the image to be tested and the comparison image may be evenly divided into a preset number of image blocks, respectively, wherein the preset number may be set to 32. Thus, image blocks are obtained, wherein each image block has no overlapping part.
[0048] In other embodiments of the present invention, when acquiring image blocks, a preset size may be set, for example, the preset size is set to 11×11, and the preset size may be changed according to the implementation scenario. Then, starting from the same position of the image to be tested and the comparison image, for example, both starting from the upper left of the image, the image to be tested and the comparison image are divided into regions, and image blocks may also be obtained, wherein each image block has no overlapping parts.
[0049] At this point, the image to be tested and the comparison image can be divided, and the image blocks can be analyzed later to obtain local information in the image. At the same time, in order to facilitate subsequent explanations and descriptions, here, any image block in the image to be tested is used as the block to be tested, and the image block corresponding to the block to be tested in the comparison image is used as the comparison block. After performing local image analysis, comparative analysis can also be performed to improve the accuracy of obtaining various indicators.
[0050] Because the refraction and reflection ability of seawater areas is stronger than that of non-seawater areas, the grayscale distribution between seawater areas will be different under the irradiation of natural light or the irradiation of the lighting equipment carried by the underwater robot during operation. For non-seawater areas such as reefs and corals, due to their poor light transmittance and light absorption, the grayscale distribution differences between non-seawater areas will not be too significant. Based on this feature, the grayscale distribution differences between image blocks and image blocks within a preset range can be analyzed to obtain the regional clustering of image blocks, which is used to preliminarily characterize the possibility that the image blocks are non-seawater areas.
[0051] Preferably, in one embodiment of the present invention, taking the block to be tested as an example, obtaining the regional aggregation corresponding to the block to be tested according to the grayscale distribution and grayscale difference between the block to be tested and other image blocks within a preset range centered on the block to be tested includes:
[0052] Since it is necessary to analyze the grayscale distribution between the image block and the surrounding image blocks to obtain the regional aggregation, firstly, a preset range is constructed with the block to be tested as the center, and other image blocks within the preset range corresponding to the block to be tested are used as analysis blocks. Then, similar blocks of the block to be tested can be preliminarily screened according to the overall grayscale difference between the block to be tested and all analysis blocks. The specific acquisition process of similar blocks is: in the block to be tested and each analysis block corresponding to the block to be tested, the mean of the grayscale values of all pixels in the block is calculated as the grayscale mean, which can reflect the overall grayscale distribution in the block. Then, the difference between the grayscale mean of the block to be tested and each analysis block is calculated and normalized as the mean difference. The mean difference reflects the difference in the overall grayscale distribution between the block to be tested and the analysis block. If the difference is smaller, it means that the two image blocks are more similar, so the analysis block corresponding to the mean difference less than the preset difference threshold is taken as the similar block of the block to be tested.
[0053] After the grayscale distribution overall difference between the block to be tested and the analysis block is analyzed and similar blocks are obtained through preliminary screening, the grayscale difference between the block to be tested and the similar blocks can be analyzed more carefully to improve the accuracy of regional aggregation. Based on the above analysis, it can be known that the refraction and reflection ability of the seawater area to light is stronger than that of non-seawater areas such as corals and reefs, so the grayscale fluctuation between the seawater areas will also be greater, and vice versa, the grayscale fluctuation between the non-seawater areas will be smaller. Therefore, in this embodiment of the present invention, the maximum grayscale value and the minimum grayscale value in the block to be tested and the maximum grayscale value and the minimum grayscale value in all similar blocks corresponding to the block to be tested form a numerical sequence, and then calculate the difference between the two numerical values in the numerical sequence, and use the obtained maximum difference as the upper limit value, and the minimum difference as the lower limit value, so as to obtain the grayscale fluctuation range, which is recorded as G. The grayscale fluctuation range is an open interval, and all integer values in the grayscale fluctuation range are used as target values. The grayscale fluctuation range is the fluctuation range allowed for the grayscale distribution between the block to be tested and its similar blocks.
[0054] Then, the grayscale difference of the pixel at the same position in the block to be tested and each similar block is used as the difference factor of the corresponding pixel, the difference between the difference factor and each target value is calculated as the fluctuation amplitude, and the maximum fluctuation amplitude is used as the fluctuation factor of the corresponding pixel; the mean value of the fluctuation factor corresponding to all pixels in the block to be tested is negatively correlated and normalized, and used as the aggregation factor of the block to be tested and similar blocks. The block to be tested takes image block a as an example, and any similar block takes image block b as an example. The formula model of the aggregation factor can be specifically, for example:
[0055]
[0056] Among them, JY a,b represents the clustering factor of the block to be tested a and the similar block b, N represents the total number of pixels in the image block, and h a,irepresents the gray value of the i-th pixel in the block a to be tested, h b,i represents the gray value of the i-th pixel in the comparison block b, q k It represents the kth target value in the grayscale fluctuation range corresponding to the block to be tested, G represents the grayscale fluctuation range, max() represents the maximum value, exp() represents the exponential function with the natural constant e as the base, and ∈ represents the symbol.
[0057] In the formula model of the clustering factor, the grayscale values of the pixels at the same position in the block to be tested and its corresponding similar block are analyzed to obtain the difference factor |h a,i -h b,i |, the difference factor is compared with the overall difference of the image block. Analyzing each pixel can obtain a more detailed analysis effect; in order to characterize the grayscale fluctuation between image blocks, the difference factor is made different from each target value. The purpose of finding the difference between the difference factor and each target value is to quantify the comparison result between the difference factor and the allowable range of grayscale fluctuation, and the difference is taken as the fluctuation amplitude||h a,i -h b,i |-q k |, according to the formula of fluctuation amplitude, it can be deduced that the maximum fluctuation amplitude will be larger when the difference factor is outside the grayscale fluctuation range than when the difference factor is within the grayscale fluctuation range. For example, if the grayscale fluctuation range is (3, 7), then the target value is 4, 5, 6. If the difference factor is 8, which is outside the grayscale fluctuation range, then the maximum fluctuation amplitude is 4. If the difference factor is 4, which is within the grayscale fluctuation range, then the maximum fluctuation amplitude is 2, so as to measure the grayscale difference between the block to be tested and its similar blocks. Since the maximum fluctuation amplitude can better characterize the grayscale difference of pixels at the same position between image blocks, the maximum fluctuation amplitude in this embodiment of the present invention is used as the fluctuation factor corresponding to the pixel point, and then the mean value of the fluctuation factor of all pixels in the block to be tested is calculated. This mean value can characterize the general level of grayscale fluctuation of pixels in the block to be tested and similar blocks. Based on the above analysis, it can be known that the grayscale fluctuation in the non-seawater area will be smaller and the aggregation factor will be larger. Therefore, the mean values of the fluctuation factors of all pixels are negatively correlated and normalized to achieve logical relationship correction and obtain the aggregation factor of the block to be tested and similar blocks.
[0058] Finally, the average of the clustering factors of the block to be tested and all similar blocks is taken as the regional clustering corresponding to the block to be tested, denoted as JX a It should be noted that the preset difference threshold is set to 0.4, and the specific value can be adjusted according to the implementation scenario and is not limited here; the preset range is set to 8 neighborhoods, and the specific size can also be adjusted according to the implementation scenario and is not limited here.
[0059] In other embodiments of the present invention, when obtaining the regional aggregation corresponding to the block to be tested, the grayscale distribution difference between the block to be tested and other image blocks within a preset range centered on the block to be tested can also be directly analyzed to obtain the regional aggregation of the block to be tested. The specific method is:
[0060] With the block to be tested as the center, a preset range is constructed, and other image blocks within the preset range corresponding to the block to be tested are used as analysis blocks. In the block to be tested and each analysis block, the grayscale value difference of the pixel points at the same position is used as the difference factor. Then the mean of all difference factors is obtained, and the mean is negatively correlated and normalized to obtain the clustering factor between the block to be tested and each analysis block. The block to be tested takes image block a as an example, and any analysis block takes image block c as an example. The formula model of the clustering factor can be specifically, for example:
[0061]
[0062] Among them, JY a,c represents the clustering factor of the block to be tested a and the analysis block c, M represents the total number of pixels in the image block, and h a,j represents the gray value of the i-th pixel in the block a to be tested, h c,j It represents the gray value of the i-th pixel in the analysis block c, and exp() represents the exponential function with the natural constant e as the base.
[0063] In the formula model of the clustering factor, the grayscale values of the pixels at the same position in the block to be tested and its corresponding analysis block are analyzed to obtain the difference factor |h a,j -h b,j |, compared with the overall difference of the image block, analyzing each pixel can obtain a more refined analysis effect; based on the above analysis, the grayscale fluctuation in the non-seawater area will be smaller, so the aggregation factor will be larger, so the mean of the difference factors of all pixels are negatively correlated and normalized to achieve logical relationship correction and obtain the aggregation factor of the block to be tested and each analysis block.
[0064] Since the clustering factor between non-seawater areas is larger, the clustering factor between seawater areas is smaller, and the clustering factor between seawater areas and non-seawater areas is also smaller, a preset clustering threshold is set, and only the clustering factors greater than the preset clustering threshold are analyzed. Among all the clustering factors corresponding to the block to be tested, the mean of the clustering factors greater than the preset clustering threshold is taken as the regional clustering corresponding to the block to be tested, denoted as JX a It should be noted that the preset aggregation threshold is set to 0.5, and the specific value can be adjusted according to the implementation scenario and is not limited here; the preset range is set to 8 neighborhoods, and the specific size can also be adjusted according to the implementation scenario and is not limited here.
[0065] At this point, the regional aggregation corresponding to the block to be tested can be obtained, which is used as one of the indicators for evaluating whether the block to be tested is a non-seawater area, and the subsequent analysis process continues.
[0066] Step S3: Analyze the grayscale change trend of all pixels in the block to be tested and the comparison block respectively to obtain the grayscale change trajectory; obtain the possibility that the block to be tested is a non-seawater area according to the difference between the pixel position distribution on the grayscale change trajectory in the block to be tested and the comparison block and the regional aggregation corresponding to the block to be tested; obtain the adaptive gamma factor corresponding to the block to be tested according to the grayscale distribution and texture information of the pixels in the block to be tested and the possibility that the block to be tested is a non-seawater area; enhance the image to be tested according to the adaptive gamma factors corresponding to all image blocks in the image to be tested to obtain an enhanced image.
[0067] In this embodiment of the present invention, gamma transformation is used to enhance the image, so it is necessary to obtain an adaptive gamma factor corresponding to each image block.
[0068] Since seawater has a certain fluidity, while objects such as corals and reefs are usually fixed and stationary, at different times, if the image block belongs to the seawater area, the difference in grayscale changes within the block will be more obvious, while in the non-seawater area at different times, the grayscale changes within the block will be more similar. Therefore, in the block to be tested and the comparison block, the grayscale change trend of the pixels in the block is analyzed to obtain the grayscale change trajectory in the block to be tested and the comparison block, which is used to characterize the grayscale change in the block.
[0069] Preferably, in one embodiment of the present invention, the grayscale change trend of all pixels in the block to be tested and the comparison block is analyzed to obtain the grayscale change trajectory, including:
[0070] Since the maximum grayscale difference between pixels can often better reflect the grayscale change trend and characteristics of the pixel, in the process of obtaining the grayscale change trajectory, the pixel at the centroid position in the block to be tested can be used as the changed pixel, and then in the preset neighborhood centered on the changed pixel, the neighborhood pixel with the largest grayscale difference with the center pixel is used as the new changed pixel, where the neighborhood pixel is the other pixel in the preset neighborhood except the center pixel. Repeat this process to continuously determine the new changed pixel until the new changed pixel is the edge pixel of the block to be tested, and then arrange all the changed pixels in the order of appearance to obtain the grayscale change trajectory of the pixels in the block to be tested.
[0071] Similarly, the grayscale change trajectory of the pixels in the comparison block is analyzed, and the pixel point at the same position of the centroid of the block to be tested in the comparison block is taken as the changed pixel point. Then, in the preset neighborhood centered on the changed pixel point, the neighborhood pixel point with the largest grayscale difference with the center pixel point is taken as the new changed pixel point. The above process is repeated to continuously determine the new changed pixel point until the new changed pixel point in the comparison block is the edge pixel point of the comparison block. All the changed pixel points are arranged in the order of appearance, and the grayscale change trajectory of the pixels in the comparison block can be obtained.
[0072] Here, an example is given to illustrate the method for obtaining the grayscale change trajectory: taking the grayscale change trajectory in the block to be tested as an example, the centroid is recorded as pixel 1, and then in the preset neighborhood centered on pixel 1, the grayscale difference between each neighborhood pixel and pixel 1 is calculated. Assuming that the pixel with the largest grayscale difference is pixel 2, then pixel 2 is the new changed pixel. Then, in the preset neighborhood centered on pixel 2, the grayscale difference between each neighborhood pixel and pixel 2 is calculated. Assuming that the pixel with the largest grayscale difference is pixel 3, then pixel 3 is the new changed pixel. Repeat this process until a new changed pixel is an edge pixel of the block to be tested, then the grayscale change trajectory is 1-2-3... It should be noted that the edge pixel is the pixel on the four sides of the image block; in this embodiment of the present invention, the preset neighborhood is set to 8 neighborhoods, and the specific size can be adjusted according to the implementation scenario, which is not limited here; the method for obtaining the centroid is an operation process well known to those skilled in the art, and will not be repeated here.
[0073] So far, by analyzing the grayscale change trends of the pixels in the block to be tested and the comparison block, the corresponding grayscale change trajectories are obtained.
[0074] If the block to be tested is a non-seawater area, or there are both seawater and non-seawater areas in the block to be tested, then compared with the seawater area, due to the presence of fixed objects such as corals and reefs, it is less affected by the flow of seawater. Therefore, at different times, the grayscale change trajectory within the block should be more consistent. Therefore, the position distribution relationship of the pixel points on the grayscale change trajectory in the block to be tested and the comparison block is analyzed, and combined with the regional aggregation of the block to be tested, the possibility that the block to be tested is a non-seawater area is calculated.
[0075] Preferably, in one embodiment of the present invention, according to the difference between the position distribution of pixels on the grayscale change trajectory in the block to be tested and the comparison block and the regional aggregation corresponding to the block to be tested, the possibility that the block to be tested is a non-seawater area is obtained, including:
[0076] On the grayscale change trajectories corresponding to the block to be tested and the comparison block, other pixels except the last pixel are taken as target points; then each target point is taken as the starting point and the next pixel adjacent to the target point is taken as the end point to obtain the grayscale change direction corresponding to the target point, and then the angle between the grayscale change direction corresponding to each target point and the preset first direction is calculated to obtain the angle value; wherein the preset first direction is the horizontal rightward direction.
[0077] At this time, on the grayscale change trajectory of the block to be tested and the comparison block, except for the last pixel, each pixel point, that is, each target point has a corresponding angle value, so the difference between the angle value means on the two grayscale change trajectories can be negatively correlated and normalized to obtain the possible factor that the block to be tested is a non-seawater area. Finally, the possible factor that the block to be tested is a non-seawater area is combined with the corresponding regional aggregation, and the value after multiplying the two is used as the possibility that the block to be tested is a non-seawater area. Taking image block a as an example of the block to be tested and image block d as an example of the comparison block, the formula model for the possibility that the block to be tested is a non-seawater area can be specifically, for example:
[0078]
[0079] Among them, FK a Indicates the possibility that the block a to be tested corresponds to a non-seawater area, R a represents the total number of target points on the grayscale change trajectory of the block a to be tested, θ r represents the angle value corresponding to the rth target point on the grayscale change trajectory of the block a to be tested, S d represents the total number of target points on the grayscale change trajectory in the comparison block d, θ s Indicates the angle value corresponding to the sth target point on the grayscale change trajectory in the comparison block d, JX a It represents the regional aggregation of the block a to be tested, and exp() represents an exponential function with the natural constant e as the base.
[0080] In the formula model of the possibility of being a non-seawater area, at different times, in the image blocks at the same position, that is, the block to be tested and the comparison block, the positional relationship of the pixel points on the corresponding grayscale change trajectory is analyzed, and the angle value between the grayscale change direction composed of adjacent pixel points on the grayscale change trajectory and the preset first direction is used to reflect the similarities and differences in the grayscale change trends in the block to be tested and the comparison block. If the grayscale change trends in the block to be tested and the comparison block are more similar, the difference in the mean angle values corresponding to the target points on the two grayscale change trajectories is The smaller it is, the less affected the block to be tested is by the flow of seawater, and the more likely it is to be a non-seawater area. Therefore, a negative correlation mapping is performed on the difference and normalized to achieve logical relationship correction, and the possible factor that the block to be tested is a non-seawater area is obtained. Since the more likely the block to be detected is a non-seawater area, the greater its regional aggregation will be, so the possibility that the block to be detected is a non-seawater area is combined with the corresponding regional aggregation, and the multiplication value of the two is used as the possibility that the block to be detected is a non-seawater area. It should be noted that the preset first direction can be adjusted in other embodiments of the present invention, which is not limited here.
[0081] So far, by analyzing the impact of the fluidity of seawater on the grayscale information in the block to be tested, and combining the evaluation of the regional aggregation corresponding to the block to be tested, the possibility that the block to be tested is a non-seawater area is obtained. At this time, based on the possibility that the block to be tested is a non-seawater area, the adjustment factor for the final image enhancement can be determined, so that the adjustment factor can be more in line with the image information in the block to be tested, and a better image enhancement effect can be obtained.
[0082] Non-seawater areas are essentially areas where there are reefs, corals and other objects in the seawater. Because such areas contain more useful positioning information, the contrast of such areas should be improved to make their texture features more prominent. However, since some image blocks may contain both seawater areas and non-seawater areas, when determining the enhancement intensity required for the image block, the texture feature information in the image block can be analyzed to obtain an adaptive gamma factor that is more in line with the image block itself.
[0083] Preferably, in one embodiment of the present invention, obtaining an adaptive gamma factor corresponding to the block to be tested according to the grayscale distribution of pixels in the block to be tested, texture information, and the possibility that the block to be tested is a non-seawater area includes:
[0084] First, the sum of the differences between the grayscale values of all pixels in the block to be tested and the grayscale mean value corresponding to the block to be tested is calculated as the grayscale expression value. The grayscale expression value can reflect the grayscale distribution and overall brightness level in the block to be tested, and can be used to make a preliminary judgment on the image information in the block to be tested.
[0085] In order to analyze the texture information in the block to be tested more accurately and specifically, the rays in the direction of the eight-chain code can be obtained in the block to be tested with the central pixel as the starting point, and then the sum of the grayscale differences between all adjacent pixels on each ray is calculated as the difference sum value, and the difference sum values corresponding to all the lines are used as the texture representation value.
[0086] Then, in order to prevent the adaptive gamma factor finally obtained from being too small and thus causing over-enhancement, the difference between the preset grayscale value and the grayscale mean value corresponding to the block to be tested may be normalized and used as a grayscale adjustment factor to avoid the aforementioned situation.
[0087] Finally, according to the grayscale expression value, texture expression value, grayscale adjustment factor and the possibility of being a non-seawater area corresponding to the block to be tested, the adaptive gamma factor corresponding to the block to be tested is obtained, and the grayscale expression value, texture expression value and the possibility of being a non-seawater area are negatively correlated with the adaptive gamma factor, and the grayscale adjustment factor is positively correlated with the adaptive gamma factor. Taking the image block a as an example, the formula model of the adaptive gamma factor can be specifically as follows:
[0088]
[0089]
[0090] Among them, γ a Indicates the adaptive gamma factor corresponding to the block a to be tested, FK a Indicates the possibility that the block a to be tested corresponds to a non-seawater area, h a,l Represents the gray value of the lth pixel in the block a to be tested, Indicates the grayscale mean of the block a to be tested, L a represents the total number of pixels in the block a to be tested, Q represents the total number of lines, and T q represents the total number of pixels on the qth line, h q,t represents the gray value of the t-th pixel on the q-th line, h q,t+1 represents the gray value of the t+1th pixel on the qth line, τ a represents the grayscale adjustment factor corresponding to the block a to be tested, μ represents the preset grayscale value, and norm() represents the normalization function.
[0091] In the formula model of the adaptive gamma factor, the cumulative sum of the differences between the grayscale values of all pixels in the block to be tested and the grayscale mean is first calculated, that is, the grayscale performance value The larger the grayscale value, the more complex the features in the block to be tested are, which means that the image information in the block to be tested is more. Similarly, by analyzing the grayscale differences between all adjacent pixels on rays in different directions in the block to be tested, the difference and value are obtained. The difference and value can represent the difference in grayscale values between pixels on a certain ray in the block to be tested. The larger the difference, the more prominent the texture feature is in the direction of the ray. Therefore, the mean of the difference and value corresponding to all rays is calculated to obtain the texture performance value. It can be used to characterize the texture information in the block to be tested. Since the non-seawater area can provide more positioning information, the larger the texture expression value and the grayscale expression value, the more image information it contains, and the more positioning information it can provide. The underwater environment is usually darker, and because the seawater area has a strong ability to reflect and refract light, the non-seawater area is darker than the seawater area. In this embodiment of the present invention, gamma transformation is used when enhancing the image. If the brightness of the dark area is to be increased and the pixels with smaller grayscale values are to be quickly amplified, a smaller gamma factor is required. Therefore, the product of the texture expression value, grayscale expression value and the possibility of being a non-seawater area of the block to be tested is normalized and negatively correlated, and the logical relationship is corrected to obtain As the first addend in the adaptive gamma factor calculation process. Since the gamma factor is less than 1 and the smaller the value is, the lower grayscale area in the image will be stretched, and the higher grayscale part will be compressed, so that the contrast of the low grayscale area of the image is enhanced. In order to prevent excessive enhancement, in this embodiment of the present invention, a grayscale adjustment factor is set, and the preset grayscale value of the block to be tested is normalized after the difference is made between the grayscale mean value. Here, the preset grayscale value is set to 128, and the middle value of the grayscale can more accurately analyze the brightness of the grayscale value in the block to be tested. At this time, if the grayscale mean value in the block to be tested is smaller, then the grayscale adjustment factor finally obtained will be correspondingly larger. Finally, the grayscale adjustment factor is used as the second addend in the adaptive gamma factor calculation process. At this time, the first addend is smaller, and the second addend is larger, so as to adjust the image enhancement effect and prevent excessive enhancement, thereby obtaining the adaptive gamma factor of the block to be tested.
[0092] In other embodiments of the present invention, when obtaining the adaptive gamma factor of the block to be tested, the product of the grayscale representation value, the texture representation value and the possibility of being a non-seawater area can be directly normalized and the value after negative correlation mapping can be used as the adaptive gamma factor.
[0093] Based on the above process, the adaptive gamma factor corresponding to each image block in the image to be tested can be obtained, and then the image can be adaptively enhanced to obtain an enhanced image.
[0094] The image blocks are gamma transformed according to the adaptive gamma factor corresponding to each image block to obtain an enhanced image of the image to be tested.
[0095] The formula used for gamma transformation is s=cr γ ; Wherein, s represents the output grayscale value, r represents the input grayscale value, c represents a positive constant, usually 1, and γ represents an adaptive gamma factor. It should be noted that the process of performing gamma transformation on an image to obtain an enhanced image is a technical means of numerical value for those skilled in the art, and will not be elaborated here.
[0096] At this point, by adaptively analyzing each image block in the image to be tested, an adaptive gamma factor of each image block can be obtained and adaptive enhancement can be performed to obtain a final enhanced image.
[0097] Step S4: Positioning the robot according to the enhanced image.
[0098] The image information contained in the non-seawater area in the enhanced image will be more significant. Therefore, more accurate positioning information can be obtained based on the enhanced image at this time, thereby achieving precise positioning.
[0099] Preferably, in one embodiment of the present invention, positioning the robot according to the enhanced image includes:
[0100] The enhanced image can be used as the input of a pre-trained neural network, and the output result of the neural network is the positioning information corresponding to the underwater robot. It should be noted that the neural network selected in this embodiment of the present invention is CNN, and the training process is briefly described as follows: different underwater image information and corresponding positioning information are used as a data set, and the CNN neural network is trained using the data set, wherein the loss function used is a cross entropy loss function. The specific training process is a technical means well known to those skilled in the art, and will not be described in detail here.
[0101] At this point, accurate positioning of the underwater robot can be achieved.
[0102] In summary, the main purpose of the embodiment of the present invention is to adaptively enhance the collected image, so as to improve the accuracy of the underwater robot's positioning information acquisition. Since the seawater area in the image provides less information for positioning than the reef, coral and other areas, it is necessary to perform image enhancement to different degrees on the area in the image, so that the non-seawater area useful for positioning is clearer. First, two grayscale images at the same position adjacent in time are obtained, and they are used as the image to be tested and the comparison image respectively. Through comparative analysis, the seawater area and the non-seawater area are distinguished. Further, starting from the local area of the image, an image block is obtained. By analyzing the image block, the information contained in the local area can be more accurately analyzed, which is convenient for improving the accuracy of image enhancement. Because the refraction and reflection ability of the seawater area to light is stronger than that of the non-seawater area, the grayscale changes at various positions in the seawater area will be different. Based on this feature, the grayscale distribution difference between the image block and the image block within the preset range is analyzed to obtain the regional aggregation of the image block, which is used to preliminarily characterize the possibility that the image block is a non-seawater area. Since the credibility of determining whether an image block is a non-seawater area only based on the grayscale difference between the image block and the surrounding image blocks is low, and seawater is usually fluid, while the positions of reefs and corals are invariant, at different times, if the image block belongs to the seawater area, the grayscale change will be more obvious, and the grayscale change in the non-seawater area will be less obvious. Therefore, the grayscale change trend in the image blocks at the same position in the test image and the comparison image can be analyzed to obtain the grayscale change trajectory. The grayscale change trajectory can characterize the path where the grayscale change in the image block is more significant. Then, the position distribution difference of the pixel points on the two grayscale change trajectories is analyzed to characterize the relative change of the pixel points, which is then combined with the regional clustering of the image block to obtain the accurate possibility that the image block is a non-seawater area. Furthermore, because some image blocks may contain both seawater areas and reef areas, when determining the enhancement strength of the image block, it is necessary to obtain an adaptive gamma factor based on the texture information contained in the image block, so that the adaptive gamma factor is more consistent with the overall situation of the image block, so as to achieve different degrees of enhancement effects. Therefore, the grayscale analysis and texture of the pixels in the image block are analyzed, combined with the possibility of being a non-seawater area, to obtain an adaptive gamma factor. Finally, the image block is enhanced according to the adaptive gamma factor to obtain an enhanced image to improve the accuracy of underwater positioning information acquisition.
[0103] An embodiment of an underwater robot image enhancement method:
[0104] As an important part of modern science and technology, underwater robot technology plays a key role in many fields such as ocean exploration, marine scientific research, search and rescue operations, etc. However, in practical applications, the special properties of the underwater environment will lead to poor image quality, which brings great challenges to underwater visual positioning.
[0105] When the prior art uses gamma transform to enhance the quality of underwater images, the gamma factor is often obtained based on the grayscale information in the image. However, due to the influence of factors such as underwater water flow fluctuations, light refraction and reflection, the gamma factor at this time cannot accurately reflect the overall situation in the image, resulting in poor image enhancement effect. Therefore, an embodiment of the present invention provides an underwater robot acquisition image enhancement method, comprising:
[0106] Step S1: acquiring two grayscale images at the same position collected by the underwater robot based on a preset time interval, selecting one as the image to be tested and the other as the comparison image;
[0107] Step S2: the image to be tested and the comparison image are evenly divided into image blocks according to the same division method, and any image block in the image to be tested is selected as the block to be tested, and the image block at the corresponding position of the block to be tested in the comparison image is selected as the comparison block; in the image to be tested, according to the grayscale distribution and grayscale difference between the block to be tested and other image blocks within a preset range centered on the block to be tested, the regional aggregation corresponding to the block to be tested is obtained;
[0108] Step S3: Analyze the grayscale change trend of all pixels in the block to be tested and the comparison block respectively to obtain the grayscale change trajectory; obtain the possibility that the block to be tested is a non-seawater area according to the difference between the pixel position distribution on the grayscale change trajectory in the block to be tested and the comparison block and the regional aggregation corresponding to the block to be tested; obtain the adaptive gamma factor corresponding to the block to be tested according to the grayscale distribution and texture information of the pixels in the block to be tested and the possibility that the block to be tested is a non-seawater area; enhance the image to be tested according to the adaptive gamma factors corresponding to all image blocks in the image to be tested to obtain an enhanced image.
[0109] Among them, steps S1 to S3 have been described in detail in the above-mentioned embodiment of the underwater robot visual positioning method, and will not be repeated here.
[0110] The beneficial effects brought by this embodiment include:
[0111] The main purpose of the embodiment of the present invention is to adaptively enhance the collected image. Since the seawater area in the image provides less information for positioning than the reef, coral and other areas, it is necessary to perform image enhancement to different degrees on the areas in the image so that the non-seawater area useful for positioning is clearer. First, two grayscale images at the same position adjacent in time are obtained, and they are used as the image to be tested and the comparison image respectively. By contrast analysis, the seawater area and the non-seawater area are distinguished. Further, starting from the local area of the image, an image block is obtained. By analyzing the image block, the information contained in the local area can be more accurately analyzed, which is convenient for improving the accuracy of image enhancement. Because the refraction and reflection ability of the seawater area to light is stronger than that of the non-seawater area, the grayscale changes at various positions in the seawater area will be different. Based on this feature, the grayscale distribution difference between the image block and the image block within the preset range is analyzed to obtain the regional aggregation of the image block, which is used to preliminarily characterize the possibility that the image block is a non-seawater area. Since the credibility of determining whether an image block is a non-seawater area only based on the grayscale difference between the image block and the surrounding image blocks is low, and seawater is usually fluid, while the positions of reefs and corals are invariant, at different times, if the image block belongs to the seawater area, the grayscale change will be more obvious, and the grayscale change in the non-seawater area will be less obvious. Therefore, the grayscale change trend in the image blocks at the same position in the test image and the comparison image can be analyzed to obtain the grayscale change trajectory. The grayscale change trajectory can characterize the path where the grayscale change in the image block is more significant. Then, the position distribution difference of the pixel points on the two grayscale change trajectories is analyzed to characterize the relative change of the pixel points, which is then combined with the regional clustering of the image block to obtain the accurate possibility that the image block is a non-seawater area. Furthermore, because some image blocks may contain both seawater areas and reef areas, when determining the enhancement strength of the image block, it is necessary to obtain an adaptive gamma factor based on the texture information contained in the image block, so that the adaptive gamma factor is more consistent with the overall situation of the image block, so as to achieve different degrees of enhancement effects. Therefore, the grayscale analysis and texture of the pixels in the image block are analyzed, combined with the possibility of being a non-seawater area, to obtain an adaptive gamma factor. Finally, the image block is enhanced according to the adaptive gamma factor to obtain a higher quality enhanced image.
[0112] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0113] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
Claims
1. A visual positioning method for an underwater robot, characterized in that: The method comprises: Acquire two grayscale images at the same position collected by the underwater robot based on a preset time interval, select one as the image to be tested, and the other as a comparison image; The image to be tested and the comparison image are evenly divided into image blocks according to the same division method, and any image block in the image to be tested is selected as the block to be tested, and the image block at the corresponding position of the block to be tested in the comparison image is selected as the comparison block; in the image to be tested, according to the grayscale distribution and grayscale difference between the block to be tested and other image blocks within a preset range centered on the block to be tested, the regional aggregation corresponding to the block to be tested is obtained; The grayscale change trends of all pixels in the block to be tested and the comparison block are analyzed respectively to obtain the grayscale change trajectory; the possibility that the block to be tested is a non-seawater area is obtained according to the difference between the pixel position distribution on the grayscale change trajectory in the block to be tested and the comparison block and the regional aggregation corresponding to the block to be tested; the adaptive gamma factor corresponding to the block to be tested is obtained according to the grayscale distribution and texture information of the pixels in the block to be tested and the possibility that the block to be tested is a non-seawater area; the image to be tested is enhanced according to the adaptive gamma factors corresponding to all image blocks in the image to be tested to obtain an enhanced image; Positioning the robot according to the enhanced image; The step of obtaining the regional aggregation corresponding to the block to be tested according to the grayscale distribution and grayscale difference between the block to be tested and other image blocks within a preset range centered on the block to be tested comprises: Other image blocks within a preset range centered on the block to be tested are used as analysis blocks, and similar blocks to the block to be tested are screened based on the overall grayscale difference between the block to be tested and all the analysis blocks; The maximum grayscale value and the minimum grayscale value in the block to be tested and the corresponding maximum grayscale value and the minimum grayscale value in all similar blocks form a numerical sequence, calculate the difference between the values in the numerical sequence, take the maximum difference as the upper limit value, and the minimum difference as the lower limit value, to obtain the grayscale fluctuation range, and take all integer values in the grayscale fluctuation range as target values; The grayscale difference between the pixel points at the same position in the block to be tested and each similar block is used as the difference factor of the corresponding pixel point, the difference between the difference factor and each target value is calculated as the fluctuation amplitude, and the maximum fluctuation amplitude is used as the fluctuation factor of the corresponding pixel point; the mean value of the fluctuation factors corresponding to all the pixels in the block to be tested is negatively correlated and normalized, and the value is used as the aggregation factor of the block to be tested and the similar blocks; The average of the clustering factors of the block to be tested and all similar blocks is taken as the regional clustering corresponding to the block to be tested.
2. The underwater robot visual positioning method according to claim 1, characterized in that: The method of using other image blocks within a preset range centered on the block to be tested as analysis blocks and screening similar blocks to the block to be tested based on the overall grayscale difference between the block to be tested and all the analysis blocks includes: The difference between the grayscale mean of the block to be tested and each analysis block is calculated and normalized as the mean difference, and the analysis block corresponding to the mean difference less than the preset difference threshold is taken as a similar block to the block to be tested.
3. The underwater robot visual positioning method according to claim 1, characterized in that: The grayscale change trend of all pixels in the block to be tested and the comparison block is analyzed to obtain the grayscale change trajectory, including: In the block to be tested and the comparison block, the pixel point at the position of the centroid of the block to be tested and the pixel point at the corresponding position of the centroid of the block to be tested in the comparison block are taken as the changed pixel points. In the preset neighborhood centered on the changed pixel point, the neighborhood pixel point with the largest grayscale difference with the central pixel point is taken as the new changed pixel point. New changed pixel points are continuously determined until the new changed pixel point is the edge pixel point of the image block. All the changed pixel points are arranged in the order of appearance to obtain the grayscale change trajectory.
4. The underwater robot visual positioning method according to claim 1, characterized in that: The method of obtaining the possibility that the block to be tested is a non-seawater area according to the difference between the pixel position distribution on the grayscale change trajectory in the block to be tested and the comparison block and the regional aggregation corresponding to the block to be tested includes: On the grayscale change trajectories corresponding to the block to be tested and the comparison block, other pixels except the last pixel are taken as target points; each target point is taken as the starting point and the next pixel point adjacent to the target point is taken as the end point to obtain the grayscale change direction corresponding to the target point; the angle between the grayscale change direction corresponding to each target point and the preset first direction is calculated to obtain the angle value; The difference in the mean angle values on the two grayscale change trajectories is negatively correlated and normalized, and the value obtained is used as the possible factor that the block to be tested is a non-seawater area; the value obtained by multiplying the possible factor that the block to be tested is a non-seawater area with the corresponding regional aggregation is used as the possibility that the block to be tested is a non-seawater area.
5. The underwater robot visual positioning method according to claim 1, characterized in that: The step of obtaining the adaptive gamma factor corresponding to the block to be tested according to the grayscale distribution of pixels in the block to be tested, texture information, and the possibility that the block to be tested is a non-seawater area comprises: Calculate the sum of the differences between the grayscale values of all pixels in the block to be tested and the grayscale mean value corresponding to the block to be tested as the grayscale representation value; In the block to be tested, take the central pixel as the starting point and obtain the ray in the direction of the eight-chain code; calculate the sum of the grayscale differences between all adjacent pixels on each ray as the difference sum value, and take the average of the difference sum values corresponding to all the strokes as the texture representation value; Normalize the difference between the preset grayscale value and the grayscale mean value corresponding to the block to be tested to obtain a grayscale adjustment factor; According to the grayscale expression value, texture expression value, grayscale adjustment factor and the possibility of being a non-seawater area corresponding to the block to be tested, an adaptive gamma factor corresponding to the block to be tested is obtained, and the grayscale expression value, texture expression value and the possibility of being a non-seawater area are all negatively correlated with the adaptive gamma factor, and the grayscale adjustment factor is positively correlated with the adaptive gamma factor.
6. The underwater robot visual positioning method according to claim 5, characterized in that: The preset grayscale value is set to 128.
7. The underwater robot visual positioning method according to claim 1, characterized in that: Positioning the robot according to the enhanced image comprises: The enhanced image is used as the input of the neural network, and the output result of the neural network is the positioning information of the underwater robot.
8. The underwater robot visual positioning method according to claim 7, characterized in that: The neural network is a CNN neural network.
9. The underwater robot visual positioning method according to claim 4, characterized in that: The preset first direction is a horizontal rightward direction.
