Color image enhancement method and device based on LAB color space, and storage medium

By separating the brightness and color channels of the color image in the LAB color space, enhancing them separately, and converting the results back to the RGB color space, the problem of color information loss during color image enhancement in the prior art is solved, and a more ideal enhancement effect is achieved.

CN119904397APending Publication Date: 2025-04-29BEIJING LUSTER LIGHTTECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411994527.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

When the prior art enhances defects in color images, the color information of the image is easily lost, resulting in unsatisfactory enhancement effect.

Method used

Using a color image enhancement method based on LAB color space, the area of ​​interest is extracted from the color image, the image is converted from the RGB color space to the LAB color space, separated into the brightness channel and the color channel, respectively, and the enhanced channel is converted back to the RGB color space.

Benefits of technology

This method can maintain the original color information and improve the enhancement effect of defects in color images. The enhanced image contrast and color contrast are significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119904397A_ABST
    Figure CN119904397A_ABST
Patent Text Reader

Abstract

The invention discloses a color image enhancement method and device based on an LAB color space and a storage medium, and belongs to the technical field of computer vision. The method comprises the following steps: extracting a region of interest from a color image of a product; converting the color image from an RGB color space to an LAB color space to obtain a brightness channel image and a color channel image; respectively performing image enhancement on the brightness channel image and the color channel image based on the gray average of the pixels in the region of interest to obtain a brightness channel enhanced image and a color channel enhanced image; and converting the brightness channel enhanced image and the color channel enhanced image from the LAB color space to the RGB color space to obtain an enhanced color image. According to the embodiment of the invention, the color image is converted from the RGB color space to the LAB color space, the brightness channel image is utilized to enhance the defect with the brightness difference, and the color channel image is utilized to enhance the defect with the color difference, so that the enhancement effect of the defect in the color image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer vision technology, and in particular, relates to a color image enhancement method, device and storage medium based on LAB color space. Background Art

[0002] In the field of industrial manufacturing, machine vision technology is widely used in product quality inspection. By analyzing and identifying the collected images, it is possible to accurately detect whether there are defects on the product surface and determine the type of defects. If the defect imaging is weak, the image is usually enhanced to accurately determine whether there are defects in the image and the type of defects.

[0003] In the related art, traditional algorithms such as filtering, grayscale conversion, color inversion and homomorphic filtering are mainly used to enhance images with weak defect imaging. However, images processed by these traditional algorithms often lose part of the color information of the image, making the enhancement effect of defects in color images unsatisfactory. Summary of the invention

[0004] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a color image enhancement method, device and storage medium based on the LAB color space to improve the enhancement effect of defects in color images.

[0005] In a first aspect, the present application provides a color image enhancement method based on the LAB color space, comprising:

[0006] Extracting a region of interest from a color image of a product; the region of interest represents a region in the product where a defect may exist;

[0007] Convert the color image from the RGB color space to the LAB color space to obtain a brightness channel image and a color channel image;

[0008] Based on the grayscale mean of the pixels in the region of interest, the brightness channel image and the color channel image are respectively enhanced to obtain a brightness channel enhanced image and a color channel enhanced image;

[0009] The brightness channel enhanced image and the color channel enhanced image are converted from the LAB color space to the RGB color space to obtain an enhanced color image.

[0010] According to the color image enhancement method based on LAB color space of the present application, by extracting the region of interest from the color image of the product; the region of interest represents the area where defects may exist in the product; converting the color image from RGB color space to LAB color space to obtain a brightness channel image and a color channel image; based on the grayscale mean of the pixels in the region of interest, the brightness channel image and the color channel image are respectively enhanced to obtain a brightness channel enhanced image and a color channel enhanced image; converting the brightness channel enhanced image and the color channel enhanced image from LAB color space to RGB color space to obtain an enhanced color image. The embodiment of the present application extracts the region of interest from the color image, which is usually where defects may exist in the product, and converts the color image from RGB color space to LAB color space, so that the image can be decomposed into a brightness channel and a color channel. Such separation allows the processing of brightness and color to be performed independently, and then the brightness channel image is used to enhance the defects with brightness differences, and the color channel image is used to enhance the defects with color differences. The enhanced brightness channel and color channel images are then converted back to RGB color space, so that the enhanced color image can maintain the original color information, thereby improving the enhancement effect of defects in the color image.

[0011] According to one embodiment of the present application, extracting the region of interest from the color image of the product includes:

[0012] Calculating the grayscale mean of pixels in the color image;

[0013] Selecting multiple grayscale thresholds according to the grayscale levels of pixels in the color image; wherein the area in the color image whose grayscale value is greater than the grayscale threshold is the foreground area, and the area whose grayscale value is less than or equal to the grayscale threshold is the background area;

[0014] Traversing the plurality of grayscale thresholds, and calculating the inter-class variance corresponding to each grayscale threshold according to the grayscale mean of pixels in the color image;

[0015] The region of interest is determined according to the grayscale threshold corresponding to the maximum inter-class variance.

[0016] According to an embodiment of the present application, the step of calculating the inter-class variance corresponding to each grayscale threshold value according to the grayscale mean value of pixels in the color image includes:

[0017] According to the formula

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

[0019] Calculate the inter-class variance corresponding to each grayscale threshold;

[0020] Among them, g represents the between-class variance, ω0 represents the ratio of the number of pixels in the foreground area to the total number of pixels in the color image, ω1 represents the ratio of the number of pixels in the background area to the total number of pixels in the color image, μ represents the grayscale mean of the pixels in the color image, μ0 represents the grayscale mean of the pixels in the foreground area, and μ1 represents the grayscale mean of the pixels in the background area.

[0021] In this embodiment, by calculating the grayscale mean of pixels in a color image and selecting multiple grayscale thresholds to distinguish between foreground and background areas, by traversing these grayscale thresholds and calculating the corresponding inter-class variances, the threshold that maximizes the distinction between foreground and background can be identified, thereby determining the region of interest, improving the accuracy of foreground and background separation, and being able to more accurately extract regions containing defects, providing accurate region positioning for subsequent image enhancement.

[0022] According to one embodiment of the present application, converting the color image from the RGB color space to the LAB color space to obtain a brightness channel image and a color channel image includes:

[0023] Normalizing the pixel values ​​of the color image to obtain normalized pixel values;

[0024] The normalized pixel values ​​are respectively mapped to the brightness channel and the color channel of the LAB color space to obtain the brightness channel image and the color channel image.

[0025] In this embodiment, by normalizing the pixel values ​​of the color image, a suitable numerical range is provided for subsequent conversion, and by mapping the normalized pixel values ​​to the brightness channel and color channel of the LAB color space, accurate conversion of the color image from the RGB color space to the LAB color space is achieved.

[0026] According to an embodiment of the present application, the image enhancement of the brightness channel image and the color channel image based on the grayscale mean of pixels in the region of interest includes:

[0027] The brightness channel image is enhanced based on the grayscale mean of the pixels in the region of interest, and the A channel and / or B channel in the color channel image is enhanced based on the grayscale mean of the pixels in the region of interest.

[0028] In this embodiment, the overall contrast of the image can be improved by enhancing the brightness channel, making the defect area more obvious; for the color channel, the A channel or the B channel can be selectively enhanced, and can be adjusted according to the specific color characteristics of the defect; enhancing the A and B channels at the same time can comprehensively improve the color contrast of the image, making the color defects more prominent. This channel enhancement method can not only optimize defects with different color characteristics, but also maintain the overall naturalness and color balance of the image, further improving the enhancement effect of defects in color images.

[0029] According to an embodiment of the present application, the image enhancement of the brightness channel image and the color channel image based on the grayscale mean of pixels in the region of interest includes:

[0030] Calculate the grayscale mean of pixels in the region of interest in the single-channel image to obtain a single-channel mean image; the single-channel image is any one of the brightness channel image, the A channel image in the color channel image, and the B channel image in the color channel image;

[0031] The single-channel image and the single-channel mean image are subtracted and image enhancement is performed.

[0032] In this embodiment, by calculating the pixel grayscale mean of the area of ​​interest in the single-channel image, a single-channel mean image is generated, which can provide a benchmark for subsequent image enhancement. By performing difference calculation between the single-channel image and the corresponding single-channel mean image, the area with a large difference from the mean can be highlighted, the details and contrast of the image can be enhanced, and the image enhancement effect can be improved.

[0033] According to one embodiment of the present application, the step of subtracting the single-channel image from the single-channel mean image and performing image enhancement includes:

[0034] According to the formula

[0035]

[0036] Perform image enhancement;

[0037] Among them, g represents the enhanced image, g1 represents the single-channel image, g2 represents the single-channel mean image, Mult represents the enhancement coefficient, Add0 represents the enhanced brightness adjustment parameter, Add1 is the intermediate parameter, Mean represents the grayscale mean of the single-channel mean image, and Min represents the minimum grayscale value of the single-channel image.

[0038] In this embodiment, by calculating the difference between the single-channel image and the mean image and multiplying it by the enhancement coefficient, the details and contrast in the image can be highlighted. By introducing an intermediate parameter, that is, the difference between the grayscale mean of the single-channel mean image and the minimum grayscale value of the single-channel image, an adjustment basis based on the image content is provided for the enhancement process. The calculation of the enhancement brightness adjustment parameter is adjusted using different strategies, so that the enhancement effect can be adaptively adjusted according to the specific situation of the image, further improving the image enhancement effect.

[0039] In a second aspect, the present application provides a color image enhancement device based on the LAB color space, comprising:

[0040] An extraction module, used to extract a region of interest from a color image of a product; the region of interest represents a region in the product where a defect may exist;

[0041] A first conversion module, used for converting the color image from the RGB color space to the LAB color space to obtain a brightness channel image and a color channel image;

[0042] An enhancement module, used to perform image enhancement on the brightness channel image and the color channel image based on the grayscale mean of the pixels in the region of interest, to obtain a brightness channel enhanced image and a color channel enhanced image;

[0043] The second conversion module is used to convert the brightness channel enhanced image and the color channel enhanced image from the LAB color space to the RGB color space to obtain an enhanced color image.

[0044] According to the color image enhancement device based on LAB color space of the present application, by extracting the region of interest from the color image of the product; the region of interest represents the area where defects may exist in the product; converting the color image from RGB color space to LAB color space to obtain a brightness channel image and a color channel image; based on the grayscale mean of the pixels in the region of interest, the brightness channel image and the color channel image are respectively enhanced to obtain a brightness channel enhanced image and a color channel enhanced image; converting the brightness channel enhanced image and the color channel enhanced image from LAB color space to RGB color space to obtain an enhanced color image. The embodiment of the present application extracts the region of interest from the color image, which is usually where defects may exist in the product, and converts the color image from RGB color space to LAB color space, so that the image can be decomposed into a brightness channel and a color channel. Such separation allows the processing of brightness and color to be performed independently, and then the brightness channel image is used to enhance the defects with brightness differences, and the color channel image is used to enhance the defects with color differences. The enhanced brightness channel and color channel images are then converted back to RGB color space, so that the enhanced color image can maintain the original color information, thereby improving the enhancement effect of defects in the color image.

[0045] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the color image enhancement method based on the LAB color space as described in the first aspect above is implemented.

[0046] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the color image enhancement method based on the LAB color space as described in the first aspect above.

[0047] In a fifth aspect, the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the color image enhancement method based on the LAB color space as described in the first aspect above.

[0048] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the color image enhancement method based on the LAB color space as described in the first aspect above.

[0049] The above one or more technical solutions in the embodiments of the present application have at least one of the following technical effects:

[0050] According to the color image enhancement method based on LAB color space of the present application, by extracting the region of interest from the color image of the product; the region of interest represents the area where defects may exist in the product; converting the color image from RGB color space to LAB color space to obtain a brightness channel image and a color channel image; based on the grayscale mean of the pixels in the region of interest, the brightness channel image and the color channel image are respectively enhanced to obtain a brightness channel enhanced image and a color channel enhanced image; converting the brightness channel enhanced image and the color channel enhanced image from LAB color space to RGB color space to obtain an enhanced color image. The embodiment of the present application extracts the region of interest from the color image, which is usually where defects may exist in the product, and converts the color image from RGB color space to LAB color space, so that the image can be decomposed into a brightness channel and a color channel. Such separation allows the processing of brightness and color to be performed independently, and then the brightness channel image is used to enhance the defects with brightness differences, and the color channel image is used to enhance the defects with color differences. The enhanced brightness channel and color channel images are then converted back to RGB color space, so that the enhanced color image can maintain the original color information, thereby improving the enhancement effect of defects in the color image.

[0051] Furthermore, in some embodiments, by calculating the grayscale mean of pixels in a color image and selecting multiple grayscale thresholds to distinguish between foreground and background areas, by traversing these grayscale thresholds and calculating the corresponding inter-class variances, the threshold that maximizes the distinction between foreground and background can be identified, thereby determining the region of interest, improving the accuracy of foreground and background separation, and being able to more accurately extract regions containing defects, providing accurate region positioning for subsequent image enhancement.

[0052] Furthermore, in some embodiments, by normalizing the pixel values ​​of the color image, a suitable numerical range is provided for subsequent conversion, and by mapping the normalized pixel values ​​to the brightness channel and color channel of the LAB color space, accurate conversion of the color image from the RGB color space to the LAB color space is achieved.

[0053] Furthermore, in some embodiments, the overall contrast of the image can be improved by enhancing the brightness channel, making the defect area more obvious; for the color channel, the A channel or the B channel can be selectively enhanced, and can be adjusted according to the specific color characteristics of the defect; enhancing the A and B channels at the same time can comprehensively improve the color contrast of the image, making the color defects more prominent. This channel enhancement method can not only optimize defects with different color characteristics, but also maintain the overall naturalness and color balance of the image, further improving the enhancement effect of defects in color images.

[0054] Furthermore, in some embodiments, by calculating the pixel grayscale mean of the area of ​​interest in the single-channel image to generate a single-channel mean image, a benchmark can be provided for subsequent image enhancement. By performing difference calculation between the single-channel image and the corresponding single-channel mean image, areas with large differences from the mean can be highlighted, thereby enhancing the details and contrast of the image and improving the image enhancement effect.

[0055] Furthermore, in some embodiments, by calculating the difference between the single-channel image and the mean image and multiplying it by the enhancement coefficient, the details and contrast in the image can be highlighted. By introducing an intermediate parameter, that is, the difference between the grayscale mean of the single-channel mean image and the minimum grayscale value of the single-channel image, an adjustment basis based on the image content is provided for the enhancement process. The calculation of the enhancement brightness adjustment parameter is adjusted using different strategies, so that the enhancement effect can be adaptively adjusted according to the specific situation of the image, further improving the image enhancement effect.

[0056] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0058] Figure 1 It is a flowchart of a color image enhancement method based on LAB color space provided in an embodiment of the present application;

[0059] Figure 2 is a schematic diagram of a color image of a product provided in an embodiment of the present application;

[0060] Figure 3 is a schematic diagram of the extraction result of the region of interest provided in the embodiment of the present application;

[0061] Figure 4 is a schematic diagram of the result of Gaussian filtering provided in an embodiment of the present application;

[0062] Figure 5 is a schematic diagram of a brightness channel image provided in an embodiment of the present application;

[0063] Figure 6 is a schematic diagram of an A channel image provided in an embodiment of the present application;

[0064] Figure 7 is a schematic diagram of a B channel image provided in an embodiment of the present application;

[0065] Figure 8is a schematic diagram of a brightness channel enhanced image provided by an embodiment of the present application;

[0066] Fig. 9 is a schematic diagram of an A channel enhanced image provided in an embodiment of the present application;

[0067] Fig.10 is a schematic diagram of a B channel enhanced image provided in an embodiment of the present application;

[0068] Fig.11 is a schematic diagram of an enhanced color image provided by an embodiment of the present application;

[0069] Fig.12 is a schematic diagram of a scenario example provided in an embodiment of the present application;

[0070] Fig.13 is a schematic diagram of the structure of a color image enhancement device based on the LAB color space provided in an embodiment of the present application;

[0071] Fig.14 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0072] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0073] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0074] Images captured by industrial cameras are mainly divided into two categories: grayscale images and color images. Although grayscale images have certain advantages in some applications because they simplify color information, their application scenarios are limited due to the lack of color dimensions. In contrast, color images can fully capture the color information of the image and can identify defects with color differences on the surface of the product, such as color pollution, color blocks, foreign body occlusion, etc. These defects with color differences usually appear as areas that are inconsistent with the surrounding normal areas. The rich color details of color images enable the detection system to more accurately distinguish and identify those subtle color changes, so most industrial inspections use color images.

[0075] If the defect image in the image is weak, the image is usually enhanced to accurately determine whether there is a defect in the image and the type of defect. In the related art, traditional algorithms such as filtering, grayscale conversion, color inversion and homomorphic filtering are mainly used to enhance images with weak defect images. These traditional algorithms have a good enhancement effect on grayscale images, but the images processed by these traditional algorithms often lose part of the color information of the image, making the enhancement effect on defects in color images unsatisfactory.

[0076] In the following, in conjunction with the accompanying drawings, the color image enhancement method, device and storage medium based on the LAB color space provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.

[0077] The color image enhancement method based on the LAB color space may be applied to a terminal, and may be specifically executed by hardware or software in the terminal.

[0078] The terminal includes, but is not limited to, a portable communication device such as a mobile phone or tablet computer with a touch-sensitive surface (e.g., a touch screen display and / or a touch pad). It should also be understood that in some embodiments, the terminal may not be a portable communication device, but a desktop computer with a touch-sensitive surface (e.g., a touch screen display and / or a touch pad).

[0079] In the following various embodiments, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, a mouse and a joystick.

[0080] The color image enhancement method based on the LAB color space provided in the embodiment of the present application may be executed by an electronic device or a functional module or functional entity in the electronic device that can implement the color image enhancement method based on the LAB color space. The electronic devices mentioned in the embodiment of the present application include but are not limited to mobile phones, tablet computers, computers, cameras, wearable devices, etc. The color image enhancement method based on the LAB color space provided in the embodiment of the present application is described below using an electronic device as an example of the execution subject.

[0081] like Figure 1 As shown, the color image enhancement method based on the LAB color space includes: step 110, step 120, step 130 and step 140.

[0082] Step 110: extracting a region of interest from the color image of the product; the region of interest indicates a region in the product where defects may exist.

[0083] In the embodiment of the present application, in industrial inspection, products may include different types of products, such as electronic products, auto parts, textiles, food, etc. The color images of these products may be images in RGB format obtained by taking pictures with a high-definition camera or an industrial camera. The color images may be stored in digital form, including information of the three color channels of RGB (red, green, and blue).

[0084] In one example, a color image can be captured by an area array camera. The resolution of the camera is 2448×2048, and the size of a single pixel is 10 μm. The captured color image is as follows: Figure 2 shown.

[0085] In the embodiments of the present application, a region of interest (ROI) refers to an area in an image that requires special attention. The region of interest may contain objects or features that you want to analyze or detect. The areas where these objects or features are located are areas where defects are more likely to exist. For example, in industrial inspection, the ROI can be a specific part of a product, such as a welding point, a surface defect, or a key part of a mechanical component.

[0086] In some embodiments, according to the characteristics of the product and the detection requirements, the visual features such as color, shape, texture, etc. can be analyzed to identify the key features in the color image, and the ROI area can be determined based on the key features. Specifically, image processing technologies such as edge detection and region segmentation can be used to identify features such as edges and contours in the image. These features are usually related to the characteristic parts or defects of the product. The position and range of the ROI area are determined based on the identified features. For example, Figure 3As shown, the ROI region can be represented by a rectangular box. Of course, in some embodiments, the ROI region can also be extracted by other methods, such as by using a machine learning algorithm, pre-training with a large number of samples to obtain a ROI extraction model, and automatically extracting the ROI region in the color image according to the ROI extraction model; or the coordinates of the ROI region input by the user in the color image can be obtained, and the ROI region can be extracted according to the user input, etc.

[0087] In some embodiments, since the background grayscale uniformity of the color image is poor, in order to reduce the interference of noise, the color image can be preprocessed by filtering and other methods to suppress the noise of the image. In one example, before or after extracting the region of interest, the color image can be preprocessed by Gaussian filtering. The result of Gaussian filtering is as follows: Figure 4 As shown, Gaussian filtering can be performed on color images using the following formula:

[0088]

[0089] Among them, G(x,y) represents the output image after filtering, (x,y) represents the coordinates of the pixel points in the output image, and σ represents the standard layer of the Gaussian function, which is used to control the width of the Gaussian kernel. The larger σ is, the wider the Gaussian kernel is and the stronger the smoothing effect is.

[0090] Step 120: Convert the color image from the RGB color space to the LAB color space to obtain a brightness channel image and a color channel image.

[0091] The RGB color space is a color model based on human visual perception, which represents colors by combining different intensities of three colors of light: R (red), G (green), and B (blue). This color space is widely used in display devices such as computer monitors, televisions, and mobile phone screens. In the RGB model, the value range of each color is usually 0 to 255, where 0 represents no light and 255 represents the maximum intensity of the color light.

[0092] LAB color space is a perceptually uniform color space that simulates the light-sensing mechanism of the human eye. LAB consists of three channels: the L channel is the brightness channel, which represents brightness information, ranging from 0 (black) to 100 (white); the A channel and the B channel are color channels, which represent color information; among them, the A channel represents the range from green to red, the value range is -128 to +127, representing the color change from green to red, and the B channel represents the range from blue to yellow, the value range is -128 to +127, representing the color change from blue to yellow.

[0093] In some embodiments, the color image may be first converted from the RGB color space to the XYZ color space, and then the XYZ value may be converted to the LAB color space, thereby separating the color information into the A channel and the B channel, while keeping the brightness information in the L channel. The XYZ color space includes three coordinate axes, namely, the X axis, the Y axis, and the Z axis, wherein the X axis represents red, the Y axis represents green, and the Z axis represents blue.

[0094] The color image is converted to the corresponding image in LAB color space. Figure 5-Figure 7 shown.

[0095] Step 130: Perform image enhancement on the brightness channel image and the color channel image based on the grayscale mean of the pixels in the region of interest to obtain a brightness channel enhanced image and a color channel enhanced image.

[0096] In the embodiment of the present application, the grayscale mean of the pixels in the region of interest in the original color image can be calculated first. If the brightness channel image is enhanced, a mean image with the same size as the brightness channel image can be generated based on the grayscale mean, and the pixel value in the mean image is equal to the grayscale mean. Then, each pixel value in the brightness channel image is subtracted from the corresponding pixel value in the mean image to generate a difference image, and then the difference image is enhanced.

