Image enhancement method and device, medium and electronic equipment
The multi-scale Retinex algorithm and adaptive histogram equalization algorithm are used to process images of reflective material products, which solves the problem of uneven illumination and inconspicuous display of defects, and improves the accuracy and recognition effect of machine vision inspection.
Patent Information
- Application Number
- CN202410972923.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-10-22
AI Technical Summary
The quality of machine vision inspection of reflective material products in the existing technology is poor, mainly due to uneven illumination and inconspicuous display of defects, resulting in low accuracy of automated identification.
The multi-scale Retinex algorithm is used to equalize the illumination of the original image, and the color order range is reduced through linear stretching. The image is then converted to the YCrCb channel, and the adaptive histogram equalization algorithm is used to enhance the contrast of the Y channel to highlight the image details.
The quality of image recognition is improved, the accuracy of machine vision inspection of reflective material products is enhanced, and more effective defect identification is achieved.
Smart Images

Figure CN118822862A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image enhancement method, device, medium and electronic device. Background Art
[0002] Inspecting the appearance quality of parts is an important part of industrial production. However, manual inspection methods such as visual inspection or manual touch are inefficient and prone to fatigue. The accuracy of inspection is also low due to proficiency and environmental factors. Therefore, automatic identification of defects is considered. However, some products are made of reflective materials, which have high requirements for cameras and ambient light. Under the current conditions, photographed images often have problems such as uneven lighting and unclear defects, resulting in poor quality of machine vision inspection. Summary of the invention
[0003] The main purpose of the present application is to provide an image enhancement method, device, medium and electronic equipment, aiming to solve the problem of poor quality of machine vision inspection of reflective material products in the prior art.
[0004] To achieve the above objectives, the technical solutions adopted in the embodiments of the present application are as follows:
[0005] In a first aspect, an embodiment of the present application provides an image enhancement method, comprising the following steps:
[0006] Performing MSR processing based on RGB channels on the original image to obtain a first enhanced image;
[0007] linearly stretching the first enhanced image to obtain a stretched image;
[0008] Convert RGB channels to YC for stretched images r C b Channel conversion, and YC based on adaptive histogram equalization algorithm r C b The Y channel of the channel is contrast enhanced to obtain the target enhanced image.
[0009] In a possible implementation manner of the first aspect, linearly stretching the first enhanced image to obtain a stretched image includes:
[0010] The first enhanced image is linearly stretched according to the truncation maximum value and the truncation minimum value to obtain a stretched image.
[0011] In a possible implementation manner of the first aspect, linearly stretching the first enhanced image according to the truncation maximum value and the truncation minimum value, before obtaining the stretched image, the method further includes:
[0012] According to the first enhanced image, a color level mean and a color level standard deviation are obtained;
[0013] According to the dynamic transformation factor, the color scale mean and the color scale standard deviation, the maximum truncation value and the minimum truncation value are obtained.
[0014] In a possible implementation of the first aspect, the stretched image is converted from RGB channels to YC channels. r C b Channel conversion, and YC based on adaptive histogram equalization algorithm r C b The Y channel of the channel is contrast enhanced to obtain the target enhanced image, including:
[0015] Convert RGB channels to YC for stretched images r C b Channel conversion to obtain a converted image;
[0016] The Y channel of the converted image is divided according to the size of the local square block to obtain several sub-blocks;
[0017] Clipping each gray level of the histogram of each sub-block according to the clipping value to obtain a clipped image;
[0018] Perform grayscale interpolation on the pixels of the cropped image to obtain the target enhanced image.
[0019] In a possible implementation manner of the first aspect, before segmenting the Y channel of the converted image according to the size of the local square block to obtain the plurality of sub-blocks, the method further includes:
[0020] The size of the local square block is determined according to the size of the pixel values corresponding to the width and height of the local square in the original image.
[0021] In a possible implementation manner of the first aspect, before clipping each gray level of the histogram of each sub-block according to the clipping value and obtaining the clipped image, the method further includes:
[0022] Perform histogram equalization on each sub-block to obtain a grayscale mapping table;
[0023] The shear value is determined according to the average pixel value of each gray level in the grayscale mapping table.
[0024] In a possible implementation manner of the first aspect, performing MSR processing based on RGB channels on the original image to obtain a first enhanced image includes:
[0025] Each channel of the RGB channel of the original image is calculated to implement MSR processing and obtain a first enhanced image; wherein the calculation formula is as follows:
[0026]
[0027] Among them, (x, y) is the pixel point, R(x, y) is the enhancement effect of the first enhanced image, S(x, y) is the color level of the original image, and w n is the weight, N represents the number of scales, F n (x, y) is the filter function corresponding to the nth scale, and * is the convolution.
[0028] In a second aspect, an embodiment of the present application provides an image enhancement device, comprising:
[0029] A first enhancement module, the first enhancement module is used to perform MSR processing based on RGB channels on the original image to obtain a first enhanced image;
[0030] A linear stretching module, which is used to linearly stretch the first enhanced image to obtain a stretched image;
[0031] The target enhancement module is used to convert the RGB channel of the stretched image to YC r C b Channel conversion, and YC based on adaptive histogram equalization algorithm r C b The Y channel of the channel is contrast enhanced to obtain the target enhanced image.
[0032] In a third aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program. When the computer program is loaded and executed by a processor, the image enhancement method provided in any one of the first aspects above is implemented.
[0033] In a fourth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein:
[0034] The memory is used to store computer programs;
[0035] The processor is used to load and execute a computer program so that the electronic device executes the image enhancement method provided in any one of the first aspects above.
[0036] Compared with the prior art, the beneficial effects of this application are:
[0037] The present application provides an image enhancement method, device, medium and electronic device, the method comprising: performing MSR processing based on RGB channels on the original image to obtain a first enhanced image; performing linear stretching on the first enhanced image to obtain a stretched image; performing RGB channel to YC channel conversion on the stretched image r C b Channel conversion, and YC based on adaptive histogram equalization algorithm r C bThe Y channel of the channel is contrast enhanced to obtain the target enhanced image. This application first uses MSR processing, that is, the multi-scale Retinex algorithm to balance the illumination of the original image. In order to prevent the color from being too bright or too dark, the image is linearly stretched to reduce the color level range, and then it is converted from RGB channels to YC r C b The adaptive histogram equalization algorithm is used to enhance the contrast of the Y channel and highlight the image details, so that the processed image can be more conducive to image recognition, thereby improving the quality of machine vision inspection of reflective material products. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A schematic diagram of the structure of an electronic device of a hardware operating environment involved in an embodiment of the present application;
[0039] Figure 2 A schematic diagram of a flow chart of an image enhancement method provided in an embodiment of the present application;
[0040] Figure 3 A schematic diagram of an original image in the image enhancement method provided in an embodiment of the present application;
[0041] Figure 4 A schematic diagram of a first enhanced image in the image enhancement method provided in an embodiment of the present application;
[0042] Figure 5 A schematic diagram of a target enhanced image in the image enhancement method provided in an embodiment of the present application;
[0043] Figure 6 A schematic diagram of a module of an image enhancement device provided in an embodiment of the present application;
[0044] Markings in the figure: 101 - processor, 102 - communication bus, 103 - network interface, 104 - user interface, 105 - memory. DETAILED DESCRIPTION
[0045] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0046] The main solution of the embodiment of the present application is: perform MSR processing based on RGB channels on the original image to obtain a first enhanced image; perform linear stretching on the first enhanced image to obtain a stretched image; perform RGB channel to YC channel conversion on the stretched image r C b Channel conversion, and YC based on adaptive histogram equalization algorithm r C b The Y channel of the channel is contrast enhanced to obtain the target enhanced image.
[0047] In the factory workshop, there are a large number of reflective material parts, such as aluminum sheet metal parts, stainless steel parts and other metal products. Such parts have high requirements for appearance quality, but often cause surface scratches or pits during storage, transportation and use, which ultimately affect the appearance quality of the finished product. In the existing inspection technology, for such parts, manual inspection processes such as visual or hand touch are often adopted. This type of inspection method is firstly extremely dependent on manual operation, and it is easy to cause errors such as missed inspection and wrong inspection due to factors such as fatigue, worker proficiency, and environment; secondly, it is not conducive to quantifying part defects; thirdly, because of contact operations such as hand touch, there is a certain degree of danger. Based on the above problems, consider using automated operations for part defect recognition, and the key step is image preprocessing.
[0048] Because reflective materials have high requirements for cameras and ambient light, under existing conditions, photographic images often have problems such as uneven lighting and unclear defects. Therefore, it is urgent to pre-process such images, restore colors and enhance contrast, highlight local details of the image, and make the enhanced image more consistent with the visual characteristics of the human body, which is conducive to the next step of defect identification.
[0049] To this end, this application provides a solution. First, the original image is processed by MSR, that is, the multi-scale Retinex algorithm to balance the illumination. In order to prevent the color from being too bright or too dark, the image is linearly stretched to reduce the color level range, and then it is converted from RGB channels to YC. r C b The adaptive histogram equalization algorithm is used to enhance the contrast of the Y channel and highlight the image details, so that the processed image can be more conducive to image recognition, thereby improving the quality of machine vision inspection of reflective material products.
[0050] See attached Figure 1 , attached Figure 1This is a schematic diagram of the structure of an electronic device of the hardware operating environment involved in the embodiment of the present application. The electronic device may include: a processor 101, such as a central processing unit (CPU), a communication bus 102, a user interface 104, a network interface 103, and a memory 105. Among them, the communication bus 102 is used to realize the connection and communication between these components. The user interface 104 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the user interface 104 may also include a standard wired interface and a wireless interface. The network interface 103 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 105 may optionally be a storage device independent of the aforementioned processor 101. The memory 105 may be a high-speed random access memory (RAM) memory, or it may be a stable non-volatile memory (NVM), such as at least one disk storage; the processor 101 may be a general-purpose processor, including a central processing unit, a network processor, etc., or it may be a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component.
[0051] Those skilled in the art will appreciate that Figure 1 The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0052] As attached Figure 1 As shown, the memory 105 as a storage medium may include an operating system, a network communication module, a user interface module and an image enhancement device.
[0053] In the attached Figure 1 In the electronic device shown, the network interface 103 is mainly used for data communication with a network server; the user interface 104 is mainly used for data interaction with a user; the processor 101 and the memory 105 in the present application can be set in the electronic device, and the electronic device calls the image enhancement device stored in the memory 105 through the processor 101, and executes the image enhancement method provided in the embodiment of the present application.
[0054] See attached Figure 2 Based on the hardware device of the aforementioned embodiment, the embodiment of the present application provides an image enhancement method, comprising the following steps:
[0055] S10: Perform MSR processing based on RGB channels on the original image to obtain a first enhanced image.
[0056] In the specific implementation process, the original image, that is, the image obtained by photographing the product whose appearance quality is to be inspected by machine vision, has reflective materials on the product that will affect the quality of the photographed image, such as aluminum sheet metal parts, stainless steel parts and other metal materials. MSR, or multi-scale Retinex algorithm, is an image enhancement technology that aims to improve the visual effect of the image, especially under low light or complex lighting conditions. This algorithm is based on Retinex theory and processes images by simulating the human visual system's perception of brightness and color. The MSR algorithm applies Retinex theory at different scales to achieve dynamic range compression and color constancy of the image. Specifically: perform MSR processing based on the RGB channel on the original image to obtain the first enhanced image, including:
[0057] Each channel of the RGB channel of the original image is calculated to implement MSR processing and obtain a first enhanced image; wherein the calculation formula is as follows:
[0058]
[0059] Among them, (x, y) is the pixel point, R(x, y) is the enhancement effect of the first enhanced image, S(x, y) is the color level of the original image, and w n is the weight, N represents the number of scales, F n (x, y) is the filter function corresponding to the nth scale, and * is the convolution.
[0060] The original image obtained by shooting the reflective material product is subjected to MSR processing, that is, the above calculation is performed for each channel of the image color RGB, and the division by 255 in the calculation formula is a normalization operation. The filter function is:
[0061]
[0062] Among them, k satisfies ∫∫F n (x,y)dxdy=1,σ n represents the kernel parameter, and exp is the natural exponential function.
[0063] S20: linearly stretching the first enhanced image to obtain a stretched image.
[0064] In the specific implementation process, in order to prevent the color from being too bright or too dark, linear stretching is performed to reduce the color level range of R(x,y) and limit the color level to the vicinity of the mean. Specifically, linear stretching is performed on the first enhanced image to obtain a stretched image, including:
[0065] The first enhanced image is linearly stretched according to the truncation maximum value and the truncation minimum value to obtain a stretched image.
[0066] Linear stretching, that is, calculating the stretched image R MSR (x, y), the calculation is determined according to the relative size of the first enhanced image R(x, y) and the truncated maximum value and the truncated minimum value:
[0067]
[0068] Among them, the maximum value R is cut off max and truncate minimum value R min It can be obtained by calculating according to the mean and the standard deviation, that is, according to the maximum truncation value and the minimum truncation value, the first enhanced image is linearly stretched. Before obtaining the stretched image, the method further includes:
[0069] According to the first enhanced image, a color level mean and a color level standard deviation are obtained;
[0070] According to the dynamic transformation factor, the color scale mean and the color scale standard deviation, the maximum truncation value and the minimum truncation value are obtained.
[0071] In the specific implementation process, R(x,y) is used to obtain the color level mean and the color level standard deviation std, so as to calculate the truncated maximum value R max and truncate minimum value R min , the calculation formula is as follows:
[0072]
[0073] Where d is the dynamic transformation factor, which is usually 1.5-3.
[0074] S30: Convert RGB channels to YC for stretched images r C b Channel conversion, and YC based on adaptive histogram equalization algorithm r C b The Y channel of the channel is contrast enhanced to obtain the target enhanced image.
[0075] In the specific implementation process, YC r C b YUV is a color encoding method, which is the same level as RGB and is widely used in the multimedia field. In other words, the color information of each pixel in the image can be expressed in YUV in addition to RGB. YUV is an analog signal, and its color model is derived from the RGB model, that is, brightness and chrominance are separated. On this basis, YUV can be used based on the adaptive histogram equalization algorithm. r C b The Y channel of the channel is contrast enhanced.
[0076] Adaptive histogram equalization (AHE) is a computer image processing technology used to enhance the contrast of images. Unlike ordinary histogram equalization algorithms, the AHE algorithm changes the image contrast by calculating the local histogram of the image and then redistributing the brightness. Therefore, the algorithm is more suitable for improving the local contrast of the image and obtaining more image details.
[0077] Specifically: Convert RGB channels to YC channels of the stretched image r C b Channel conversion, and YC based on adaptive histogram equalization algorithm r C b The Y channel of the channel is contrast enhanced to obtain the target enhanced image, including:
[0078] Convert RGB channels to YC for stretched images r C b Channel conversion to obtain a converted image;
[0079] The Y channel of the converted image is divided according to the size of the local square block to obtain several sub-blocks;
[0080] Clipping each gray level of the histogram of each sub-block according to the clipping value to obtain a clipped image;
[0081] Perform grayscale interpolation on the pixels of the cropped image to obtain the target enhanced image.
[0082] In the specific implementation process, the stretched image R MSR (x,y) convert RGB channels to YC r C b Channel conversion, the above-mentioned specific operation is performed on the Y channel, and before this, the size of the local square block can be determined first, that is, the Y channel of the converted image is divided according to the size of the local square block, and before obtaining a plurality of sub-blocks, the method further includes:
[0083] The size of the local square block is determined according to the size of the pixel values corresponding to the width and height of the local square in the original image.
[0084] The width and height of the local square are adjusted according to about 1% of the pixel value corresponding to the width and height of the original image. The smaller the width and height, the greater the contrast of the equalized image, but more noise points will be added. This is the problem that AHE has the problem of over-amplifying the noise in the same area of the image. At this time, another adaptive histogram equalization algorithm, namely the limited contrast histogram equalization (CLAHE) algorithm, can be used to limit this unfavorable amplification.
[0085] In the contrast enhancement process, the channel is first converted to obtain a converted image. Then, the Y channel of the converted image is divided into a plurality of sub-blocks according to the local square blocks of determined sizes. Then, each gray level of the histogram of each sub-block is clipped by a clipping value. The clipping value is determined according to a gray mapping table, that is, each gray level of the histogram of each sub-block is clipped according to the clipping value. Before obtaining the clipped image, the method further includes:
[0086] Perform histogram equalization on each sub-block to obtain a grayscale mapping table;
[0087] The shear value is determined according to the average pixel value of each gray level in the grayscale mapping table.
[0088] Perform histogram equalization on each sub-block, calculate the histogram and cumulative histogram, and obtain the grayscale mapping table corresponding to the equalized grayscale of each block of original grayscale. The clipping value is a multiple of the average pixel value of each grayscale level, starting from twice and adjusting with a step size of 1. After clipping, perform grayscale interpolation on each pixel to obtain the final grayscale output value, that is, the target enhanced image. Grayscale interpolation is used to estimate and generate pixel grayscale values at non-integer coordinate positions in the image, which is necessary for image transformation. It highlights the details of image defects through contrast enhancement, which is conducive to machine vision recognition.
[0089] In this embodiment, the original image is first processed by MSR, that is, the multi-scale Retinex algorithm to balance the illumination. In order to prevent the color from being too bright or too dark, the image is linearly stretched to reduce the color range, and then converted from RGB channels to YC channels. r C b The adaptive histogram equalization algorithm is used to enhance the contrast of the Y channel and highlight the image details, so that the processed image can be more conducive to image recognition, thereby improving the quality of machine vision inspection of reflective material products.
[0090] Attach Figure 3 The original image shown in the figure is taken as an example to further illustrate the present application. Figure 3 The image obtained by shooting the aluminum sheet metal is subjected to the image enhancement operation provided in the embodiment of the present application. The scale in the MSR operation is selected as {3, 51, 301}, d is 2, and the image after the illumination equalization is as shown in the attached figure. Figure 4 As shown in the figure, in the CLAHE operation, the width and height of the local square are 16 and 16 respectively, and the shear value is 2. Figure 4 Based on the Y channel contrast enhancement, the target enhanced image is obtained as shown in the attached figure. Figure 5 As shown in the figure, the image details are significantly enhanced. Then the enhanced image, i.e. the target enhanced image, is fed into the machine vision inspection equipment for recognition, thus realizing automatic defect detection.
[0091] See attached Figure 6 Based on the same inventive concept as in the above-mentioned embodiment, the embodiment of the present application further provides an image enhancement device, comprising:
[0092] A first enhancement module, the first enhancement module is used to perform MSR processing based on RGB channels on the original image to obtain a first enhanced image;
[0093] A linear stretching module, which is used to linearly stretch the first enhanced image to obtain a stretched image;
[0094] The target enhancement module is used to convert the RGB channel of the stretched image to YC r C b Channel conversion, and YC based on adaptive histogram equalization algorithm r C b The Y channel of the channel is contrast enhanced to obtain the target enhanced image.
[0095] Those skilled in the art should understand that the division of the various modules in the embodiment is only a division of logical functions, and can be fully or partially integrated into one or more actual carriers in actual application, and these modules can be implemented entirely in the form of software called by a processing unit, or entirely in the form of hardware, or in the form of a combination of software and hardware. It should be noted that the modules in the image enhancement device in this embodiment correspond one-to-one to the steps in the image enhancement method in the aforementioned embodiment. Therefore, the specific implementation of this embodiment can refer to the implementation of the aforementioned image enhancement method, which will not be repeated here.
[0096] Based on the same inventive concept as in the aforementioned embodiment, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when loaded and executed by a processor, implements an image enhancement method as provided in the embodiment of the present application.
[0097] Based on the same inventive concept as in the above-mentioned embodiment, an embodiment of the present application further provides an electronic device, including a processor and a memory, wherein:
[0098] The memory is used to store computer programs;
[0099] The processor is used to load and execute a computer program so that the electronic device executes the image enhancement method provided in the embodiment of the present application.
[0100] In some embodiments, the computer readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or various devices including one or any combination of the above memories. The computer may be various computing devices including intelligent terminals and servers.
[0101] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0102] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0103] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0104] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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 system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0105] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0106] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a multimedia terminal device (which can be a mobile phone, a computer, a television receiver, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0107] In summary, the present application provides an image enhancement method, device, medium and electronic device, the method comprising: performing MSR processing based on RGB channels on the original image to obtain a first enhanced image; performing linear stretching on the first enhanced image to obtain a stretched image; performing RGB channel to YC channel conversion on the stretched image; r C b Channel conversion, and YC based on adaptive histogram equalization algorithm r C b The Y channel of the channel is contrast enhanced to obtain the target enhanced image. This application first uses MSR processing, that is, the multi-scale Retinex algorithm to balance the illumination of the original image. In order to prevent the color from being too bright or too dark, the image is linearly stretched to reduce the color level range, and then it is converted from RGB channels to YC r C b The adaptive histogram equalization algorithm is used to enhance the contrast of the Y channel and highlight the image details, so that the processed image can be more conducive to image recognition, thereby improving the quality of machine vision inspection of reflective material products.
[0108] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. An image enhancement method, characterized in that: The following steps are involved: Performing MSR processing based on RGB channels on the original image to obtain a first enhanced image; linearly stretching the first enhanced image to obtain a stretched image; Convert the RGB channels of the stretched image to YC r C b Channel conversion, and YC based on adaptive histogram equalization algorithm r C b The Y channel of the channel is contrast enhanced to obtain the target enhanced image.
2. The image enhancement method according to claim 1, characterized in that: The linearly stretching the first enhanced image to obtain a stretched image includes: The first enhanced image is linearly stretched according to the truncation maximum value and the truncation minimum value to obtain a stretched image.
3. The image enhancement method according to claim 2, characterized in that: Before linearly stretching the first enhanced image according to the truncation maximum value and the truncation minimum value to obtain the stretched image, the method further comprises: According to the first enhanced image, obtaining a color scale mean and a color scale standard deviation; The truncation maximum value and the truncation minimum value are obtained according to the dynamic transformation factor, the color scale mean value and the color scale standard deviation.
4. The image enhancement method according to claim 1, characterized in that: Converting the RGB channel of the stretched image to YC r C b Channel conversion, and YC based on adaptive histogram equalization algorithm r C b The Y channel of the channel is contrast enhanced to obtain the target enhanced image, including: Convert the RGB channels of the stretched image to YC r C b Channel conversion to obtain a converted image; The Y channel of the conversion image is divided according to the size of the local square block to obtain a plurality of sub-blocks; Clipping each gray level of the histogram of each of the sub-blocks according to the clipping value to obtain a clipped image; Grayscale interpolation is performed on the pixels of the cropped image to obtain a target enhanced image.
5. The image enhancement method according to claim 4, characterized in that: Before dividing the Y channel of the converted image according to the size of the local square blocks to obtain a plurality of sub-blocks, the method further includes: The size of the local square block is determined according to the size of the pixel values corresponding to the width and height of the local square in the original image.
6. The image enhancement method according to claim 4, characterized in that: Before clipping each gray level of the histogram of each sub-block according to the clipping value to obtain the clipped image, the method further comprises: Performing histogram equalization on each of the sub-blocks to obtain a grayscale mapping table; The clipping value is determined according to the average pixel value of each gray level in the gray mapping table.
7. The image enhancement method according to claim 1, characterized in that: The performing MSR processing based on RGB channels on the original image to obtain a first enhanced image includes: Each channel of the RGB channel of the original image is calculated to implement MSR processing and obtain a first enhanced image; wherein the calculation formula is as follows: Where, (x, y) is a pixel, R(x, y) is the enhancement effect of the first enhanced image, S(x, y) is the color level of the original image, and w n is the weight, N represents the number of scales, F n (x, y) is the filter function corresponding to the nth scale, and * is the convolution.
8. An image enhancement device, characterized in that: include: A first enhancement module, wherein the first enhancement module is used to perform MSR processing based on RGB channels on the original image to obtain a first enhanced image; A linear stretching module, configured to linearly stretch the first enhanced image to obtain a stretched image; The target enhancement module is used to convert the RGB channel of the stretched image to the YC channel. r C b Channel conversion, and YC based on adaptive histogram equalization algorithm r C b The Y channel of the channel is contrast enhanced to obtain the target enhanced image.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is loaded and executed by a processor, the image enhancement method according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: comprising a processor and a memory, wherein: The memory is used to store computer programs; The processor is used to load and execute the computer program so that the electronic device performs the image enhancement method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Infrared image enhancement method based on improved histogram equalization and enhanced high-pass filtering
CN114418904A
Medical image multi-stage enhancement method and system
CN116452502A
Highly reflective metal surface character recognition method based on deep learning
CN117275010A
