CN115761241A - Image enhancement method and application thereof - Google Patents
Image enhancement method and application thereof Download PDFInfo
- Publication number
- CN115761241A CN115761241A CN202211393128.XA CN202211393128A CN115761241A CN 115761241 A CN115761241 A CN 115761241A CN 202211393128 A CN202211393128 A CN 202211393128A CN 115761241 A CN115761241 A CN 115761241A
- Authority
- CN
- China
- Prior art keywords
- image
- product
- map
- camera
- fusion
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 230000004927 fusion Effects 0.000 claims abstract description 53
- 230000011218 segmentation Effects 0.000 claims abstract description 20
- 238000000605 extraction Methods 0.000 claims abstract description 18
- 230000004044 response Effects 0.000 claims abstract description 15
- 239000011159 matrix material Substances 0.000 claims abstract description 9
- 230000006870 function Effects 0.000 claims description 28
- 230000003044 adaptive effect Effects 0.000 claims description 16
- 238000003709 image segmentation Methods 0.000 claims description 14
- 238000002310 reflectometry Methods 0.000 claims description 14
- 238000005286 illumination Methods 0.000 claims description 12
- 238000013507 mapping Methods 0.000 claims description 11
- 238000004364 calculation method Methods 0.000 claims description 9
- 238000006243 chemical reaction Methods 0.000 claims description 7
- 230000008569 process Effects 0.000 claims description 6
- 230000001186 cumulative effect Effects 0.000 claims description 5
- 238000005315 distribution function Methods 0.000 claims description 5
- 238000003384 imaging method Methods 0.000 claims description 5
- 230000002708 enhancing effect Effects 0.000 claims description 4
- 238000012805 post-processing Methods 0.000 claims description 4
- 238000013528 artificial neural network Methods 0.000 claims description 2
- 238000007689 inspection Methods 0.000 claims description 2
- 238000010801 machine learning Methods 0.000 claims description 2
- 238000012360 testing method Methods 0.000 claims 1
- 238000001514 detection method Methods 0.000 abstract description 14
- 238000009826 distribution Methods 0.000 description 12
- 235000011869 dried fruits Nutrition 0.000 description 9
- 235000013311 vegetables Nutrition 0.000 description 9
- 238000010606 normalization Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 5
- 238000004590 computer program Methods 0.000 description 4
- 238000004422 calculation algorithm Methods 0.000 description 3
- 238000013139 quantization Methods 0.000 description 3
- 230000004913 activation Effects 0.000 description 2
- 238000001914 filtration Methods 0.000 description 2
- 238000007500 overflow downdraw method Methods 0.000 description 2
- 238000012549 training Methods 0.000 description 2
- 238000009827 uniform distribution Methods 0.000 description 2
- 208000037170 Delayed Emergence from Anesthesia Diseases 0.000 description 1
- 241000282326 Felis catus Species 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013527 convolutional neural network Methods 0.000 description 1
- 230000007797 corrosion Effects 0.000 description 1
- 238000005260 corrosion Methods 0.000 description 1
- 238000003708 edge detection Methods 0.000 description 1
- 239000012530 fluid Substances 0.000 description 1
- 235000012055 fruits and vegetables Nutrition 0.000 description 1
- 238000009499 grossing Methods 0.000 description 1
- 230000004298 light response Effects 0.000 description 1
- 238000012417 linear regression Methods 0.000 description 1
- 230000004807 localization Effects 0.000 description 1
- 238000005065 mining Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000011176 pooling Methods 0.000 description 1
- 238000005070 sampling Methods 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 238000013179 statistical model Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Images
Landscapes
- Image Analysis (AREA)
Abstract
The application discloses an image enhancement method and application thereof, wherein the image enhancement method carries out brightness constant processing on an acquired image through the enhancement of a constructed camera response model to obtain an enhanced image, and carries out denoising processing after the enhanced image is converted into a gray matrix image. The application also provides an edge extraction method based on the image enhancement method, and the edge extraction method is implemented by using a new SED model based on dynamic feature fusion, namely, semantic segmentation is carried out on the denoised gray level image, then the denoised gray level image is converted into a binary image, the amplitude scale of the multilayer features of the binary image is normalized, and then dynamic feature fusion is carried out to obtain the required edge features. The image enhancement method and the edge extraction method are upgraded, the application prospect is wide, the requirements of large batch and high precision of product size detection can be particularly met, and the manual pressure is reduced.
Description
Technical Field
The application belongs to the field of intelligent industry, and particularly relates to an image enhancement method and application thereof.
Background
At present, in the target screening and sorting process, the detection of the area and the size of a product mainly depends on a mold, manual intervention is needed, and a calibrated instrument with scales is used for finishing final detection and calibration, so that the problems of low efficiency and low accuracy exist. The contrast enhancement and histogram equalization in the image enhancement method can not suppress noise, and the smoothing mode can remove noise, but while denoising, the edge position of the resulting image is changed, the details are blurred or even lost, and the edge of the image is blurred. The nonlinear filtering can better maintain the position and the details of the image edge, but the algorithm is difficult to realize relative linear filtering. The Sobel operator detection method in the edge extraction method is not very high in precision, and the Laplacian operator method is sensitive to noise.
Disclosure of Invention
According to one aspect of the present application, there is provided an image enhancement method capable of revealing details hidden therein while preserving their naturalness, so as to make these images visually look more attractive and scientifically useful.
The image enhancement method comprises the following steps:
(1) Acquiring an acquired image, selecting a camera response model and calculating model parameters to obtain an enhanced image;
(2) And converting the enhanced image into a gray matrix image, and carrying out denoising treatment on the gray matrix image.
Preferably, step (1) comprises:
(11) Decomposing the collected image into a reflection component and an illumination component to obtain a reflection image;
(12) Calculating an exposure map and a reflectivity map according to the reflection image;
(13) Obtaining logarithmic reflectivity according to the reflectivity graph, and calculating a space variation function;
(14) Calculating a probability density function of the reconstructed image according to the spatial variation function;
(15) Calculating a mapping function according to the probability density function of the reconstructed image;
(16) And inputting the acquired image into the mapping function, and enhancing according to the exposure rate graph and the image intensity to obtain an enhanced image.
Preferably, the reflectivity map is a reflection component of an image, and is obtained by reversely calculating an expression formula of the reflection image I as follows:
s.t.r n ≤0and t≤i n .
wherein, R is a reflectivity graph; i = log (I) for illumination; t = log (T), I = log (I), R = log (R) is the logarithmic reflectivity, c 1 And c 2 Is a positive parameter, u is a supplementary variable and v is an error. n is the number of iterations; λ is a weight coefficient;
preferably, the calculation formula of the exposure rate map is as follows:
wherein I is a reflection image I min Is the minimum value of illumination;
preferably, the calculation formula of the spatial variation function is as follows:
where q denotes the coordinates of a pixel, N (q) is a set of adjacent coordinates of q, U (-) is a factor 2 i Upper mining ofSampling operators, i is the resolution level, L is the total number of levels, and L represents the number of terms of the variable when the geometric mean is carried out on the sampling operators;
preferably, the probability density function pdf of the reconstructed image adopts the following calculation formula:
wherein the probability density function pdf is expressed asDelta denotes the Kronecker function (Kronecker delta), a (q), K ∈ [0,K) is the intensity per pixel q, K is the total number of intensities.
Preferably, the mapping function adopts the following calculation formula:
wherein the cumulative distribution function cdf is denoted as P a (k),P b (k) Representing the cumulative distribution function of the output image.
Preferably, the enhancing according to the exposure map and the image intensity is as follows: j (T) is enhanced using the following formula, resulting in an enhanced image:
Preferably, the denoising process adopts a physics-based extremely low light original denoising noise forming model.
According to another aspect of the present application, there is provided an edge extraction method, after the image enhancement method, further comprising the steps of:
performing semantic segmentation on the denoised gray level image;
converting the segmented image into a binary image;
and normalizing the amplitude scale of the multilayer features of the binary image, and then performing dynamic feature fusion to obtain the required edge features, thereby extracting the image edge.
Preferably, the semantic segmentation of the denoised grayscale image includes:
inputting the denoised gray level image into a deep convolution neural network DCNN and an Atrous convolution in sequence, and extracting the characteristics;
and performing post-processing by adopting a full-connection CRF model to obtain a semantic image segmentation result.
Preferably, the performing post-processing by using a fully-connected CRF model to obtain a semantic image segmentation result includes:
outputting a rough segmentation result by the Atrous convolution;
restoring the rough segmentation result to the resolution of the original image by adopting bilinear interpolation;
and inputting the semantic image segmentation result into a full-connection CRF model to obtain a semantic image segmentation result.
Preferably, the converting the segmented image into a binary image adopts adaptive threshold segmentation.
Preferably, the dynamic characteristics are fused as: and predicting the adaptive fusion weight for different positions of the multilayer feature map by utilizing machine learning.
Preferably, the adaptive fusion weight comprises at least one of: a location-invariant fusion weight, a location-adaptive fusion weight; wherein,
for the fusion weight with invariable position, all positions in the feature map are treated equally, and the general fusion weight is learned adaptively according to specific input; dynamically generating a fusion weight value of a specific position according to the image content;
for the position-adaptive fusion weight, the fusion weight is adaptively adjusted according to the image position characteristics, and the contribution of the low-layer characteristics to the accurate positioning of the edge along the target contour is improved.
According to still another aspect of the present application, there is provided an application of an edge extraction method in product specification inspection, including the steps of:
collecting an image of a product to be detected, and calibrating a camera;
obtaining the outline of a product to be detected by an edge extraction method;
and converting the specification of the outline of the product to be detected according to the calibration plate scale calibrated by the camera to obtain the actual specification of the product to be detected.
Preferably, the acquiring the image of the product to be tested includes:
acquiring an image of a product to be detected by using a monocular industrial camera;
and carrying out camera calibration on the acquired image of the product to be detected according to the single-point undistorted camera imaging model.
Preferably, the actual specification of the product to be tested comprises at least one of the following: actual area of the product to be measured and actual length and width data of the product to be measured.
Preferably, the actual area of the product to be measured is calculated by the following steps:
and calculating the area in the maximum outline of the product to be measured to obtain the area represented by the pixel value of the product to be measured in the image, and performing proportional conversion according to the area of the scale plate calibrated by the camera to obtain the actual area of the product to be measured.
Preferably, the actual length and width data of the product to be tested is calculated by adopting the following steps:
determining the center point of the minimum external moment of the rotation outline of the product to be detected and the coordinates of four corner points of the calibration frame, and drawing the calibration frame;
and (5) taking the standard size of the calibration plate as a scale to obtain the actual length and width of the product to be measured.
The beneficial effects that this application can produce include:
1) The image enhancement method provided by the application is to decompose an image by using a measured adaptive model according to a Retinex theory. A new CRM is used to enhance the illumination of the image, while the reconstructed histogram equalization method locally enhances the reflectivity. The method locally enhances the low-light image to make its details dominant while adapting the Camera Response Model (CRM) to preserve the naturalness of the image.
2) According to the semantic image segmentation method provided by the application, a front end adopts a deep convolution network DCNN and an Atrous convolution to acquire a score map and generate a feature mapping map, and a rear end is fully connected with a CRF to perform semantic image segmentation; inputting the collected images into the convolutional neural network, and training to obtain a new model of weight and bias parameters; the model has higher robustness and better accuracy for the segmentation and identification of the target product and the background.
3) The edge extraction method provided by the application can be used for adaptively distributing different fusion weights for different input images and positions. This is achieved by the proposed weight learner to infer the appropriate fusion weights for the multi-level features for each position of the feature map from specific inputs. In this way, the heterogeneity contributed by the different locations of the feature map and the input image may be better taken into account, thereby facilitating the generation of more accurate and clearer edge predictions.
4) The product specification detection method provided by the application can realize real-time large-batch acquisition and detection, and has a set of complete algorithm flow with high robustness and good precision; and the self-adaptive threshold segmentation algorithm is skillfully designed, so that complicated operations such as fuzzy corrosion expansion and the like are omitted.
Drawings
FIG. 1 is a schematic view of a detection system employed in one embodiment of the present application;
FIG. 2 is an original image of a dried fruit and vegetable in one embodiment of the present application;
FIG. 3 is a schematic diagram of a semantic image segmentation result of a dried fruit and vegetable according to an embodiment of the present application;
FIG. 4 is a binary image of dried fruits and vegetables according to an embodiment of the present application;
FIG. 5 is a schematic diagram of dynamic feature extraction fusion according to an embodiment of the present application;
FIG. 6 is a diagram illustrating a dynamic feature weight learner, according to one embodiment of the present application;
fig. 7 is a diagram illustrating a length and width calibration result according to an embodiment of the present application.
Detailed Description
The present application will be described in detail with reference to examples, but the present application is not limited to these examples.
An image enhancement method, comprising:
(1) And acquiring the acquired image, selecting a camera response model and calculating model parameters to obtain an enhanced image.
The adopted method is divided into three parts:
the first part focuses on resolving 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.
First, we input the captured image, then select a camera response model and calculate the model parameters.
According to Retinex theory, any image T perceived by the human eye is described as:
where R is the reflection component of the image, i.e., the reflectance map, in the range of (0,1)]I is the illumination component of the image, i.e. the reflection image, in the range (0, ∞),representing pixel-by-pixel multiplication. All images are in vector form.
(11) Obtaining a reflection image I:
where I is illumination, T = R + I, T = log (T), R = log (R), I = log (I), R is log reflectivity, c is 1 And c 2 Is a positive parameter, a supplementary variable u and an error v, n being the number of iterations; λ is a weight coefficient;
(12) Calculating an exposure map S:
wherein, I min Is the minimum value of illumination;
(13) Obtaining a reflectance map R using the formula in step (11).
(14) Computing a spatial variation function φ (q):
where q denotes the coordinates of a pixel, N (q) is a set of adjacent coordinates of q, U (-) is a factor of 2 i L is the resolution level; i is the number of each of the levels,representing a geometric average thereof;
Where δ represents the Kronecker function (Kronecker delta), a (q), K ∈ [0,K) is the intensity per pixel q, K is the total number of intensities.
(16) Calculate mapping function J (k):
wherein the cumulative distribution function cdf is denoted as P a (k),P b (k) Indicating the cdf of the output image.
(17) Using the exposure map S, the image intensity P is enhanced by J (T) by the following equation:
(2) And converting the enhanced image into a gray matrix image, and carrying out denoising treatment on the gray matrix image. The imaging model of the RAW domain can be expressed as follows:
D=KI+N,
where I represents the number of charges photoelectrically converted, K represents the gain of the entire system, and N represents noise. Based on the expression, the distribution of noise forms in different processes is estimated.
The photoelectric sensor model adopted by the method is mainly based on a CMOS sensor. The steps of the method are divided into how the incident light is converted from photons to electrons, from electrons to voltages, and finally from voltages to numbers, to simulate an electronic imaging conduit of noise.
Firstly, photoelectric conversion is carried out, light rays irradiate the sensor through the lens module, and charges are excited, the process is random to some extent, the excited charges are related to the photoelectric conversion efficiency of the sensor and the size of each pixel on the sensor, but the process can be represented by Poisson distribution:
wherein N is p Referred to as photon shot noise,representing a poisson distribution. This type of noise depends on the light intensity, i.e. the signal. We assume a constant light response and noise the dark current N d Is absorbed into the read noise N read This will be described in the following step.
After photoelectric conversion, charge conversion to voltage follows. After collecting electrons at each location, they are typically integrated, amplified, and read out at the end of the exposure time as a measurable charge or voltage. Thermal noise N is taken into account in the model t Source follower noise N s And the band pattern noise N b . Absorbing multiple noise sources into one unified term, read noise:
N read =N d +N t +N s
N read ~TL(λ;0,σ TL ),
where λ and a represent the shape and scale parameters, respectively, and the position parameter is set to zero under the assumption of zero-mean noise.
Read noise was modeled by the Tukey lambda distribution (TL).
Finally, from voltage to number, the quantization noise, here modeled as a uniform distribution:
where q is the quantization step size.
Finally, the distribution of the noise is expressed as:
N=KN p +N read +N r +N q
of these, K, N p 、N read 、N r And N q Representing overall system gain, photon shot noise, read noise, line noise, and quantization noise, respectively.
After modeling the noise distribution, the estimation of the model parameters is left, and the parameters to be estimated can be seen from the expression of the noise model.
The method comprises the steps of estimating a K value through an image acquired in an environment with uniform illumination, estimating an image brightness I value, constructing a Poisson distribution, adding noise to I and multiplying the noise by the K value, and simulating shot noiseN p . To analyze the noise distribution, the average value of each row of the image is calculated, then a mean and variance estimation is performed to estimate the scale of the banding pattern noise, then the banding pattern noise is subtracted by bias images, a statistical model is used to fit the remaining residual error, and finally a combined parameter distribution model is obtained:
wherein U (·,) represents a uniform distribution,representing a gaussian distribution.Andthe overall system gain estimated at the minimum and maximum ISO of the camera, respectively. a and b represent the slope and intercept, respectively, of the fitted line.Is an unbiased estimate of the standard deviation of the linear regression under the assumption of gaussian error.
From this set of parameter distributions, an estimation of the noise can be made, simulating the noise distribution of the real environment. And finally, successfully denoising the image through a denoising noise forming model (ELD).
In one embodiment, an edge extraction method further includes, after the image enhancement method, the steps of:
(3) And performing semantic segmentation on the denoised gray level image. A model is constructed, the front end of the model is formed by deep convolution networks DCNN and Atrous convolution, the model is mainly used for generating a feature mapping image according to a score map, and finally, full-connection CRF is applied to semantic image segmentation. The acquired images are substituted into the network for training to obtain weights and bias parameters, and the model has higher robustness and better accuracy for the segmentation and identification of the product and the background.
And the deep convolution network DCNN selects VGG-16 or ResNet-101 to use in a complete convolution mode.
The Atrous convolution performs dense feature extraction, which can reduce the degree of signal downsampling. The output y [ i ] of an Atrous convolution of a one-dimensional input signal x [ i ] with a filter w [ k ] of length k can be defined as:
i represents each position, y represents the corresponding output, w is the convolution kernel, x represents the input feature map, r represents the proportion of each hole, and is also the step size.
I.e. a coarse segmentation result is obtained.
And adopting bilinear interpolation to the rough segmentation result, and amplifying the rough segmentation result to the resolution of the original image. The fully connected CRF is then applied to refine the segmentation result and better capture the object boundaries, resulting in a semantic image segmentation result, as shown in fig. 3.
The fully-connected CRF model adopts the following energy function:
where x is the label assignment for the pixel. We use a unary function θ i (x i )=-log P(x i ) Wherein P (x) i ) Is the label assignment probability at pixel i computed by DCNN.
(4) Converting the segmented image into a binary image, specifically comprising: the semantic image segmentation result is combined with local histogram adaptation by using the greater fluid threshold method to obtain a binary image, as shown in fig. 4.
For image I (x, y), the segmentation threshold of foreground (target) and background is denoted as T, and the proportion of the number of pixels belonging to foreground in the whole image is denoted as omega 0 Average gray level mu of 0 (ii) a The proportion of the number of background pixels to the whole image is omega 1 Average gray of μ 1 . The between-class variance is denoted as g. The background of the image is dark, and the size of the image is M × N. The between-class variance formula:
g=ω 0 ω 1 (μ 0 -μ 1 ) 2
and obtaining the threshold T which enables the inter-class variance g to be maximum by adopting a traversal method, namely obtaining the threshold T.
(5) Normalizing the amplitude scale of the multilayer features of the binary image, and then performing dynamic feature fusion to obtain the required edge features, thereby extracting the image edge, wherein the specific model is as follows: the multilevel features are fused by two modules:
1) Normalizing the amplitude scale of the multilevel features by a feature extractor with a normalizer;
2) And the self-adaptive weight fusion module learns the self-adaptive fusion weights of different positions of the multi-level feature mapping.
The overall architecture of the model adopted comprises two parts (a) and (b) as shown in fig. 5 and 6 respectively:
(a)
1) The input image is fed to the ResNet backbone to produce a set of features (response maps) of different scales.
2) The edge feature normalization block is connected to the first three stacks and the fifth stack of the remaining blocks, generating Side1-3 and Side5 response maps with the same response size.
3) A shared connection (formula below) is used to connect Side1-3 and Side5.
Wherein, { A side1 ,A side2 ,A side3 Is a three-channel profile, A side5 Is a K-channel class activation map. Where K is the number of categories. A. The cat Activation of a graph for a connection
4) The side5-w feature normalization block, followed by the location adaptive weight learning block, forms another branch of the res5 extension, predicting the dynamic location-aware fusion weights Ψ (x).
5) The element multiplication and class summation is then applied to the location-aware fusion weights Ψ (x), and the concatenated response mapAcatto is used to generate the final fusion output taf.
6) Semantic loss is used to supervise the easide5 and final fused output.
(b) And respectively taking the feature mapping as input by the position-invariant weight learner and the position-adaptive weight learner, and outputting a position-invariant fusion weight and a position-adaptive fusion weight Ψ (x).
1) The main network still adopts resnet-101, standardized feature maps with the number of channels being 1 are extracted in the first three stages, standardized feature maps with the number of channels being k and 4k are extracted in the fifth stage, and the feature maps extracted in the first three stages and the k feature maps extracted in the fifth stage are used for shared localization to generate 4k connection feature maps.
2) 4k normalized feature maps extracted in the fifth stage are used to obtain 4k H W weight maps through the learning of the adaptive weight learner, so that the weight parameter 4k H W is equal to the number of pixel points of the connection feature maps, and each pixel point of the connection feature maps has a corresponding weight instead of the prior art that the weights of all the pixel points of the same connection feature maps are the same.
3) These weights are then used for fusion.
4) The adaptive weight learner structure, see fig. b above, which replaces the full connection in the original location-invariant weight learner structure with 1*1 convolution and removes the global pooling operation, so that the original number of weight parameters that can only obtain 1 x 4k becomes H x W4 k.
Dynamic feature fusion:
1) And the characteristic extraction module with normalization is used for normalizing the amplitude scale of the multilayer characteristic. This module handles scale changes of multi-layer responses by normalizing their sizes prior to feature fusion.
2) And the self-adaptive weight fusion module learns the self-adaptive fusion weights for different positions of the multilayer characteristic diagram.
There are two different schemes for predicting adaptive fusion weights
Location-invariant fusion weights: all positions in the feature map are treated equally and the generic fusion weights are adaptively learned according to the specific input. And dynamically generating a fusion weight value of a specific position according to the image content.
Location-adaptive fusion weights: and adaptively adjusting the fusion weight according to the image position characteristic, and improving the contribution of the low-layer characteristic to the accurate positioning of the edge along the target contour.
Comparing CASENTet:
an adaptive weight learner is used to actively learn fusion weights based on the feature map itself, the fusion output being formulated as follows:
A fuse =f(A side ;Ψ(x)),
wherein x represents a 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 depend explicitly on the feature map x. Different input feature maps will result in different parameters Ψ (x), resulting in a dynamic modification of the adaptive weight learner f. In this way, the semantic edge detection model can adapt to the input image quickly and learn the appropriate multilevel response fusion weights in an end-to-end manner.
With respect to Ψ (x), there are two adaptive weight learners, i.e., a location-invariant weight learner and a location-adaptive weight learner, corresponding to the two fused weight schemes. The total fusion weight learned by the learner with the position invariant weight is 4K, and is shared by all positions of the feature map to be fused as shown in the following formula:
however, the position adaptive weight learner generates 4K fusion weights for each spatial position, which in total yields H × W × 4K weight parameters.
Ψ(x)=(w s,t ),s∈[1,H],t∈[1,W]
A location-invariant weight learner generates a generic fusion weight for all locations, while a location-adaptive weight learner customizes the fusion weight for each location based on spatial variation.
The network structure is as follows:
the side feature normalization block is connected to the first three and fifth remaining block stacks. The block consists of a 1 × 1 convolutional layer, a Batch Normalization (BN) layer, and an anti-convolutional layer. The 1 × 1 convolutional layers generate single-channel and K-channel response maps for Side1-3 and Side5, respectively. The BN layer is applied to the output of the 1 x 1 convolutional layer to normalize the multi-level response of the same magnitude. The response map is then up-sampled using the deconvolution layer to the original image size.
The other side feature normalization block is connected to a fifth stack of residual blocks, where a 4K channel feature map is generated. The adaptive weight learner then receives the output of the Side5-w feature normalization block to predict the dynamic fusion weights ω (x). Thereby ultimately obtaining the desired edge feature.
As shown in fig. 1, the product specification detection system designed by the present application uses a monocular industrial camera in the system to acquire images of a product to be detected.
Taking specification detection of dried fruits and vegetables as an example, the product specification detection method comprises the following steps:
the method comprises the following steps: the method comprises the steps of adopting a monocular industrial camera in a detection system to carry out batch image acquisition on dried fruit and vegetables, adopting an image acquired by a Zhang Zhengyou method to carry out camera calibration, correcting distortion of the monocular industrial camera, and obtaining an original image of the dried fruit and vegetables as shown in figure 2.
The Zhang Zhengyou method is a single-point undistorted camera imaging model as follows:
f is the distance; the amount of the dX is greater than the total amount of the dX,dY represents the physical length of a pixel on the camera plate in the X, Y directions (i.e., how many millimeters a pixel is on the plate), respectively; u. of 0 、v 0 Representing the coordinates of the center of the camera light-sensing plate under the pixel coordinates; θ represents an angle between the lateral and longitudinal edges of the light-sensing plate (where 90 degrees indicates no error). (U, V, W) is the physical coordinate of a point in a world coordinate system, (U, V) is the pixel coordinate of the point in a pixel coordinate system, and Z is a scale factor;
referred to as the camera's external reference matrix, which depends on the relative positions of the camera coordinate system and the world coordinate system, R denotes the rotation matrix and T denotes the translation vector.
Step two: and obtaining the outline of the product to be detected by using the edge extraction method.
Step three: and calculating the area in the maximum outline to obtain the area represented by the pixel value of the dry fruit and vegetable to be detected in the image. And carrying out proportional conversion on the pixel value and the area of the scale of the calibration plate to obtain the actual area of the dried fruit and vegetable to be measured. The real area Cal _ area of the calibration plate under the fixed view field, the pixel area Pix _ area of the calibration plate for image acquisition, the pixel area Pobj _ area in the acquired object outline, and the actual area Obj _ area of the object to be measured.
Step four: and determining the central point of the minimum external moment of the rotation profile of the dried fruit and vegetable to be detected and the coordinates of four angular points of the calibration frame, and drawing the calibration frame.
Step five: calculating the ratio of the side length pixel Pix _ cal of the calibration board to the actual Euclidean distance Dist _ cal of the calibration board according to the following formula:
converting the proportional numerical value and the pixel value Pix of the object calibration frame of each picture to obtain the actual size Obj of the object:
Obj=ratio*Pix
the actual size of the dried fruit and vegetable to be tested is displayed next to the calibration frame (1 decimal place is shown in the image), as shown in fig. 6.
The application provides a product specification detection system, which comprises a processor and a memory; the memory stores a computer program, and the processor implements part or all of the steps of the product specification detection method when executing the computer program.
The application also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize part or all of the steps of the product specification detection method.
Although the present application has been described with reference to a few embodiments, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the application as defined by the appended claims.
Claims (10)
1. An image enhancement method, comprising:
(1) Acquiring an acquired image, selecting a camera response model and calculating model parameters to obtain an enhanced image;
(2) And converting the enhanced image into a gray matrix image, and carrying out denoising treatment on the gray matrix image.
2. The image enhancement method according to claim 1, wherein step (1) comprises:
(11) Decomposing the collected image into a reflection component and an illumination component to obtain a reflection image;
(12) Calculating an exposure map and a reflectivity map according to the reflection image;
(13) Obtaining logarithmic reflectivity according to the reflectivity graph, and calculating a space variation function;
(14) Calculating a probability density function of the reconstructed image according to the spatial variation function;
(15) Calculating a mapping function according to the probability density function of the reconstructed image;
(16) And inputting the acquired image into the mapping function, and enhancing according to the exposure rate image and the image intensity to obtain an enhanced image.
3. The image enhancement method according to claim 2, wherein the reflectivity map is a reflection component of an image, and is obtained by inverse calculation of an expression formula of the reflection image I as follows:
s.t.r n ≤0 and t≤i n
wherein R is a reflectivity graph; i = log (I) is the illumination; t = log (T), I = log (I), R = log (R) is the logarithmic reflectivity, c 1 And c 2 Is a positive parameter, u is a supplementary variable, and v is an error; n is the number of iterations; λ is a weight coefficient;
preferably, the calculation formula of the exposure rate map is as follows:
wherein I is a reflection image; i is min Is the minimum value of the illumination;
preferably, the calculation formula of the spatial variation function is as follows:
wherein q represents the coordinates of a pixel, and N (q) isq, U (-) is a factor of 2 i I is the resolution level, L is the total number of levels, and L represents the number of terms of the variable when the geometric mean is carried out on the variable;
preferably, the probability density function pdf of the reconstructed image adopts the following calculation formula:
wherein the probability density function pdf is expressed asδ represents the Kronecker function (Kronecker delta), a (q), K ∈ [0,K) is the intensity of each pixel q, K is the total number of intensities;
preferably, the mapping function uses the following calculation formula:
wherein the cumulative distribution function cdf is denoted as P a (k),P b (k) A cumulative distribution function representing an output image;
preferably, the enhancing according to the exposure map and the image intensity is as follows: j (T) is enhanced using the following formula, resulting in an enhanced image:
4. The image enhancement method of claim 1, wherein the denoising process employs a physics-based very low-light raw denoising noise-forming model.
5. An edge extraction method, characterized by comprising, in addition to the image enhancement method of any one of claims 1 to 4:
performing semantic segmentation on the denoised gray level image;
converting the segmented image into a binary image;
and normalizing the amplitude scale of the multilayer features of the binary image, and then performing dynamic feature fusion to obtain the required edge features, thereby extracting the image edge.
6. The edge extraction method as claimed in claim 5, wherein the semantic segmentation of the denoised grayscale image comprises:
inputting the denoised gray level image into a deep convolution neural network DCNN and an Atrous convolution in sequence, and extracting the characteristics;
performing post-processing by adopting a full-connection CRF model to obtain a semantic image segmentation result;
preferably, the performing post-processing by using a fully-connected CRF model to obtain a semantic image segmentation result includes:
outputting a rough segmentation result by the Atrous convolution;
restoring the rough segmentation result to the resolution of the original image by adopting bilinear interpolation;
inputting the semantic image segmentation result into a full-connection CRF model to obtain a semantic image segmentation result;
preferably, the converting the segmented image into a binary image adopts adaptive threshold segmentation.
7. The edge extraction method according to claim 5, wherein the dynamic features are fused as: predicting self-adaptive fusion weights for different positions of the multilayer feature map by utilizing machine learning;
preferably, the adaptive fusion weight comprises at least one of: a location-invariant fusion weight, a location-adaptive fusion weight; wherein,
for the fusion weight with invariable positions, all the positions in the feature map are treated equally, and the universal fusion weight is learned in a self-adaptive manner according to specific input; dynamically generating a fusion weight value of a specific position according to the image content;
for the position-adaptive fusion weight, the fusion weight is adaptively adjusted according to the image position characteristics, and the contribution of the low-layer characteristics to the accurate positioning of the edge along the target contour is improved.
8. Use of the edge extraction method according to any one of claims 5 to 7 in product specification inspection, comprising:
collecting an image of a product to be detected, and calibrating a camera;
obtaining the outline of a product to be detected by an edge extraction method;
and converting the specification of the outline of the product to be detected according to the calibration plate scale calibrated by the camera to obtain the actual specification of the product to be detected.
9. The product specification testing method of claim 8, wherein said collecting an image of a product to be tested comprises:
acquiring an image of a product to be detected by using a monocular industrial camera;
and carrying out camera calibration on the acquired image of the product to be detected according to the single-point undistorted camera imaging model.
10. The product specification detecting method according to claim 8, wherein the actual specification of the product to be detected comprises at least one of: actual area of the product to be tested and actual length and width data of the product to be tested;
preferably, the actual area of the product to be measured is calculated by the following steps:
calculating the area in the maximum outline of the product to be measured to obtain the area represented by the pixel value of the product to be measured in the image, and carrying out proportional conversion according to the area of a scale plate calibrated by a camera to obtain the actual area of the product to be measured;
preferably, the actual length and width data of the product to be tested is calculated by adopting the following steps:
determining the center point of the minimum external moment of the rotation outline of the product to be detected and the coordinates of four corner points of the calibration frame, and drawing the calibration frame;
and taking the standard size of the calibration plate as a scale to obtain the actual length and width of the product to be measured.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211393128.XA CN115761241A (en) | 2022-11-08 | 2022-11-08 | Image enhancement method and application thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211393128.XA CN115761241A (en) | 2022-11-08 | 2022-11-08 | Image enhancement method and application thereof |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115761241A true CN115761241A (en) | 2023-03-07 |
Family
ID=85368243
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211393128.XA Pending CN115761241A (en) | 2022-11-08 | 2022-11-08 | Image enhancement method and application thereof |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115761241A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116228589A (en) * | 2023-03-22 | 2023-06-06 | 新创碳谷集团有限公司 | Method, equipment and storage medium for eliminating noise points of visual inspection camera |
-
2022
- 2022-11-08 CN CN202211393128.XA patent/CN115761241A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116228589A (en) * | 2023-03-22 | 2023-06-06 | 新创碳谷集团有限公司 | Method, equipment and storage medium for eliminating noise points of visual inspection camera |
CN116228589B (en) * | 2023-03-22 | 2023-08-29 | 新创碳谷集团有限公司 | Method, equipment and storage medium for eliminating noise points of visual inspection camera |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Hosseini et al. | Encoding visual sensitivity by maxpol convolution filters for image sharpness assessment | |
Liu et al. | Additive white Gaussian noise level estimation in SVD domain for images | |
Aslantas et al. | A comparison of criterion functions for fusion of multi-focus noisy images | |
Raihan A et al. | Review of underwater image restoration algorithms | |
CN112819772A (en) | High-precision rapid pattern detection and identification method | |
Singh et al. | A comparative analysis of illumination estimation based Image Enhancement techniques | |
CN113808036B (en) | Low-illumination image enhancement and denoising method based on Retinex model | |
CN112200848B (en) | Depth camera vision enhancement method and system under low-illumination weak-contrast complex environment | |
Iwasokun et al. | Image enhancement methods: a review | |
CN114022383A (en) | Moire pattern removing method and device for character image and electronic equipment | |
Lei et al. | Low-light image enhancement using the cell vibration model | |
John et al. | Enhancement of weather degraded video sequences using wavelet fusion | |
CN115761241A (en) | Image enhancement method and application thereof | |
Patil et al. | Bilateral filter for image denoising | |
CN113781375B (en) | Vehicle-mounted vision enhancement method based on multi-exposure fusion | |
Gupta et al. | A novel finetuned YOLOv8 model for real-time underwater trash detection | |
CN117830134A (en) | Infrared image enhancement method and system based on mixed filtering decomposition and image fusion | |
CN114066786A (en) | Infrared and visible light image fusion method based on sparsity and filter | |
Ayoub et al. | Video quality enhancement using recursive deep residual learning network | |
Chowdhury et al. | Eradication of Salt and Pepper Noise from a Tumorous MRI image using SNPRB Filter | |
CN115115653A (en) | Refined temperature calibration method for cold and hot impact test box | |
Narasimharao et al. | Advanced Techniques for Color Image Blind Deconvolution to Restore Blurred Images | |
AKINTOYE et al. | COMPOSITE MEDIAN WIENER FILTER BASED TECHNIQUE FOR IMAGE ENHANCEMENT. | |
Nasrin Jumana et al. | Methods of Image Enhancement in Low-light Situations | |
Wu et al. | Contrast enhancement based on discriminative co-occurrence statistics |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |