Image enhancement method and application thereof

By decomposing the illumination and reflection components of an image using Retinex theory and deep convolutional neural networks, and combining this with a fully connected CRF model for image enhancement and edge extraction, the problems of low detection efficiency and low accuracy in existing technologies are solved, achieving efficient and accurate product specification detection.

CN115761241BActive Publication Date: 2026-05-08MINDU INNOVATION LAB
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
MINDU INNOVATION LAB
Filing Date
2022-11-08
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing technologies have low efficiency and low accuracy in detecting product area and size during target screening and sorting. Image enhancement methods cannot effectively suppress noise and maintain image edges and details, while edge extraction methods have low accuracy and are sensitive to noise.

Method used

The Retinex theory is used to decompose the illumination and reflection components of the image. The deep convolutional neural network and the fully connected CRF model are combined for image enhancement and edge extraction. The adaptive threshold segmentation algorithm is used for product specification detection.

Benefits of technology

It achieves local enhancement of image details and edge preservation, improves the robustness and accuracy of product inspection, and enables efficient real-time, large-scale inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115761241B_ABST
    Figure CN115761241B_ABST
Patent Text Reader

Abstract

The application discloses an image enhancement method and application thereof, the image enhancement method enhances the brightness constant processing on the collected image through a constructed camera response model, obtains an enhanced image, converts the enhanced image into a gray matrix image and then carries out denoising processing. The application also provides an edge extraction method based on the image enhancement method, uses a new SED model based on dynamic feature fusion to extract edges, that is, carries out semantic segmentation on the denoised gray image, converts the denoised gray image into a binary image, normalizes the amplitude scale of the multi-layer features of the binary image, carries out dynamic feature fusion, obtains the required edge features, and thus realizes edge extraction. The image enhancement method and the edge extraction method are both upgraded, and the application prospect is wide, and the image enhancement method and the edge extraction method can especially meet the demand of large batch and high precision product size detection, and reduce the artificial pressure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of intelligent industry, and in particular relates to an image enhancement method and its application. Background Technology

[0002] Currently, in the target screening and sorting process, the detection of product area and size mainly relies on molds, and requires manual intervention and the use of calibrated instruments for final detection and calibration. Therefore, it suffers from low efficiency and accuracy. Contrast enhancement and histogram equalization in image enhancement methods cannot suppress noise. Smoothing can remove noise, but this can alter the edge positions of the resulting image, blurring or even losing details, and also blurring the image edges. Nonlinear filtering can better preserve the image edge positions and details, but the algorithm implementation is more difficult than linear filtering. The Sobel operator detection method in edge extraction methods has relatively low accuracy, while the Laplacian operator method is quite sensitive to noise. Summary of the Invention

[0003] According to one aspect of this application, an image enhancement method is provided that can reveal details hidden within them while preserving their naturalness, so that the images look more visually appealing and are more scientifically useful.

[0004] The image enhancement method includes:

[0005] (1) Acquire the captured image, select the camera response model and calculate the model parameters to obtain the enhanced image;

[0006] (2) Convert the enhanced image into a grayscale matrix and perform noise reduction processing on it.

[0007] Preferably, step (1) includes:

[0008] (11) Decompose the acquired image into reflection component and illumination component to obtain the reflection image;

[0009] (12) Calculate the exposure map and reflectance map based on the reflection image;

[0010] (13) Obtain the logarithmic reflectance from the reflectance diagram and calculate the spatial variation function;

[0011] (14) Calculate the probability density function of the reconstructed image based on the spatial variation function;

[0012] (15) Calculate the mapping function based on the probability density function of the reconstructed image;

[0013] (16) Input the acquired image into the mapping function, and enhance it according to the exposure rate map and image intensity to obtain the enhanced image.

[0014] Preferably, the reflectance map is the reflectance component of the image, obtained by reverse calculation using the expression formula for reflectance image I as shown below:

[0015]

[0016] str n ≤0 and t≤i n .

[0017] Where R is the reflectance map; i = log(I) is the illumination; t = log(T), i = log(I), r = log(R) are log reflectance, c1 and c2 are positive parameters, u is a supplementary variable, v is the error, n is the number of iterations, and λ is the weighting coefficient.

[0018] Preferably, the formula for calculating the exposure rate map is as follows:

[0019]

[0020] Where I is the reflected image, I min This represents the minimum illuminance.

[0021] Preferably, the formula for calculating the spatial variation function is as follows:

[0022]

[0023] Where q represents the coordinates of a pixel, N(q) is a set of neighboring coordinates of q, and U(·) is a factor of 2. i The upsampling operator, where i is the resolution level, L is the total number of levels, and l represents the number of terms of the variable when performing a geometric mean;

[0024] Preferably, the probability density function pdf of the reconstructed image is calculated using the following formula:

[0025]

[0026] Wherein, the probability density function pdf is denoted as δ represents the Kronecker delta, a(q), k∈[0,K) is the intensity of each pixel q, and K is the total number of intensities.

[0027] Preferably, the mapping function is calculated using the following formula:

[0028]

[0029] Wherein, the cumulative distribution function cdf is denoted as P a (k), P b (k) represents the cumulative distribution function of the output image.

[0030] Preferably, the enhancement based on the exposure rate map and image intensity is performed by enhancing J(T) using the following formula to obtain the enhanced image:

[0031]

[0032] Where P represents image intensity and S represents the exposure rate map. This indicates a division by element.

[0033] Preferably, the denoising process employs a physics-based, extremely low-light raw denoising noise formation model.

[0034] According to another aspect of this application, an edge extraction method is provided, which, after the above-described image enhancement method, further includes the step of:

[0035] Perform semantic segmentation on the denoised grayscale image;

[0036] Convert the segmented image into a binary image;

[0037] The amplitude scale of the multi-layer features of the binary image is normalized, and then dynamic feature fusion is performed to obtain the required edge features, thereby extracting the image edge.

[0038] Preferably, the semantic segmentation of the denoised grayscale image includes:

[0039] The denoised grayscale image is then fed into a deep convolutional neural network (DCNN) and an Atrous convolutional network for feature extraction.

[0040] A fully connected CRF model is used for post-processing to obtain semantic image segmentation results.

[0041] Preferably, the post-processing using a fully connected CRF model to obtain the semantic image segmentation result includes:

[0042] Atrous convolution outputs a coarse segmentation result;

[0043] Bilinear interpolation is used to restore the coarse segmentation results to the resolution of the original image;

[0044] The input is fed into a fully connected CRF model to obtain semantic image segmentation results.

[0045] Preferably, the conversion of the segmented image into a binary image uses adaptive thresholding.

[0046] Preferably, the dynamic feature fusion is: using machine learning to predict adaptive fusion weights for different locations in the multi-layer feature map.

[0047] Preferably, the adaptive fusion weights include at least one of the following: position-invariant fusion weights and position-adaptive fusion weights; wherein,

[0048] For the fusion weights that remain unchanged at their positions, all positions in the feature map are treated equally, and a general fusion weight is adaptively learned based on a specific input; fusion weights for specific positions are dynamically generated based on the image content.

[0049] For position-adaptive fusion weights, the fusion weights are adaptively adjusted according to the image position features, and the contribution of low-level features to accurately locate edges along the target contour is enhanced.

[0050] According to another aspect of this application, an edge extraction method is provided for application in product specification inspection, comprising the following steps:

[0051] Acquire images of the product to be tested and perform camera calibration on them;

[0052] The outline of the product to be tested is obtained by edge extraction method;

[0053] The specifications of the product under test are converted based on the scale of the calibration plate calibrated by the camera to obtain the actual specifications of the product under test.

[0054] Preferably, the acquisition of the product image to be tested includes:

[0055] Using a monocular industrial camera to acquire images of the product under test;

[0056] Based on the single-point distortion-free camera imaging model, the camera is calibrated on the acquired images of the product under test.

[0057] Preferably, the actual specifications of the product under test include at least one of the following: the actual area of ​​the product under test, and the actual length and width data of the product under test.

[0058] Preferably, the actual area of ​​the product to be tested is calculated using the following steps:

[0059] Calculate the area within the maximum outline of the product under test to obtain the area represented by the pixel value of the product under test in the image. Then, perform a proportional conversion based on the area of ​​the calibration plate scale set by the camera to obtain the actual area of ​​the product under test.

[0060] Preferably, the actual length and width data of the product to be tested are calculated using the following steps:

[0061] Determine the coordinates of the center point of the minimum circumscribed moment of the rotational profile of the product under test and the coordinates of the four corner points of the calibration frame, and draw the calibration frame;

[0062] Using the standard dimensions of the calibration plate as a scale, the actual length and width of the product to be tested are obtained.

[0063] The beneficial effects that this application can produce include:

[0064] 1) The image enhancement method provided in this application is initially based on Retinex theory, using a measurement-adaptive model to decompose the image. A novel CRM is used to enhance the image's illumination, while a reconstructed histogram equalization method locally enhances reflectivity. This method locally enhances low-light images to make their details dominant, while adapting the camera response model (CRM) to maintain the image's naturalness.

[0065] 2) The semantic image segmentation method provided in this application uses a deep convolutional network (DCNN) and Atrous convolution at the front end to obtain a scoring map and generate a feature map, and a fully connected CRF at the back end to perform semantic image segmentation; the collected image is input into the convolutional neural network, and a new model with weights and bias parameters is obtained after training; the model has higher robustness and better accuracy for the segmentation and recognition of target products and background.

[0066] 3) The edge extraction method provided in this application can adaptively assign different fusion weights to different input images and locations. This is achieved through the proposed weight learner, which infers appropriate fusion weights for multi-level features based on each location of the feature map for a specific input. In this way, the heterogeneity of contributions made by different locations in the feature map and the input image can be better taken into account, thereby contributing to more accurate and clearer edge predictions.

[0067] 4) The product specification testing method provided in this application can realize real-time large-scale data collection and testing, and has a complete algorithm process with high robustness and high accuracy; the adaptive threshold segmentation algorithm is cleverly designed to eliminate complex operations such as fuzzing, erosion and dilation. Attached Figure Description

[0068] Figure 1 This is a schematic diagram of the detection system used in one embodiment of this application;

[0069] Figure 2 This is an original image of dried fruits and vegetables in one embodiment of this application;

[0070] Figure 3 This is a schematic diagram of the semantic image segmentation results of dried fruits and vegetables in one embodiment of this application;

[0071] Figure 4 This is a binary image of dried fruits and vegetables in one embodiment of this application;

[0072] Figure 5This is a schematic diagram of dynamic feature extraction and fusion in one embodiment of this application;

[0073] Figure 6 This is a schematic diagram of a dynamic feature weight learner in one embodiment of this application;

[0074] Figure 7 This is a schematic diagram of the length and width calibration results in one embodiment of this application. Detailed Implementation

[0075] The present application is described in detail below with reference to the embodiments, but the present application is not limited to these embodiments.

[0076] An image enhancement method, comprising:

[0077] (1) Acquire the captured image, select the camera response model and calculate the model parameters to obtain the enhanced image.

[0078] The method used consists of three parts:

[0079] The first part focuses on decomposing and determining the illumination and reflection components of the image. The second part focuses on preserving the naturalness of the image. The third part focuses on contrast enhancement.

[0080] First, we input the acquired image, then select a camera response model and calculate the model parameters.

[0081] According to Retinex theory, any image T perceived by the human eye is described as:

[0082]

[0083] Where R is the reflectance component of the image, also known as the reflectance map, ranging from (0, 1], and I is the illumination component of the image, also known as the reflectance image, ranging from (0, ∞). This indicates pixel-by-pixel multiplication. All images are in vector form.

[0084] (11) Obtain the reflection image I:

[0085]

[0086] Where i is illumination, t = r + i, t = log(T), r = log(R), i = log(I), r is log reflectance, c1 and c2 are positive parameters, supplementary variables u and an error v, n is the number of iterations; λ is the weighting coefficient.

[0087] (12) Calculate the exposure rate graph S:

[0088]

[0089] Among them, Imin This represents the minimum illuminance.

[0090] (13) Use the formula in step (11) to obtain the reflectance map R.

[0091] (14) Calculate the spatial variation function φ(q):

[0092]

[0093] Where q represents the coordinates of a pixel, N(q) is a set of neighboring coordinates of q, and U(·) is a factor of 2. i The upsampling operator, where L is the resolution level; i is each level, This indicates that the geometric mean is calculated from it;

[0094] (15) Calculate the probability density function pdf of the reconstructed image, denoted as

[0095]

[0096] Where δ represents the Kronecker delta, a(q), k∈[0,K) is the intensity of each pixel q, and K is the total number of intensities.

[0097] (16) Calculate the mapping function J(k):

[0098]

[0099] Wherein, the cumulative distribution function cdf is denoted as P a (k), P b (k) represents the cdf of the output image.

[0100] (17) Using the exposure map S, the image intensity P is enhanced by the following equation:

[0101]

[0102] The final enhanced image is obtained. This indicates a division by element.

[0103] (2) The enhanced image is converted into a grayscale matrix and then denoised. The imaging model in the RAW domain can be expressed as follows:

[0104] D = KI + N,

[0105] Where I represents the number of charges converted from photoelectric charge, K represents the gain of the entire system, and N represents noise. Starting from this expression, we estimate the distribution of noise patterns in different processes.

[0106] The photoelectric sensor model used in this method is mainly based on CMOS sensors. The method's steps are divided into how incident light is converted from photons to electrons, from electrons to voltage, and finally from voltage to digital, to simulate the noise in the electron imaging pipeline.

[0107] First, there's the photoelectric conversion. Light passes through the lens module and shines onto the sensor, generating electrical charges. This process has a certain degree of randomness; the amount of charge generated depends on the sensor's photoelectric conversion efficiency and the size of each pixel on the sensor. However, this process can be represented by a Poisson distribution.

[0108]

[0109] Where, N p This is called photon shot noise. This represents a Poisson distribution. This type of noise depends on the light intensity, i.e., the signal. We assume a constant light response and represent the dark current noise N. d The effect of absorption into read noise N read This will be explained in the following steps.

[0110] After photoelectric conversion, the next step is the conversion of charge into voltage. After electrons are collected at each location, they are typically integrated, amplified, and read out as measurable charge or voltage at the end of the exposure time. Thermal noise N is considered in the model. t Source follower noise N s and strip mode noise N b To absorb multiple noise sources into a unified term, i.e., to read the noise:

[0111] N read =N d +N t +N s

[0112] N read ~TL(λ;0,σ TL ),

[0113] Here, λ and a represent the shape and scale parameters, respectively, while the location parameter is set to zero under the zero-mean noise assumption.

[0114] Read noise is modeled using the Tukey lambda distribution (TL).

[0115] Finally, from voltage to digital, the noise is quantized, and this quantization noise is modeled as a uniform distribution:

[0116]

[0117] Where q is the quantization step size.

[0118] Finally, the noise distribution is represented as follows:

[0119] N = KN p +N read +N r +N q

[0120] Among them, K and N p N read N r and N q These represent the overall system gain, photon shot noise, readout noise, line noise, and quantization noise, respectively.

[0121] After modeling the noise distribution, the remaining task is to estimate the model parameters. The parameters that need to be estimated can be seen from the expression of the noise model.

[0122] By acquiring an image in a uniformly lit environment, the K value can be estimated, followed by the image brightness I value. A Poisson distribution is then constructed, noise is added to I, and multiplied by the K value to simulate shot noise N. p To analyze the noise distribution, we can average each row of the image, then estimate the mean and variance to estimate the scale of the banding pattern noise. Next, we subtract the banding pattern noise from the bias images, fit the remaining residuals using a statistical model, and finally obtain a joint parameter distribution model.

[0123]

[0124] Where U(·,·) represents a uniform distribution. This indicates a Gaussian distribution. and These are the estimated overall system gain at the camera's minimum and maximum ISO, respectively. a and b represent the slope and intercept of the fitted line, respectively. It is an unbiased estimator of the standard deviation of linear regression under the Gaussian error assumption.

[0125] By using this set of parameter distributions, noise can be estimated, thereby simulating the noise distribution in a real environment. Finally, the image is successfully denoised using the Elastic Noise Deformation (ELD) model.

[0126] In one embodiment, an edge extraction method, following the image enhancement method described above, further includes the following step:

[0127] (3) Semantic segmentation of the denoised grayscale image. Here we constructed a model with a front-end consisting of a deep convolutional network (DCNN) and an Atrous convolution, mainly used to generate a feature map based on the rating map. Finally, a fully connected CRF was applied for semantic image segmentation. After training the network with the acquired images, the weights and bias parameters were obtained. After testing, our model showed higher robustness and better accuracy in the segmentation and recognition of products and backgrounds.

[0128] The deep convolutional network (DCNN) is either VGG-16 or ResNet-101, and is used in a fully convolutional manner.

[0129] The Atrous convolution performs dense feature extraction, which reduces the degree of signal downsampling. The output y[i] of the Atrous convolution of a one-dimensional input signal x[i] with a filter w[k] of length k can be defined as:

[0130]

[0131] i represents each position, y represents the corresponding output, w is the convolution kernel, x represents the input feature map, and r represents the proportion of each hole, which is also the stride.

[0132] This yields a rough segmentation result.

[0133] The coarse segmentation result is then enlarged to the original image resolution using bilinear interpolation. A fully connected CRF is then applied to refine the segmentation result and better capture object boundaries, yielding a semantic image segmentation result, such as... Figure 3 As shown.

[0134] The fully connected CRF model uses the following energy function:

[0135]

[0136] Here, x is the pixel label assignment. We use a unary function θ. i (x i )=-log P(x i ), where P(x) i ) is the label assignment probability at pixel i calculated by DCNN.

[0137] (4) Convert the segmented image into a binary image, specifically including: using the Otsu thresholding method combined with local histogram adaptation to obtain a binary image from the semantic image segmentation result, such as... Figure 4 As shown.

[0138] For an image I(x, y), the segmentation thresholds for the foreground (i.e., the target) and background are denoted as T. The proportion of foreground pixels to the entire image is denoted as ω0, with an average gray level of μ0; the proportion of background pixels to the entire image is denoted as ω1, with an average gray level of μ1. The inter-class variance is denoted as g. The background of the image is relatively dark, and the image size is M×N. The formula for inter-class variance is:

[0139] g = ω0ω1(μ0-μ1) 2

[0140] The threshold T that maximizes the inter-class variance g is obtained by traversing the data, which is the desired threshold.

[0141] (5) Normalize the amplitude scale of the multi-level features of the binary image, and then perform dynamic feature fusion to obtain the required edge features, thereby extracting the image edges. The specific model is as follows: multi-level features are fused through two modules:

[0142] 1) The feature extractor with a normalizer normalizes the amplitude scale of multi-level features;

[0143] 2) The adaptive weight fusion module learns the adaptive fusion weights at different positions of the multi-level feature map.

[0144] The overall architecture of the model used includes, respectively, as follows: Figure 5 , 6 The two parts shown are (a) and (b):

[0145] (a)

[0146] 1) The input image is fed into the ResNet backbone to produce a set of features (response maps) at different scales.

[0147] 2) Connect the edge feature normalized block to the first three stacks and the fifth stack of the remaining blocks to generate Side1-3 and Side5 response graphs with the same response size.

[0148] 3) Shared connection (the following formula) is used to connect Side1-3 and Side5.

[0149]

[0150] Among them, {A side1 A side2 A side3} represents three single-channel feature maps, A side5 This is a K-channel class activation graph. Here, K is the number of classes. A cat For connection activation graph

[0151] 4) The side5-w feature normalization block is followed by the position-adaptive weight learning block, forming another branch of the res5 extension, which predicts the dynamic position-aware fusion weight Ψ(x).

[0152] 5) Then, element-wise multiplication and class summation are applied to the location-aware fusion weights Ψ(x), and the connected responses mapAcatto are used to generate the final fusion output taf.

[0153] 6) Semantic loss was used to supervise easide5 and the final fusion output.

[0154] (b) The position-invariant weight learner and the position-adaptive weight learner take the feature map as input and output the position-invariant fusion weight and the position-adaptive fusion weight Ψ(x).

