Image enhancement method based on hybrid particle swarm optimization and related device

Through the hybrid particle swarm optimization method, dynamically adjusting the number of image decomposition layers and parameter combinations, the problem of low license plate image quality is solved, and the image quality is improved and the recognition accuracy is improved.

CN120430959APending Publication Date: 2025-08-05SHENZHEN POWER SUPPLY BUREAU
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510502669.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-21
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

In image processing and computer vision, due to the performance of the acquisition equipment and complex environmental factors, the quality of license plate images often has low contrast, blurred details or uneven grayscale distribution, which affects the accuracy of subsequent recognition.

Method used

Through the mixed particle swarm optimization method, the image decomposition layer number is dynamically adjusted, the image is decomposed using the Laplace pyramid algorithm, and the gray value normalization process is performed, and the target parameter combination is determined according to the mixed particle swarm optimization method for image enhancement.

Benefits of technology

Improves image quality, enhances contrast and clarity, and improves image recognition accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120430959A_ABST
    Figure CN120430959A_ABST
Patent Text Reader

Abstract

The invention provides an image enhancement method based on hybrid particle swarm optimization and a related device, and the method comprises the steps: obtaining a first image, and determining a first decomposition layer number according to the first image; decomposing the first image according to the first decomposition layer number and a Laplacian pyramid algorithm to obtain n layers of second images; performing normalization processing on gray values of all pixel points of each second image in the n layers of second images to obtain n gray value sets; determining a target parameter combination according to a preset hybrid particle swarm optimization method; transforming each gray value set in the n gray value sets according to the target parameter combination to obtain n layers of third images; and reconstructing the n layers of third images to obtain a target image. The image is enhanced according to the hybrid particle swarm optimization method, and the quality of the image can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image enhancement technology, and in particular to an image enhancement method and related devices based on hybrid particle swarm optimization. Background Art

[0002] Image enhancement technology plays a crucial role in the vast fields of image processing and computer vision. In the actual process of license plate image acquisition, image quality is often significantly compromised due to limitations in the performance of the acquisition equipment and complex and changing environmental factors. For example, factors such as lighting variations and noise interference often manifest as low contrast, blurred details, or uneven grayscale distribution, resulting in poor image quality and affecting the accuracy of subsequent image recognition.

[0003] Therefore, how to improve the quality of images needs to be solved urgently. Summary of the Invention

[0004] The embodiments of the present application provide an image enhancement method and related devices based on hybrid particle swarm optimization, which can improve the quality of the image by dynamically adjusting the number of decomposition layers of the image and enhancing the image according to the hybrid particle swarm optimization method.

[0005] In a first aspect, an embodiment of the present application provides an image enhancement method based on hybrid particle swarm optimization, the method comprising:

[0006] Acquire a first image, and determine a first decomposition layer number according to the first image;

[0007] Decomposing the first image according to the first decomposition layer number and the Laplacian pyramid algorithm to obtain n-layer second images, where n is an integer greater than 1;

[0008] Normalizing the grayscale values of all pixels of each second image in the n layers of second images to obtain n grayscale value sets;

[0009] Determining a target parameter combination according to a preset hybrid particle swarm optimization method; the target parameter combination includes a target first parameter and a target second parameter;

[0010] transforming each of the n grayscale value sets according to the target parameter combination to obtain n layers of third images;

[0011] The n-layer third image is reconstructed to obtain a target image.

[0012] In a second aspect, an embodiment of the present application provides an image enhancement device based on hybrid particle swarm optimization, the device comprising a first determination module, a decomposition module, a processing module, a second determination module, a transformation module, and a reconstruction module, wherein:

[0013] The first determining module is configured to acquire a first image and determine a first decomposition layer number according to the first image;

[0014] The decomposition module is configured to decompose the first image according to the first decomposition layer number and the Laplacian pyramid algorithm to obtain n-layer second images, where n is an integer greater than 1;

[0015] The processing module is configured to normalize the grayscale values of all pixels of each second image in the n layers of second images to obtain n grayscale value sets;

[0016] The second determination module is used to determine a target parameter combination according to a preset hybrid particle swarm optimization method; the target parameter combination includes a target first parameter and a target second parameter;

[0017] The transformation module is configured to transform each of the n grayscale value sets according to the target parameter combination to obtain n layers of third images;

[0018] The reconstruction module is used to reconstruct the n-layer third image to obtain a target image.

[0019] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program comprises instructions for executing the steps of any method of the first aspect of the embodiment of the present application.

[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the above-mentioned computer-readable storage medium stores a computer program for electronic data exchange, wherein the above-mentioned computer program enables a computer to execute part or all of the steps described in any method of the first aspect of the embodiment of the present application.

[0021] In a fifth aspect, embodiments of the present application provide a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute some or all of the steps described in any method of the first aspect of the embodiments of the present application. The computer program product may be a software installation package.

[0022] By implementing the embodiments of the present application, the number of decomposition layers of an image can be dynamically adjusted, and the image can be enhanced according to a hybrid particle swarm optimization method, thereby improving the quality of the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0024] Figure 1 This is a system architecture diagram of an image enhancement system provided by an embodiment of the present application;

[0025] Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0026] Figure 3 This is a schematic diagram of an image enhancement process provided by an embodiment of the present application;

[0027] Figure 4 This is an application scenario diagram of vehicle image enhancement provided by an embodiment of the present application;

[0028] Figure 5 1 is a flow chart of an image enhancement method based on hybrid particle swarm optimization provided in an embodiment of the present application;

[0029] Figure 6 This is a schematic diagram of a process for determining the number of first decomposition layers provided in an embodiment of the present application;

[0030] Figure 7 This is a schematic diagram of an image decomposition process provided by an embodiment of the present application;

[0031] Figure 8 This is a block diagram of the functional modules of an image enhancement device based on hybrid particle swarm optimization provided in an embodiment of the present application. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 this application.

[0033] The terms "first," "second," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish between different objects, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.

[0034] It should be understood that the term "and / or" in this document is merely a description of the association relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this document indicates that the associated objects are in an "or" relationship. The "plurality" appearing in the embodiments of this application refers to two or more.

[0035] In the embodiments of the present application, "at least one item" or similar expressions refers to any combination of these items, including any combination of single items or plural items, and refers to one or more, and multiple refers to two or more. For example, at least one item (item) of a, b, or c can represent the following seven situations: a, b, c, a and b, a and c, b and c, a, b, and c. Among them, each of a, b, and c can be an element or a set containing one or more elements.

[0036] The "connection" appearing in the embodiments of the present application refers to various connection methods such as direct connection or indirect connection to achieve communication between devices, and the embodiments of the present application do not impose any limitations on this.

[0037] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0038] The following are the explanations of the relevant terms involved in this application:

[0039] Downsampling: This refers to the process of downsampling an image or signal, reducing the amount of data to reduce resolution. In image processing, downsampling reduces the size of the image and the number of pixels.

[0040] Upsampling: This refers to an operation that increases the resolution of an image or signal. In image processing, bilinear interpolation is often used to increase the size of the image and the number of pixels.

