Image enhancement method and device based on adaptive gamma correction, equipment and medium
Automatically determine the gamma value through backpropagation neural network and particle swarm algorithm, solving the problem of inaccurate gamma value and manual adjustment in the prior art, and achieving efficient and automatic image enhancement effect.
Patent Information
- Application Number
- CN202411609557.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-02-07
AI Technical Summary
The existing gamma correction algorithm requires manual selection of gamma values, resulting in inaccurate gamma values, affecting the image enhancement effect, and requires multiple manual adjustments to achieve the optimal effect, reducing the efficiency of NMR image enhancement.
The backpropagation neural network is used to combine the particle swarm algorithm to automatically determine the gamma value. By building a backpropagation neural network, the initial weight and threshold are optimized using the particle swarm model, the model is trained to obtain the image pixel difference value, and the target gamma value is determined based on the difference value and target weight, and gamma correction is performed.
The automatic and accurate value selection of gamma values is realized, which improves the image enhancement effect and efficiency of magnetic resonance images, and avoids the tedious process of manual adjustment.
Smart Images

Figure CN119399047A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image enhancement method, device, equipment and medium based on adaptive gamma correction. Background Art
[0002] With the rapid development of high-tech industries, imaging technology in the medical field has also been greatly improved, and the quality requirements for medical imaging are also getting higher and higher. Magnetic resonance imaging (MRI) images are a digital imaging technology, a reconstructed grayscale image, and the quality of its image is directly related to the accuracy of disease diagnosis. However, the MRI scanning process is often disturbed by the external environment, which may passively introduce noise and metal artifacts, reduce the clarity of the image, and interfere with the correct diagnosis of the lesion. Therefore, it is necessary to enhance the scanned nuclear magnetic resonance images. Image enhancement refers to the pre-processing of images through certain algorithms and technologies to improve the quality, contrast and clarity of the image, thereby improving the visual effect of the image. Traditional solutions perform image enhancement through histogram equalization or Retinex algorithm, Laplace enhancement algorithm, etc. However, histogram equalization may lead to image grayscale merging, especially in under-sampling areas, which is prone to introducing noise; the Retinex algorithm takes a long time to process the image, which can easily cause halo phenomenon at the edge of the image, causing image distortion and poor image enhancement effect; the Laplace enhancement algorithm relies on the simplest homogeneous filter, which makes it not sensitive enough to the direction of image transformation, resulting in regional differences in image enhancement.
[0003] In the prior art, a digital image enhancement algorithm based on gamma correction is proposed, which has the advantages of improving the visualization of MBI images, correcting the brightness, saturation and contrast of nuclear magnetic resonance images, and its algorithm operation is simple, which can reduce image noise while improving image clarity. However, the existing gamma correction algorithm requires manual selection and setting of the gamma value (gamma) based on subjective feelings and experience in advance, resulting in inaccurate gamma values, which affects the image enhancement effect. If you want to achieve the best effect, you need to manually adjust the gamma value multiple times to observe the image enhancement effect, which greatly reduces the efficiency of nuclear magnetic resonance image enhancement. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide an image enhancement method, device, equipment and medium based on adaptive gamma correction, which can improve the image enhancement effect and improve the image enhancement efficiency. The specific scheme is as follows: In a first aspect, the present application discloses an image enhancement method based on adaptive gamma correction, comprising: Constructing a back-propagation neural network, and using a particle swarm model to determine the initial weights and initial thresholds of the back-propagation neural network, so as to perform model training on the back-propagation neural network according to the initial weights and the initial thresholds to obtain a back-propagation neural network model; Inputting the magnetic resonance image to be enhanced into the back propagation neural network model, and obtaining the image pixel difference of the magnetic resonance image to be enhanced according to the output of the back propagation neural network model; Based on the image pixel difference and a preset target weight, a target gamma value corresponding to the magnetic resonance image to be enhanced is determined, and gamma correction is performed on the magnetic resonance image to be enhanced according to the target gamma value to obtain an enhanced magnetic resonance image.
[0005] Optionally, before using the particle swarm algorithm to determine the initial weights and initial thresholds of the back propagation neural network, the method further includes: Initialize the particle swarm model and configure the training dimension, inertia factor and acceleration factor; The goal of the particle swarm model is to find the optimal initial weights and thresholds of the back propagation neural network; the training dimension is determined according to the array dimension of the magnetic resonance image to be enhanced.
[0006] Optionally, the constructing of a back propagation neural network includes: Constructing the back propagation neural network in the order of input layer, hidden layer and output layer; The number of nodes in the input layer is equal to the number of scanning layers of the magnetic resonance image to be enhanced, the number of neurons in the hidden layer is a target multiple of the number of neurons in the input layer, and the number of neurons in the output layer is 1.
[0007] Optionally, the determining the initial weights and initial thresholds of the back propagation neural network by using a particle swarm model includes: The fitness function is used to calculate the fitness value of each particle in the particle swarm model, so that the particle iteratively updates the position and speed according to the fitness value; When the algorithm termination condition is met, the initial weight and initial threshold of the back propagation neural network are determined according to the global extreme value of the particle swarm model.
[0008] Optionally, the particle iteratively updates the position and speed according to the fitness value, including: If the algorithm termination condition is not met within a preset number of iterations, the training dimension, inertia factor and acceleration factor of the particle swarm model are adjusted.
[0009] Optionally, inputting the magnetic resonance image to be enhanced into the back propagation neural network model, and obtaining the image pixel difference of the magnetic resonance image to be enhanced according to the output of the back propagation neural network model, comprises: Based on the data information of the K space corresponding to each layer of the magnetic resonance image to be enhanced, the image pixel difference of the magnetic resonance image to be enhanced is determined by using the back propagation neural network model; the K space is used to store frequency information.
[0010] Optionally, before determining the target gamma value corresponding to the magnetic resonance image to be enhanced based on the image pixel difference and a preset target weight, the method further includes: The target weight is determined based on the image quality, signal-to-noise ratio and pixel distribution corresponding to the magnetic resonance image to be enhanced.
[0011] In a second aspect, the present application discloses an image enhancement device based on adaptive gamma correction, comprising: An initial weight threshold determination module is used to construct a back propagation neural network and determine the initial weight and initial threshold of the back propagation neural network using a particle swarm model, so as to perform model training on the back propagation neural network according to the initial weight and the initial threshold to obtain a back propagation neural network model; An image pixel difference determination module, used for inputting the magnetic resonance image to be enhanced into the back propagation neural network model, and obtaining the image pixel difference value of the magnetic resonance image to be enhanced according to the output of the back propagation neural network model; The image enhancement module is used to determine the target gamma value corresponding to the magnetic resonance image to be enhanced based on the image pixel difference and the preset target weight, and perform gamma correction on the magnetic resonance image to be enhanced according to the target gamma value to obtain an enhanced magnetic resonance image.
[0012] In a third aspect, the present application discloses an electronic device, comprising: Memory, used to store computer programs; A processor is used to execute the computer program to implement the aforementioned image enhancement method based on adaptive gamma correction.
[0013] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein when the computer program is executed by a processor, the aforementioned image enhancement method based on adaptive gamma correction is implemented.
[0014] In the present application, a back propagation neural network is constructed, and the initial weights and initial thresholds of the back propagation neural network are determined using a particle swarm model, so that the back propagation neural network is trained according to the initial weights and the initial thresholds to obtain a back propagation neural network model; the magnetic resonance image to be enhanced is input into the back propagation neural network model, and the image pixel difference of the magnetic resonance image to be enhanced is obtained according to the output of the back propagation neural network model; based on the image pixel difference and the preset target weight, the target gamma value corresponding to the magnetic resonance image to be enhanced is determined, and the magnetic resonance image to be enhanced is gamma corrected according to the target gamma value to obtain an enhanced magnetic resonance image. It can be seen that by obtaining the image pixel difference of the magnetic resonance image to be enhanced through the back propagation neural network model, automatically generating the target gamma value based on the image pixel difference, and realizing the automatic and accurate value of the gamma value, the image enhancement effect of the magnetic resonance image can be improved, and the image enhancement efficiency can be improved. In addition, the particle swarm algorithm is used to optimize the back propagation neural network. Its advantage of fast convergence speed and easy to find the global optimal point is used to optimize the initial weight value and threshold of the neural network, accelerate the convergence speed, improve the accuracy of the back propagation neural network, improve the accuracy of image pixel difference calculation, and improve image enhancement efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0016] FIG1 is a flow chart of an image enhancement method based on adaptive gamma correction provided by the present application; FIG2 is a schematic diagram of a gamma correction expression curve; FIG3 is a flowchart of a specific image enhancement method based on adaptive gamma correction provided by the present application; FIG4 is a magnetic resonance image to be enhanced provided by the present application; FIG5 is an enhanced image and a corresponding image histogram after the image of FIG4 is enhanced by three methods respectively; FIG6 is another magnetic resonance image to be enhanced provided by the present application; FIG7 is an enhanced image and a corresponding image histogram after the image of FIG6 is enhanced by three methods respectively; FIG8 is a schematic diagram of the structure of an image enhancement device based on adaptive gamma correction provided by the present application; FIG. 9 is a structural diagram of an electronic device provided in this application. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] In the prior art, a digital image enhancement algorithm based on gamma correction is proposed, which has the advantages of improving the visualization of MBI images and correcting the brightness, saturation and contrast of nuclear magnetic resonance images. In addition, the algorithm is simple to operate and can reduce image noise while improving image clarity. However, the existing gamma correction algorithm requires manual selection and setting of the gamma value based on subjective feelings and experience in advance, resulting in inaccurate gamma values, which affects the image enhancement effect. If you want to achieve the optimal effect, you need to manually adjust the gamma value multiple times to observe the image enhancement effect, which greatly reduces the efficiency of nuclear magnetic resonance image enhancement. In order to overcome the above technical problems, the present application proposes an image enhancement method based on adaptive gamma correction, which can improve the image enhancement effect and improve the image enhancement efficiency.
[0019] The present application embodiment discloses an image enhancement method based on adaptive gamma correction. Referring to FIG1 , the method may include the following steps: Step S11: construct a back propagation neural network, and use a particle swarm model to determine the initial weights and initial thresholds of the back propagation neural network, so as to perform model training on the back propagation neural network according to the initial weights and the initial thresholds to obtain a back propagation neural network model.
[0020] It is understandable that in order to solve the problem that the gamma value needs to be manually set based on experience in the prior art, the present application uses a back propagation neural network to extract the image pixel difference and determine the gamma value based on the image pixel difference. Back propagation neural network (BP (back propagation) neural network) is a multi-layer feedforward network that is trained by error back propagation. The multi-layer feedforward of the neural network refers to the introduction of at least one hidden layer between the input layer and the output layer during the operation of the neural network. The specific number of layers depends on the actual situation. The three-layer index structure transforms the perceptron of the calculation single layer into a multi-layer perceptron. However, the BP neural network still has some shortcomings that restrict the accuracy of the final output result and the running speed of the algorithm; for example, the BP neural network is greatly affected by the initial weights and thresholds. If the selection is improper, it is very easy to fall into the local minimum; the local minimum refers to the process of training. After multiple iterations (epochs), if the loss value (loss) does not decrease significantly, it may be because the gradient value is too small or even close to zero, which ultimately leads to a slow parameter update or even close to 0 during the iteration process, so the parameters cannot obtain the latest updated value, and the loss will no longer change. Falling into the local minimum has a great influence on the accuracy of the final expected value. At the same time, because the BP neural network adopts a gradient descent method, its training time is long and the number of iterative results is large, which will eventually lead to the disadvantages of poor data convergence and slow convergence speed, and cannot meet the fast calculation of intelligent pattern recognition.
[0021] In order to solve the drawbacks of BP neural network, this application uses particle swarm optimization (PSO) to optimize BP neural network. Particle swarm algorithm is an intelligent optimization algorithm that simulates bird foraging behavior. This algorithm is an intelligent group algorithm that simulates bird groups when collectively foraging. This optimization algorithm requires relatively few parameters to be adjusted, the operation process is relatively simple, and the convergence speed is very fast. It can provide initial weights and thresholds for BP neural network training, thereby effectively avoiding the drawbacks of falling into local minima. The advantages of particle swarm convergence speed and easy to find the global optimum are used to optimize the initial weights and thresholds of the neural network. The neural network optimized by particle swarm algorithm can well overcome the disadvantage that the population is prone to fall into local minima after training. The back propagation neural network model based on particle swarm optimization accelerates the convergence speed while improving the prediction accuracy of the image data model.
[0022] In this embodiment, before using the particle swarm algorithm to determine the initial weights and initial thresholds of the back propagation neural network, the following steps are also included: initializing the particle swarm model and configuring the training dimension, inertia factor and acceleration factor; wherein the goal of the particle swarm model is to find the optimal initial weights and thresholds of the back propagation neural network; the training dimension is determined according to the array dimension of the magnetic resonance image to be enhanced. That is, the particle swarm algorithm is initialized according to the magnetic resonance image to be enhanced obtained by scanning, that is, the dimension N of the particle swarm training, the initial inertia factor w, the acceleration factors c1 and c2 are defined as initial values; wherein the dimension N can determine the training dimension according to the dimension size of the array of the nuclear magnetic resonance image.
[0023] In this embodiment, the construction of the back propagation neural network includes: constructing the back propagation neural network in the order of input layer, hidden layer and output layer; wherein the number of nodes in the input layer is equal to the number of scanning layers of the magnetic resonance image to be enhanced, the number of neurons in the hidden layer is the target multiple of the number of neurons in the input layer, and the number of neurons in the output layer is 1. The BP neural network is a multi-layer feedforward network, and its network structure is composed of an input layer, a hidden layer, and an output layer. Different weights and thresholds are used as the medium for network calculation between each layer. When training the image model, the number of input layers of the BP neural network is determined according to the number of MRI scanning layers. The number of neurons in the hidden layer is selected according to the generalized training theory, which is 1.5 times that of the input layer. At the same time, what needs to be obtained is the pixel difference error between each image, so the number of neurons in the output layer is set to 1. The calculation weight matrix and threshold matrix between the input layer and the hidden layer can be shown as follows: ; ; Among them, P represents the weight matrix between the first layer input and the hidden layer; Q represents the weight matrix between the hidden layer input and the third layer; D represents the threshold matrix between each layer; k, m and n are the number of neurons between the input layer, hidden layer and output layer respectively. The back propagation neural network model is trained by using multiple magnetic resonance image samples and the optimal gamma value corresponding to each sample for multiple iterations of training.
[0024] Furthermore, the use of the particle swarm model to determine the initial weights and initial thresholds of the back propagation neural network includes: using the fitness function to calculate the fitness value of each particle in the particle swarm model so that the particle iteratively updates the position and speed according to the fitness value; when the algorithm termination condition is met, the initial weights and initial thresholds of the back propagation neural network are determined according to the global extreme value of the particle swarm model. It can be understood that in the calculation process of the particle swarm algorithm, each particle represents a potential advantage solution, and they carry their own position information and speed information respectively. The position of the particle represents the interconnection weight between neurons, and the speed of the particle is used to update the group weight. The solution required in the problem is regarded as the food source that the bird group needs to forage. The individual particles in the particle swarm continuously adjust their positions according to the degree of deviation of the current position from the best particle, that is, each particle corresponds to a fitness value determined by the fitness function. According to the size of the determined fitness value, each particle continuously moves to the solution space according to its own optimal route, so as to find the required optimal solution. The fitness function is the objective function of the optimization problem. In each iteration process, the particles will continuously change and update their own speed and position according to the individual extreme value (pbest) and the global extreme value (gbest) to prepare for the next iterative calculation process. After finding these two optimal solutions, the particles will continue to update their speed and position according to the following formula.
[0025] ; Among them, w represents the inertia factor, whose value is non-negative; r is a random number between (0,1); v[i] is the velocity vector of the ith particle, x[i] is the position vector of the ith particle, c1 and c2 are learning factors, pb is the individual optimal position vector of the ith particle, and gb is the current global optimal position. The algorithm termination condition can be that the fitness value improvement ratio within a certain number of iterations is less than a given threshold, etc.
[0026] In some embodiments, the particle iteratively updates the position and speed according to the fitness value, including: if the algorithm termination condition is not met within a preset number of iterations, the training dimension, inertia factor and acceleration factor of the particle swarm model are adjusted. That is, if the condition is not met for a long time, the particle swarm algorithm model needs to be readjusted, specifically the training dimension, inertia factor and acceleration factor of the particle swarm model are adjusted, and the optimal solution is recalculated.
[0027] Step S12: inputting the magnetic resonance image to be enhanced into the back propagation neural network model, and obtaining the image pixel difference of the magnetic resonance image to be enhanced according to the output of the back propagation neural network model.
[0028] The magnetic resonance image to be enhanced is input into the trained back propagation neural network model, which is used to learn the K-space data information of each layer of the magnetic resonance image to be enhanced and output the image pixel difference of the magnetic resonance image to be enhanced.
[0029] The above-mentioned inputting the magnetic resonance image to be enhanced into the back propagation neural network model, and obtaining the image pixel difference of the magnetic resonance image to be enhanced according to the output of the back propagation neural network model, specifically includes: based on the data information of the K space corresponding to each layer of the magnetic resonance image to be enhanced, using the back propagation neural network model to determine the image pixel difference of the magnetic resonance image to be enhanced; the K space is used to store frequency information. K space is a simulated space, a three-dimensional space used to store all frequency information of nuclear magnetic resonance images.
[0030] Step S13: Based on the image pixel difference and the preset target weight, a target gamma value corresponding to the magnetic resonance image to be enhanced is determined, and gamma correction is performed on the magnetic resonance image to be enhanced according to the target gamma value to obtain an enhanced magnetic resonance image.
[0031] After the image pixel difference is obtained, a target gamma value is determined based on the image pixel difference and a preset target weight. Finally, the magnetic resonance image to be enhanced is gamma corrected according to the target gamma value to obtain an enhanced magnetic resonance image.
[0032] Image gamma correction is a technical method for adjusting image contrast and brightness in digital image processing. It achieves image enhancement by changing the image grayscale distribution by adjusting the power function parameters. The general expression of its mathematical power law function is as follows: ; where g(x) is the pixel value of the output image, f(x) is the input value of the input image, (gamma) is the adjustment parameter required for calculation, A is the normalization coefficient; the value range of f(x) is 0~1, and the most important parameter is Parameters. The grayscale value calculation and grayscale mapping between the input image and the output image are all determined by The value of determines whether the low grayscale area or the high grayscale area of the enhanced image is. The curve of the correction expression is shown in Figure 2, where g(x) is the ordinate and is represented by Vout, and f(x) is the abscissa and is represented by Vin. >1, the contrast of high grayscale areas is enhanced, making bright areas darker, i.e. the red curve; <1, the contrast of low grayscale areas is enhanced, making dark areas brighter, i.e. the blue curve; =1, the original image is not changed.
[0033] In this embodiment, the improved gamma correction image enhancement algorithm trains the image K-space data information of each layer through the PSO optimized BP neural network to obtain the difference of the image pixel training results, and then performs data calculations through the target weight and the image pixel difference to obtain the final more accurate target gamma value, so that the system can adaptively, quickly and accurately complete the image enhancement effect, providing a good foundation for precision treatment.
[0034] In some embodiments, before determining the target gamma value corresponding to the magnetic resonance image to be enhanced based on the image pixel difference and the preset target weight, the method may also include: determining the target weight based on the image quality, signal-to-noise ratio and pixel distribution corresponding to the magnetic resonance image to be enhanced. Determining the target weight based on image quality, signal-to-noise ratio and pixel distribution can comprehensively reflect image characteristics and requirements, thereby balancing visual effects and retaining important features during the enhancement process; in addition, the target weight can be set in combination with user preferences to ensure that the technology is consistent with user expectations.
[0035] It can be seen that the neural network model that can be built by combining the PSO algorithm and the BP neural network algorithm can train the characteristics of the pixel difference error of the image data. Combined with the image correction superiority of the Gamma algorithm, a new fusion image algorithm based on the particle swarm optimization BP neural network and adaptively correcting the gamma correction gamma parameter is proposed to establish the PSO-BP-GAM image enhancement model. The pixel difference trained by the PSO-BP neural network algorithm is multiplied by the weight value to obtain the final Gamma value. The specific process is shown in Figure 3 below, and the specific steps are described as follows: (1) Initialize the particle swarm algorithm according to the MRI image obtained by scanning, determine the dimension of the particle swarm training, and define the initial value of the inertia factor and acceleration factor after initialization. (2) Use the particle swarm optimization algorithm to obtain the optimal weight and threshold. Specifically, calculate the fitness function f(x) based on the position information and speed information carried by each particle; judge the fitness function. If it meets the requirements, assign the optimized particle information to the weight and threshold of the BP neural network. If it does not meet the requirements, recalculate the learning factor and network weight, and adjust the algorithm calculation process again until the optimal weight and threshold that meet the BP neural network are obtained. (3) Using the constructed PSO-BP neural network model, start network training on image information and obtain image pixel difference. (4) Multiply the final image pixel difference by the given weight coefficient to obtain the final Gamma training value, perform gamma correction enhanced image processing to obtain the final image after adaptive enhancement. It can ensure the clarity and contrast of MRI images at a higher scanning speed, improve the quality of magnetic resonance images and the speed of magnetic resonance scanning. At the same time, when the external environment and surrounding noise of MRI hardware are constantly changing, the detailed parameters of the image enhancement algorithm are adjusted in time to ensure the clarity and superiority of the final MRI image. The BP neural network optimized by particle swarm obtains global gamma correction parameters after global training, ensuring that image enhancement is performed on the basis of the global image, avoiding image edge distortion, effectively suppressing noise, and improving the real-time performance of image enhancement.
[0036] As can be seen from the above, in this embodiment, a back propagation neural network is constructed, and the initial weights and initial thresholds of the back propagation neural network are determined using a particle swarm model, so that the back propagation neural network is trained according to the initial weights and the initial thresholds to obtain a back propagation neural network model; the magnetic resonance image to be enhanced is input into the back propagation neural network model, and the image pixel difference of the magnetic resonance image to be enhanced is obtained according to the output of the back propagation neural network model; based on the image pixel difference and the preset target weight, the target gamma value corresponding to the magnetic resonance image to be enhanced is determined, and the magnetic resonance image to be enhanced is gamma corrected according to the target gamma value to obtain an enhanced magnetic resonance image. It can be seen that by obtaining the image pixel difference of the magnetic resonance image to be enhanced through the back propagation neural network model, automatically generating the target gamma value based on the image pixel difference, and realizing the automatic value of the gamma value, the image enhancement effect of the magnetic resonance image can be improved, and the image enhancement efficiency can be improved. In addition, the particle swarm algorithm is used to optimize the back propagation neural network. Its advantage of fast convergence speed and easy to find the global optimal point is used to optimize the initial weight value and threshold of the neural network, accelerate the convergence speed, improve the accuracy of the back propagation neural network, improve the accuracy of image pixel difference calculation, and improve image enhancement efficiency.
[0037] For example, FIG4 shows a magnetic resonance image to be enhanced with noise and low contrast. This magnetic resonance image is corrected and enhanced by the image enhancement (PSO-BP-GAM), histogram equalization algorithm (Equalized) and Laplace enhancement algorithm using the particle swarm optimization BP neural network combined with the gamma algorithm in this application. FIG5 shows the image enhanced by the three methods and the enhanced image histogram. The image enhancement effect can be intuitively compared, and the image contrast and uniformity can be observed to judge the superiority of the image enhancement algorithm. FIG6 shows another magnetic resonance image to be enhanced. FIG7 shows the image enhanced by the three methods and the enhanced image histogram. According to FIG5 and FIG7, it can be seen that the image enhancement using the particle swarm optimization BP neural network combined with the gamma algorithm has significant advantages. The enhanced MRI image is more uniform, the detail contrast is more obvious, the details are clearer, the display of important tissues is clearer, the image edge distortion phenomenon is effectively suppressed, and the details of the image are also more clearly displayed. The overall visual effect has been greatly improved, which is more conducive to the diagnosis of pathology.
[0038] Correspondingly, the embodiment of the present application further discloses an image enhancement device based on adaptive gamma correction, as shown in FIG8 , the device includes: An initial weight threshold determination module 11 is used to construct a back propagation neural network and determine the initial weight and initial threshold of the back propagation neural network using a particle swarm model, so as to perform model training on the back propagation neural network according to the initial weight and the initial threshold to obtain a back propagation neural network model; An image pixel difference determination module 12 is used to input the magnetic resonance image to be enhanced into the back propagation neural network model, and obtain the image pixel difference value of the magnetic resonance image to be enhanced according to the output of the back propagation neural network model; The image enhancement module 13 is used to determine the target gamma value corresponding to the magnetic resonance image to be enhanced based on the image pixel difference and the preset target weight, and perform gamma correction on the magnetic resonance image to be enhanced according to the target gamma value to obtain an enhanced magnetic resonance image.
[0039] As can be seen from the above, in this embodiment, a back propagation neural network is constructed, and the initial weights and initial thresholds of the back propagation neural network are determined by using a particle swarm model, so that the back propagation neural network is trained according to the initial weights and the initial thresholds to obtain a back propagation neural network model; the magnetic resonance image to be enhanced is input into the back propagation neural network model, and the image pixel difference of the magnetic resonance image to be enhanced is obtained according to the output of the back propagation neural network model; based on the image pixel difference and the preset target weight, the target gamma value corresponding to the magnetic resonance image to be enhanced is determined, and the magnetic resonance image to be enhanced is gamma corrected according to the target gamma value to obtain an enhanced magnetic resonance image. It can be seen that by obtaining the image pixel difference of the magnetic resonance image to be enhanced through the back propagation neural network model, automatically generating the target gamma value based on the image pixel difference, and realizing the automatic value of the gamma value, the image enhancement effect of the magnetic resonance image can be improved, and the image enhancement efficiency can be improved. In addition, the particle swarm algorithm is used to optimize the back propagation neural network. Its advantage of fast convergence speed and easy to find the global optimal point is used to optimize the initial weight value and threshold of the neural network, accelerate the convergence speed, improve the accuracy of the back propagation neural network, improve the accuracy of image pixel difference calculation, and improve image enhancement efficiency.
[0040] In some specific embodiments, the image enhancement device based on adaptive gamma correction may specifically include: A particle swarm initialization unit, used to initialize the particle swarm model and configure the training dimension, inertia factor and acceleration factor before determining the initial weight and initial threshold of the back propagation neural network using the particle swarm algorithm; The goal of the particle swarm model is to find the optimal initial weights and thresholds of the back propagation neural network; the training dimension is determined according to the array dimension of the magnetic resonance image to be enhanced.
[0041] In some specific embodiments, the initial weight threshold determination module may specifically include: A back propagation neural network construction unit, used to construct the back propagation neural network in the order of input layer, hidden layer and output layer; The number of nodes in the input layer is equal to the number of scanning layers of the magnetic resonance image to be enhanced, the number of neurons in the hidden layer is a target multiple of the number of neurons in the input layer, and the number of neurons in the output layer is 1.
[0042] In some specific embodiments, the initial weight threshold determination module 11 may specifically include: A fitness value calculation unit, used to calculate the fitness value of each particle in the particle swarm model using a fitness function, so that the particle iteratively updates the position and speed according to the fitness value; The initial weight threshold determination unit is used to determine the initial weight and initial threshold of the back propagation neural network according to the global extreme value of the particle swarm model when the algorithm termination condition is met.
[0043] In some specific embodiments, the image enhancement device based on adaptive gamma correction may specifically include: The particle swarm model adjustment unit is used to adjust the training dimension, inertia factor and acceleration factor of the particle swarm model if the algorithm termination condition is not met within a preset number of iterations.
[0044] In some specific embodiments, the image pixel difference determination module 12 may specifically include: An image pixel difference determination unit is used to determine the image pixel difference value of the magnetic resonance image to be enhanced based on the data information of the K space corresponding to each layer of the magnetic resonance image to be enhanced and using the back propagation neural network model; the K space is used to store frequency information.
[0045] In some specific embodiments, the image enhancement device based on adaptive gamma correction may specifically include: The target weight is determined based on the image quality, signal-to-noise ratio and pixel distribution corresponding to the magnetic resonance image to be enhanced.
[0046] Furthermore, an embodiment of the present application also discloses an electronic device, as shown in FIG9 . The content in the figure cannot be regarded as any limitation on the scope of use of the present application.
[0047] FIG9 is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the image enhancement method based on adaptive gamma correction disclosed in any of the aforementioned embodiments.
[0048] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0049] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222, and data 223 including magnetic resonance images to be enhanced, etc. The storage method can be temporary storage or permanent storage.
[0050] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the image enhancement method based on adaptive gamma correction performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0051] Furthermore, an embodiment of the present application also discloses a computer storage medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, the steps of the image enhancement method based on adaptive gamma correction disclosed in any of the aforementioned embodiments are implemented.
[0052] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0053] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0054] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0055] The above is a detailed introduction to the image enhancement method, device, equipment and medium based on adaptive gamma correction provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. An image enhancement method based on adaptive gamma correction, characterized in that: include: Constructing a back propagation neural network, and determining the initial weights and initial thresholds of the back propagation neural network using a particle swarm model, so as to perform model training on the back propagation neural network according to the initial weights and the initial thresholds to obtain a back propagation neural network model; Inputting the magnetic resonance image to be enhanced into the back propagation neural network model, and obtaining the image pixel difference of the magnetic resonance image to be enhanced according to the output of the back propagation neural network model; Based on the image pixel difference and a preset target weight, a target gamma value corresponding to the magnetic resonance image to be enhanced is determined, and gamma correction is performed on the magnetic resonance image to be enhanced according to the target gamma value to obtain an enhanced magnetic resonance image.
2. The image enhancement method based on adaptive gamma correction according to claim 1, characterized in that: Before using the particle swarm algorithm to determine the initial weights and initial thresholds of the back propagation neural network, the method further includes: Initialize the particle swarm model and configure the training dimension, inertia factor and acceleration factor; The goal of the particle swarm model is to find the optimal initial weights and thresholds of the back propagation neural network; the training dimension is determined according to the array dimension of the magnetic resonance image to be enhanced.
3. The image enhancement method based on adaptive gamma correction according to claim 1, characterized in that: The back propagation neural network is constructed, comprising: Constructing the back propagation neural network in the order of input layer, hidden layer and output layer; The number of nodes in the input layer is equal to the number of scanning layers of the magnetic resonance image to be enhanced, the number of neurons in the hidden layer is a target multiple of the number of neurons in the input layer, and the number of neurons in the output layer is 1.
4. The image enhancement method based on adaptive gamma correction according to claim 1, characterized in that: The method of using a particle swarm model to determine the initial weights and initial thresholds of the back propagation neural network includes: The fitness function is used to calculate the fitness value of each particle in the particle swarm model, so that the particle iteratively updates the position and speed according to the fitness value; When the algorithm termination condition is met, the initial weight and initial threshold of the back propagation neural network are determined according to the global extreme value of the particle swarm model.
5. The image enhancement method based on adaptive gamma correction according to claim 4, characterized in that: The particle iteratively updates the position and speed according to the fitness value, including: If the algorithm termination condition is not met within a preset number of iterations, the training dimension, inertia factor and acceleration factor of the particle swarm model are adjusted.
6. The image enhancement method based on adaptive gamma correction according to claim 1, characterized in that: The step of inputting the magnetic resonance image to be enhanced into the back propagation neural network model and obtaining the image pixel difference of the magnetic resonance image to be enhanced according to the output of the back propagation neural network model comprises: Based on the data information of the K space corresponding to each layer of the magnetic resonance image to be enhanced, the image pixel difference of the magnetic resonance image to be enhanced is determined by using the back propagation neural network model; the K space is used to store frequency information.
7. The image enhancement method based on adaptive gamma correction according to any one of claims 1 to 6, characterized in that: Before determining the target gamma value corresponding to the magnetic resonance image to be enhanced based on the image pixel difference and the preset target weight, the method further includes: The target weight is determined based on the image quality, signal-to-noise ratio and pixel distribution corresponding to the magnetic resonance image to be enhanced.
8. An image enhancement device based on adaptive gamma correction, characterized in that: include: An initial weight threshold determination module is used to construct a back propagation neural network and determine the initial weight and initial threshold of the back propagation neural network using a particle swarm model, so as to perform model training on the back propagation neural network according to the initial weight and the initial threshold to obtain a back propagation neural network model; An image pixel difference determination module, used for inputting the magnetic resonance image to be enhanced into the back propagation neural network model, and obtaining the image pixel difference value of the magnetic resonance image to be enhanced according to the output of the back propagation neural network model; The image enhancement module is used to determine the target gamma value corresponding to the magnetic resonance image to be enhanced based on the image pixel difference and the preset target weight, and perform gamma correction on the magnetic resonance image to be enhanced according to the target gamma value to obtain an enhanced magnetic resonance image.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the image enhancement method based on adaptive gamma correction as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein when the computer programs are executed by a processor, the image enhancement method based on adaptive gamma correction as described in any one of claims 1 to 7 is implemented.