[0155] 1) The backbone network still uses ResNet-101. In the first three stages, a normalized feature map with 1 channel is extracted. In the fifth stage, normalized feature maps with k and 4k channels are extracted. Shared concatenation is performed using the feature maps extracted in the first three stages and the k feature maps extracted in the fifth stage to generate 4k connection feature maps.

[0156] 2) The 4k standardized feature maps extracted in the fifth stage are used to learn 4k weight maps of H*W through an adaptive weight learner. In this way, the weight parameters 4k*H*W are equal to the number of pixels in the connected feature map. Each pixel in the connected feature map will have a corresponding weight, instead of the previous situation where all pixels in the same connected feature map had the same weight.

[0157] 3) Then use these weights to perform the fusion.

[0158] 4) The adaptive weight learner structure is shown in Figure b above. It replaces the fully connected layer in the original position-invariant weight learner structure with a 1*1 convolution and removes the global pooling operation, so that the original weight parameter quantity of only 1*1*4k becomes H*W*4k.

[0159] Dynamic feature fusion:

[0160] 1) A feature extraction module with normalization is used to normalize the magnitude scale of multi-layer features. This module handles the scale variation of multi-layer responses by normalizing their magnitudes before feature fusion.

[0161] 2) Adaptive weight fusion module, which learns adaptive fusion weights for different locations in multi-layer feature maps.

[0162] There are two different schemes for predicting adaptive fusion weights.

[0163] Position-invariant fusion weights: Treat all locations in the feature map equally and adaptively learn general fusion weights based on specific inputs. Dynamically generate fusion weights for specific locations based on image content.

[0164] Position-adaptive fusion weights: The fusion weights are adaptively adjusted based on the image position features, and the contribution of low-level features to the accurate positioning of edges along the target contour is enhanced.

[0165] Comparison with CASENet:

[0166] An adaptive weight learner is used to actively learn the fusion weights based on the feature maps themselves. The formula for the fusion output is as follows:

[0167] A fuse =f(A side ;Ψ(x)),

[0168] Where x represents the feature map. The above formula describes the essential difference between our proposed adaptive weight fusion method and the fixed weight fusion method. We force the fusion weights Ψ(x) to explicitly depend on the feature map x. Different input feature maps will produce different parameters Ψ(x), resulting in dynamic modifications to the adaptive weight learner f(.;.). In this way, the semantic edge detection model can quickly adapt to the input image and learn appropriate multi-level response fusion weights in an end-to-end manner.

[0169] Regarding Ψ(x), corresponding to the two fusion weight schemes, there are two types of adaptive weight learners: position-invariant weight learners and position-adaptive weight learners. The position-invariant weight learner learns a total of 4K fusion weights, as shown in the following formula, which are shared by all locations in the feature map to be fused:

[0170]

[0171] However, the location-adaptive weight learner generates 4K fused weights for each spatial location, which in total produces H*W*4k weight parameters.

[0172] Ψ(x)=(w s,t ), s∈[1,H], t∈[1,W]

[0173]

[0174] The position-invariant weight learner generates universal fusion weights for all positions, while the position-adaptive weight learner customizes fusion weights for each position based on spatial variations.

[0175] Network structure:

[0176] The side feature normalization block is connected to the stack of the first three and the fifth remaining blocks. This block consists of a 1×1 convolutional layer, a batch normalization (BN) layer, and a deconvolutional layer. The 1×1 convolutional layers generate single-channel and K-channel response maps for Sides 1-3 and Side 5, respectively. The BN layer is applied to the output of the 1×1 convolutional layer to normalize the multi-level responses of the same magnitude. The response maps are then upsampled using deconvolutional layers to bring them back to the original image size.

[0177] Another side-feature normalization block is connected to the fifth stack of the remaining blocks, where a 4K-channel feature map is generated. Then, an adaptive weight learner receives the output of the Side5-w feature normalization block to predict the dynamically fused weights ω(x). This ultimately yields the desired edge features.

[0178] like Figure 1 The image shown is a product specification testing system independently designed in this application, which uses a monocular industrial camera in the system to acquire images of the product under test.

[0179] Taking the specification testing of dried fruits and vegetables as an example, the product specification testing method described in this application includes:

[0180] Step 1: A monocular industrial camera in the detection system is used to acquire batch images of dried fruits and vegetables. The images acquired using the Zhang Zhengyou method are then used for camera calibration to correct distortion in the monocular industrial camera, resulting in the following... Figure 2 The original image of the dried fruits and vegetables shown.

[0181] The Zhang Zhengyou method is a single-point distortion-free camera imaging model as follows:

[0182]

[0183] f is the distance; dX and dY represent the physical length of a pixel on the camera sensor in the X and Y directions, respectively (i.e., how many millimeters a pixel is on the sensor); u0 and v0 represent the coordinates of the center of the camera sensor in pixel coordinates; θ represents the angle between the horizontal and vertical edges of the sensor (where 90 degrees is considered correct). (U, V, W) are the physical coordinates of a point in the world coordinate system, (u, v) are the pixel coordinates of that point in the pixel coordinate system, and Z is the scale factor.

[0184] This is called the camera's extrinsic parameter matrix. The extrinsic parameter matrix depends on the relative position of the camera coordinate system and the world coordinate system. R represents the rotation matrix, and T represents the translation vector.

[0185] Step 2: Obtain the outline of the product to be tested using the edge extraction method described above.

[0186] Step 3: Calculate the area within the maximum contour to obtain the area represented by the pixel values ​​of the dried fruits and vegetables to be measured in the image. Convert the pixel values ​​to the area represented by the scale bar on the calibration board to obtain the actual area of ​​the dried fruits and vegetables to be measured. The area represented by the calibration board is Cal_area (true area under a fixed field of view), Pix_area (pixel area of ​​the calibration board in the image acquisition), Pobj_area (pixel area within the acquired object contour), and Obj_area (actual area of ​​the object to be measured).

[0187]

[0188] Step 4: Determine the coordinates of the center point of the minimum circumscribed moment of the rotational profile of the dried fruit and vegetable to be tested and the coordinates of the four corner points of the calibration frame, and draw the calibration frame.

[0189] Step 5: Calculate the ratio of the calibration board's side length pixel value Pix_cal to the actual Euclidean distance Dist_cal of the calibration board using the following formula:

[0190]

[0191] The proportional value is converted to the pixel value Pix of the object's bounding box in each image to obtain the actual object size Obj:

[0192] Obj = ratio * Pix

[0193] Display the actual dimensions of the dried fruits and vegetables to be tested next to the calibration box (the images will show one decimal place). Figure 6 As shown.

[0194] This application provides a product specification testing system, including a processor and a memory; the memory stores a computer program, and when the processor executes the computer program, it implements some or all of the steps in the above-described product specification testing method.

[0195] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements some or all of the steps in the above-described product specification testing method.

[0196] The above description is merely a few embodiments of this application and is not intended to limit this application in any way. Although this application discloses preferred embodiments as described above, it is not intended to limit this application. Any changes or modifications made by those skilled in the art without departing from the scope of the technical solution of this application using the disclosed technical content are equivalent to equivalent implementation cases and fall within the scope of the technical solution.

Claims

1. An image enhancement method, characterized in that, include: (1) Acquire the captured image, select the camera response model and calculate the model parameters to obtain the enhanced image; Step (1) includes: (11) Decompose the acquired image into reflection component and illumination component to obtain the reflection image; (12) Calculate the exposure map and reflectance map based on the reflected image; The reflectance map represents the reflectance component of an image, as shown in the following reflection image. The expression formula is obtained by reverse calculation: in, Reflectance map; For illumination; , Logarithmic reflectance, and It is a positive parameter. To supplement variables, For error; This represents the number of iterations. These are the weighting coefficients; for the image The segmentation threshold between foreground and background is denoted as The formula for calculating the exposure rate map is as follows: in, It is a reflection image; This represents the minimum illuminance. (13) Obtain the logarithmic reflectance from the reflectance map and calculate the spatial variation function; (14) Calculate the probability density function of the reconstructed image based on the spatial variation function; (15) Calculate the mapping function based on the probability density function of the reconstructed image; (16) Input the acquired image into the mapping function, and enhance it according to the exposure rate map and image intensity to obtain the enhanced image; (2) Convert the enhanced image into a grayscale matrix and perform noise reduction processing on it.