[0041] Image enhancement technology plays a crucial role in the vast fields of image processing and computer vision. In the actual process of license plate image acquisition, image quality is often significantly compromised due to limitations in the performance of the acquisition equipment and complex and changing environmental factors. For example, factors such as lighting variations and noise interference often manifest as low contrast, blurred details, or uneven grayscale distribution, resulting in poor image quality and impacting the accuracy of subsequent image recognition. Therefore, improving image quality is an urgent issue.

[0042] To address the above-mentioned issues, an embodiment of the present application provides an image enhancement method and related apparatus based on hybrid particle swarm optimization. A first image is acquired, and a first decomposition layer number is determined based on the first image. The first image is decomposed based on the first decomposition layer number and the Laplacian pyramid algorithm to obtain n-layer second images, where n is an integer greater than 1. The grayscale values of all pixels in each of the n-layer second images are normalized to obtain n grayscale value sets. A target parameter combination is determined based on a preset hybrid particle swarm optimization method, where the target parameter combination includes a target first parameter and a target second parameter. Each grayscale value set in the n grayscale value sets is transformed based on the target parameter combination to obtain an n-layer third image. The n-layer third images are reconstructed to obtain a target image. By dynamically adjusting the number of image decomposition layers and enhancing the image based on the hybrid particle swarm optimization method, the image quality can be improved.

[0043] See also Figure 1 , Figure 1 This is a system architecture diagram of an image enhancement system provided in an embodiment of the present application. The image enhancement system includes an image input module, an image decomposition module, an image enhancement module, an image reconstruction module, and an image output module.

[0044] The image input module is responsible for receiving raw images. As the starting point for the entire image enhancement process, it can obtain images from various data sources, such as file systems, camera devices, and network transmissions, providing basic data for subsequent processing. The image input module supports multiple common image formats, such as JPEG, PNG, and BMP, ensuring that it can process images from different sources and types.

[0045] The image decomposition module determines the appropriate number of decomposition layers based on the input original image and decomposes the image using techniques such as the Laplacian pyramid algorithm, splitting the original image into n layers. This image decomposition can separate the image's different frequency components or detail information, facilitating subsequent targeted processing of each layer.

[0046] The image enhancement module normalizes the grayscale values of all pixels in each of the n-layer images obtained by the image decomposition module, obtaining n grayscale value sets. A preset hybrid particle swarm optimization method is then used to determine a target parameter combination (including a target first parameter and a target second parameter). Finally, each of the n grayscale value sets is transformed based on this target parameter combination to obtain an enhanced n-layer image. This enhances each layer of the image and improves image quality, such as contrast and clarity.

[0047] The image reconstruction module reconstructs the enhanced n-layer image, reassembling the enhanced image information at each layer to restore it into a complete image. By reconstructing the n-layer image, the enhancement effects applied at each layer are integrated into the final image, resulting in the enhanced target image.

[0048] The image output module can output the target image and provide it to the user or other systems. The output method can be displayed on the screen of the electronic device, saved as an image file to a local storage device, or transmitted to other devices or systems via a network, without specific limitations here.

[0049] As can be seen, the hierarchical decomposition of images using the Laplacian pyramid algorithm can process image details and features at different scales, facilitating better capture of various information in the image, from macroscopic image structure to microscopic texture details. This provides a richer information foundation for subsequent enhancement operations, contributing to more precise and detailed image enhancement effects. A hybrid particle swarm optimization method is used to determine the target parameter combination, enabling the system to automatically search for and find the optimal parameter settings based on the specific characteristics of the input image. This adaptive capability enables personalized enhancement processing for images of different types and qualities, eliminating the need for manual adjustment of numerous parameters. This improves the efficiency and accuracy of image enhancement and adapts to a variety of complex image scenarios and user needs.

[0050] The following combination Figure 2 The electronic device in the embodiment of the present application is described. Figure 2 is a structural diagram of an electronic device provided in an embodiment of the present application, such as Figure 2As shown, the electronic device includes one or more processors, a memory, a communication interface and one or more programs, and the processor is communicatively connected with the memory and the communication interface via an internal communication bus.

[0051] Among them, the processor is mainly used for:

[0052] Acquire a first image, and determine a first decomposition layer number according to the first image;

[0053] Decomposing the first image according to the first decomposition layer number and the Laplacian pyramid algorithm to obtain n-layer second images, where n is an integer greater than 1;

[0054] Normalizing the grayscale values of all pixels of each second image in the n layers of second images to obtain n grayscale value sets;

[0055] Determining a target parameter combination according to a preset hybrid particle swarm optimization method; the target parameter combination includes a target first parameter and a target second parameter;

[0056] transforming each of the n grayscale value sets according to the target parameter combination to obtain n layers of third images;

[0057] The n-layer third image is reconstructed to obtain a target image.

[0058] The one or more programs are stored in the above-mentioned memory and are configured to be executed by the above-mentioned processor, and the one or more programs include instructions for executing any step in the above-mentioned method embodiment.

[0059] Among them, the processor can be a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It can implement or execute the various exemplary logic blocks, units and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like. The communication unit can be a communication interface, a transceiver, a transceiver circuit, etc., and the storage unit can be a memory.

[0060] The memory may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus RAM (DR RAM).

[0061] It is understood that the electronic device may include more or fewer structural elements than those in the above structural block diagram, for example, including a power module, physical buttons, Wi-Fi module, speaker, Bluetooth module, sensor, display module, etc., which are not limited here. It is understood that the electronic device may be equipped with Figure 1 The system architecture described.

[0062] For easier understanding, see Figure 3 , Figure 3This is a flow chart of an image enhancement process provided by an embodiment of the present application. First, the original image is input, and then the original image is decomposed and processed according to the Laplacian pyramid to obtain n layers of images at different levels, providing a data basis for subsequent particle swarm optimization. Then, the parameters required for the particle swarm optimization algorithm are initialized, such as the number of particles, the initial position and velocity of the particles, the inertia weight, the learning factor, etc., which are not specifically limited here. Among them, for each particle in the particle swarm, the decomposed image level is processed according to the parameter combination corresponding to its current position, and then the fitness is calculated using a comprehensive evaluation function to measure the effect of the corresponding parameter combination of the particle on image enhancement. The first fitness is compared with the average fitness. The first fitness is the fitness of any particle in the particle swarm, and the average fitness is the average fitness of all particles in the particle swarm. If the first fitness is less than or equal to the average fitness, it means that the particle performs relatively poorly, and it is necessary to use simulated annealing probability to determine whether to accept the suboptimal solution to avoid the algorithm falling into a local optimum. If the first fitness is greater than the average fitness, it means that the particle performs relatively well and can be directly regarded as a better solution. Then, the position and velocity of the particle are updated according to the preset update formula of the particle swarm optimization algorithm, and it is determined whether the updated velocity is within the preset range. If it exceeds the preset range, the velocity will need to be adjusted to the boundary value corresponding to the preset range to ensure reasonable particle search. At the same time, it is determined whether the current iteration number a is the preset maximum iteration number. If the current iteration number a is less than the maximum iteration number, the next iteration is required. If the current iteration number a is equal to the maximum iteration number, the iteration is terminated to avoid wasting computing resources. When the velocity is within the preset range, the current iteration number a is automatically increased by one, and it is determined whether the iteration number a is equal to the maximum iteration number. If the iteration number a is less than the maximum iteration number, the next iteration is required. If the iteration number a is equal to the maximum iteration number, the iteration is terminated. After the iterative update of the particle swarm is completed, the target parameter combination corresponding to the global optimal position of the particle swarm is determined. The decomposed image layer is processed using this target parameter combination, and then the image is reconstructed to obtain the enhanced image and output it.

