Dark image preprocessing method and device based on machine vision, equipment and medium
By constructing a multi-scale Retinex enhanced fusion adaptive gamma correction model, designing an adaptive joint bilateral filter and pyramid decomposition strategy, the efficiency and accuracy problems of garlic seed image processing in complex lighting and high noise environments are solved, and efficient defect detection and grading are achieved.
Patent Information
- Application Number
- CN202510325875.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-07-18
AI Technical Summary
The prior art is difficult to effectively process garlic seed images in complex lighting and high noise environments, resulting in low screening efficiency and low classification accuracy, especially in the background of garlic seed epidermal folds and light reflections, noise interference and dynamics.
The multi-scale Retinex enhancement fusion adaptive gamma correction light compensation model, adaptive combined bilateral filter, and pyramid decomposition and entropy-driven blocking strategy are used to perform light compensation, texture complexity detection and multi-resolution contrast enhancement processing.
The defect detection accuracy and grading efficiency are significantly improved in the context of high noise and complexity, providing robust visual preprocessing support for subsequent automated sorting.
Smart Images

Figure CN120339151A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of agricultural automation, and particularly to a method for preprocessing garlic seed images and classifying and grading quality based on machine vision in complex lighting and high-noise environments. Background Technique
[0002] Machine vision, as the core perception technology in the field of agricultural product quality detection, is the key support for realizing the intelligence of agricultural automation sorting equipment. During the garlic seed screening process, high-precision imaging and robust preprocessing technologies directly determine the accuracy of key links such as mildew spot detection and size grading.
[0003] Current mainstream methods mainly rely on traditional image enhancement algorithms for feature extraction, such as histogram equalization, Gaussian filtering, etc. However, they face significant challenges in actual application scenarios: Firstly, the epidermal wrinkles of garlic seeds and the light reflection effect result in local overexposure or low contrast in the image, and it is difficult for traditional methods to balance the global and retain details; Secondly, high-frequency noise and salt-and-pepper noise introduced by attached soil particles and mechanical vibrations of equipment make it easy to lose texture features during the noise reduction process by conventional filtering algorithms; Thirdly, dynamic background interferences such as conveyor belt textures and foreign objects mixed in the environment make it difficult to separate the defect area from the background. These problems directly restrict the recognition accuracy of subsequent classifiers and the sorting efficiency of the production line, and there is an urgent need to develop a dedicated preprocessing technology system for complex agricultural scenarios. Summary of the Invention
[0004] In view of this, the embodiments of the present application provide a method, device, equipment and medium for preprocessing dim images based on machine vision to solve the problem of low screening efficiency due to poor image quality in existing screening methods in complex lighting and high-noise environments, so as to achieve the purpose of improving the accuracy and efficiency of garlic seed screening and quality classification and grading.
[0005] The embodiments of the present application provide the following technical solutions: A method for preprocessing dim images based on machine vision, including:
[0006] Construct a multi-scale Retinex enhanced fusion adaptive gamma correction light compensation model, and process the original garlic seed screening image through the light compensation model to eliminate uneven lighting and reflection interference, and obtain the first garlic seed screening image;
[0007] According to the texture complexity detection method based on a grayscale guidance map, design an adaptive joint bilateral filter, and process the first garlic seed screening image through the adaptive joint bilateral filter to obtain the second garlic seed screening image;
[0008] Perform multi-resolution contrast enhancement processing on the second garlic seed screening image through pyramid decomposition and entropy-driven block strategy to obtain the preprocessed garlic seed screening image.
[0009] According to an embodiment of the present application, a light compensation model for multi-scale Retinex enhanced fusion adaptive gamma correction is constructed, and the original garlic seed screening image is processed by the light compensation model, including:
[0010] The illumination component of the original garlic seed screening image is estimated by Gaussian blur to obtain multi-scale Gaussian kernels, and the reflection components are calculated for the Gaussian kernels of multiple scales respectively to obtain multi-scale reflection components;
[0011] The multi-scale reflection components are normalized, and the normalized reflection components are converted into a grayscale luminance map;
[0012] Guided filtering is used to calculate the local luminance mean of the grayscale luminance map, and according to the local luminance mean, a dynamic gamma value is designed to generate a dynamic gamma mapping;
[0013] According to the dynamic gamma mapping, gamma correction is performed on the normalized reflection components to obtain the first garlic seed screening image.
[0014] According to an embodiment of the present application, the method further includes: obtaining multi-scale Gaussian kernels by calling OpenCV functions.
[0015] According to an embodiment of the present application, the method further includes: mapping the multi-scale reflection components to the interval [0,1] to achieve normalized output of the reflection components.
[0016] According to an embodiment of the present application, processing the first garlic seed screening image by the adaptive joint bilateral filter includes:
[0017] For the neighborhood point q of the pixel point p in the first garlic seed screening image, calculate the gradient magnitude and the direction consistency metric to quantify the local texture complexity;
[0018] Calculate the comprehensive texture complexity factor according to the gradient magnitude and the direction consistency metric, and then calculate the spatial standard deviation dynamic adjustment factor and the color standard deviation dynamic adjustment factor according to the comprehensive texture complexity factor to dynamically adjust the spatial standard deviation and the color standard deviation according to the texture complexity;
[0019] Calculate the spatial weight according to the spatial distance between the pixel point p and the neighborhood point q and the spatial standard deviation dynamic adjustment factor, and calculate the gray-scale similarity weight according to the gray-scale value of the pixel point p and the gray-scale value of the neighborhood point q and the color standard deviation dynamic adjustment factor;
[0020] The filtered second garlic seed screening image is obtained by weighted averaging the spatial weight and the gray-scale similarity weight.
[0021] According to an embodiment of the present application, through a pyramid decomposition and entropy-driven block strategy, multi-resolution contrast enhancement processing is performed on the second garlic seed screening image, including:
[0022] Construct an image pyramid, divide the images of each resolution layer in the image pyramid into multiple blocks, calculate the local information entropy of each block respectively, dynamically adjust the number of blocks of the block according to the local information entropy value, and perform histogram equalization;
[0023] Perform bilinear interpolation processing on the boundary pixels of the block, and then fuse the enhanced results of different resolutions of each layer of the pyramid according to weights to obtain an enhanced LAB image;
[0024] Convert the enhanced LAB image back to the RGB color space to obtain the final enhancement result.
[0025] According to an embodiment of the present application, constructing an image pyramid includes:
[0026] Convert the RGB image of the second garlic seed screening image into an LAB image, and use a Gaussian filter and downsampling to generate three layers of 1 / 4 resolution image, 1 / 2 resolution image and original resolution image to obtain the image pyramid.
[0027] The present application also provides a dim image preprocessing device based on machine vision, including:
[0028] A light compensation module for constructing a light compensation model of multi-scale Retinex enhanced fusion adaptive gamma correction, and processing the original garlic seed screening image through the light compensation model to eliminate uneven illumination and specular reflection interference, and obtain a first garlic seed screening image;
[0029] A filtering module for designing an adaptive joint bilateral filter according to the texture complexity detection method based on a gray-scale guidance map, and processing the first garlic seed screening image through the adaptive joint bilateral filter to obtain a second garlic seed screening image;
[0030] A multi-resolution contrast enhancement module for performing multi-resolution contrast enhancement processing on the second garlic seed screening image through a pyramid decomposition and entropy-driven block strategy to obtain a preprocessed garlic seed screening image.
[0031] The present application also provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the above-mentioned dim image preprocessing method based on machine vision is implemented.
[0032] The present application also provides a computer-readable storage medium storing a computer program for executing the above-mentioned machine vision-based dim image preprocessing method.
[0033] A machine vision-based dim image preprocessing method according to an embodiment of the present invention includes: (1) constructing a multi-scale Retinex enhanced fusion adaptive gamma correction-based illumination compensation model to eliminate uneven illumination and specular interference through a weighted coefficient dynamic adjustment technique; (2) designing an adaptive joint bilateral filter to achieve edge-preserving denoising by combining a grayscale guidance map and texture complexity detection; (3) introducing a multi-resolution contrast enhancement module to enhance the detail signal-to-noise ratio of minute defects through pyramid decomposition and entropy-driven block-based strategies. Compared with traditional image preprocessing methods, the machine vision-based dim image preprocessing method disclosed by the present invention can effectively improve the defect detection accuracy and grading efficiency under high-noise and complex background conditions, providing robust vision preprocessing support for subsequent automated sorting. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.
[0035] Figure 1 is a schematic flowchart of the machine vision-based dim image preprocessing method according to an embodiment of the present invention;
[0036] Figure 2 is a schematic flowchart of the processing of the illumination compensation model in the garlic seed image preprocessing method according to an embodiment of the present invention;
[0037] Figure 3 is a schematic structural diagram of the machine vision-based dim image preprocessing device according to an embodiment of the present invention;
[0038] Figure 4 is a schematic structural diagram of the computer device of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0039] The embodiments of the present application will be described in detail below with reference to the drawings.
[0040] The following describes the implementation manners of the present application through specific specific examples. Those skilled in the art can easily understand other advantages and effects of the present application from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application can also be implemented or applied through other different specific implementation manners. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that, without conflict, the following embodiments and the features in the embodiments can be combined with each other. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts belong to the scope protected by the present application.
[0041] As Figure 1 shown, an embodiment of the present invention provides a method for preprocessing a dim image based on machine vision, including:
[0042] S101. Construct a lighting compensation model of multi-scale Retinex enhanced fusion adaptive gamma correction, and process the original garlic seed screening image through the lighting compensation model to eliminate uneven lighting and specular reflection interference, and obtain a first garlic seed screening image;
[0043] S102. Design an adaptive joint bilateral filter according to the texture complexity detection method based on a gray-scale guidance map, and process the first garlic seed screening image through the adaptive joint bilateral filter to obtain a second garlic seed screening image;
[0044] S103. Perform multi-resolution contrast enhancement processing on the second garlic seed screening image through pyramid decomposition and entropy-driven block strategy to obtain a preprocessed garlic seed screening image.
[0045] In step S101 of the embodiment of the present invention, a lighting compensation model of multi-scale Retinex enhanced fusion adaptive gamma correction is constructed, and uneven lighting and specular reflection interference are eliminated through a weighted coefficient dynamic adjustment technique. Specifically, it includes: using Gaussian blur to estimate the lighting component of the original garlic seed screening image to obtain multi-scale Gaussian kernels, calculating the reflection components for multiple scales of Gaussian kernels respectively to obtain multi-scale reflection components; normalizing the multi-scale reflection components, and converting the normalized reflection components into a gray-scale luminance map; using a guided filter to calculate the local luminance mean of the gray-scale luminance map, designing a dynamic gamma value according to the local luminance mean to generate a dynamic gamma mapping; performing gamma correction on the normalized reflection components according to the dynamic gamma mapping to obtain a first garlic seed screening image.
[0046] Specifically, when implementing, as Figure 2As shown in the figure, in the above step S101, the construction of the illumination compensation model for multi-scale Retinex enhancement fusion adaptive gamma correction specifically includes the following steps:
[0047] (1) Estimate the illumination component using Gaussian blur:
[0048] Assume the input image is I(x,y) = [I R(x,y) , I G(x,y) , I B(x,y) ∈ R H×W×3 , where I R(x,y) , I G(x,y) , I B(x,y) are the three primary color components respectively, and (x,y) represents the spatial position coordinates of the pixel. Estimate the illumination component using Gaussian blur:
[0049] L σ (x,y) = I(x,y) * G σ (x,y) (1)
[0050] In the formula, G σ (x,y) is a Gaussian kernel with a standard deviation of σ formed by calling the OpenCV function.
[0051] (2) Select N scales {σ1, σ2,..., σ N} to calculate the multi-scale reflection components:
[0052]
[0053] where ε = 1e -6 is used to avoid data instability and prevent division by zero.
[0054] (3) Map the result to the [0,1] interval to achieve the normalized output of the reflection component:
[0055]
[0056] where, R min is the minimum value of R multi , and R max is the maximum value of R multi .
[0057] (4) Convert the reflection component into a grayscale luminance map:
[0058] The reflection component R norm (x,y) = [R R(x,y) , R G(x,y) , R B(x,y) ∈ R H×W×3 where R R(x,y) , R G(x,y) , R B(x,y)They are the three primary color components and the grayscale brightness map:
[0059] G(x,y) = 0.299R R(x,y) + 0.587R G(x,y) + 0.114R B(x,y) (4)
[0060] (5) Use the guided filter in OpenCV to retain the edge smoothing property and obtain the local brightness mean:
[0061] M(x,y) = GuidedFilter(G(x,y)) (5)
[0062] (6) Calculate the gamma mapping:
[0063] γ0(x,y) = α(1 - M(x,y)) + β (6)
[0064] where α is the slope for adjusting contrast; β is the reference offset.
[0065] (7) To prevent overcorrection, constrain the range of gamma values:
[0066] γ(x,y) = max(γ min , min(γ max , γ0(x,y))) (7)
[0067] where γ min is the minimum value of γ0(x,y), and γ max is the maximum value of γ0(x,y).
[0068] (8) Correct the normalized reflection component R norm (x,y) = [R R(x,y) , R G(x,y) , R B(x,y) ∈ R H×W×3 :
[0069] O(x,y) = [R R(x,y) γ(x,y) , R G(x,y) γ(x,y) , R B(x,y) γ(x,y) (8)
[0070] (19) Map O(x,y) to the range [0, 255]:
[0071] O final (x,y) = max(0, min(255, O(x,y) × 255)) (9)
[0072] In step S102 of the embodiment of the present invention, an adaptive joint bilateral filter is designed to achieve edge-preserving denoising by combining a grayscale guidance map and texture complexity detection. Specifically, it includes: for the neighborhood point q of the pixel point p in the first garlic seed screening image, calculating the gradient magnitude and direction consistency measure to quantify the local texture complexity; calculating a comprehensive texture complexity factor according to the gradient magnitude and the direction consistency measure, and then calculating a spatial standard deviation dynamic adjustment factor and a color standard deviation dynamic adjustment factor according to the comprehensive texture complexity factor to dynamically adjust the spatial standard deviation and color standard deviation according to the texture complexity; calculating a spatial weight according to the spatial distance between the pixel point p and the neighborhood point q and the spatial standard deviation dynamic adjustment factor, and calculating a grayscale similarity weight according to the grayscale value of the pixel point p and the grayscale value of the neighborhood point q and the color standard deviation dynamic adjustment factor; obtaining the filtered second garlic seed screening image by weighted averaging the spatial weight and the grayscale similarity weight.
[0073] Specifically, in step S102 above, the adaptive joint bilateral filter specifically includes the following steps:
[0074] (1) Assume that the pixel positions in O final (x) are p = (i, j) and the neighborhood point q of p = (k, l) respectively. For the neighborhood point q of p, calculate the gradient magnitude:
[0075]
[0076] (22) Calculate the gradient direction consistency measure:
[0077]
[0078] Where N is the number of neighborhood points of p, is the imaginary unit.
[0079] (2) Calculate the comprehensive texture complexity factor:
[0080]
[0081] Where α, β ∈ [0, 1] and can be set according to the actual situation.
[0082] (3) Calculate the spatial standard deviation dynamic adjustment factor:
[0083]
[0084] Where is the lower limit of the spatial standard deviation, is the upper limit of the spatial standard deviation, T0 is the activation threshold, and γ is the steepness of the activation threshold, all of which can be set according to the actual situation.
[0085] (4) Calculate the color standard deviation dynamic adjustment factor:
[0086]
[0087] where is the reference color standard deviation, k is the amplification factor, and λ is the sensitivity factor, all of which can be set according to the actual situation.
[0088] (5) Calculate the spatial weight factor:
[0089]
[0090] where ||p - q|| 2 =(i - k) 2 +(j - l) 2 represents the Euclidean distance between two points.
[0091] (6) Calculate the guiding weight factor:
[0092]
[0093] where B(p) and B(q) are the grayscale values of points p and q respectively.
[0094] (7) Calculate the image after joint bilateral filtering
[0095]
[0096] where, is the normalization factor, Ω p is the neighborhood window centered on pixel P, and q is the neighborhood point of p.
[0097] In step S103 of the embodiment of the present invention, a multi - resolution contrast enhancement module is introduced to enhance the detail signal - to - noise ratio of micro - defects through pyramid decomposition and entropy - driven block - based strategy. Specifically, it includes: constructing an image pyramid, dividing the images of each resolution layer in the image pyramid into multiple blocks, calculating the local information entropy of each block respectively, dynamically adjusting the number of blocks of the block according to the local information entropy value, and performing histogram equalization; performing bilinear interpolation on the boundary pixels of the block, and then fusing the enhancement results of different resolutions of each layer of the pyramid according to weights to obtain the enhanced LAB image; converting the enhanced LAB image back to the RGB color space to obtain the final enhancement result.
[0098] Specifically, in the above step S103, the multi - resolution contrast enhancement module specifically includes the following steps:
[0099] (1) Convert the RGB image to an LAB image and only take the luminance channel L(x, y). Generate three layers of images with 1 / 4, 1 / 2, and original resolutions using a Gaussian filter:
[0100] The image with 1 / 2 resolution generated by one downsampling is:
[0101] L1(x, y) = L blur (2x, 2y) (18)
[0102] The image with 1 / 4 resolution generated by secondary downsampling is:
[0103] L1(x, y) = L blur (4x, 4y) (19)
[0104] The image with 1 / 2 resolution generated by one downsampling is:
[0105] L1(x, y) = L blur (2x, 2y) (20)
[0106] (2) Establish an image pyramid construction unit:
[0107] L pyramid (x, y) = {L(x, y), L1(x, y), L2(x, y)} (21)
[0108] (3) For each resolution layer L k , divide it into 32×32 blocks and calculate the local information entropy:
[0109]
[0110] Among them, is the probability that the gray level i occupies in the block b, i ∈ (0, 255)
[0111] (4) Refine the number of blocks layer by layer:
[0112]
[0113] Among them, ΔE = 2.0, is the maximum entropy value of the current layer, is the minimum entropy value of the current layer.
[0114] (5) Histogram initialization:
[0115] Assume that the total number of pixels in a certain block b is N b , k is the gray value, and calculate its initial histogram
[0116]
[0117] (6) Histogram clipping and recording the number of clipped pixels:
[0118]
[0119] Among them, is the set clipping threshold.
[0120] (7) Reassign to 256 gray levels:
[0121]
[0122] (8) Calculate the normalized cumulative distribution function of the clipped histogram:
[0123]
[0124] (9) Map the original pixel value L(p)=k to the equalized value L ep (p):
[0125]
[0126] Among them, represents the minimum value of the normalized cumulative distribution function of this block, represents the maximum value of the normalized cumulative distribution function of this block, and round(·) represents rounding.
[0127] (10) Perform bilinear interpolation on the block boundary pixels:
[0128]
[0129] Among them, represents the mapping results of the 4 nearest adjacent blocks, w ij represents the distance of this pixel to the center of the adjacent block.
[0130] (11) Upsample the enhancement result k of pyramid layer L to the original size and fuse:
[0131]
[0132] Among them, H and W are the height and width of the original size respectively.
[0133] (12) Fusing weight assignment:
[0134]
[0135] (13) Combine the enhanced luminance channel L final with the original chrominance channels A and B to form a complete LAB image:
[0136] LABfinal = [L final , A, B] (32)
[0137] (14) Finally, use the OPENCV library to convert the LAB image to an RGB image:
[0138] RGB final = cvtColor[LAB final (33)
[0139] A method for preprocessing images for garlic seed screening based on machine vision according to an embodiment of the present invention includes the following steps: (1) Construct a lighting compensation model for multi-scale Retinex enhanced fusion adaptive gamma correction, and eliminate uneven lighting and specular reflection interference through a weighted coefficient dynamic adjustment technique; (2) Design an adaptive joint bilateral filter, and combine a grayscale guidance map and texture complexity detection to achieve edge-preserving denoising; (3) Introduce a multi-resolution contrast enhancement module, and enhance the detail signal-to-noise ratio of small defects through pyramid decomposition and entropy-driven block-based strategies. Compared with traditional image preprocessing methods, the method for preprocessing dim images based on machine vision disclosed by the present invention can effectively improve the defect detection accuracy and grading efficiency under high-noise and complex background conditions, providing robust visual preprocessing support for subsequent automatic sorting.
[0140] As Figure 3 shown, an embodiment of the present invention also provides a device 200 for preprocessing dim images based on machine vision, including:
[0141] A lighting compensation module 201, configured to construct a lighting compensation model for multi-scale Retinex enhanced fusion adaptive gamma correction, and process the original garlic seed screening image through the lighting compensation model to eliminate uneven lighting and specular reflection interference, and obtain a first garlic seed screening image;
[0142] A filtering module 202, configured to design an adaptive joint bilateral filter according to a texture complexity detection method based on a grayscale guidance map, and process the first garlic seed screening image through the adaptive joint bilateral filter to obtain a second garlic seed screening image;
[0143] A multi-resolution contrast enhancement module 203, configured to perform multi-resolution contrast enhancement processing on the second garlic seed screening image through pyramid decomposition and entropy-driven block-based strategies to obtain a preprocessed garlic seed screening image.
[0144] In one embodiment, a computer device is provided, as Figure 4 shown, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned method for preprocessing dim images based on machine vision is implemented.
[0145] Specifically, the computer device may be a computer terminal, a server, or a similar computing device.
[0146] In this embodiment, a computer-readable storage medium is provided, and the computer-readable storage medium stores a computer program for executing the above-mentioned machine vision-based dim image preprocessing method.
[0147] Specifically, the computer-readable storage medium includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information may be computer-readable instructions, data structures, program modules, or other data. Examples of computer-readable storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory, or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD), or other optical storage, magnetic cassette tapes, magnetic disk storage, or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device. As defined herein, computer-readable storage media do not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0148] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the embodiments of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Optionally, they can be implemented by program codes executable by the computing device. Thus, they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order than here, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module to be implemented. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.
[0149] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A preprocessing method for dim images based on machine vision, characterized in that, Including: Construct a lighting compensation model with multi-scale Retinex enhancement fusion and adaptive gamma correction, and process the original garlic seed screening image through the lighting compensation model to eliminate uneven lighting and reflection interference, obtaining a first garlic seed screening image; Design an adaptive joint bilateral filter according to the texture complexity detection method based on a grayscale guidance map, and process the first garlic seed screening image through the adaptive joint bilateral filter to obtain a second garlic seed screening image; Perform multi-resolution contrast enhancement processing on the second garlic seed screening image through pyramid decomposition and entropy-driven block strategy to obtain a preprocessed garlic seed screening image.
2. The machine vision-based dim image preprocessing method according to claim 1, wherein Construct a lighting compensation model with multi-scale Retinex enhancement fusion and adaptive gamma correction, and the processing of the original garlic seed screening image through the lighting compensation model includes: Use Gaussian blur on the original garlic seed screening image to estimate the lighting component, obtain multi-scale Gaussian kernels, calculate the reflection components for Gaussian kernels at multiple scales respectively, and obtain multi-scale reflection components; Normalize the multi-scale reflection components, and convert the normalized reflection components into a grayscale luminance map; Use guided filtering to calculate the local luminance mean of the grayscale luminance map, and design a dynamic gamma value according to the local luminance mean to generate a dynamic gamma mapping; Perform gamma correction on the normalized reflection components according to the dynamic gamma mapping to obtain a first garlic seed screening image.
3. The machine vision-based dim image preprocessing method according to claim 2, wherein The method further includes: obtaining multi-scale Gaussian kernels by calling OpenCV functions.
4. The machine vision-based dim image preprocessing method according to claim 2, wherein The method further includes: mapping the multi-scale reflection components to the interval [0, 1] to achieve normalized output of the reflection components.
5. The machine vision-based dim image preprocessing method according to claim 1, wherein The processing of the first garlic seed screening image through the adaptive joint bilateral filter includes: For the neighborhood point q of the pixel point p in the first garlic seed screening image, calculate the gradient magnitude and direction consistency measure to quantify the local texture complexity; Calculate a comprehensive texture complexity factor according to the gradient magnitude and the direction consistency measure, and then calculate a spatial standard deviation dynamic adjustment factor and a color standard deviation dynamic adjustment factor according to the comprehensive texture complexity factor to dynamically adjust the spatial standard deviation and the color standard deviation according to the texture complexity; Calculate the spatial weight according to the spatial distance between the pixel point p and the neighborhood point q and the spatial standard deviation dynamic adjustment factor, and calculate the gray similarity weight according to the gray value of the pixel point p and the gray value of the neighborhood point q and the color standard deviation dynamic adjustment factor; Obtain the filtered second garlic seed screening image by performing weighted average on the spatial weight and the gray similarity weight.
6. The preprocessing method for dim images based on machine vision according to claim 1, wherein The multi-resolution contrast enhancement processing of the second garlic seed screening image through pyramid decomposition and entropy-driven block strategy includes: Construct an image pyramid, divide the images at each resolution layer in the image pyramid into multiple blocks, calculate the local information entropy of each block respectively, dynamically adjust the number of blocks of the block according to the local information entropy value, and perform histogram equalization; Perform bilinear interpolation on the boundary pixels of the block, and then fuse the enhancement results of different resolutions of each layer of the pyramid according to weights to obtain the enhanced LAB image; Convert the enhanced LAB image back to the RGB color space to obtain the final enhancement result.
7. The machine vision-based dim image preprocessing method according to claim 6, characterized in that, Construct an image pyramid, including: Convert the RGB image of the second garlic seed screening image to an LAB image, and use a Gaussian filter and downsampling to generate three layers of images with 1 / 4 resolution, 1 / 2 resolution, and original resolution images to obtain the image pyramid.
8. An apparatus for preprocessing dim images based on machine vision, characterized in that, Include: A light compensation module for constructing a light compensation model of multi-scale Retinex enhanced fusion adaptive gamma correction, and processing the original garlic seed screening image through the light compensation model to eliminate uneven illumination and specular interference to obtain the first garlic seed screening image; A filtering module for designing an adaptive joint bilateral filter according to the texture complexity detection method based on the gray-scale guidance map, and processing the first garlic seed screening image through the adaptive joint bilateral filter to obtain the second garlic seed screening image; A multi-resolution contrast enhancement module for performing multi-resolution contrast enhancement processing on the second garlic seed screening image through pyramid decomposition and entropy-driven block strategy to obtain the preprocessed garlic seed screening image.
9. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the machine vision-based dim image preprocessing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program for executing the machine vision-based dim image preprocessing method according to any one of claims 1 to 7.
Citation Information
Cited By
Machine vision defect real-time detection and classification method and system based on deep learning
CN120612502A
Real-time detection and classification method and system for machine vision defects based on deep learning
CN120612502B
Real-time monitoring method for density relay production line
CN120782763A
Titanium scrap impurity sorting monitoring method based on image processing
CN122265984A