2. The image enhancement method according to claim 1, characterized in that, The formula for calculating the spatial variation function is as follows: , in, Represents the coordinates of a pixel. yes A set of adjacent coordinates, Is the factor Upsampling operator, At the resolution level, The total number of levels, This indicates the number of terms in the variable when its geometric mean is calculated.

3. The image enhancement method according to claim 2, characterized in that, The probability density function of the reconstructed image The following calculation formula is used: Wherein, probability density function Recorded as , This represents the Kronecker delta function. Each pixel The strength, It represents the total number of intensities.

4. The image enhancement method according to claim 3, characterized in that, The mapping function is calculated using the following formula: Wherein, cumulative distribution function Recorded as , This represents the cumulative distribution function of the output image.

5. The image enhancement method according to claim 4, characterized in that, The enhancement based on the exposure rate map and image intensity is performed using the following formula to obtain the enhanced image: in, For image intensity, This is an exposure rate chart. This indicates a division by element.

6. The image enhancement method according to claim 1, characterized in that, The denoising process employs a physics-based, extremely low-light raw denoising noise formation model.

7. An edge extraction method, characterized in that, In addition to the image enhancement method according to any one of claims 1-6, it also includes: Perform semantic segmentation on the denoised grayscale image; Convert the segmented image into a binary image; The amplitude scale of the multi-layer features of the binary image is normalized, and then dynamic feature fusion is performed to obtain the required edge features, thereby extracting the image edge.

8. The edge extraction method according to claim 7, characterized in that, The semantic segmentation of the denoised grayscale image includes: The denoised grayscale image is then fed into a deep convolutional neural network (DCNN) and an Atrous convolutional network for feature extraction. Post-processing using a fully connected CRF model yields semantic image segmentation results, including: Atrous convolution outputs a coarse segmentation result; Bilinear interpolation is used to restore the coarse segmentation results to the resolution of the original image; The input is fed into a fully connected CRF model to obtain the semantic image segmentation result; The process of converting the segmented image into a binary image uses adaptive thresholding.

9. The edge extraction method according to claim 7, characterized in that, The dynamic feature fusion is achieved by using machine learning to predict adaptive fusion weights for different locations in the multi-layer feature map, including at least one of the following: position-invariant fusion weights and position-adaptive fusion weights; wherein, For the position-invariant fusion weights, all positions in the feature map are treated equally, and a general fusion weight is adaptively learned based on the input; the fusion weights for the positions are dynamically generated based on the image content. For position-adaptive fusion weights, the fusion weights are adaptively adjusted according to the image position features, and the contribution of low-level features to accurately locate edges along the target contour is enhanced.

10. An application method of the edge extraction method as described in any one of claims 7-9 in product specification inspection, characterized in that, include: Acquire images of the product to be tested and perform camera calibration on them; The outline of the product to be tested is obtained by edge extraction method; The specifications of the product under test are converted based on the scale of the calibration plate calibrated by the camera to obtain the actual specifications of the product under test.

11. The application method according to claim 10, characterized in that, The acquisition of images of the product to be tested includes: Using a monocular industrial camera to acquire images of the product under test; Based on the single-point distortion-free camera imaging model, the camera is calibrated on the acquired images of the product under test.

12. The application method according to claim 10, characterized in that, The actual specifications of the product under test include at least one of the following: the actual area of ​​the product under test, and the actual length and width data of the product under test. The actual area of ​​the product to be tested is calculated using the following steps: Calculate the area within the maximum outline of the product under test to obtain the area represented by the pixel value of the product under test in the image. Then, perform a proportional conversion based on the area of ​​the calibration plate scale of the camera calibration to obtain the actual area of ​​the product under test. The actual length and width data of the product under test are calculated using the following steps: Determine the coordinates of the center point of the minimum circumscribed moment of the rotational profile of the product under test and the coordinates of the four corner points of the calibration frame, and draw the calibration frame; Using the standard dimensions of the calibration plate as a scale, the actual length and width of the product to be tested are obtained.

Citation Information

Patent Citations

  • Low-illumination image enhancement method

    CN113034395A