[0063] For easier understanding, see Figure 4 , Figure 4This is an application scenario diagram of vehicle image enhancement provided by an embodiment of the present application, wherein the original vehicle image is an unprocessed vehicle-related image, which serves as the input data source of the image enhancement system and is the starting object of the image enhancement processing. The original vehicle image can be obtained by shooting with equipment such as road monitoring cameras, vehicle-mounted cameras, drone-mounted cameras, etc., or the original vehicle image can be directly exported from an image database, without specific limitation here. The original vehicle image retains the true state of the vehicle and the surrounding environment at the moment of shooting, including the brightness and darkness, color under natural light, possible blur and noise, etc. For subsequent vehicle feature recognition (such as license plate recognition, vehicle model recognition), traffic condition analysis, accident identification and other work, the original vehicle image is the basic data. However, due to factors such as lighting, weather, and equipment performance during shooting, the image quality may be poor, so it is often necessary to further process it with the help of an image enhancement system to improve clarity, contrast, etc., in order to better serve subsequent applications.

[0064] The target vehicle image is the original vehicle image processed by the image enhancement system. The clarity of this target vehicle image is significantly improved compared to the original vehicle image, making details such as the vehicle's outline, license plate number, and vehicle model easier to discern. For example, in traffic monitoring, previously blurry license plates can be clearly identified after processing, facilitating traffic enforcement and vehicle management.

[0065] The image enhancement system receives raw vehicle images, processes them using specific algorithms and techniques, and ultimately outputs a target vehicle image. By analyzing the higher-quality target vehicle image, it facilitates identification of vehicle license plates and models, and analyzes traffic flow and vehicle driving status, thereby improving traffic management efficiency. It should be noted that the image enhancement system is used to enhance raw images, including but not limited to raw vehicle images, raw person images, raw product images, and raw scenery images, without further specific limitation.

[0066] After understanding the software and hardware architecture of this application, Figure 5 An image enhancement method based on hybrid particle swarm optimization in an embodiment of the present application is described. Figure 5 : This is a flow chart of an image enhancement method based on hybrid particle swarm optimization provided in an embodiment of the present application, which specifically includes the following steps:

[0067] Step S501: Acquire a first image, and determine a first decomposition layer number according to the first image.

[0068] Specifically, the first image can be read from a storage device such as a hard disk or a USB flash drive, or can be acquired in real time by a camera, which is not specifically limited here. Then, the first decomposition layer number is determined based on the first image.

[0069] For easier understanding, see Figure 6 , Figure 6 : This is a flow chart of determining the first number of decomposition layers according to an embodiment of the present application. The specific steps of determining the first number of decomposition layers according to the first image include:

[0070] A1. Obtain a first resolution corresponding to the first image;

[0071] A2. determining the initial number of decomposition layers according to the first resolution;

[0072] A3. Calculate the entropy value of the first image to obtain a first entropy value;

[0073] A4. If the first entropy value is greater than a preset threshold, increase the initial decomposition level by one to obtain the first decomposition level;

[0074] A5. If the first entropy value is less than or equal to the preset threshold, the initial decomposition level number is used as the first decomposition level number.

[0075] In a specific embodiment, first, a first resolution corresponding to the first image is obtained. The first resolution refers to the number of pixels contained in the first image in the horizontal and vertical directions, that is, the width and height of the first image. The first resolution is then calculated according to a preset first calculation formula to obtain the initial number of decomposition layers. The first calculation formula is as follows:

[0076] n init =[log2(min(H,W))-log2(T min )」

[0077] Among them, n init represents the number of initial decomposition layers; H represents the number of pixels of the first image in the vertical direction; W represents the number of pixels of the first image in the horizontal direction; T min Indicates the minimum size threshold of the top-level image after the first image is decomposed.

[0078] Next, the entropy value of the first image is calculated according to a preset second calculation formula to obtain a first entropy value. The second calculation formula is as follows:

[0079]

[0080] Among them, Entropy represents the first entropy value; p iThe probability of occurrence of grayscale value i can be obtained by normalizing the grayscale histogram corresponding to the first image. Grayscale values i range from 0 to 255. It should be noted that the entropy of an image is a measure of the information richness of the image. A larger entropy value indicates more information and a more complex image. If the grayscale values of the first image are evenly distributed and rich in detail, the first entropy value is large; if the grayscale values of the first image are concentrated in a small number of values, the first entropy value is small.

[0081] Finally, when the first entropy value is greater than the preset threshold, it indicates that the first image contains a large amount of information, and the initial number of decomposition layers may not be sufficient to fully process the details and information of the first image. Therefore, the initial number of decomposition layers is increased by one to obtain the final first decomposition layer number. When the first entropy value is less than or equal to the preset threshold, it indicates that the first image contains relatively little information, and the initial number of decomposition layers is sufficient to process the first image. There is no need to increase the number of decomposition layers, so the initial number of decomposition layers is directly used as the final first decomposition layer number.

[0082] It can be seen that by considering the resolution and entropy value of the image to determine the number of decomposition layers, it can be flexibly adjusted according to the specific characteristics of the image, so as to more accurately match the processing fineness required by the image, and make the choice of decomposition layers more in line with the characteristics of the image itself, thereby better processing images of different types and qualities.

[0083] Step S502 : Decompose the first image according to the first decomposition level and the Laplacian pyramid algorithm to obtain an n-layer second image.

[0084] For easier understanding, see Figure 7 , Figure 7 This is a schematic diagram of a process for image decomposition provided by an embodiment of the present application, wherein n is an integer greater than 1. Decomposing the first image according to the first decomposition level and the Laplacian pyramid algorithm to obtain an n-layer second image specifically includes the following steps:

[0085] B1. Perform n-1 Gaussian blur and n-1 downsampling operations on the first image according to the first decomposition level to obtain an n-1-level reference image.

[0086] B2. Determine a Gaussian pyramid based on the first image and the n-1-th layer reference image, wherein the first image is the first layer image of the Gaussian pyramid, and the n-1-th layer reference image is the second to nth layer images of the Gaussian pyramid;

[0087] B3. Calculate the Gaussian pyramid according to a preset difference calculation formula to obtain the first n-1 layers of the second image;

[0088] The difference calculation formula is as follows:

[0089] L k =I k -upsample(I k+1 )

[0090] Among them, L k Represents the second image of the kth layer; k is an integer between 1 and n-1; I k I represents the k-th layer image of the Gaussian pyramid; k+1 represents the k+1th layer image of the Gaussian pyramid; upsample(I k+1 ) indicates I k+1 Perform upsampling operation;

[0091] B4. Determine the n-th layer second image according to the n-th layer image of the Gaussian pyramid and the first n-1 layers of the second image.

[0092] In a specific embodiment, first, according to the first decomposition layer number, n-1 Gaussian blur and n-1 downsampling operations are performed on the first image to obtain an n-1 layer reference image. The first decomposition layer number is n, and Gaussian blur refers to a commonly used image smoothing method. By performing a convolution operation on the image through a Gaussian filter, the noise in the first image can be reduced and the first image can be made smoother. Each time Gaussian blur is performed, a downsampling operation is performed (usually reducing the resolution of the first image, for example, reducing the size of the first image to half of the original), which can gradually remove high-frequency detail information in the first image and retain low-frequency information, thereby obtaining an n-1 layer reference image. Then, the first image is used as the bottom layer of the pyramid, that is, the first layer, and the n-1 layers of reference images are arranged on top of it in descending order of scale, thereby constructing a Gaussian pyramid.

[0093] Next, the Gaussian pyramid is calculated according to the preset difference calculation formula to obtain the first n-1 layers of the second image. The difference calculation formula is as follows:

[0094] L k =I k -upsample(I k+1 )

[0095] Among them, L k Represents the second image of the kth layer; k is an integer between 1 and n-1; I k Represents the k-th layer image of the Gaussian pyramid; I k+1 represents the k+1th layer image of the Gaussian pyramid; upsample(I k+1 ) indicates I k+1 Perform upsampling operation.

[0096] It should be noted that after Gaussian blurring and downsampling operations, the low-frequency information is mainly stored in the images of each layer of the Gaussian pyramid. Through this differential calculation, the removed high-frequency information can be re-extracted, thereby obtaining the high-frequency detail information of the first image at different scales, that is, the first n-1 layers of the second image.

[0097] Finally, an n-th layer of second images is determined based on the n-th layer image of the Gaussian pyramid and the first n-1 layers of second images. The n-th layer of second images can be used to construct a Laplacian pyramid, and the n-th layer of the Laplacian pyramid is the n-th layer of the Gaussian pyramid. The first to n-1-th layers of the n-th layer of second images are high-frequency components, and the n-th layer of second images is a low-frequency component.

[0098] It can be seen that by decomposing the first image, the first image can be decomposed into information of different scales and frequencies, providing a multi-scale representation for subsequent image enhancement operations, making the analysis and processing of the first image at different scales more convenient and effective.

[0099] Step S503 : normalizing the grayscale values of all pixels of each second image in the n layers of second images to obtain n grayscale value sets.

[0100] Specifically, the grayscale values of all pixels of each second image are processed according to a preset normalization formula to obtain n grayscale value sets, each grayscale value set corresponding to a layer of the second image. k The grayscale values of all pixels are normalized, and the second image L k is any second image in the n-layer second image, k is a positive integer less than or equal to n, and the normalization formula is as follows:

[0101]

[0102] Where z(x,y) represents the second image L k After normalization, the grayscale value of the pixel at the coordinate (x, y); f(x, y) represents the grayscale value of the second image L k Before normalization, the grayscale value of the pixel at the coordinate (x, y); L min Represents the second image L k The corresponding minimum gray value; L max Represents the second image L k The corresponding maximum grayscale value. It should be noted that, according to the second image L k Establish a coordinate system and use coordinates (x, y) to represent the second image L k Pixel points at different positions in the image, x represents the horizontal coordinate and y represents the vertical coordinate.

[0103] It can be seen that the grayscale value ranges of different images or different layers of the same image may vary greatly. After normalization, subsequent processing can be performed under a unified standard, which facilitates the algorithm to analyze and operate on the second image.

[0104] Step S504: determining a target parameter combination according to a preset hybrid particle swarm optimization method.

[0105] The target parameter combination includes a target first parameter and a target second parameter, and the target parameter combination is determined according to a preset hybrid particle swarm optimization method, and the specific steps include:

[0106] Randomly generate particles according to a preset parameter space to obtain an initial particle group; the initial particle group includes m initial particles; m is an integer greater than 1; the position of each initial particle corresponds to a parameter combination; each parameter combination corresponds to a first parameter and a second parameter;

[0107] Obtaining the number of iterations a and initializing the number of iterations a to 0;

[0108] Perform the following steps G1-G8 on the initial particle swarm:

[0109] G1. Determine a first parameter combination according to a first position of a first particle; the first particle is any one of the m initial particles;

[0110] G2. Transforming the reference second image according to the first parameter combination using a non-complete Beta function to obtain a fourth image; the reference second image is any second image in the n layers of second images;

[0111] G3. Calculate the fourth image using a comprehensive evaluation function to obtain a first fitness; repeat steps G1-G3 m-1 times to obtain m-1 fitnesses, and calculate an average of the m-1 fitnesses and the first fitness to obtain an average fitness;

[0112] G4. Determine whether the first fitness is less than or equal to the average fitness; if the first fitness is less than or equal to the average fitness, perform a simulated annealing process on the first particle and go to step G5; if the first fitness is greater than the average fitness, go directly to step G5;

[0113] G5. Update the first particle according to a preset optimization algorithm to obtain an updated first particle;

[0114] G6. Update m-1 initial particles other than the first particle among the m initial particles according to steps G1 to G5. When all the m initial particles are updated, the number of iterations a is automatically increased by 1.

[0115] G7. If the number of iterations a is less than the preset maximum number of iterations, proceed to the next iteration and repeat steps G1-G6 until the number of iterations a is equal to the preset maximum number of iterations. The iteration is terminated and the target particle swarm is obtained.

[0116] G8. Determine the target parameter combination according to the target particle group.

[0117] In a specific embodiment, particles are first randomly generated within a preset parameter space to form an initial particle swarm consisting of m initial particles. The position of each particle corresponds to a set of parameter combinations, each of which includes a first parameter and a second parameter. It should be noted that the preset reference space can be a two-dimensional space defined by the value ranges of the first and second parameters to facilitate the subsequent search for the optimal parameter combination, which is not specifically limited here. The iteration count a is then initialized to 0 to record the number of optimization iterations.

[0118] Next, perform the following specific steps G1-G8 on the initial particle swarm:

[0119] G1. Select a first particle from the initial particle group and determine the corresponding first parameter combination based on its position.

[0120] G2. Transform the second reference image of any layer using a non-complete Beta function according to the first parameter combination to obtain a fourth image. The non-complete Beta function is as follows:

[0121]

[0122] Here, Y(u) represents the grayscale value after transformation using the incomplete Beta function; u represents the normalized grayscale value; α represents the first parameter in the first parameter combination; β represents the second parameter in the first parameter combination; and B(α,β) represents the complete Beta function, which is used to determine the weight of the integral component of the incomplete Beta function. It should be noted that α and β are key parameters of the incomplete Beta function and control the shape of its corresponding transformation curve. By varying the values of α and β, the degree of stretching or compression of the grayscale values can be adjusted, thereby changing the contrast and brightness distribution of the image.

[0123] G3. Calculate the fourth image using the comprehensive evaluation function to obtain the first fitness. Repeat steps G1-G3 m-1 times to obtain m-1 fitnesses. Calculate the average of the m-1 fitnesses and the first fitness to obtain the average fitness. The comprehensive evaluation function is as follows:

[0124] F=w1*Entropy+w2*Strength+w3*StdDev

[0125] Among them, F represents the evaluation result of the comprehensive evaluation function on the image, that is, fitness; Entropy represents the entropy value of the image; Strength represents the edge strength of the image; StdDev represents the standard deviation of the image; w1, w2, and w3 represent the weight of the entropy value, the weight of the edge strength, and the weight of the standard deviation, respectively, which are used to adjust the importance of each feature in the comprehensive evaluation.

[0126]

[0127] Among them, G x (x,y) represents the horizontal gradient of pixel point (x,y); G y (x,y) represents the vertical gradient of the pixel point (x,y); g(x,y) represents the grayscale value of the pixel point (x,y); μ represents the mean grayscale value of the image.

[0128] G4. Evaluate the relative performance of a single particle within the initial particle swarm by comparing the first fitness and the average fitness. If the first fitness is less than or equal to the average fitness, it indicates that the current parameter combination of the first particle is performing relatively poorly or at an average level. At this point, a simulated annealing process needs to be performed on the first particle. The simulated annealing algorithm is based on a physical annealing process and can accept suboptimal solutions with a certain probability during the optimization search. After executing the simulated annealing process, proceed to step G5. If the first fitness is greater than the average fitness, it indicates that the parameter combination corresponding to the first particle performs relatively well within the current initial particle swarm. There is no need to perform the simulated annealing process on the first particle, and the process proceeds directly to step G5.

[0129] G5. Update the first particle according to the preset optimization algorithm to obtain an updated first particle. The preset optimization algorithm is as follows:

[0130]

[0131] in, represents the velocity of the i-th particle at the k+1-th iteration; ω represents the inertia weight, which is used to control the degree to which the i-th particle inherits the velocity at the k-th iteration. represents the speed of the i-th particle at the k-th iteration; c1 and c2 are learning factors, which are used to adjust the degree to which the i-th particle learns from its historical optimal position and the global optimal position; r1 and r2 are random numbers between 0 and 1; x pbest represents the optimal position experienced by the i-th particle; x gbest Indicates the optimal position currently found by the i-th particle; represents the position of the i-th particle at the k-th iteration; represents the position of the i-th particle at the k+1-th iteration.

[0132] G6. Update the m-1 initial particles, excluding the first particle, according to steps G1-G5. This ensures that the entire initial particle swarm optimizes and adjusts based on its own and the swarm's information, continuously exploring the search space and seeking a better solution. Once all m initial particles have been updated, meaning all particles in the swarm have completed a complete update cycle, the number of iterations, a, is automatically incremented by 1.

[0133] G7. The preset maximum number of iterations indicates the number of iterations allowed during the search for the optimal solution and can be set based on actual conditions and specific requirements. Iteration count a represents the number of iterations currently completed. Each time a completes a round of updates for all particles, it automatically increments by 1. Iteration count a is compared with the preset maximum number of iterations. If it is less than the preset maximum number of iterations, indicating that the optimization algorithm still has room for further optimization, the algorithm proceeds to the next iteration and continues with steps G1-G6. The iteration terminates when iteration count a equals the preset maximum number of iterations, and the target particle swarm is obtained.

[0134] G8. Determine the target parameter combination based on the target particle group.

[0135] As can be seen, by continuously iteratively updating particle positions, the particle swarm can rapidly approach the optimal solution. By introducing a simulated annealing process, when a particle's fitness is poor, a suboptimal solution is accepted with a certain probability. This prevents the algorithm from becoming stuck at a local optimal solution and allows it to continue searching beyond the local optimal region. This helps find a target parameter combination that is closer to the global optimal, improving the stability and reliability of the image enhancement effect. Using a comprehensive evaluation function as the optimization objective allows for comprehensive consideration of multiple image characteristics. For complex image enhancement tasks, parameter combinations can be evaluated and optimized from multiple dimensions, ensuring that the target parameter combination better meets actual needs and improving image quality in terms of information richness, edge clarity, contrast, and other aspects.

[0136] If the first particle is not in the first iteration, performing the simulated annealing process on the first particle specifically includes the following steps:

[0137] C1. Calculate the simulated annealing probability of the first particle according to a preset probability formula to obtain a first probability; wherein the probability formula is as follows:

[0138]

[0139] Among them, P r represents the first probability; F(i) represents the fitness of the first particle at the i-th iteration; F(j) represents the fitness of the first particle at the j-th iteration; where i=j+1, j is a positive integer; otherwise represents the case where F(i) is less than F(j); T(i) represents the temperature parameter of simulated annealing at the i-th iteration;

[0140] C2. When the first probability is not 1, generate a random number between 0 and 1;

[0141] C3. When the random number is less than the first probability or the first probability is 1, taking the position of the first particle in the i-th iteration as the position of the first particle after executing the simulated annealing process;

[0142] C4. When the random number is greater than or equal to the first probability, the position of the first particle at the jth iteration is used as the position of the first particle after the simulated annealing process is completed.

[0143] In a specific embodiment, first, the simulated annealing probability of the first particle is calculated according to a preset probability formula to obtain a first probability. The probability formula is as follows:

[0144]

[0145] Among them, P r represents the first probability; F(i) represents the fitness of the first particle at the i-th iteration; F(j) represents the fitness of the first particle at the j-th iteration; where i = j + 1, j is a positive integer; otherwise represents the case where F(i) is less than F(j); T(i) represents the temperature parameter of simulated annealing at the i-th iteration.

[0146] It should be noted that the higher the temperature parameter T(i), the greater the probability of accepting a poor solution. Therefore, in the early stages of the iteration, a higher temperature parameter T(i) makes the particles more likely to accept a poor solution, thereby searching more widely in the solution space. As the number of iterations increases, the temperature parameter T(i) can be gradually reduced, thereby reducing the probability of accepting a poor solution and avoiding falling into a local optimum.

[0147] Next, when the first probability is not 1, a random number between 0 and 1 is generated. This random number is compared with the first probability to determine whether to accept the new particle position. When the random number is less than the first probability or the first probability is 1, the conditions for accepting the new solution are met, and the position of the first particle at the i-th iteration is used as the position of the first particle after the simulated annealing process. When the random number is greater than or equal to the first probability, the new solution is not accepted, and the position of the first particle at the j-th iteration is used as the position of the first particle after the simulated annealing process, that is, the state of the first particle at the j-th iteration is retained.

[0148] This means that by introducing a mechanism for probabilistically accepting suboptimal solutions, the particle swarm optimization algorithm will not fall into a local optimal solution too early during the search process. Even if the current solution is not the global optimal solution, it can still accept a less optimal solution with a certain probability, thus jumping out of the local optimal area and continuing to explore a wider solution space, increasing the possibility of finding the global optimal solution, thereby improving the quality of the target parameter combination in tasks such as image enhancement.

[0149] If the first particle is in the first iteration, performing the simulated annealing process on the first particle specifically includes the following steps:

[0150] D1. Randomly perturb the first position according to a preset method to obtain a second position;

[0151] D2. determining a second parameter combination according to the second position;

[0152] D3. transforming the reference second image using the incomplete Beta function according to the second parameter combination to obtain a fifth image;

[0153] D4. Calculating the fifth image using the comprehensive evaluation function to obtain a second fitness;

[0154] D5. Execute the simulated annealing process on the first particle according to the first fitness and the second fitness.

[0155] In a specific embodiment, the first position of a first particle is first randomly perturbed according to a predetermined method to obtain a second position. Predetermined methods include, but are not limited to, Gaussian noise perturbation, uniform distribution perturbation, and random walk perturbation, which are not specifically limited here. This random perturbation introduces a degree of randomness into the particle, enabling it to explore a wider range of regions in the search space and avoiding the limitations of the particle's initial position.

[0156] Next, a second parameter combination is determined based on the second position. The reference second image is then transformed using a non-complete Beta function based on the second parameter combination to obtain a fifth image. The fifth image is then calculated using a comprehensive evaluation function to obtain a second fitness, which reflects the optimization effect of the second parameter combination on the reference second image.

[0157] Finally, a simulated annealing process is performed on the first particle based on the first fitness and the second fitness. The initial state of the first particle (the state corresponding to the first fitness) is compared with the state after random perturbation (the state corresponding to the second fitness). The simulated annealing rules are then used to determine whether to update the position of the first particle, thereby guiding the first particle to search in a more optimal direction.

[0158] It can be seen that random perturbation in the first iteration enriches the initial search range of the particles, avoids the particles from being concentrated in a local area from the beginning, helps the initial particle swarm to explore the solution space more comprehensively in the early stage of the search, and increases the possibility of finding the global optimal solution.

[0159] The target particle group includes m target particles; each target particle corresponds to one initial particle; and the target parameter combination is determined according to the target particle group, specifically comprising the following steps:

[0160] E1. Calculate the fitness of each of the m target particles to obtain m reference fitnesses;

[0161] E2. Obtain the maximum reference fitness among the m reference fitnesses;

[0162] E3. Determine the target particle corresponding to the maximum reference fitness as the global optimal particle;

[0163] E4. Determine the target parameter combination according to the position of the global optimal particle.

[0164] In a specific embodiment, first, the fitness of each of the m target particles is calculated based on a comprehensive evaluation function to obtain m reference fitnesses. Then, the maximum value, i.e., the maximum reference fitness, is found from the m reference fitnesses. The target particle corresponding to the maximum reference fitness is determined as the global optimal particle, i.e., the target particle with the best performance in the target particle swarm. Finally, the target parameter combination is determined based on the position of the global optimal particle. In the particle swarm optimization algorithm, the position of the particle corresponds to a specific parameter combination, such as α and β in the incomplete Beta function, which is used for subsequent operations such as image enhancement.

[0165] As can be seen, calculating fitness based on a comprehensive evaluation function and accurately selecting the globally optimal particle from the target particle swarm ensures that the target parameter combination determined is one that performs well across multiple image feature dimensions. Compared to optimization methods that only consider a single feature, this approach can more comprehensively improve image quality, meeting the multi-faceted image performance requirements of practical applications, thereby enhancing the algorithm's optimization effectiveness and performance.

[0166] Step S505 : transforming each of the n grayscale value sets according to the target parameter combination to obtain an n-layer third image.

[0167] Specifically, the transformation method and degree are determined based on the target first and second parameters corresponding to the target parameter combination, thereby transforming each of the n grayscale value sets to obtain n layers of the third image. For example, a non-complete Beta function is adjusted using the target first and second parameters, and each grayscale value is mapped to a new grayscale value using the non-complete Beta function, thereby obtaining n new grayscale value sets. The grayscale values in each grayscale value set are then recombined to form a new image layer, namely, the third image.

[0168] Step S506: reconstruct the n-layer third image to obtain a target image.

[0169] Specifically, from the top layer L' in the third image of n layers n Start and let I′ n =L′ n , taking the top image as the initial value. Then, calculate the n-layer third image according to the preset superposition calculation formula to obtain the target image. The superposition calculation formula is as follows:

[0170] I′ k =L′ k +upsample(I′ k+1 )

[0171] Among them, I′ k Represents the kth layer image after superposition; k is an integer between 1 and n-1; L′ k represents the third image of the kth layer; I′ k+1 Represents the third image of the k+1th layer, i.e. L′ k The previous image; upsample(I′ k+1 ) represents the I′ k+1 Perform upsampling operation.

[0172] It should be noted that upsampling increases the resolution of the upper layer image to the same or matching scale as the current layer, allowing the different layers of images to be correctly fused in spatial dimensions. By performing a superposition operation on the third image of the nth layer according to the superposition calculation formula, the current layer image can be fused with the previous layer image, integrating the information of the previous layer into the current layer, gradually restoring the details and structure of the complete image. Finally, the bottom layer I1′ is obtained and used as the target image.

[0173] It can be seen that by reconstructing the image, the image contrast and detail clarity are improved, which is more conducive to subsequent recognition tasks.

[0174] The above mainly introduces the solution of the embodiment of the present application from the perspective of the execution process of the method side. It is understandable that, in order to realize the above functions, the electronic device includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiment provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0175] The embodiment of the present application can divide the functional units of the electronic device according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0176] In the case of dividing each functional module into corresponding functional modules, Figure 8 8 is a functional module block diagram of an image enhancement device based on hybrid particle swarm optimization provided in an embodiment of the present application. The image enhancement device 800 based on hybrid particle swarm optimization includes a first determination module 810, a decomposition module 820, a processing module 830, a second determination module 840, a transformation module 850, and a reconstruction module 860, wherein:

[0177] The first determining module 810 is configured to acquire a first image and determine a first decomposition layer number according to the first image;

[0178] The decomposition module 820 is configured to decompose the first image according to the first decomposition layer number and the Laplacian pyramid algorithm to obtain n-layer second images, where n is an integer greater than 1;

[0179] The processing module 830 is configured to normalize the grayscale values of all pixels of each second image in the n layers of second images to obtain n grayscale value sets;

[0180] The second determination module 840 is used to determine a target parameter combination according to a preset hybrid particle swarm optimization method; the target parameter combination includes a target first parameter and a target second parameter;

[0181] The transformation module 850 is configured to transform each of the n grayscale value sets according to the target parameter combination to obtain an n-layer third image;

[0182] The reconstruction module 860 is used to reconstruct the n-layer third image to obtain a target image.

[0183] Optionally, in determining the first decomposition level according to the first image, the first determining module 810 is specifically configured to:

[0184] Obtaining a first resolution corresponding to the first image;

[0185] determining the initial number of decomposition layers according to the first resolution;

[0186] Calculating an entropy value of the first image to obtain a first entropy value;

[0187] If the first entropy value is greater than a preset threshold, the initial decomposition level is increased by one to obtain the first decomposition level;

[0188] If the first entropy value is less than or equal to the preset threshold, the initial decomposition level number is used as the first decomposition level number.

[0189] Optionally, in the aspect of decomposing the first image according to the first decomposition layer number and the Laplacian pyramid algorithm to obtain the n-layer second image, the decomposition module 820 is specifically configured to:

[0190] Perform n-1 Gaussian blur and n-1 downsampling operations on the first image according to the first decomposition layer number to obtain an n-1 layer reference image;

[0191] Determine a Gaussian pyramid based on the first image and the n-1 layer reference image; the first image is the first layer image of the Gaussian pyramid, and the n-1 layer reference image is the second to nth layer images of the Gaussian pyramid;

[0192] Calculating the Gaussian pyramid according to a preset difference calculation formula to obtain the first n-1 layers of the second image;

[0193] The difference calculation formula is as follows:

[0194] L k =I k -upsample(I k+1 )

[0195] Among them, L k Represents the second image of the kth layer; k is an integer between 1 and n-1; I k I represents the k-th layer image of the Gaussian pyramid; k+1 represents the k+1th layer image of the Gaussian pyramid; upsample(I k+1 ) indicates I k+1 Perform upsampling operation;

[0196] The n-th layer second image is determined according to the n-th layer image of the Gaussian pyramid and the first n-1 layers of the second image.

[0197] Optionally, in determining the target parameter combination according to the preset hybrid particle swarm optimization method, the second determining module 840 is specifically configured to:

[0198] Randomly generate particles according to a preset parameter space to obtain an initial particle group; the initial particle group includes m initial particles; m is an integer greater than 1; the position of each initial particle corresponds to a parameter combination; each parameter combination corresponds to a first parameter and a second parameter;

[0199] Obtaining the number of iterations a and initializing the number of iterations a to 0;

[0200] Perform the following steps G1-G8 on the initial particle swarm:

[0201] G1. Determine a first parameter combination according to a first position of a first particle; the first particle is any one of the m initial particles;

[0202] G2. Transforming the reference second image according to the first parameter combination using a non-complete Beta function to obtain a fourth image; the reference second image is any second image in the n layers of second images;

[0203] G3. Calculate the fourth image using a comprehensive evaluation function to obtain a first fitness; repeat steps G1-G3 m-1 times to obtain m-1 fitnesses, and calculate an average of the m-1 fitnesses and the first fitness to obtain an average fitness;

[0204] G4. Determine whether the first fitness is less than or equal to the average fitness; if the first fitness is less than or equal to the average fitness, perform a simulated annealing process on the first particle and go to step G5; if the first fitness is greater than the average fitness, go directly to step G5;

[0205] G5. Update the first particle according to a preset optimization algorithm to obtain an updated first particle;

[0206] G6. Update m-1 initial particles other than the first particle among the m initial particles according to steps G1 to G5. When all the m initial particles are updated, the number of iterations a is automatically increased by 1.

[0207] G7. If the number of iterations a is less than the preset maximum number of iterations, proceed to the next iteration and repeat steps G1-G6 until the number of iterations a is equal to the preset maximum number of iterations. The iteration is terminated and the target particle swarm is obtained.

[0208] G8. Determine the target parameter combination according to the target particle group.

[0209] Optionally, if the first particle is not in the first iteration, in performing the simulated annealing process on the first particle, the second determining module 840 is further specifically configured to:

[0210] The simulated annealing probability of the first particle is calculated according to a preset probability formula to obtain a first probability; wherein the probability formula is as follows:

[0211]

[0212] Among them, P r represents the first probability; F(i) represents the fitness of the first particle at the i-th iteration; F(j) represents the fitness of the first particle at the j-th iteration; where i=j+1, j is a positive integer; otherwise represents the case where F(i) is less than F(j); T(i) represents the temperature parameter of simulated annealing at the i-th iteration;

[0213] When the first probability is not 1, generating a random number between 0 and 1;

[0214] When the random number is less than the first probability or the first probability is 1, the position of the first particle in the i-th iteration is used as the position of the first particle after the simulated annealing process is completed;

[0215] When the random number is greater than or equal to the first probability, the position of the first particle at the jth iteration is used as the position of the first particle after the simulated annealing process is completed.

[0216] Optionally, if the first particle is in the first iteration, in performing the simulated annealing process on the first particle, the second determining module 840 is further specifically configured to:

[0217] Randomly perturb the first position according to a preset method to obtain a second position;

[0218] determining a second parameter combination according to the second position;

[0219] transforming the reference second image using the incomplete Beta function according to the second parameter combination to obtain a fifth image;

[0220] Calculating the fifth image using the comprehensive evaluation function to obtain a second fitness;

[0221] The simulated annealing process is performed on the first particles according to the first fitness and the second fitness.

[0222] Optionally, the target particle group includes m target particles; each target particle corresponds to one initial particle; in determining the target parameter combination based on the target particle group, the second determination module 840 is further specifically configured to:

[0223] Calculating the fitness of each of the m target particles to obtain m reference fitnesses;

[0224] Obtaining the maximum reference fitness among the m reference fitnesses;

[0225] Determining the target particle corresponding to the maximum reference fitness as the global optimal particle;

[0226] The target parameter combination is determined according to the position of the global optimal particle.

[0227] It can be seen that the quality of the image can be improved by dynamically adjusting the number of decomposition layers of the image and enhancing the image according to the hybrid particle swarm optimization method.

[0228] It should be noted that the specific implementation of each operation can adopt the corresponding description of the method embodiment shown above. The image enhancement device 800 based on hybrid particle swarm optimization can be used to execute the above method embodiment of the present application, which will not be described in detail.

[0229] An embodiment of the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.

[0230] The present application also provides a computer program product comprising a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to perform some or all of the steps of any of the methods described in the above method embodiments. The computer program product may be a software installation package, and the computer may comprise an electronic device.

[0231] It should be noted that, for the above-mentioned various embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. Those skilled in the art should know that this application is not limited by the order of the actions described, because some steps in the embodiments of the present application can be performed in other orders or simultaneously. In addition, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions, steps, modules or units involved are not necessarily required by the embodiments of the present application.

[0232] In the above embodiments, the embodiments of the present application have different focuses on the description of each embodiment. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0233] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

[0234] The steps of the method or algorithm described in the embodiments of the present application can be implemented in hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in RAM, flash memory, ROM, EPROM, electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and storage medium can be located in an ASIC. In addition, the ASIC can be located in a terminal device or a management device. Of course, the processor and storage medium can also be present in a terminal device or a management device as discrete components.

[0235] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, they can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0236] The modules / units included in the devices and products described in the above embodiments may be software modules / units, hardware modules / units, or partly software modules / units and partly hardware modules / units. For example, for the devices and products applied to or integrated in the chip, the modules / units included therein may all be implemented in the form of hardware such as circuits, or at least part of the modules / units may be implemented in the form of software programs, which run on the processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits; for the devices and products applied to or integrated in the chip module, the modules / units included therein may all be implemented in the form of hardware such as circuits, and different modules / units may be located in the same component (such as chip, circuit module, etc.) or different components of the chip module, or at least part of the modules / units may be It is implemented in the form of a software program, which runs on the processor integrated inside the chip module, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuits; for various devices and products applied to or integrated in the terminal equipment, the various modules / units contained therein can be implemented in the form of hardware such as circuits, and different modules / units can be located in the same component (for example, chip, circuit module, etc.) or different components in the terminal equipment, or, at least some modules / units can be implemented in the form of a software program, which runs on the processor integrated inside the terminal equipment, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuits.

[0237] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects of the embodiments of the present application. It should be understood that the above description is only a specific implementation method of the embodiments of the present application and is not intended to limit the scope of protection of the embodiments of the present application. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions of the embodiments of the present application should be included in the scope of protection of the embodiments of the present application.

Claims

1. An image enhancement method based on hybrid particle swarm optimization, characterized in that: The method comprises: Acquire a first image, and determine a first decomposition layer number according to the first image; Decomposing the first image according to the first decomposition layer number and the Laplacian pyramid algorithm to obtain n-layer second images, where n is an integer greater than 1; Normalizing the grayscale values of all pixels of each second image in the n layers of second images to obtain n grayscale value sets; Determining a target parameter combination according to a preset hybrid particle swarm optimization method; the target parameter combination includes a target first parameter and a target second parameter; transforming each of the n grayscale value sets according to the target parameter combination to obtain n layers of third images; The n-layer third image is reconstructed to obtain a target image.

2. The method according to claim 1, wherein The determining of the first decomposition number of layers according to the first image includes: Obtaining a first resolution corresponding to the first image; determining the initial number of decomposition layers according to the first resolution; Calculating an entropy value of the first image to obtain a first entropy value; If the first entropy value is greater than a preset threshold, the initial decomposition level is increased by one to obtain the first decomposition level; If the first entropy value is less than or equal to the preset threshold, the initial decomposition level number is used as the first decomposition level number.

3. The method according to claim 1, wherein Decomposing the first image according to the first decomposition layer number and the Laplacian pyramid algorithm to obtain n-layer second images includes: Performing n-1 Gaussian blur and n-1 downsampling operations on the first image according to the first decomposition layer number to obtain an n-1 layer reference image; Determine a Gaussian pyramid based on the first image and the n-1 layer reference image, wherein the first image is the first layer image of the Gaussian pyramid, and the n-1 layer reference image is the second to nth layer images of the Gaussian pyramid; Calculating the Gaussian pyramid according to a preset difference calculation formula to obtain the first n-1 layers of the second image; The difference calculation formula is as follows: L k =I k -upsample(I k+1 ) Among them, L k Represents the second image of the kth layer; k is an integer between 1 and n-1; I k I represents the k-th layer image of the Gaussian pyramid; k+1 represents the k+1th layer image of the Gaussian pyramid; upsample(I k+1 ) indicates I k+1 Perform upsampling operation; The n-th layer second image is determined according to the n-th layer image of the Gaussian pyramid and the first n-1 layers of the second image.

4. The method according to claim 1, wherein The method of determining the target parameter combination according to the preset hybrid particle swarm optimization method includes: Randomly generate particles according to a preset parameter space to obtain an initial particle group; the initial particle group includes m initial particles; m is an integer greater than 1; the position of each initial particle corresponds to a parameter combination; each parameter combination corresponds to a first parameter and a second parameter; Obtaining the number of iterations a and initializing the number of iterations a to 0; Perform the following steps G1-G8 on the initial particle swarm: G1. Determine a first parameter combination according to a first position of a first particle; the first particle is any one of the m initial particles; G2. Transforming the reference second image according to the first parameter combination using a non-complete Beta function to obtain a fourth image; the reference second image is any second image in the n layers of second images; G3. Calculate the fourth image using a comprehensive evaluation function to obtain a first fitness; repeat steps G1-G3 m-1 times to obtain m-1 fitnesses, and calculate an average of the m-1 fitnesses and the first fitness to obtain an average fitness; G4. Determine whether the first fitness is less than or equal to the average fitness; if the first fitness is less than or equal to the average fitness, perform a simulated annealing process on the first particle and go to step G5; if the first fitness is greater than the average fitness, go directly to step G5; G5. Update the first particle according to a preset optimization algorithm to obtain an updated first particle; G6. Update m-1 initial particles other than the first particle among the m initial particles according to steps G1 to G5. When all the m initial particles are updated, the number of iterations a is automatically increased by 1. G7. If the number of iterations a is less than the preset maximum number of iterations, proceed to the next iteration and repeat steps G1-G6 until the number of iterations a is equal to the preset maximum number of iterations. The iteration is terminated and the target particle swarm is obtained. G8. Determine the target parameter combination according to the target particle group.

5. The method according to claim 4, wherein If the first particle is not in the first iteration, performing a simulated annealing process on the first particle includes: The simulated annealing probability of the first particle is calculated according to a preset probability formula to obtain a first probability; wherein the probability formula is as follows: Among them, P r represents the first probability; F(i) represents the fitness of the first particle at the i-th iteration; F(j) represents the fitness of the first particle at the j-th iteration; where i=j+1, j is a positive integer; otherwise represents the case where F(i) is less than F(j); T(i) represents the temperature parameter of simulated annealing at the i-th iteration; When the first probability is not 1, generating a random number between 0 and 1; When the random number is less than the first probability or the first probability is 1, the position of the first particle in the i-th iteration is used as the position of the first particle after the simulated annealing process is completed; When the random number is greater than or equal to the first probability, the position of the first particle at the jth iteration is used as the position of the first particle after the simulated annealing process is completed.

6. The method according to claim 5, wherein If the first particle is in the first iteration, performing a simulated annealing process on the first particle includes: Randomly perturb the first position according to a preset method to obtain a second position; determining a second parameter combination according to the second position; transforming the reference second image using the incomplete Beta function according to the second parameter combination to obtain a fifth image; Calculating the fifth image using the comprehensive evaluation function to obtain a second fitness; The simulated annealing process is performed on the first particles according to the first fitness and the second fitness.

7. The method according to any one of claims 4 to 6, characterized in that The target particle group includes m target particles; Each target particle corresponds to one initial particle; and determining the target parameter combination according to the target particle group includes: Calculating the fitness of each of the m target particles to obtain m reference fitnesses; Obtaining the maximum reference fitness among the m reference fitnesses; Determining the target particle corresponding to the maximum reference fitness as the global optimal particle; The target parameter combination is determined according to the position of the global optimal particle.

8. An image enhancement device based on hybrid particle swarm optimization, characterized in that: The apparatus includes a first determination module, a decomposition module, a processing module, a second determination module, a transformation module, and a reconstruction module, wherein: The first determining module is configured to acquire a first image and determine a first decomposition layer number according to the first image; The decomposition module is configured to decompose the first image according to the first decomposition layer number and the Laplacian pyramid algorithm to obtain n-layer second images, where n is an integer greater than 1; The processing module is configured to normalize the grayscale values of all pixels of each second image in the n layers of second images to obtain n grayscale value sets; The second determination module is used to determine a target parameter combination according to a preset hybrid particle swarm optimization method; the target parameter combination includes a target first parameter and a target second parameter; The transformation module is configured to transform each of the n grayscale value sets according to the target parameter combination to obtain n layers of third images; The reconstruction module is used to reconstruct the n-layer third image to obtain a target image.

9. An electronic device, characterized in that: include: a processor, a memory, a communication interface, and one or more programs; The one or more programs are stored in the memory and configured to be executed by the processor, wherein the programs include instructions for executing the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 7.