Underwater image distortion correction method based on multi-medium refraction model
By using a multi-medium refraction model and an adaptive correction algorithm, the problem of light refraction distortion caused by changes in the medium in underwater image processing is solved, achieving high-precision correction and stable recognition of underwater images, thus improving security inspection efficiency and the versatility of image processing.
Patent Information
- Application Number
- CN202511525604.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-24
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-10-24
AI Technical Summary
Underwater image processing systems suffer from light refraction distortion due to changes in the medium, affecting the position, shape, and edge information of objects, resulting in inaccurate recognition results. Furthermore, they lack adaptive modeling capabilities, making it difficult to guarantee stability and unified analysis across devices and scenarios.
A multi-medium refraction model is adopted. By acquiring raw underwater image data, optical interference features are extracted. Convolutional neural networks are used to analyze medium changes. Combined with adaptive correction algorithms and dynamic threshold settings, image pixel distribution is adjusted and local contrast is enhanced to generate a corrected image version. Furthermore, the contours of the objects are extracted through region segmentation and brightness equalization. Standardized process parameters are updated, and noise suppression and iterative optimization are integrated to generate an optimized image output.
It significantly improves the clarity of underwater images and the accuracy of object recognition, optimizes security inspection efficiency, enhances the stability and versatility of image processing, and ensures unified analysis capabilities across devices and scenarios.
Smart Images