[0097] Specifically, enhancement can be performed in a linear or nonlinear manner. For example, if linear enhancement is used, the image can be enhanced by adjusting the contrast, such as by using a linear stretch or normalization method. If nonlinear enhancement is used, the image can be enhanced by using methods such as histogram equalization, gamma correction, or logarithmic transformation. Of course, enhancement can also be performed in combination with linear enhancement and nonlinear enhancement, which is not limited in the embodiments of the present application.

[0098] If image enhancement is performed on a color channel image, for example, an A channel image can be enhanced, then a mean image of the same size as the A channel image can be generated based on the grayscale mean, and the pixel values ​​in the mean image are equal to the grayscale mean. Then, each pixel value in the A channel image is subtracted from the corresponding pixel value in the mean image to generate a difference image, and then the difference image is enhanced. If image enhancement is performed on the B channel image, a similar method can be used. The image enhancement results for the brightness channel image, the A channel image, and the B channel image are shown in the figure below. Figure 8-Figure 10 shown.

[0099] Step 140: Convert the brightness channel enhanced image and the color channel enhanced image from the LAB color space to the RGB color space to obtain an enhanced color image.

[0100] In some embodiments, the brightness channel enhanced image and the color channel enhanced image may be integrated into a LAB format image, and then the values ​​of the pixels in the LAB format image in the LAB color space may be converted into values ​​in the XYZ color space. Specifically, the intermediate values ​​X0, Y0, and Z0 corresponding to the components X, Y, and Z of the pixel converted from the LAB color space to the XYZ color space may be calculated according to the following formula:

[0101]

[0102] Among them, L represents the value of the L channel in the LAB format image, t is an intermediate variable,

[0103] Calculate the values ​​of the XYZ color space components X, Y, and Z based on the value of the reference white point D65:

[0104]

[0105] Among them, X n , Y n and Z n They are the values ​​of the reference white point D65 in the XYZ color space. The commonly used D65 white point values ​​can be: X n =95.047, Y n =100.000, Z n =108.883.

[0106] According to the above formula, the components X, Y and Z of the brightness channel enhanced image and the color channel enhanced image in the XYZ color space can be calculated, and then the image can be converted from the XYZ color space to the RGB color space through the coefficient matrix to obtain the enhanced color image. In an example, the enhanced color image is as follows Fig.11 shown.

[0107] In some embodiments, extracting a region of interest from a color image of a product includes:

[0108] Calculate the grayscale mean of pixels in a color image;

[0109] Select multiple grayscale thresholds according to the grayscale level of pixels in the color image; wherein the area in the color image whose grayscale value is greater than the grayscale threshold is the foreground area, and the area whose grayscale value is less than or equal to the grayscale threshold is the background area;

[0110] Traverse multiple grayscale thresholds and calculate the inter-class variance corresponding to each grayscale threshold according to the grayscale mean of the pixels in the color image;

[0111] The region of interest is determined according to the grayscale threshold corresponding to the maximum inter-class variance.

[0112] In this embodiment, the color image can be converted into a grayscale image by the values ​​of the RGB channels, and then the average value of the pixel values ​​in the grayscale image can be calculated to obtain the grayscale mean of the pixels in the color image. A series of possible grayscale thresholds can be selected according to the grayscale distribution in the grayscale image, for example, at least one grayscale threshold can be selected at each grayscale level, or at least one grayscale threshold can be selected at a grayscale level with a large number of pixels. Of course, the selection of grayscale thresholds can be equally spaced, or can be selected based on the histogram distribution of the image to cover the entire range of the image grayscale value, which is not limited in the embodiments of the present application.

[0113] In this embodiment, the area with a gray value greater than the gray threshold can be regarded as the foreground area, and the area with a gray value less than or equal to the gray threshold can be regarded as the background area. For each selected gray threshold, the pixels in the gray image can be divided into two categories: the foreground area and the background area. The variance within each category (intra-class variance) is calculated, and then the variance between the two categories (inter-class variance) is calculated. The inter-class variance measures the degree of separation between the foreground and the background. The larger the inter-class variance, the more obvious the distinction between the foreground and the background.

[0114] In some embodiments, the formula

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

[0116] Calculate the inter-class variance corresponding to each grayscale threshold;

[0117] Among them, g represents the between-class variance, ω0 represents the ratio of the number of pixels in the foreground area to the total number of pixels in the color image, ω1 represents the ratio of the number of pixels in the background area to the total number of pixels in the color image, μ represents the grayscale mean of the pixels in the color image, μ0 represents the grayscale mean of the pixels in the foreground area, and μ1 represents the grayscale mean of the pixels in the background area.

[0118] In this embodiment, the selected grayscale thresholds are traversed to find the grayscale threshold that maximizes the inter-class variance. This grayscale threshold can best distinguish the foreground area and the background area, and can be considered as the best segmentation point. Using this optimal grayscale threshold, the pixels in the grayscale image are divided into the foreground area and the background area, thereby determining the region of interest. Among them, the foreground area is the region of interest, which is the area containing potential defects or other important features.

[0119] In this embodiment, by calculating the grayscale mean of pixels in a color image and selecting multiple grayscale thresholds to distinguish between foreground and background areas, by traversing these grayscale thresholds and calculating the corresponding inter-class variances, the threshold that maximizes the distinction between foreground and background can be identified, thereby determining the region of interest, improving the accuracy of foreground and background separation, and being able to more accurately extract regions containing defects, providing accurate region positioning for subsequent image enhancement.

[0120] In some embodiments, converting a color image from an RGB color space to a LAB color space to obtain a brightness channel image and a color channel image includes:

[0121] Normalizing the pixel values ​​of the color image to obtain normalized pixel values;

[0122] The normalized pixel values ​​are mapped to the brightness channel and color channel of the LAB color space respectively to obtain a brightness channel image and a color channel image.

[0123] In this embodiment, the pixel values ​​of the color image can be normalized to the range of [0, 1], and then the normalized RGB values ​​are centered to adapt to the calculation of the LAB color space. Through centering, colors can be better represented in the LAB color space. In one example, the normalization and centering processes can be combined by the following formula:

[0124]

[0125] Among them, R represents the value of the pixel in the R channel of the color image, R c represents the value of the centralized R channel, G represents the value of the pixel in the G channel of the color image, G c represents the value of the centralized G channel, B represents the value of the pixel in the color image in the B channel, and B c Indicates the value of the centralized B channel.

[0126] Use the centered RGB values ​​to calculate the L (brightness), A (from green to red), and B (from blue to yellow) values ​​in the LAB color space. The calculation formula is as follows:

[0127]

[0128] In this embodiment, by normalizing the pixel values ​​of the color image, a suitable numerical range is provided for subsequent conversion, and by mapping the normalized pixel values ​​to the brightness channel and color channel of the LAB color space, accurate conversion of the color image from the RGB color space to the LAB color space is achieved.

[0129] In some embodiments, image enhancement is performed on the brightness channel image and the color channel image based on the grayscale mean of the pixels in the region of interest, including:

[0130] The brightness channel image is enhanced based on the grayscale mean of the pixels in the region of interest, and the A channel and / or B channel in the color channel image is enhanced based on the grayscale mean of the pixels in the region of interest.

[0131] In this embodiment, the brightness channel image may be enhanced based on the grayscale mean of the pixels in the region of interest to obtain a brightness enhanced image;

[0132] In this embodiment, the A channel or the B channel may be selectively enhanced as needed, or both the A channel and the B channel may be enhanced simultaneously.

[0133] In this embodiment, the overall contrast of the image can be improved by enhancing the brightness channel, making the defect area more obvious; for the color channel, the A channel or the B channel can be selectively enhanced, and can be adjusted according to the specific color characteristics of the defect; enhancing the A and B channels at the same time can comprehensively improve the color contrast of the image, making the color defects more prominent. This channel enhancement method can not only optimize defects with different color characteristics, but also maintain the overall naturalness and color balance of the image, further improving the enhancement effect of defects in color images.

[0134] In some embodiments, image enhancement is performed on the brightness channel image and the color channel image based on the grayscale mean of the pixels in the region of interest, including:

[0135] Calculate the grayscale mean of pixels in the region of interest in the single-channel image to obtain a single-channel mean image; the single-channel image is any one of a brightness channel image, an A channel image in a color channel image, and a B channel image in a color channel image;

[0136] Subtract the single-channel image from the single-channel mean image and perform image enhancement.

[0137] In this embodiment, the single-channel image can be any one of a brightness channel image, an A channel image in a color channel image, and a B channel image in a color channel image. For example, when enhancing a brightness channel image, the single-channel image is a brightness channel image, and when enhancing a color channel image, the single-channel image is an A channel image or a B channel image.

[0138] In this embodiment, the grayscale mean of the pixels in the region of interest in the single-channel image can be calculated according to the following formula:

[0139]

[0140] Among them, Mean represents the grayscale mean of the pixels in the region of interest in the single-channel image, p represents any pixel in the region of interest, g(p) represents the region of interest of the single-channel image, and F represents the area of ​​the region of interest of the single-channel image.

[0141] In this embodiment, a single-channel mean image of the same size as the single-channel image can be generated by using the grayscale mean, and the pixel value in the single-channel mean image is equal to the grayscale mean of the pixel in the region of interest in the single-channel image. Then, each pixel value in the single-channel image is subtracted from the pixel value in the corresponding single-channel mean image to generate a single-channel difference image, and then the single-channel difference image is enhanced.

[0142] Specifically, enhancement can be performed in a linear or nonlinear manner. For example, if linear enhancement is used, the image can be enhanced by adjusting the contrast, such as by using a linear stretch or normalization method. If nonlinear enhancement is used, the image can be enhanced by using methods such as histogram equalization, gamma correction, or logarithmic transformation. Of course, enhancement can also be performed in combination with linear enhancement and nonlinear enhancement, which is not limited in the embodiments of the present application.

[0143] In this embodiment, by calculating the pixel grayscale mean of the area of ​​interest in the single-channel image, a single-channel mean image is generated, which can provide a benchmark for subsequent image enhancement. By performing difference calculation between the single-channel image and the corresponding single-channel mean image, the area with a large difference from the mean can be highlighted, the details and contrast of the image can be enhanced, and the image enhancement effect can be improved.

[0144] In some embodiments, subtracting the single-channel image from the single-channel mean image and performing image enhancement includes:

[0145] According to the formula

[0146]

[0147] Perform image enhancement;

[0148] Among them, g represents the enhanced image, g1 represents the single-channel image, g2 represents the single-channel mean image, Mult represents the enhancement coefficient, Add0 represents the enhanced brightness adjustment parameter, Add1 is the intermediate parameter, Mean represents the grayscale mean of the single-channel mean image, and Min represents the minimum grayscale value of the single-channel image.

[0149] In this embodiment, by calculating the difference between the single-channel image and the mean image and multiplying it by the enhancement coefficient, the details and contrast in the image can be highlighted. By introducing an intermediate parameter, that is, the difference between the grayscale mean of the single-channel mean image and the minimum grayscale value of the single-channel image, an adjustment basis based on the image content is provided for the enhancement process. The calculation of the enhancement brightness adjustment parameter is adjusted using different strategies, so that the enhancement effect can be adaptively adjusted according to the specific situation of the image, further improving the image enhancement effect.

[0150] like Fig.12 As shown, the present application also provides a scenario example to illustrate the color image enhancement method based on the LAB color space provided in an embodiment of the present application.

[0151] In this scenario example, a color image of the product can be first acquired, and the color image can be an image in RGB format. Then, the ROI area of ​​the color image can be extracted, and the color image can be Gaussian filtered. After that, the color image after Gaussian filtering is converted from the RGB color space to the LAB color space.

[0152] In the LAB color space, the L channel image, the A channel image and the B channel image can be enhanced respectively. Specifically, for the L channel image, the grayscale mean of the region of interest in the L channel image can be calculated, and the L channel mean image can be generated. The L channel image is subtracted from the L channel mean image to obtain the L channel difference image, and then the L channel difference image is enhanced; for the A channel image, the grayscale mean of the region of interest in the A channel image can be calculated, and the A channel mean image can be generated. The A channel image is subtracted from the A channel mean image to obtain the A channel difference image, and then the A channel difference image is enhanced; for the B channel image, the grayscale mean of the region of interest in the B channel image can be calculated, and the B channel mean image can be generated. The B channel image is subtracted from the B channel mean image to obtain the B channel difference image, and then the B channel difference image is enhanced.

[0153] In this scenario example, after performing image enhancement on the L channel image, the A channel image, and the B channel image in the LAB color space, the enhanced L channel image, the A channel image, and the B channel image can be integrated into a LAB format image, and then the LAB format image is converted to the RGB color space to obtain an enhanced color image.

[0154] The color image enhancement method based on the LAB color space provided in the embodiment of the present application can be executed by a color image enhancement device based on the LAB color space. In the embodiment of the present application, the color image enhancement device based on the LAB color space is taken as an example to illustrate the color image enhancement method based on the LAB color space provided in the embodiment of the present application.

[0155] The embodiment of the present application also provides a color image enhancement device based on the LAB color space.

[0156] like Fig.13 As shown, the color image enhancement device based on the LAB color space includes:

[0157] An extraction module 1310 is used to extract a region of interest from a color image of a product; the region of interest indicates a region in the product where a defect may exist;

[0158] A first conversion module 1320 is used to convert the color image from the RGB color space to the LAB color space to obtain a brightness channel image and a color channel image;

[0159] An enhancement module 1330 is used to perform image enhancement on the brightness channel image and the color channel image based on the grayscale mean of the pixels in the region of interest, to obtain a brightness channel enhanced image and a color channel enhanced image;

[0160] The second conversion module 1340 is used to convert the brightness channel enhanced image and the color channel enhanced image from the LAB color space to the RGB color space to obtain an enhanced color image.

[0161] According to the color image enhancement device based on LAB color space of the present application, by extracting the region of interest from the color image of the product; the region of interest represents the area where defects may exist in the product; converting the color image from RGB color space to LAB color space to obtain a brightness channel image and a color channel image; based on the grayscale mean of the pixels in the region of interest, the brightness channel image and the color channel image are respectively enhanced to obtain a brightness channel enhanced image and a color channel enhanced image; converting the brightness channel enhanced image and the color channel enhanced image from LAB color space to RGB color space to obtain an enhanced color image. The embodiment of the present application extracts the region of interest from the color image, which is usually where defects may exist in the product, and converts the color image from RGB color space to LAB color space, so that the image can be decomposed into a brightness channel and a color channel. Such separation allows the processing of brightness and color to be performed independently, and then the brightness channel image is used to enhance the defects with brightness differences, and the color channel image is used to enhance the defects with color differences. The enhanced brightness channel and color channel images are then converted back to RGB color space, so that the enhanced color image can maintain the original color information, thereby improving the enhancement effect of defects in the color image.

[0162] In some embodiments, the extraction module 1310 is further configured to:

[0163] Calculate the grayscale mean of pixels in a color image;

[0164] Select multiple grayscale thresholds according to the grayscale level of pixels in the color image; wherein the area in the color image whose grayscale value is greater than the grayscale threshold is the foreground area, and the area whose grayscale value is less than or equal to the grayscale threshold is the background area;

[0165] Traverse multiple grayscale thresholds and calculate the inter-class variance corresponding to each grayscale threshold according to the grayscale mean of the pixels in the color image;

[0166] The region of interest is determined according to the grayscale threshold corresponding to the maximum inter-class variance.

[0167] In some embodiments, the extraction module 1310 is further configured to:

[0168] According to the formula

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

[0170] Calculate the inter-class variance corresponding to each grayscale threshold;

[0171] Among them, g represents the between-class variance, ω0 represents the ratio of the number of pixels in the foreground area to the total number of pixels in the color image, ω1 represents the ratio of the number of pixels in the background area to the total number of pixels in the color image, μ represents the grayscale mean of the pixels in the color image, μ0 represents the grayscale mean of the pixels in the foreground area, and μ1 represents the grayscale mean of the pixels in the background area.

[0172] In some embodiments, the first conversion module 1320 is further configured to:

[0173] Normalizing the pixel values ​​of the color image to obtain normalized pixel values;

[0174] The normalized pixel values ​​are mapped to the brightness channel and color channel of the LAB color space respectively to obtain a brightness channel image and a color channel image.

[0175] In some embodiments, the enhancement module 1330 is further configured to:

[0176] The brightness channel image is enhanced based on the grayscale mean of the pixels in the region of interest, and the A channel and / or B channel in the color channel image is enhanced based on the grayscale mean of the pixels in the region of interest.

[0177] In some embodiments, the enhancement module 1330 is further configured to:

[0178] Calculate the grayscale mean of pixels in the region of interest in the single-channel image to obtain a single-channel mean image; the single-channel image is any one of the brightness channel image, the A channel image in the color channel image, and the B channel image in the color channel image;

[0179] The single-channel image and the single-channel mean image are subtracted and image enhancement is performed.

[0180] In some embodiments, the enhancement module 1330 is further configured to:

[0181] According to the formula

[0182]

[0183] Perform image enhancement;

[0184] Among them, g represents the enhanced image, g1 represents the single-channel image, g2 represents the single-channel mean image, Mult represents the enhancement coefficient, Add0 represents the enhanced brightness adjustment parameter, Add1 is the intermediate parameter, Mean represents the grayscale mean of the single-channel mean image, and Min represents the minimum grayscale value of the single-channel image.

[0185] The color image enhancement device based on the LAB color space in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0186] The color image enhancement device based on the LAB color space in the embodiment of the present application may be a device having an operating system. The operating system may be a Microsoft (Windows) operating system, an Android (Android) operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0187] In some embodiments, Fig.14 As shown, an embodiment of the present application also provides an electronic device 1400, including a processor 1401, a memory 1402, and a computer program stored in the memory 1402 and executable on the processor 1401. When the program is executed by the processor 1401, the various processes of the above-mentioned color image enhancement method embodiment based on the LAB color space are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0188] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.

[0189] An embodiment of the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned color image enhancement method embodiment based on the LAB color space are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0190] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0191] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned color image enhancement method based on the LAB color space when executed by a processor.

[0192] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0193] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned color image enhancement method embodiment based on the LAB color space, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0194] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0195] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0196] 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 computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0197] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

[0198] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0199] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.

Claims

1. A color image enhancement method based on LAB color space, characterized in that: include: Extracting a region of interest from a color image of a product; the region of interest represents a region in the product where a defect may exist; Convert the color image from the RGB color space to the LAB color space to obtain a brightness channel image and a color channel image; Based on the grayscale mean of the pixels in the region of interest, the brightness channel image and the color channel image are respectively enhanced to obtain a brightness channel enhanced image and a color channel enhanced image; The brightness channel enhanced image and the color channel enhanced image are converted from the LAB color space to the RGB color space to obtain an enhanced color image.

2. The method according to claim 1, characterized in that The step of extracting a region of interest from a color image of a product comprises: Calculating the grayscale mean of pixels in the color image; Selecting multiple grayscale thresholds according to the grayscale levels of pixels in the color image; wherein the area in the color image whose grayscale value is greater than the grayscale threshold is the foreground area, and the area whose grayscale value is less than or equal to the grayscale threshold is the background area; Traversing the plurality of grayscale thresholds, and calculating the inter-class variance corresponding to each grayscale threshold according to the grayscale mean of pixels in the color image; The region of interest is determined according to the grayscale threshold corresponding to the maximum inter-class variance.

3. The method according to claim 1, characterized in that The calculating the inter-class variance corresponding to each grayscale threshold according to the grayscale mean of pixels in the color image includes: According to the formula g=ω0(μ0-μ) 2 +ω1(μ1-μ) 2 Calculate the inter-class variance corresponding to each grayscale threshold; Among them, g represents the between-class variance, ω0 represents the ratio of the number of pixels in the foreground area to the total number of pixels in the color image, ω1 represents the ratio of the number of pixels in the background area to the total number of pixels in the color image, μ represents the grayscale mean of the pixels in the color image, μ0 represents the grayscale mean of the pixels in the foreground area, and μ1 represents the grayscale mean of the pixels in the background area.

4. The method according to claim 1, characterized in that: The step of converting the color image from the RGB color space to the LAB color space to obtain a brightness channel image and a color channel image comprises: Normalizing the pixel values ​​of the color image to obtain normalized pixel values; The normalized pixel values ​​are respectively mapped to the brightness channel and the color channel of the LAB color space to obtain the brightness channel image and the color channel image.

5. The method according to claim 1, characterized in that The performing image enhancement on the brightness channel image and the color channel image based on the grayscale mean of the pixels in the region of interest respectively comprises: The brightness channel image is enhanced based on the grayscale mean of the pixels in the region of interest, and the A channel and / or B channel in the color channel image is enhanced based on the grayscale mean of the pixels in the region of interest.

6. The method according to claim 1, characterized in that The performing image enhancement on the brightness channel image and the color channel image based on the grayscale mean of the pixels in the region of interest respectively comprises: Calculate the grayscale mean of pixels in the region of interest in the single-channel image to obtain a single-channel mean image; the single-channel image is any one of the brightness channel image, the A channel image in the color channel image, and the B channel image in the color channel image; The single-channel image and the single-channel mean image are subtracted and image enhancement is performed.

7. The method according to claim 6, characterized in that The step of performing image enhancement by subtracting the single-channel image from the single-channel mean image comprises: According to the formula Perform image enhancement; Among them, g represents the enhanced image, g1 represents the single-channel image, g2 represents the single-channel mean image, Mult represents the enhancement coefficient, Add0 represents the enhanced brightness adjustment parameter, Add1 is the intermediate parameter, Mean represents the grayscale mean of the single-channel mean image, and Min represents the minimum grayscale value of the single-channel image.

8. A color image enhancement device based on LAB color space, characterized in that: include: An extraction module, used to extract a region of interest from a color image of a product; the region of interest represents a region in the product where a defect may exist; A first conversion module, used for converting the color image from the RGB color space to the LAB color space to obtain a brightness channel image and a color channel image; An enhancement module, used to perform image enhancement on the brightness channel image and the color channel image based on the grayscale mean of the pixels in the region of interest, to obtain a brightness channel enhanced image and a color channel enhanced image; The second conversion module is used to convert the brightness channel enhanced image and the color channel enhanced image from the LAB color space to the RGB color space to obtain an enhanced color image.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Image enhancement processing method and device for X-ray defect weld seam image

    CN121883326A