Controllable brightness migration method for soil image
Patent Information
- Application Number
- CN202310164360.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2043-02-24
AI Technical Summary
[0048] The beneficial effects of this invention are as follows: This invention can smooth the brightness of soil images and constrain the range of reflectivity, thereby effectively avoiding the influence of brightness migration on texture, thus effectively ensuring the accuracy of the final soil image brightness migration result, effectively preventing excessive brightness enhancement, ensuring the accuracy of subsequent soil type identification, and the algorithm process is simpler and more efficient than the existing technology.
Smart Images

Figure CN115953689B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a soil image processing method, and more particularly to a method for controllable brightness migration of soil images. Background Technology
[0002] Soil species identification is mostly based on machine learning, which involves inputting the image information of the target soil into a trained recognition network for identification processing, thereby outputting the corresponding soil species classification.
[0003] Before inputting soil images into the recognition network, preprocessing of the soil images is necessary, especially brightness processing. This is crucial for ensuring accurate soil type classification and identification. Existing technologies generally use the LR3M (Low-Rank Regularized Retinex Model) brightness enhancement algorithm or the LIME brightness enhancement algorithm. However, existing algorithms have the following drawbacks:
[0004] like Figure 2 As shown in (b): Figure 2 (a) in the image is the original image. Figure 2 (b) shows the result after brightness processing of the original image using the LR3M brightness enhancement algorithm. This algorithm defines image brightness using the average value of three channels and calculates the reflectance of each of the three channels. Then to Gamma enhancement is performed to obtain an enhanced image, due to the increased brightness of the image. Reflectivity is defined as the average of the three channels. It may be greater than 1, which will cause some pixels in the image to be over-enhanced, resulting in white spots, thus affecting the final soil type identification.
[0005] like Figure 2 As shown in (c): Figure 2 (c) is the result of brightness processing of the original image using the LIME brightness enhancement algorithm, which defines the image brightness using the largest channel of the image. This also leads to the same result, because the reflectivity of some pixels... The value of its brightness After being smoothed, a value greater than 1 also resulted in white spots, leading to poor accuracy in the final soil type identification result.
[0006] Therefore, in order to solve the above-mentioned technical problems, it is urgent to propose a new technical approach. Summary of the Invention
[0007] In view of this, the purpose of this invention is to provide a method for controllable brightness transfer of soil images, which can smooth the brightness of soil images and constrain the range of reflectivity, thereby effectively avoiding the influence of brightness transfer on texture, thus effectively ensuring the accuracy of the final soil image brightness transfer result, effectively preventing excessive brightness enhancement, ensuring the accuracy of subsequent soil type identification, and the algorithm process is simpler and more efficient than the prior art.
[0008] This invention provides a method for controllable brightness migration of soil images, comprising the following steps:
[0009] S1. Obtain image information of the target soil, decompose the soil image into a brightness layer and a reflectance layer based on Retinex theory, determine the brightness of each pixel in the soil image in the RGB color space, and form a brightness matrix based on the brightness of the pixels;
[0010] S2. Construct a brightness optimization target model:
[0011] (1)
[0012] Where m and n represent the height and width of the image. Pixels representing soil images initial brightness, pixels of soil image The estimated brightness value; The smoothing weight matrix in the horizontal direction of the image The middle corresponds to the pixel The value, The smooth weight matrix in the vertical direction The middle corresponds to the pixel The value, To balance the weights, and These represent the brightness gradients in the horizontal and vertical directions of the image, respectively.
[0013] S3. Solve for the pixels of the soil image based on the brightness optimization target model. Brightness estimate Soil image pixels were determined based on brightness estimates. reflectivity ; Represents the RGB color channels of the soil image. ;
[0014] S4. Construct a luminance transfer model based on gamma transform, and calculate the gamma factor of the luminance transfer model based on gamma transform. Optimization was performed, and a brightness transfer model based on gamma transform was used to determine the pixels after brightness transfer. brightness value ;
[0015] S5. Luminance value after luminance migration and reflectivity Soil images after brightness migration.
[0016] Furthermore, in step S3, the pixels of the soil image are solved using the following method. Brightness estimate :
[0017] S301. Convert the brightness optimization target model into matrix form:
[0018] (2);
[0019] in: The brightness estimation matrix formed by the brightness estimates column vectors, The initial brightness matrix formed by the initial brightness values of the soil image. column vectors, This is a discrete gradient operator with positive differences in the vertical direction of the soil image. This is a discrete gradient operator with positive differences in the horizontal direction of the soil image. The smooth weight matrix in the vertical direction Vectorized form The smoothing weight matrix in the horizontal direction of the image The vectorized form, For The constructed diagonal matrix, For The constructed diagonal matrix;
[0020] S302. Apply formula (2) to... Find the partial derivatives and set them equal to 0:
[0021] (3);
[0022] Simplifying formula (3) yields:
[0023] (4);
[0024] in: yes The identity matrix;
[0025] S303. Perform k iterations of calculation on formula (4):
[0026] (5);
[0027] in: ;
[0028] ; ; To set a constant;
[0029] The termination condition for the iteration is: ;in: It is the threshold for controlling the iteration.
[0030] Furthermore, in step S3, reflectivity Determined using the following method:
[0031] ;in: For pixels The initial brightness of the c-th color channel in the RGB color space.
[0032] Furthermore, a brightness transfer model based on gamma transform determines the pixel values after brightness transfer. brightness value Specifically, it includes:
[0033] Determine pixels domain point set :
[0034] ;
[0035] Determine pixels Domain information :
[0036] ;
[0037] Construct a brightness transfer model based on gamma transform and perform brightness transfer:
[0038] When brightness increases:
[0039] ;
[0040] When the brightness decreases:
[0041] Where: A is a constant that controls the range of output values;
[0042] A brightness transfer model based on gamma transform performs brightness transfer processing on each pixel in an image.
[0043] Furthermore, in step S4, the gamma factor The optimization is achieved using the following gamma factor optimization model:
[0044] ;
[0045] The optimal gamma factor is obtained by iteratively solving the gamma factor optimization model. ; The brightness offset is set, where H and W represent the height and width of the soil image.
[0046] Furthermore, the pixels of the soil image in step S1 initial brightness Determined using the following method:
[0047] ;in: For pixels The brightness value of the R channel in the RGB color space. For pixels The brightness value of the B channel in the RGB color space. For pixels The brightness value of the G channel in the RGB color space.
[0048] The beneficial effects of this invention are as follows: This invention can smooth the brightness of soil images and constrain the range of reflectivity, thereby effectively avoiding the influence of brightness migration on texture, thus effectively ensuring the accuracy of the final soil image brightness migration result, effectively preventing excessive brightness enhancement, ensuring the accuracy of subsequent soil type identification, and the algorithm process is simpler and more efficient than the existing technology. Attached Figure Description
[0049] The present invention will be further described below with reference to the accompanying drawings and embodiments:
[0050] Figure 1 This is a flowchart of the present invention.
[0051] Figure 2 This is a diagram showing the brightness enhancement results of existing technologies.
[0052] Figure 3 This is a comparison chart of the processing results of existing technologies and the processing results of the algorithm of this invention. Detailed Implementation
[0053] The present invention will be further described in detail below:
[0054] This invention provides a method for controllable brightness migration of soil images, comprising the following steps:
[0055] S1. Obtain image information of the target soil. Based on Retinex theory, decompose the soil image into a brightness layer and a reflectance layer, determine the brightness of each pixel in the soil image in the RGB color space, and form a brightness matrix based on the pixel brightness. That is, use the Retinex model to decompose the soil image to obtain the brightness layer and reflectance layer of the image. Then, transfer the brightness of the soil image (including brightness enhancement and brightness reduction), and then synthesize the transferred brightness and reflectance to obtain the transferred soil image. The synthesis process is also implemented using the Retinex model. The Retinex model is an existing technology and will not be described in detail here.
[0056] S2. Construct a brightness optimization target model:
[0057] (1)
[0058] Where m and n represent the height and width of the image. Pixels representing soil images initial brightness, pixels of soil image The estimated brightness value; The smoothing weight matrix in the horizontal direction of the image The middle corresponds to the pixel The value, The smooth weight matrix in the vertical direction The middle corresponds to the pixel The value, To balance the weights, and These represent the brightness gradients in the horizontal and vertical directions of the image, respectively; where the vertical direction of the image is the height direction and the horizontal direction is the width direction.
[0059] in: ; , To set a constant, it is generally set to 0.001. This represents the vertical brightness gradient of the image. The gradient in the horizontal direction of the image is calculated for each pixel. and A matrix is formed after the calculation is completed. and .
[0060] S3. Solve for the pixels of the soil image based on the brightness optimization target model. Brightness estimate Soil image pixels were determined based on brightness estimates. reflectivity ; Represents the RGB color channels of the soil image. ;
[0061] S4. Construct a luminance transfer model based on gamma transform, and calculate the gamma factor of the luminance transfer model based on gamma transform. Optimization was performed, and a brightness transfer model based on gamma transform was used to determine the pixels after brightness transfer. brightness value ;
[0062] S5. Luminance value after luminance migration and reflectivity The method described above can smooth the brightness of the soil image and constrain the range of reflectivity, thereby effectively avoiding the influence of brightness transfer on texture and ensuring the accuracy of the final soil image brightness transfer result. This effectively prevents excessive brightness enhancement and ensures the accuracy of subsequent soil species identification. Moreover, the algorithm process is simpler and more efficient than existing technologies.
[0063] In this embodiment, in step S3, the pixels of the soil image are solved using the following method. Brightness estimate :
[0064] S301. Convert the brightness optimization target model into matrix form:
[0065] (2);
[0066] in: The brightness estimation matrix formed by the brightness estimates column vectors, The initial brightness matrix formed by the initial brightness values of the soil image. column vectors, This is a discrete gradient operator with positive differences in the vertical direction of the soil image. This is a discrete gradient operator with positive differences in the horizontal direction of the soil image. The smooth weight matrix in the vertical direction Vectorized form The smoothing weight matrix in the horizontal direction of the image The vectorized form, For The constructed diagonal matrix, For The construction of the diagonal matrix, the construction of the diagonal matrix and , The process of converting to vectorized form is based on existing technology and will not be elaborated here;
[0067] S302. Apply formula (2) to... Find the partial derivatives and set them equal to 0:
[0068] (3);
[0069] Simplifying formula (3) yields:
[0070] (4);
[0071] in: yes The identity matrix;
[0072] S303. Perform k iterations of calculation on formula (4):
[0073] (5);
[0074] in: ;
[0075] ; ; To set a constant, it is generally set to 0.001;
[0076] The termination condition for the iteration is: ;in: It is the threshold for controlling the iteration. That is, when calculating for the first time, formula (4) is used, and when calculating for the second time and thereafter, formula (5) is used. Through this step, redundant textures in the image can be effectively removed, thereby ensuring the accuracy of the final brightness migration result.
[0077] In this embodiment, in step S3, reflectivity Determined using the following method:
[0078] ;in: For pixels The initial brightness of the c-th color channel in the RGB color space is used to constrain the reflectivity range of the soil image, thereby ensuring the accuracy of the final brightness transfer processed image.
[0079] In this embodiment, the brightness migration model based on gamma transform determines the pixels after brightness migration. brightness value Specifically, it includes:
[0080] Determine pixels domain point set :
[0081] ;
[0082] Determine pixels Domain information :
[0083] ;in ;
[0084] Construct a brightness transfer model based on gamma transform and perform brightness transfer:
[0085] When brightness increases:
[0086] ;
[0087] When the brightness decreases:
[0088] Where: A is a constant that controls the range of output values;
[0089] A brightness transfer model based on gamma transform performs brightness transfer processing on each pixel in an image.
[0090] In step S4, the gamma factor The optimization is achieved using the following gamma factor optimization model:
[0091] ;
[0092] The optimal gamma factor is obtained by iteratively solving the gamma factor optimization model. ; H and W represent the height and width of the soil image, respectively, as the set brightness offset. During gamma factor optimization, the initial value of the gamma factor is set to 1, the iteration step size is 0.025, and the interval is [0,10]. The termination condition for the iteration is:
[0093] ,in The value is usually set to 1 / 255.
[0094] In this embodiment, the pixels of the soil image in step S1 initial brightness Determined using the following method:
[0095] ;in: For pixels The brightness value of the R channel in the RGB color space. For pixels The brightness value of the B channel in the RGB color space. For pixels The brightness value of the G channel in the RGB color space; the brightness of the pixel is calculated using the values of the three RGB channels of the pixel, while simultaneously constraining the pixel reflectivity range to [0,1].
[0096] Image reconstruction is performed using the following model:
[0097] .
[0098] Figure 3 As a specific example, the results of processing the image using existing algorithms and the method of this invention are shown: it can be clearly seen that the method of this invention processes the image to be closer to the target image and has higher accuracy.
[0099] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for controllable brightness migration of soil images, characterized in that: Includes the following steps: S1. Obtain image information of the target soil, decompose the soil image into a brightness layer and a reflectance layer based on Retinex theory, determine the brightness of each pixel in the soil image in the RGB color space, and form a brightness matrix based on the brightness of the pixels; S2. Construct a brightness optimization target model: (1) Where m and n represent the height and width of the image. Pixels representing soil images initial brightness, pixels of soil image The estimated brightness value; The smoothing weight matrix in the horizontal direction of the image The middle corresponds to the pixel The value, The smooth weight matrix in the vertical direction The middle corresponds to the pixel The value, To balance the weights, and These represent the brightness gradients in the horizontal and vertical directions of the image, respectively. S3. Solve for the pixels of the soil image based on the brightness optimization target model. Brightness estimate Soil image pixels were determined based on brightness estimates. reflectivity ; Represents the RGB color channels of the soil image. ; S4. Construct a luminance transfer model based on gamma transform, and calculate the gamma factor of the luminance transfer model based on gamma transform. Optimization was performed, and a brightness transfer model based on gamma transform was used to determine the pixels after brightness transfer. brightness value ; S5. Luminance value after luminance migration and reflectivity Synthesized soil images with brightness shift; In step S3, the pixels of the soil image are calculated using the following method. Brightness estimate : S301. Convert the brightness optimization target model into matrix form: (2); in: The brightness estimation matrix formed by the brightness estimates column vectors, The initial brightness matrix formed by the initial brightness values of the soil image. column vectors, This is a discrete gradient operator with positive differences in the vertical direction of the soil image. This is a discrete gradient operator with positive differences in the horizontal direction of the soil image. The smooth weight matrix in the vertical direction Vectorized form The smoothing weight matrix in the horizontal direction of the image The vectorized form, For The constructed diagonal matrix, For The constructed diagonal matrix; S302. Apply formula (2) to... Find the partial derivatives and set them equal to 0: (3); Simplifying formula (3) yields: (4); in: yes The identity matrix; S303. Perform k iterations of calculation on formula (4): (5); in: ; ; ; To set a constant; The termination condition for the iteration is: ;in: It is the threshold that controls the iteration; The brightness transfer model based on gamma transform determines the pixels after brightness transfer. brightness value Specifically, it includes: Determine pixels domain point set : ; Determine pixels Domain information : ; Construct a brightness transfer model based on gamma transform and perform brightness transfer: When brightness increases: ; When the brightness decreases: Where: A is a constant that controls the range of output values; A brightness transfer model based on gamma transform performs brightness transfer processing on each pixel in an image.
2. The method for controllable brightness migration of soil images according to claim 1, characterized in that: In step S3, reflectivity Determined using the following method: ;in: For pixels The initial brightness of the c-th color channel in the RGB color space.
3. The method for controllable brightness migration of soil images according to claim 1, characterized in that: In step S4, the gamma factor The optimization is achieved using the following gamma factor optimization model: ; The optimal gamma factor is obtained by iteratively solving the gamma factor optimization model. ; H and W represent the height and width of the soil image, respectively, as set brightness offsets.
4. The method for controllable brightness migration of soil images according to claim 1, characterized in that: Pixels of the soil image in step S1 initial brightness Determined using the following method: ;in: For pixels The brightness value of the R channel in the RGB color space. For pixels The brightness value of the B channel in the RGB color space. For pixels The brightness value of the G channel in the RGB color space.
Citation Information
Patent Citations
Low-illumination image enhancement method based on illumination map optimization and adaptive gamma correction
CN113962898A