Figure CN120997099A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to an underwater image distortion correction method based on a multi-medium refraction model. BACKGROUND
[0002] In the fields of marine engineering, port infrastructure, underwater pipelines, etc., underwater safety inspection is an important means to ensure the structural integrity and operational safety, and its inspection accuracy and efficiency are directly related to the reliability of national key facilities and the level of public safety. With the deepening of marine development activities, the underwater environment is becoming increasingly complex, and the security inspection task is facing higher challenges. In particular, in identifying hidden objects, extracting target contours, and judging minor damage, image processing technology is playing an increasingly key role.
[0003] At present, underwater image processing systems mainly rely on underwater camera equipment to collect video images and assist in completing safety inspections through image enhancement, contour extraction, and target detection technologies. However, underwater optical interference seriously restricts image quality, mainly due to the refraction distortion caused by medium changes (such as air-glass-water multi-layer medium), which causes deviations in the position, shape, and edge information of objects in the image, leading to inaccurate recognition results and seriously affecting the reliability of security inspection conclusions. For example, when detecting underwater pipeline cracks or facility deformation, refraction distortion may cause the boundaries of target objects in the image to be blurred and the contours to be misaligned, affecting the judgment of automatic recognition algorithms and even leading to false positives or false negatives. In addition, existing technologies generally lack adaptive modeling capabilities for complex underwater medium changes, and under different water quality, water flow speed, water depth, etc., the image processing performance fluctuates severely, making it difficult to ensure stability. Furthermore, due to the lack of standardization mechanisms in current underwater image processing processes, the results of data collected by different devices after independent processing algorithms differ significantly, making it difficult to perform unified analysis across devices and scenarios. This not only increases the pressure of manual review, but also limits the universality and reusability of image processing templates. Especially in high-risk scenarios such as port enclosed water areas, deep water pipeline inspection, etc., if image distortion is not effectively corrected, it is easy to miss minor but critical safety hazards. SUMMARY
[0004] The present application aims to provide an underwater image distortion correction method based on a multi-medium refraction model to solve the problems existing in the prior art.
[0005] To achieve the above object, the present application provides the following technical solutions: a water image distortion correction method based on a multi-medium refraction model, comprising S1, obtaining a preliminary distortion parameter set by collecting original water image data and extracting optical interference features in the data; S2, analyzing the influence of medium changes according to the preliminary distortion parameter set, processing image pixel distribution using a convolutional neural network model, and integrating pixel intensity adjustment and local contrast enhancement to determine the refraction distortion degree; S3, if the refraction distortion degree exceeds a preset threshold, applying an adaptive correction algorithm to the image pixel distribution in combination with refraction deviation compensation and dynamic threshold setting to obtain a corrected image version; S4, obtaining object contour data from the corrected image version and integrating region segmentation processing and brightness equalization to determine whether the object offset is within an acceptable range to obtain an offset calibration result; S5, updating the standardized process parameters using the offset calibration result, smoothing the image edges through a Gaussian filter algorithm, and applying kernel size selection and standard deviation parameters to determine the final recognition accuracy index; S6, if the final recognition accuracy index meets the detection capability requirements, integrating the standardized process parameters to generate a general processing template and embedding a noise suppression mechanism and an iterative optimization cycle to obtain an optimized image output; S7, analyzing hidden object features according to the optimized image output and combining edge-preserving filtering and bilateral filtering expansion to determine the degree of security efficiency improvement to obtain a complete underwater inspection report; S8, updating the medium change model by feeding back the adaptive correction algorithm parameters through the complete underwater inspection report and integrating gradient calculation and smoothing intensity control to obtain the basis for the next cycle of image processing.
[0006] Preferably, S1 comprises collecting original underwater image data through a sensor to obtain an initial image set; denoising the initial image set using image preprocessing technology to generate a denoised image set; extracting optical interference features from the denoised image set to obtain an interference feature set; if the feature values in the interference feature set exceed a preset threshold, classifying the feature values to determine the interference category; calculating distortion parameters according to the interference category to generate an initial distortion parameter set; reducing the dimension of the initial distortion parameter set through principal component analysis algorithm to obtain an optimized distortion parameter set; verifying the parameters using support vector machine algorithm for the optimized distortion parameter set to obtain a final distortion parameter set.
[0007] Preferably, the S2 comprises obtaining the refractive index change data from the medium change feature, analyzing the interference of the refractive index change on the image pixel distribution by using the optical flow estimation algorithm to obtain the pixel offset set; if the offset value in the pixel offset set exceeds the preset threshold value, the offset value is clustered and analyzed to determine the offset category; according to the offset category, the gradient descent algorithm is used to optimize the pixel intensity adjustment parameter to obtain the adjusted pixel intensity set; the adjusted pixel intensity set is processed by the local contrast enhancement algorithm to generate the enhanced image set; the local texture feature is extracted from the enhanced image set, and the feature matching method is used to compare with the original image to obtain the texture distortion distribution; if the distortion value in the texture distortion distribution exceeds the preset threshold value, the distortion value is weighted and fused to generate the refractive distortion degree parameter; the refractive distortion degree parameter is associated with the medium change feature to determine the final refractive distortion degree.
[0008] Preferably, the S3 comprises obtaining the pixel distribution data from the original image, analyzing the influence of the refractive distortion on the pixel distribution by using the optical flow estimation algorithm to obtain the pixel offset set; if the offset value in the pixel offset set exceeds the preset threshold value, the pixel offset set is processed by using the adaptive correction algorithm, combined with the refractive deviation compensation, to generate the corrected pixel set; according to the corrected pixel set, the dynamic threshold setting method is used to adjust the local feature contrast of the corrected pixel set to obtain the enhanced image set; the texture feature is extracted from the enhanced image set, and the feature matching method is used to compare with the original image to determine the final image version.
[0009] Preferably, the S4 comprises obtaining the object contour data from the corrected image version, extracting the boundary pixel set of the target object by using the edge detection algorithm to obtain the object contour data set; according to the object contour data set, the region segmentation algorithm is used to process the corrected image version to generate the region segmentation data set containing the target object; the brightness distribution feature is extracted from the region segmentation data set, and the histogram equalization method is used to adjust the brightness of the region segmentation data set to obtain the brightness equalization image set; if the object offset value in the brightness equalization image set exceeds the preset threshold value, the texture matching algorithm is used to compare with the object contour data set to determine whether the object offset is within an acceptable range to obtain the offset calibration result.
[0010] Preferably, S5 comprises generating an updated parameter data set by processing the offset calibration data using a parameter adjustment algorithm according to the offset calibration result; obtaining the kernel size and standard deviation value from the updated parameter data set, and smoothing the image edges using a Gaussian filtering algorithm to obtain a smoothed edge image set; if the texture feature of the smoothed edge image set is below a preset threshold value, performing secondary calibration using a texture matching algorithm to determine a calibrated image data set; processing the calibrated image data set by a region segmentation algorithm to extract a target object region, and calculating a comprehensive index of brightness distribution and edge sharpness to obtain a final recognition accuracy index.
[0011] Preferably, S6 comprises obtaining standardized process parameters from a preset parameter database, generating an initial general processing template by a parameter integration algorithm, and determining a preliminary structure of the initial general processing template; if the detection capability of the initial general processing template is below a preset threshold value, processing the parameter data set in the initial general processing template using a noise suppression algorithm to obtain a noise-suppressed template parameter set; adjusting the parameters in the template parameter set using an iterative optimization loop algorithm according to the noise-suppressed template parameter set to obtain an optimized general processing template; processing the optimized general processing template by a region segmentation algorithm to extract a feature region from a target image to generate an optimized image output.
[0012] Preferably, S7 comprises obtaining a target underwater image from a preset image database, processing the target underwater image using a bilateral filtering algorithm to retain edge details to obtain a first optimized image; separating the foreground and background regions from the first optimized image using an image segmentation algorithm to extract a hidden object region to obtain a segmentation feature set; analyzing the hidden object features using a convolutional neural network algorithm according to the segmentation feature set to determine whether a target object exists to obtain an object recognition result; comparing the object recognition result with a preset efficiency threshold value, integrating the object recognition result and efficiency data using a report generation algorithm to obtain an underwater inspection report.
[0013] Preferably, S8 comprises obtaining a target underwater image from a preset underwater image database, processing the target underwater image using an adaptive correction algorithm to generate a first corrected image by adjusting the brightness and contrast; calculating the image pixel gradient using a gradient calculation method to extract edge features to generate an edge feature set for the first corrected image.
[0014] Preferably, S8 further comprises adjusting the feature smoothing degree using a smoothing strength control algorithm according to the edge feature set to optimize the edge features to obtain an optimized feature set; comparing the optimized feature set with a preset medium change database, if the matching degree of the optimized feature set exceeds a preset threshold value, updating the medium change model using a convolutional neural network algorithm to obtain the basis for the next cycle of image processing.
[0015] From the above technical solutions, the present application has the following beneficial effects: The underwater image distortion correction method based on the multi-medium refraction model solves the business problems of image refraction distortion caused by medium changes and insufficient object recognition accuracy in underwater security. The problem is caused by image distortion due to underwater optical interference, affecting object contour extraction and hidden feature analysis, and reducing security efficiency. The present application collects original image data, extracts optical interference features, generates a preliminary distortion parameter set, and uses a convolutional neural network to analyze medium changes, adjust pixel distribution and local contrast, and accurately determine the degree of refraction distortion. For distortion exceeding the threshold, an adaptive correction algorithm is applied, combined with refraction deviation compensation and dynamic threshold, to generate a corrected image. Further, object contours are extracted by region segmentation and brightness equalization, offset is calibrated, standardized process parameters are updated, Gaussian filter is used to smooth edges, and recognition accuracy is ensured. Finally, noise suppression and iterative optimization are integrated to generate a general processing template, combined with edge preservation and bilateral filtering to improve security efficiency, and feedback is provided to update the medium model for the next cycle. The present application significantly improves the clarity of underwater images and the accuracy of object recognition, and optimizes the security efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0016] Figure 1 The present application is based on a multi-medium refraction model for underwater image distortion correction method flowchart. DETAILED DESCRIPTION
[0017] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor are within the scope of protection of the present application.
[0018] As Figure 1As shown, the present application provides a technical solution: an underwater image distortion correction method based on a multi-medium refraction model, comprising S1, obtaining a preliminary distortion parameter set by collecting original underwater image data and extracting optical interference features in the data; S2, according to the preliminary distortion parameter set, analyze the influence of medium change, use convolutional neural network model to process image pixel distribution and integrate pixel intensity adjustment and local contrast enhancement, determine the refraction distortion degree; S3, if the refraction distortion degree exceeds the preset threshold, then apply adaptive correction algorithm to image pixel distribution combined with refraction deviation compensation and dynamic threshold setting, obtain the corrected image version; S4, obtain object contour data from the corrected image version and integrate region segmentation processing and brightness equalization, judge whether the object offset is within the acceptable range, obtain the offset calibration result; S5, update the standardized process parameter by using the offset calibration result, smooth the image edge by Gaussian filtering algorithm and apply kernel size selection and standard deviation parameter, determine the final recognition accuracy index; S6, if the final recognition accuracy index meets the detection ability requirement, integrate the standardized process parameter to generate a general processing template and embed a noise suppression mechanism and an iterative optimization cycle, obtain an optimized image output; S7, according to the optimized image output, analyze the hidden object features and combine edge retention filtering and bilateral filter expansion, judge the degree of security efficiency improvement, obtain a complete underwater inspection report; S8, update the medium change model by feeding back the adaptive correction algorithm parameters through the complete underwater inspection report and integrating gradient calculation integration and smoothness control, obtain the basis for the next cycle of image processing.
[0019] The method establishes an underwater image correction framework based on a multi-medium refraction model. First, the collected underwater original image usually contains complex refraction and distortion caused by multi-medium propagation of light (such as air-glass-water), and by extracting the optical interference features in the image, the distortion parameters affecting the image quality can be preliminarily obtained. Second, the convolutional neural network (CNN) is used to model and learn the pixel distribution of the image, and combined with the pixel intensity adjustment and local contrast enhancement strategy, the distribution law of the refraction distortion is more accurately reflected. According to whether the refraction distortion degree exceeds the preset threshold, it is determined whether to enter the adaptive correction stage. In the correction stage, by introducing the refraction deviation compensation mechanism and the dynamic threshold setting based on image characteristics, the restoration accuracy of the image geometric structure is effectively improved. Subsequently, the corrected image is subjected to object contour extraction, and combined with the region segmentation algorithm and brightness equalization processing, the target object offset degree is analyzed. The obtained offset calibration result is further used to update the standardized image processing parameters, and then the final recognition accuracy of the image is calculated through Gaussian filtering for edge smoothing processing under the control of kernel size and standard deviation. If the recognition accuracy meets the requirements, a general template is generated by combining the current process parameters, noise suppression mechanism and iterative optimization process, which is used to output the optimized image. Finally, by analyzing the characteristics of the hidden objects in the optimized image, and cooperating with edge-preserving filtering and bilateral filtering and other technologies to expand the analysis depth, the security efficiency is evaluated and a complete inspection report is output. The analysis results in the report are used to update the correction algorithm and medium change model in the image processing process, providing a basis for the next cycle.
[0020] The method can effectively solve the non-linear distortion problem of underwater images due to complex refraction paths. By combining deep learning models with image enhancement strategies, the accuracy of refraction distortion estimation and the correction effect are improved. The adaptive correction algorithm has dynamic threshold adjustment and refraction deviation compensation functions, which significantly improves the accuracy of image structure restoration. Gaussian filtering optimizes the edge transition process, ensuring image clarity and recognition stability. The edge-preserving and bilateral filtering techniques exhibit strong detail preservation capabilities in analyzing hidden object characteristics, making the final generated underwater inspection report superior to traditional methods in terms of recognition rate and analysis efficiency. In addition, through the feedback mechanism, the algorithm parameters and model are iteratively updated, improving the overall adaptability and continuous optimization capability, significantly enhancing the practicality and robustness of underwater image processing in complex environments.
[0021] S1 includes collecting underwater original image data through a sensor to obtain an initial image set; adopting an image preprocessing technique to denoise the initial image set to generate a denoised image set; extracting optical interference features from the denoised image set to obtain an interference feature set; if a feature value in the interference feature set exceeds a preset threshold, classifying the feature value to determine an interference category; according to the interference category, calculating distortion parameters to generate an initial distortion parameter set; performing dimension reduction on the initial distortion parameter set through a principal component analysis algorithm to obtain an optimized distortion parameter set; for the optimized distortion parameter set, adopting a support vector machine algorithm to verify the parameters to obtain a final distortion parameter set.
[0022] In a possible implementation, first, an underwater special image acquisition sensor is deployed on an underwater platform or a mobile device (such as an underwater robot). The sensor is preferably a high-resolution low-illumination CMOS image sensor, has a waterproof shell and a red-blue filter lens, and can perform image acquisition under weak light and turbid water conditions. The acquisition operation is started under a control instruction, the sensor continuously acquires image data at a frequency of 1 frame per second to 5 frames per second, the duration is set to 60 seconds, and a number of not less than 60 static image frames are obtained to form an initial image set. All images are encoded in a standard image format (such as JPEG or PNG) and saved in a local storage module.
[0023] Subsequently, each frame of image in the initial image set is preprocessed, and the main target is to remove random noise in the image caused by underwater particle suspended matter, sensor noise or light flicker. The image preprocessing preferably includes the following operations: first, median filtering is applied to each frame of image, the window size is set to 3*3 pixels, each pixel is taken as the center, the gray values of 9 pixels in the neighborhood are sorted, and the center pixel gray value is replaced with the median value to complete the suppression of salt and pepper noise; second, histogram equalization is performed on the whole image to enhance the image contrast and highlight the edge region, so that the subsequent feature recognition is more stable; third, the color offset value of the image is calculated according to the RGB three channels, and if the offset exceeds 10 gray levels, color recorrection based on the channel mean value is performed. After the preprocessing, an image set without obvious noise and light abnormality is obtained, that is, a denoised image set.
[0024] On the basis of the denoised image set, the optical interference feature extraction operation is started frame by frame. The process first identifies the high light spot area through local gray difference calculation: a 5*5 window is used to scan the whole image, the difference between the maximum brightness and the average brightness in each window is calculated, and if the difference exceeds 20 gray levels, it is marked as a high light area. Then the image is subjected to gradient analysis, the Sobel operator is used to extract the edge intensity map in the horizontal and vertical directions, and the average edge gradient of each image area is calculated, and if the average gradient of the area is lower than 5, it is identified as a fuzzy area. Then by analyzing the local mean difference of the RGB three channels, if the difference of any two channels exceeds 15, it is determined as a color distortion area. The above three types of areas are recorded as different types of optical interference features, and the image position, interference type and numerical characteristics are marked. Finally, the information of all interference areas forms the interference feature set, and each record includes the image number, area position, interference type, corresponding feature value and its extraction method.
[0025] Each feature value in the interference feature set is judged one by one. The feature values include brightness deviation value, edge gradient mean value and color channel difference value, which correspond to high light, blur and color distortion respectively. The following preset threshold values are set in advance: the brightness deviation threshold is set to 20, if the brightness value in a certain image area is higher than the average value of the adjacent area by more than 20 gray levels, it is marked as high light interference; the edge gradient mean value threshold is set to 5, if the value is lower than 5, it is considered that there is a blur problem in the area; the color channel difference threshold is set to 15, if the mean difference of any two channels of RGB is greater than 15, it is determined as color distortion interference. The threshold is obtained by a large number of manual annotation samples, which ensures its applicability to various underwater imaging environments.
[0026] If any feature value exceeds its corresponding threshold, the classification rule is immediately called to classify the interference type of the area as light reflection, blur or color distortion. The classification rule is realized by a static mapping table, that is, the interference type is directly mapped according to the feature index that exceeds the threshold. There can be multiple interference areas in each image, and after processing each area separately, the classification results of all areas are combined to count the number of each type of interference and its average feature value in each image.
[0027] On this basis, the corresponding distortion parameters are generated according to each type of interference. Specifically, for light reflection interference, the distortion parameter is set as the ratio of the average brightness deviation to the average brightness of the whole image; for blur interference, it is set as the difference between the average edge gradient of the fuzzy area in the image and the average gradient of the whole image; for color distortion, it is set as the standard deviation of the RGB three channel difference. These parameters are obtained by image pixel level statistical calculation, and one to two quantitative indicators are output for each type as distortion description. The distortion parameters in multiple images are arranged in sequence to form the initial distortion parameter set.
[0028] The initial distortion parameter set is usually high-dimensional, which is not conducive to subsequent algorithm processing, so principal component analysis algorithm is introduced for dimension reduction. The PCA processing procedure is as follows: first, calculate the covariance matrix of all parameter items in the set; second, solve the eigenvalues and corresponding eigenvectors of the covariance matrix; third, sort the eigenvalues from high to low, select the first several principal components, so that the cumulative variance contribution rate of these principal components is greater than 85%. Usually, the first 3 principal components are selected as representatives, and the multi-dimensional distortion parameters of each original image are projected into 3-dimensional vectors to obtain an optimized distortion parameter set. The data amount of the set is significantly reduced, while the main distortion feature information is retained.
[0029] In order to verify the accuracy and discrimination ability of the optimized distortion parameter set, support vector machine in supervised learning method is introduced for parameter verification. The specific steps are as follows: 200 labeled "distorted images" and "non-distorted images" are selected from historical data, and the corresponding optimized distortion parameters of these images are used as training set sample features, and the image labels are used as supervision labels; the linear kernel function is used to train the SVM model, after the training is completed, the model is used to predict and classify each parameter vector in the current optimized distortion parameter set. If the consistency rate of the prediction result and the artificial labeling result is more than 95%, it is considered that the parameter set passes the verification and is confirmed as the final distortion parameter set. Otherwise, feedback to the initial feature extraction or threshold setting link for correction. The final distortion parameter set is used as the core input for image correction, precision adjustment and template generation.
[0030] S2 includes obtaining refractive index change data from the medium change feature, using an optical flow estimation algorithm to analyze the interference of the refractive index change on the pixel distribution of the image, and obtaining a pixel offset set; if the offset value in the pixel offset set exceeds a preset threshold, the offset value is clustered and analyzed to determine the offset category; according to the offset category, a gradient descent algorithm is used to optimize the pixel intensity adjustment parameter to obtain an adjusted pixel intensity set; the adjusted pixel intensity set is processed by a local contrast enhancement algorithm to generate an enhanced image set; local texture features are extracted from the enhanced image set, and a feature matching method is used to compare with the original image to obtain a texture distortion distribution; if the distortion value in the texture distortion distribution exceeds a preset threshold, the distortion value is weighted and fused to generate a refractive distortion degree parameter; the refractive distortion degree parameter is associated with the medium change feature to determine the final refractive distortion degree.
[0031] In one possible implementation, an environmental monitoring module is first integrated in the underwater image acquisition device, which records the temperature, salinity and depth information in real time during image acquisition and records them as medium change characteristics. By consulting the existing optical medium physical parameter table, the temperature, salinity and depth are converted into underwater refractive index values. For example, when the water temperature is 25 degrees Celsius, the salinity is 35 units and the depth is 10 meters, the corresponding refractive index of the image is calculated to be 1.3408 through the refractive index lookup table.
[0032] After the refractive index is extracted, the refractive index change is used as one of the boundary constraint terms of the optical flow estimation algorithm, and the pyramid Lucas-Kanade optical flow algorithm is used to estimate the pixel motion between images. The process includes the following steps: first, a 4-layer image pyramid is constructed for the image, and the image is sequentially reduced in size; then, each pixel point in the image is selected from the smallest layer, and the gray difference of the point between two consecutive images is calculated in a 3x3 window around the point, and then the horizontal and vertical displacement vectors of the pixel are derived based on the gray invariance assumption and the local spatial consistency assumption; after the preliminary estimation is completed in all image levels, the original resolution is up-sampled layer by layer for refinement compensation, and finally the complete displacement data of each pixel is obtained, and the combination of the displacement of all pixels constitutes the pixel offset set.
[0033] Next, the judgment threshold of pixel offset is set to 2 pixel units, that is, if the total offset distance of a pixel in two consecutive images is greater than 2 pixels, it is considered that the pixel has significant interference caused by medium refraction. This threshold is obtained by analyzing a large-scale underwater image data set, which can effectively distinguish the pixel changes caused by natural motion and physical refraction. The entire pixel offset set is traversed, and all pixels with an offset value greater than 2 are marked and their offset vectors are recorded.
[0034] These significant offset vectors are sent to the K-means clustering algorithm for clustering analysis, and the number of clusters is preset to 3, corresponding to three common offset modes: "concentrated offset type", "dispersed edge type" and "mixed type". The clustering process takes the horizontal component and the vertical component of each offset vector as two-dimensional feature input, uses Euclidean distance as similarity measurement index, iteratively calculates the distance between each sample point and the three initial cluster centers, assigns the sample to the nearest cluster center, updates the cluster center position, and loops until all centers are stable. Finally, the cluster category of each pixel offset point is output to form an offset category label map, and the spatial distribution proportion and center offset intensity of each offset category are counted to provide classification basis for subsequent optimization processing.
[0035] According to the offset category label map generated in the previous step, the entire image is divided into multiple regions of different offset types. Specifically, it is divided into three categories: the first category is the concentrated offset region, usually appearing in the center of the image or the edge of the target, the second category is the scattered edge offset region, usually located at the image boundary, and the third category is the mixed offset region, irregularly distributed. Each type of region is processed separately, and different pixel intensity optimization objectives are set.
[0036] For each image region determined to be an abnormal offset, the gray value of all pixels in the region is used as the optimization variable to construct a gradient descent optimization model. The optimization objective is to minimize the mean square error between the pixel gray value in the region and the average gray value of the surrounding region to improve local gray consistency and eliminate the brightness distortion caused by refraction. The gradient descent process is as follows: first, initialize the pixel intensity adjustment parameter to the gray value of the corresponding pixel in the original image, set the learning rate to 0.01, and set the loss function to the square error between each pixel in the region and the average value of the neighborhood. Then, for each pixel, the following operations are iteratively performed: calculate the derivative of the pixel intensity with respect to the loss function, which is the product of the current gray value minus twice the average value of the neighborhood, multiplied by the learning rate to correct the current pixel value. Update the pixel gray value after each iteration, and determine whether the loss function change is less than 0.001 or the iteration count is less than 50. If either condition is met, terminate the iteration. The optimization process is executed in parallel by region, and the optimized pixel intensity set is output, where the gray value of each pixel has been adjusted according to the offset distribution characteristics.
[0037] After the pixel intensity optimization is completed, local contrast enhancement processing is performed on the entire image. The processing method is as follows: taking each pixel as the center, a 5x5 neighborhood region is extracted, and the difference between the maximum and minimum gray values in the region is calculated as the local contrast value of the current pixel. If the difference is less than a set minimum contrast threshold (e.g., 10 gray levels), it is considered that the region has low contrast, and enhancement operation is performed. The enhancement method is to normalize the current pixel gray value to the dynamic range of the local window, which is calculated as follows: subtract the local minimum value from the current gray value, multiply by 255 divided by the maximum-minimum value difference, and obtain the new enhanced pixel value. This process is executed pixel by pixel to ensure that each pixel is individually enhanced according to its local gray environment, thereby improving the visibility of image details and overall visual level.
[0038] Finally, the image after the gradient descent optimization and local contrast enhancement processing constitutes an enhanced image set, which is used for subsequent texture feature extraction and distortion degree analysis processing.
[0039] Local texture features are extracted from the generated enhanced image set frame by frame. The process adopts the local binary pattern method for texture description. For each enhanced image, the image is divided into 4x4 blocks, and in each block, the gray-scale information of the 3x3 neighborhood of each pixel is extracted. By comparing the gray-scale values of the center pixel with the surrounding 8 pixels, the value greater than or equal to the center pixel is recorded as 1, and the value less than the center pixel is recorded as 0, forming an 8-bit binary code, which is then converted into a decimal integer as the local texture feature value of the pixel. The mean value of the local texture feature values of all pixels in each image block is calculated to form the texture feature map of the enhanced image at the block level.
[0040] Then, the texture feature map of the enhanced image is matched with the corresponding original image one by one. The original image uses the same local binary pattern method to extract texture features, ensuring consistent feature extraction methods. In the matching process, the texture feature values of each corresponding image block are subtracted to calculate the absolute difference between them. If the difference is greater than the set texture distortion judgment threshold, it is considered that the block has texture structure distortion. The texture distortion threshold is set to 20, and experiments have verified that this value can stably distinguish natural texture changes from structure disturbances caused by refraction. All image block distortion values are recorded as a texture distortion distribution map, where each block corresponds to a specific distortion value and is marked as whether it exceeds the threshold.
[0041] After obtaining the complete texture distortion distribution, a weighted fusion operation is performed on all distortion values to generate a unified refraction distortion degree parameter. The weighted fusion adopts a multi-factor weighted average method, and the weights are set as follows: texture intensity difference accounts for 50%, that is, the greater the texture difference, the higher the weight; image block area accounts for 30%, that is, the larger the block coverage, the more significant the distortion impact; spatial continuity accounts for 20%, that is, if multiple adjacent blocks continuously exist distortion, the overall weight of this area is adjusted up. The calculation method is as follows: first, normalize each factor to convert its value to 0 to 1, then multiply by the corresponding weight to sum up to get the fusion score of each image block, and finally take the average of the scores of all image blocks as the refraction distortion degree parameter of the whole image. The numerical range of this parameter is 0 to 100, and the higher the value, the more serious the refraction interference on the image.
[0042] Finally, the calculated refraction distortion degree parameter is correlated with the medium change characteristics during image acquisition. The goal of the correlation analysis is to determine whether the refraction distortion appearing in the image is mainly caused by the medium change. Specifically, according to the water temperature, salinity and depth information recorded during the current image acquisition, the corresponding refraction index change range is obtained by table lookup, and is compared with the image refraction distortion degree under the same refraction index in the historical data, and the correlation coefficient is calculated. If the refraction distortion degree parameter of the current image and the refraction index change present a high linear correlation in the statistical data, and the correlation coefficient is greater than 0.85, it is confirmed that the current refraction distortion is mainly caused by the medium change, and the image is marked as an "effective refraction distortion image", and the final refraction distortion degree is output for guiding the subsequent adaptive image correction processing.
[0043] S3 includes obtaining pixel distribution data from the original image, analyzing the influence of refraction distortion on pixel distribution using an optical flow estimation algorithm, and obtaining a pixel offset set; if the offset value in the pixel offset set exceeds a preset threshold, processing the pixel offset set using an adaptive correction algorithm, combining refraction deviation compensation to generate a corrected pixel set; according to the corrected pixel set, adjusting the local feature contrast of the corrected pixel set using a dynamic threshold setting method to obtain an enhanced image set; extracting texture features from the enhanced image set and comparing them with the original image using a feature matching method to determine the final image version.
[0044] In one possible implementation, first, the gray value information of all pixel points in the original image is extracted to construct a complete pixel distribution data matrix. Each pixel is identified by row and column coordinates, and the gray value range is 0 to 255, stored in 8-bit unsigned integer format. Reading the pixel pairs of the image frame and the previous frame image, the influence of refraction distortion on pixel distribution is analyzed using a pyramid dense optical flow estimation algorithm. The specific steps are as follows: first, construct a 4-layer image pyramid for the original image and the reference image, the bottom layer is the original image, and the highest layer is the image reduced by 4 times; second, starting from the top layer of the pyramid, extract a 3x3 neighborhood centered on each pixel, calculate the gray difference and gradient direction between the current image and the reference image, and iteratively solve the horizontal and vertical displacement of the pixel according to the optical flow constraint condition; third, upsample the optical flow result to the original resolution layer by layer to obtain a two-dimensional offset vector for each pixel in the complete image range. The offset value is the Euclidean distance, which is calculated by squaring the horizontal component and the vertical component of the vector and then taking the square root. The combination of all pixel offset values forms a pixel offset set, stored as a two-dimensional array.
[0045] To determine whether there is a significant refraction effect, set the offset determination threshold to 2 pixel units, that is, if the offset distance of a pixel in consecutive image frames exceeds 2, it is considered to be abnormal offset. The threshold is determined by label analysis in images collected under different underwater depths and different refractive indices. When the range exceeds 2 pixels, the image usually has obvious geometric structure dislocation, which meets the refraction distortion judgment standard. All pixels exceeding the threshold are marked to form an abnormal offset area mask image, which is used for subsequent correction processing.
[0046] After entering the correction process, the adaptive correction algorithm is used to process the abnormal offset area. Each abnormal pixel performs a reverse mapping operation based on its offset vector, that is, the pixel is projected back to its theoretical position in the reference image from the current image in the reverse direction. At the same time, according to the environmental parameters recorded during underwater image acquisition, such as water temperature, salinity and depth, the refractive index value corresponding to the image is obtained by table lookup, and the common value is between 1.3330 and 1.3400. Combined with the distance from the image sensor to the imaging plane and the light incidence angle, the theoretical refraction path deviation is calculated, which is converted into a pixel coordinate compensation amount and superimposed on the reverse mapping result to form a corrected pixel position. All corrected pixels are recombined into a corrected pixel set.
[0047] When post-processing the set, to enhance its visual expressiveness, a local feature contrast enhancement operation is performed. Specifically, the entire image is divided into 8x8 image blocks, and the maximum, minimum and average gray values of each image block are calculated. The dynamic threshold is set by taking 0.7 times the difference between the maximum and minimum values as the enhancement reference threshold, that is, if the gray scale range of a block is 40, the dynamic threshold is 28. Then, a linear stretching operation is performed on all pixels in the image block, that is, the gray values are standardized mapped according to the dynamic threshold interval, thereby improving the gray scale contrast of the block. This process ensures that each image region performs adaptive enhancement according to its actual gray scale distribution characteristics, and the output is an enhanced image set.
[0048] Then, the enhanced image set is verified for texture consistency. The gray level co-occurrence matrix method is used to extract texture features, and a texture feature vector is calculated in each image block, including energy, contrast, entropy and correlation. After extraction, the feature vectors of the enhanced image and the original image at the same position are compared, and the Euclidean distance is used to calculate the difference between them. Set the texture difference threshold to 20, that is, if the feature vector difference of any two corresponding image blocks exceeds 20, it is considered that the corrected texture consistency is insufficient and needs to be re-evaluated; if the difference is within 20, it is considered that the correction is effective. The threshold is determined through a large number of comparison experiments and can maintain the authenticity of the image texture structure while accommodating a certain range of visual changes.
[0049] Finally, the texture difference values of all image blocks are weighted and averaged, the weight is set according to the area size of each block, the texture consistency score of the whole image is output, and the image version with the highest texture score is taken as the final image version.
[0050] S4 includes obtaining object contour data from the corrected image version, extracting a boundary pixel set of the target object by using an edge detection algorithm to obtain an object contour data set; according to the object contour data set, performing partition processing on the corrected image version by using a region segmentation algorithm to generate a region segmentation data set containing the target object; extracting the brightness distribution feature from the region segmentation data set, and adjusting the brightness of the region segmentation data set by using a histogram equalization method to obtain a brightness equalization image set; if the object offset value in the brightness equalization image set exceeds a preset threshold, comparing the object contour data set by using a texture matching algorithm to determine whether the object offset is within an acceptable range to obtain an offset calibration result.
[0051] In a possible implementation, first, the complete image pixel matrix is read from the corrected image version and is transmitted as input data into an edge detection module. The Canny edge detection algorithm is used to extract the boundary of the target object that may exist in the image, which specifically includes the following steps: first, a Gaussian blur operation is performed on the input image to remove noise, the convolution kernel size is set to 5*5, and the standard deviation is set to 1.4. The parameters are determined by experiments to effectively remove background interference while maintaining the edge structure; second, the gradient amplitude and direction of each pixel of the image are calculated, which are used to detect the edge strength and edge direction respectively; third, non-maximum suppression is applied, and the neighborhood of each pixel in its gradient direction is compared, and only the local maximum value is reserved as an edge candidate point; fourth, a double-threshold algorithm is used to connect the edge candidate points, the low threshold is set to 50, and the high threshold is set to 150, to ensure that the weak edge is retained when connected with the strong edge, and a complete edge image is formed. The set composed of points with a pixel value of 255 in the edge image is the boundary pixel set, all coordinate points are extracted and recorded as a two-dimensional coordinate array to form the object contour data set.
[0052] Next, guided by the contour data set, enter the region segmentation module. Preferably, a region growing-based image segmentation algorithm is used, and the specific steps are as follows: take each contour point as a seed point, obtain its gray value as a growth reference value, and check the gray value of each adjacent pixel in the image in the 8-neighborhood direction. If the difference between the gray value of the adjacent pixel and the reference value is within 10, the pixel is included in the current region. The pixel gray value difference threshold 10 is determined by analyzing the gray value range of the target region in 100 groups of representative underwater images, which can effectively separate the target region from the background. The region growing process continues to expand until the current region cannot continue to expand outward, and this process is repeated until all seed points are grown. Finally, the image is divided into several regions, and the region containing the target contour is marked as the target region. The pixel coordinate information in each region is summarized to generate a region segmentation data set, and the data format is a region number matrix corresponding to each pixel.
[0053] Subsequently, the brightness distribution features of each region are extracted from the region segmentation data set. The brightness feature of each region is composed of the gray values of all pixels in the region, and the gray histogram of each region is counted. In order to enhance the image brightness level, histogram equalization processing is performed on each region. The processing flow is as follows: first, calculate the cumulative distribution function of the region gray histogram; second, map the original gray value to the range of 0 to 255 according to the cumulative probability, and realize the equal redistribution of the gray value; third, update the gray value of all pixels in the region, and finally output the brightness equalization image set. No new parameters are introduced in this step, and the gray value range and mapping formula used are standard image processing specifications.
[0054] Next, it is detected whether the object in the brightness equalization image set has shifted position. The method is as follows: according to the object contour data extracted in the edge detection stage, calculate the center point of the minimum circumscribed rectangle of the object bounding box, and obtain the original image object center coordinates; then repeat the calculation for the same object region in the equalization image to obtain new center coordinates. Calculate the Euclidean distance between the two sets of center coordinates as the object shift value. If the shift value is greater than 5 pixel units, it is considered that the object has shifted significantly during processing and needs to be calibrated. This threshold is based on the statistics of 1000 manually labeled images. When the position difference exceeds 5 pixels, the user can visually perceive the position difference, which is used as a reliable basis for recognizing the shift.
[0055] If the offset value exceeds the threshold value, a texture matching algorithm is called to calibrate the object position. The algorithm takes the object contour area in the original image as a template and performs texture matching in the brightness equalization image in a sliding window of 32x32 pixels size. In each matching process, the similarity of the current window and the template area in the texture dimension is compared, four texture feature values of contrast, energy, entropy and correlation are extracted using the gray level co-occurrence matrix method, and the Euclidean distance of the corresponding indicators with the template is calculated. The matching position with the smallest distance is regarded as the calibrated object position. If the minimum matching distance is less than the threshold value 20, it is determined that the current offset is within an acceptable range, and the offset calibration result is output. The texture error threshold value 20 is also set through experiments to ensure that the matching position does not produce significant errors visually.
[0056] S5 includes generating an updated parameter data set by processing the offset calibration data using a parameter adjustment algorithm according to the offset calibration result; obtaining the kernel size and standard deviation value from the updated parameter data set, smoothing the image edge using a Gaussian filter algorithm to obtain a smoothed edge image set; if the matching degree of the texture feature of the smoothed edge image set and the preset texture template is lower than the preset threshold value, performing secondary calibration using a texture matching algorithm to determine the calibrated image data set; processing the calibrated image data set by a region segmentation algorithm to extract the target object region, calculating the comprehensive index of brightness distribution and edge sharpness to obtain the final recognition accuracy index.
[0057] In a possible implementation, the residual offset, the edge intensity of the corresponding pixel and the local brightness difference are read pixel by pixel from the offset calibration result, the average value, the maximum value and the 90th percentile value of the residual offset are counted in the whole image, the average value and the standard deviation of the edge intensity and the brightness range of the local region centered on the edge are counted in each local region, then the updated parameter data set is generated by entering the parameter adjustment algorithm, the parameter adjustment algorithm does not use empirical description but uses a fixed decision mapping table: when the average value of the residual offset in the image is not more than 2, the kernel size is set to 3 and the standard deviation is set to 0.8; when the average value is greater than 2 and not more than 4, the kernel size is set to 5 and the standard deviation is set to 1.2; when the average value is greater than 4 and not more than 6, the kernel size is set to 7 and the standard deviation is set to 1.8; when the average value is greater than 6, the kernel size is set to 9 and the standard deviation is set to 2.3, the above threshold interval is obtained by error distribution statistics of 1000 labeled samples, which ensures that the filtering strength increases simultaneously when the offset increases to stabilize the edge; then the kernel size and the standard deviation are taken out from the updated parameter data set and the Gaussian filter is executed to smooth the edge, the specific process is to establish a square neighborhood consistent with the kernel size for each pixel, read the weight of each neighborhood pixel from the pre-generated weight table according to the distance and the standard deviation, multiply the neighborhood pixel grayscale by the corresponding weight, sum the multiplication results and normalize the sum by the sum of all weights to obtain the new center pixel value, the image boundary is processed by copying the boundary pixels to avoid size changes, and the smoothed edge image set is obtained after traversal; then the texture features of each smoothed image are calculated and compared with the preset texture template, the texture features are calculated in each non-overlapping block of 32x32 pixels, four statistical indicators of contrast, entropy, energy and correlation are extracted for each block, the preset texture template is a set of four indicators extracted from representative underwater target images collected in a standard environment by the same method, the matching degree is calculated as the average difference obtained by dividing the sum of the absolute differences of the four indicators and the corresponding indicators of the template by four, if the average difference exceeds the threshold value 20, it is determined that the block texture deviates from the template and needs to be calibrated again, the threshold value 20 is determined by the subjective perceptible critical value of 500 texture samples and achieves the optimal balance between false positives and false negatives; the texture matching algorithm is executed for the block determined to deviate for secondary calibration, the search window is established in the range of 8 pixels in the horizontal and vertical directions with the center of the block as the origin, the four texture indicators are recalculated position by position and compared with the template, the position with the smallest average difference is taken as the calibration position, the displacement of the position relative to the original position is used for pixel coordinate fine tuning, and the average grayscale of the block is compared with the average grayscale of the template block and linear stretching is performed to make them consistent, to avoid abrupt changes at the block boundary, the block is executed again after displacement and brightness calibration with a kernel size of 3 and a standard deviation of 0.8 is obtained, and the region segmentation algorithm is entered to extract the target object region. The region segmentation algorithm performs pixel-by-pixel scanning on the whole image guided by the edge intensity map. First, the pixels with edge intensity in the top two components of the whole image are marked as candidate boundaries. Then, the connected pixels within the candidate boundaries are taken as the starting set to expand the region inward and outward. The expansion criterion is that the difference between the adjacent pixel and the average gray scale of the current region is not more than 12, and the difference between the adjacent pixel and the average edge intensity of the current region is not more than 15. If both conditions are met, the adjacent pixel is included in the current region. If not, the expansion is stopped. Until all pixels in the whole image are labeled to a region or background, the isolated region with an area less than 50 pixels is merged into the adjacent region with the largest area to eliminate debris. Finally, the region segmentation result containing only the target object and its background is output. After obtaining the target object region, a comprehensive index of brightness distribution and edge sharpness is calculated to form the final recognition accuracy index. The calculation process is as follows: first, the brightness standard deviation of all pixels in the target region is calculated, and the standard deviation is divided by 255 to obtain the brightness non-uniformity ratio. Then, 1 is subtracted from the ratio and multiplied by 100 to obtain the brightness uniformity score. Subsequently, the average value of the gradient intensity on the boundary of the target region is calculated, and the average value is divided by 255 and multiplied by 100 to obtain the edge sharpness score. Finally, the brightness uniformity score is added to the edge sharpness score with a weight of 0.4 and 0.6 respectively to obtain a single numerical final recognition accuracy index, with a value range of 0 to 100. The higher the value, the better the brightness consistency and contour sharpness required for recognition. All the parameters involved in this paragraph have been clearly given and explained one by one: the kernel size of 3 or 5 or 7 or 9 is read from the updated parameter data set to determine the filter neighborhood size, and the standard deviation of 0.8 or 1.2 or 1.8 or 2.3 is used to control the weight decay rate, which is determined by fixed mapping according to the interval of the average value of the remaining offset. The texture block size is 32 by 32 to stabilize the statistical quantity and ensure the spatial positioning accuracy. The search range is 8 pixels in the horizontal and vertical directions to limit the spatial displacement of the secondary calibration to prevent misalignment. The texture matching threshold is 20 to distinguish between consistency and inconsistency with the template. The gray scale difference threshold for region expansion is 12 and the edge intensity difference threshold is 15 to ensure the consistency of illumination and structure within the region. The threshold for merging debris is 50 pixels to remove non-target small regions. The weights of the comprehensive index are brightness 0.4 and edge 0.6 to highlight the dominant role of the edge in recognition. The above values are determined and fixed in the configuration through statistical analysis and cross-validation of not less than 1000 sample images.
[0058] S6 includes obtaining standardized process parameters from a preset parameter database, generating an initial general processing template through a parameter integration algorithm, and determining a preliminary structure of the initial general processing template; if the detection capability of the initial general processing template is lower than a preset threshold, processing parameter data sets in the initial general processing template using a noise suppression algorithm to obtain a template parameter set after noise suppression; according to the template parameter set after noise suppression, adjusting parameters in the template parameter set using an iterative optimization loop algorithm to obtain an optimized general processing template; and processing the optimized general processing template through a region segmentation algorithm to extract a feature region from a target image to generate an optimized image output.
[0059] In a possible implementation, firstly, a standardized process parameter set closest to the current medium condition is read from a preset parameter database, the medium condition is described by three values of water temperature, salinity and depth, the database retrieval is sorted according to the sum of absolute differences of the three values as a similarity score, and the three parameter sets with the lowest score are selected as the reference set, each parameter set includes nine fields of kernel size, standard deviation, contrast enhancement factor, brightness equalization intensity, edge gradient threshold, texture matching threshold, region growing gray difference threshold, region growing edge difference threshold and final recognition accuracy threshold, and the value range of each field in the database is set as kernel size taking odd numbers from 3 to 11, standard deviation taking 0.8 to 2.5, contrast enhancement factor taking 0.6 to 0.8, brightness equalization intensity taking 1 to 3, edge gradient threshold taking 30 to 80, texture matching threshold taking 10 to 30, region growing gray difference threshold taking 8 to 16, region growing edge difference threshold taking 10 to 20, and final recognition accuracy threshold taking 70 to 90; then, a parameter integration algorithm is executed to perform weighted fusion on the three reference parameters according to fixed weights, the weights are set as 0.5, 0.3 and 0.2, the weights are determined through historical statistics of no less than 1000 sample images, a higher average recognition accuracy can be stably obtained, an initial general processing template is obtained after fusion and its preliminary structure is determined, the structure order is denoising and enhancement, refraction distortion estimation, pixel-level correction, local contrast enhancement, texture consistency judgment, region segmentation and index calculation, and the nine fused parameters are gradually bound for subsequent processing; then, the detection capability of the initial general processing template is evaluated on verification images from the same medium condition, the number of verification images is no less than 30, the detection capability is defined as the arithmetic mean of the final recognition accuracy index output by the foregoing process on the images, if the average value is less than a preset threshold of 80, the noise suppression algorithm is entered, otherwise the template is directly retained for subsequent output; the noise suppression algorithm performs two-step processing on the template parameter data set, the first step is outlier rejection, the values below the second percentile and above the ninety-eighth percentile are truncated to the corresponding percentile points according to the distribution of the parameters in the verification set dimension, for removing occasional extreme fluctuations, the second step is sequence smoothing, the median smoothing is performed with a window size of 3 in the image index dimension to eliminate short-time jitter of the parameters, and a noise-suppressed template parameter set is obtained; on this basis, an iterative optimization loop algorithm is executed to perform a limited neighborhood search on the template parameters and gradually improve the detection capability, the iterative process includes three steps of candidate generation, template execution and index evaluation, in the candidate generation stage, the kernel size is searched within 1 feasible odd number above and below the current value, the standard deviation is searched within a range of 0.4 above and below the current value with a step of 0.2, and the contrast enhancement factor is searched within a range of 0.1 above and below the current value with a step of 0.05Search for brightness equalization intensity in the range of 1 to 3 with a step size of 1, search for edge gradient threshold in the range of 10 above and below the current value with a step size of 5, search for texture matching threshold in the range of 10 to 30 with a step size of 5, search for region growing gray difference threshold in the range of 8 to 16 with a step size of 2, search for region growing edge difference threshold in the range of 10 to 20 with a step size of 2, and comprehensively limit the number of candidate groups to no more than 50 groups to control the amount of calculation; in the template execution stage, each group of candidate parameters is run through the template process on the same verification set and the final recognition accuracy index of each image is recorded; in the index evaluation stage, the average recognition accuracy of each group of candidate parameters is calculated and the highest one is selected as the new template parameter, if the average improvement of this round compared to the last round is less than 1 and the average improvement of the last 3 rounds is less than 1, the process is stopped in advance, or when the number of iterations reaches 20 times, the process is forced to stop, and the optimized general processing template is output; the determination method of all parameters is clear in the process, among them, the kernel size is used to determine the pixel size of the filtering neighborhood and is positively related to the structural complexity of the image, the standard deviation is used to control the decay speed of the filtering weight with distance and is positively related to the residual noise intensity, the contrast enhancement factor is used to limit the local contrast stretching amplitude to prevent over-enhancement, the brightness equalization intensity is used to determine the intensity of histogram redistribution to balance the dynamic range of dark and bright areas, the edge gradient threshold is used to filter stable edge pixels before region segmentation to reduce false expansion, the texture matching threshold is used to distinguish consistency and inconsistency with the template and directly trigger secondary texture correction, the region growing gray difference threshold is used to limit the brightness consistency within the same region, the region growing edge difference threshold is used to ensure the structural consistency within the same region, and the final recognition accuracy threshold is used to judge whether the current template meets the deployment standard, the above thresholds are determined through statistical analysis of not less than 1000 training samples and not less than 100 verification samples and combined with the artificially perceptible limit and are fixed stored in the database to ensure consistency; after completing the template optimization, the optimized general processing template is used to execute the region segmentation algorithm on the target image to generate an optimized image output, the specific process of region segmentation is to first generate a candidate boundary map according to the edge gradient threshold, then execute region growing guided by the candidate boundary, the growing criterion is that the difference between the adjacent pixel and the average gray value of the current region is not more than the region growing gray difference threshold and the difference between the adjacent pixel and the average edge intensity of the current region is not more than the region growing edge difference threshold, any one that does not meet the criterion stops expansion, after the end, the fragments less than 50 pixels are merged into the adjacent region with the largest area to obtain a regular target region contour, finally the brightness standard deviation and the mean value ratio in the target region are calculated to obtain the brightness uniformity score and the gradient intensity average value on the target boundary is calculated to obtain the edge sharpness score, the final recognition accuracy index is linearly combined into a single numerical value according to the brightness weight of 0.4 and the edge weight of 0.6 and is output together with the optimized image, which is used for subsequent link qualification determination or sorting decision.
[0060] S7 comprises obtaining a target underwater image in a preset image database, processing the target underwater image by using a bilateral filtering algorithm to retain edge details and obtain a first optimized image; for the first optimized image, separating foreground and background regions by using an image segmentation algorithm, extracting a hidden object region, and obtaining a segmentation feature set; according to the segmentation feature set, analyzing hidden object features by using a convolutional neural network algorithm to determine whether a target object exists, and obtaining an object recognition result; by comparing the object recognition result with a preset efficiency threshold, integrating the object recognition result and efficiency data by using a report generation algorithm, and obtaining an underwater inspection report.
[0061] In a possible implementation, first, a target underwater image is read from a preset image database according to a task identifier and unified to a fixed size and a fixed gray scale range, then a bilateral filter is executed to suppress noise while retaining edge details, a spatial neighborhood diameter of the bilateral filter is set to 9, a spatial range parameter is set to 5, an intensity range parameter is set to 20, and a boundary processing mode is to copy boundary pixels and calculate a weighted average of the whole image pixel by pixel to output a first optimized image; then, the first optimized image is subjected to image segmentation to separate foreground and background and extract a hidden object region, a specific process is that a global gray histogram is first calculated and a strategy combining a fixed threshold segmentation and an adaptive segmentation is adopted, wherein the global threshold is 128 for preliminary screening of foreground pixels, the adaptive threshold is obtained by subtracting 10 from the sum of the median and the gray range of the gray scale in each local block of 32 by 32 pixels, and a pixel needs to meet both types of threshold judgment to be classified into the foreground, then morphological denoising is performed on the foreground mask, an opening operation is iterated once to remove isolated noise points, a closing operation is iterated once to fill small cavities, and then four-neighbor connected component analysis is performed, connected components with an area less than 200 are directly removed, and the remaining connected components are cropped to form a segmentation feature set with five statistical quantities of minimum bounding rectangle, area, aspect ratio, average gray scale, and edge density; based on the segmentation feature set, a convolutional neural network algorithm is entered for hidden object feature analysis and target object determination, the input in the reasoning stage is a foreground candidate block scaled by the long side and cropped to 256 by 256 pixels and subjected to zero mean unit range normalization according to the channel mean and the channel standard deviation, the network structure is fixed as five convolutional layers and three down-sampling layers stacked alternately followed by two fully connected layers with a rectified linear unit as an activation function, a dropout layer with a dropout ratio of 0.5 to suppress overfitting, and two-class probability output of the last layer as a determination basis, a determination threshold is 0.8, when the target probability of any candidate block is not less than 0.8, it is determined that there is a target object and an existence mark in the object recognition result and position information and probability score of the corresponding candidate block are output; then, the object recognition result is compared with a preset efficiency threshold to generate an underwater inspection report, wherein the efficiency data consists of two parts, one part is a total time consumption from reading an image to obtaining an object recognition result in seconds, and the other part is a recognition quality score expressed in percentage according to the target probability of the candidate block and taking the highest value when multiple blocks exist, both are added according to a fixed weight to obtain a single efficiency score, a time weight is 0.4, which is obtained by linearly mapping the maximum acceptable time length to percentage, a quality weight is 0.6The quality sub-score is obtained by multiplying the probability by 100, and the preset efficiency threshold is 80. When the efficiency score is not less than 80, the conclusion is reported as meeting the standard, otherwise, it is reported as not meeting the standard and the time, probability, reason for not meeting the standard and recommended parameter range are listed in the report. In order to ensure that each step is reproducible and the parameters are interpretable, all the parameters involved in this step and their determination methods are as follows: the spatial neighborhood diameter 9 and the spatial range parameter 5 are used to limit the spatial influence range of bilateral filtering to avoid cross-border blur, and the intensity range parameter 20 is used to control the weight attenuation across the gray scale boundary to retain the true edge; the global threshold 128 is used to quickly distinguish between foreground and background under the condition of uniform illumination, and the block size of the adaptive threshold is 32 by 32 to stabilize the segmentation when the underwater illumination is uneven, and the in-block correction amount 10 is used to suppress weak noise false detection; the morphological iteration number is 1 for cleaning isolated noise points and small holes without changing the shape; the connected domain minimum area 200 is used to filter out accidental noise spots without missing small targets, and this value is determined by statistics on not less than 1000 samples and is fixedly configured; the five statistical quantities of the segmentation feature set are used to provide distinguishable prior structural information to the convolutional neural network without introducing additional modules; the input size 256 by 256 is used to balance between memory and precision, the rectified linear unit activation is used to improve the convergence speed without introducing letter symbols, the dropout ratio 0.5 is used to close the regularity during inference but keep the training consistency, and the target probability threshold 0.8 is determined by the inflection point of the receiver operating characteristic curve on the validation set; the efficiency threshold 80 is used to ensure that the comprehensive requirements of processing time and recognition quality are met, and the linear mapping upper limit of the time sub-score is 5 seconds, which comes from the real-time processing requirements of the device, and the quality sub-score is directly taken in the probability percentage system to maintain interpretability; the report generation algorithm fixedly outputs fields including image identification, processing time, highest target probability, candidate position, efficiency score, threshold comparison conclusion and recommended parameter interval, and is archived as an underwater inspection report in the form of single-page structured text.
[0062] S8 includes obtaining a target underwater image in a preset underwater image database, processing the target underwater image by using an adaptive correction algorithm, and generating a first corrected image by adjusting brightness and contrast; for the first corrected image, an image pixel gradient is calculated by using a gradient calculation method, an edge feature is extracted, and an edge feature set is generated; according to the edge feature set, the smoothing degree of the feature is adjusted by using a smoothing intensity control algorithm, the edge feature is optimized, and an optimized feature set is obtained; by comparing the optimized feature set with a preset medium change database, if the matching degree of the optimized feature set exceeds a preset threshold, a convolutional neural network algorithm is used to update a medium change model, and a next period of image processing basis is obtained.
[0063] In one possible implementation, the target underwater image is first read from the preset underwater image database according to the task identification, and the image resolution is unified to 512 by 512 pixels and the grayscale range is unified to 0 to 255, so as to ensure the consistency of the processing flow. Subsequently, the adaptive correction algorithm stage is entered. The algorithm takes the global grayscale histogram of the image as the input, first calculates the mean, standard deviation and grayscale distribution skewness, and determines the brightness and contrast adjustment parameters based on the same. When the mean is less than 100, the brightness increase is set to 255 minus 10% of the mean; when the mean is greater than 180, the brightness decrease is set to the mean minus 10% of 180; when the standard deviation is less than 40, the contrast amplification coefficient is set to 1.3; when the standard deviation is greater than 80, the contrast compression coefficient is set to 0.8; and in other cases, it remains unchanged. The adjustment parameters are applied pixel by pixel, and the first corrected image is output.
[0064] For the first corrected image, the edge features are extracted using a gradient calculation method. Specifically, the Sobel operator is used to calculate the gradient values in the horizontal and vertical directions. The gradient intensity is the square root of the sum of the squares of the two directions, and the direction is obtained by arctangent calculation. After traversing the entire image, the gradient intensity points greater than 20 are determined as valid edge points and their coordinates and directions are recorded, and the edge feature set is output. The threshold value 20 is obtained by statistical analysis of the gradients of not less than 500 image samples, which can effectively distinguish background noise from real edges.
[0065] Subsequently, the edge feature set is optimized by applying a smoothing intensity control algorithm. The algorithm first calculates the gradient variance of each edge point in a local 5 by 5 neighborhood. If the variance is greater than 50, it indicates that there are edge burrs in the region, which need to be smoothed. If the variance is less than 10, it indicates that the edge is too sharp, and the smoothing intensity needs to be weakened. In other cases, the default smoothing intensity is 1.0. Based on this judgment, the smoothing intensity is dynamically adjusted between 0.5 and 1.5, and a weighted average of the edge point gradient values is performed within the neighborhood range to generate an optimized feature set.
[0066] Finally, the optimized feature set is compared with the preset medium change database. The database stores edge feature statistical templates under different water temperature, salinity and depth conditions, including average gradient intensity, direction distribution histogram and edge density. The matching degree is calculated using the cosine similarity method. If the similarity between the optimized feature set and the database template exceeds the threshold value 0.85, it is determined that the medium change characteristics of the image are known, and the convolutional neural network algorithm is called to update the medium change model. The input of the convolutional neural network is the feature vector of the optimized feature set, and the output is a new medium change parameter set, including the refractive index correction coefficient, the optical attenuation factor and the local scattering weight. After updating, it is stored in the model as the basis for the next image processing. The threshold value 0.85 is determined by drawing the receiver operating characteristic curve in the verification set of 1000 sample images to ensure the balance of sensitivity and specificity.
[0067] The upper and lower limits of brightness adjustment are determined by mean threshold values 100 and 180 respectively, the contrast adjustment is determined by standard deviation threshold values 40 and 80, the edge detection threshold value is 20, the gradient variance threshold value for smoothing intensity control is 10 and 50, and the similarity threshold value for final database matching is 0.85. The above parameters are determined and fixed by large-scale sample statistical experiments.
[0068] While embodiments of the application have been shown and described, it is to be understood that the application is not limited to these embodiments. Rather, it is the intention that modifications, changes, substitutions and variations be made to the embodiments disclosed herein without departing from the spirit and scope of the application, which is defined solely by the claims and their equivalents.
Claims
1. A method for underwater image rectification based on multi-medium refraction model, characterized in that, The method comprises the following steps: S1, obtaining a preliminary distortion parameter set by collecting original underwater image data and extracting optical interference features in the data; S2, analyzing the influence of medium changes based on the preliminary distortion parameter set, processing image pixel distribution using a convolutional neural network model, and integrating pixel intensity adjustment and local contrast enhancement to determine the degree of refraction distortion; S3, if the degree of refraction distortion exceeds a preset threshold, applying an adaptive correction algorithm to image pixel distribution combined with refraction deviation compensation and dynamic threshold setting to obtain a corrected image version; S4, obtaining object contour data from the corrected image version and integrating region segmentation processing and brightness equalization to determine whether the object offset is within an acceptable range to obtain an offset calibration result; S5, updating standardized process parameters using the offset calibration result, smoothing image edges through a Gaussian filter algorithm, and applying kernel size selection and standard deviation parameters to determine the final recognition accuracy index; S6, if the final recognition accuracy index meets the detection capability requirements, integrating the standardized process parameters to generate a general processing template and embedding a noise suppression mechanism and an iterative optimization loop to obtain an optimized image output; S7, analyzing hidden object features based on the optimized image output and combining edge-preserving filtering and bilateral filtering extension to determine the degree of security efficiency improvement to obtain a complete underwater inspection report; S8, updating the medium change model by feeding back the adaptive correction algorithm parameters and integrating gradient calculation and smoothing intensity control based on the complete underwater inspection report to obtain the basis for the next cycle of image processing.
2. The method of claim 1, wherein the method is based on a multi-medium refraction model. The S1 comprises: Collecting underwater original image data through a sensor to obtain an initial image set; Using image preprocessing techniques to denoise the initial image set to generate a denoised image set; Extracting optical interference features from the denoised image set to obtain an interference feature set; If the feature values in the interference feature set exceed a preset threshold, classifying the feature values to determine the interference category; According to the interference category, calculate the distortion parameters to generate an initial distortion parameter set; Using principal component analysis algorithm to reduce the dimension of the initial distortion parameter set to obtain an optimized distortion parameter set; Using support vector machine algorithm to verify the parameters for the optimized distortion parameter set to obtain the final distortion parameter set.
3. The method of claim 1, wherein the method is based on a multi-medium refraction model. The S2 comprises: Obtaining refractive index change data from the medium change features, using optical flow estimation algorithm to analyze the interference of refractive index change on image pixel distribution to obtain a pixel offset set; If the offset value in the pixel offset set exceeds a preset threshold, clustering the offset value to determine the offset category; According to the offset category, using gradient descent algorithm to optimize the pixel intensity adjustment parameter to obtain the adjusted pixel intensity set; Processing the adjusted pixel intensity set through local contrast enhancement algorithm to generate an enhanced image set; Extracting local texture features from the enhanced image set and comparing them with the original image using feature matching method to obtain texture distortion distribution; If the distortion value in the texture distortion distribution exceeds a preset threshold, weighting and fusing the distortion value to generate a refraction distortion degree parameter; Correlating the refraction distortion degree parameter with the medium change features to determine the final refraction distortion degree.
4. The method of claim 1, wherein the method is based on a multi-medium refraction model. The S3 comprises: Pixel distribution data is acquired from the original image, a light flow estimation algorithm is used to analyze the influence of refraction distortion on the pixel distribution, and a pixel offset set is obtained; If the offset value in the pixel offset set exceeds a preset threshold, an adaptive correction algorithm is used to process the pixel offset set, combined with refraction deviation compensation, to generate a corrected pixel set; According to the corrected pixel set, a dynamic threshold setting method is used to adjust the local feature contrast of the corrected pixel set, and an enhanced image set is obtained; Texture features are extracted from the enhanced image set, and a feature matching method is used to compare with the original image to determine the final image version.
5. The method of claim 1, wherein: The S4 includes: Object contour data is acquired from the corrected image version, an edge detection algorithm is used to extract the boundary pixel set of the target object, and an object contour data set is obtained; According to the object contour data set, a region segmentation algorithm is used to process the corrected image version, and a region segmentation data set containing the target object is generated; Luminance distribution features are extracted from the region segmentation data set, and a histogram equalization method is used to adjust the luminance of the region segmentation data set, and a luminance equalization image set is obtained; If the object offset value in the luminance equalization image set exceeds the preset threshold, a texture matching algorithm is used to compare with the object contour data set to determine whether the object offset is within an acceptable range, and an offset calibration result is obtained.
6. The method of claim 1, wherein: The S5 includes: According to the offset calibration result, a parameter adjustment algorithm is used to process the offset calibration data to generate an updated parameter data set; The core size and standard deviation value are obtained from the updated parameter data set, a Gaussian filter algorithm is used to smooth the image edge, and a smoothed edge image set is obtained; If the texture feature of the smoothed edge image set is lower than the preset texture template threshold, a texture matching algorithm is used for secondary calibration to determine the calibrated image data set; The target object region is extracted by processing the calibrated image data set through the region segmentation algorithm, and the comprehensive index of luminance distribution and edge definition is calculated to obtain the final recognition accuracy index.
7. The method of claim 1, wherein the method is based on a multi-medium refraction model. The S6 includes: Standardized process parameters are obtained from the preset parameter database, and an initial general processing template is generated by a parameter integration algorithm to determine the preliminary structure of the initial general processing template; If the detection capability of the initial general processing template is lower than the preset threshold, a noise suppression algorithm is used to process the parameter data set in the initial general processing template to obtain a noise-suppressed template parameter set; According to the noise-suppressed template parameter set, an iterative optimization loop algorithm is used to adjust the parameters in the template parameter set to obtain an optimized general processing template; The feature region is extracted from the target image by processing the optimized general processing template through the region segmentation algorithm to generate an optimized image output.
8. The method of claim 1, wherein: The S7 includes: A target underwater image in the preset image database is acquired, and a bilateral filter algorithm is used to process the target underwater image to retain edge details to obtain a first optimized image; For the first optimized image, an image segmentation algorithm is used to separate the foreground and background regions, and the hidden object region is extracted to obtain a segmentation feature set; According to the segmentation feature set, a convolutional neural network algorithm is used to analyze the hidden object features, to determine whether there is a target object, and to obtain an object recognition result; By comparing the object recognition result with a preset efficiency threshold, a report generation algorithm is used to integrate the object recognition result and the efficiency data, to obtain an underwater inspection report.
9. The method of claim 1, wherein: The S8 comprises: A target underwater image in a preset underwater image database is acquired, an adaptive correction algorithm is used to process the target underwater image, and a first corrected image is generated by adjusting the brightness and contrast; For the first corrected image, a gradient calculation method is used to calculate the image pixel gradient, to extract the edge features, and to generate an edge feature set.
10. The method of claim 9, wherein the method is based on a multi-medium refraction model. The S8 further comprises: According to the edge feature set, a smoothing strength control algorithm is used to adjust the feature smoothing degree, to optimize the edge features, and to obtain an optimized feature set; By comparing the optimized feature set with a preset medium change database, if the matching degree of the optimized feature set exceeds a preset threshold, a convolutional neural network algorithm is used to update the medium change model, to obtain the basis for the next cycle of image processing.
Citation Information
Patent Citations
Underwater three-dimensional measurement data correction method based on structured light three-dimensional measurement
CN111006610A
Underwater image enhancement method and device based on Retinex algorithm
CN111275644A
Image blur correction device, optical instrument, imaging apparatus, and control method for image blur correction device
JP2013218111A
Cited By
Image correction method and system suitable for zoom camera
CN121213435A