An image processing method, apparatus, electronic device, and storage medium

By determining the classification category of image pixels and calculating the lifting intensity, the pixel value is adjusted to reduce the influence of diffuse reflection, which solves the problem of decreased image color distinction and improves the accuracy of image processing.

CN117237220BActive Publication Date: 2025-10-10HANGZHOU HAIKANG HUIYING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311203376.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-18
Publication Date
2025-10-10
Estimated Expiration
2043-09-18

AI Technical Summary

Technical Problem

The color distinction of the image decreases when light refraction and reflection form a diffuse light field, affecting the subsequent processing effect, especially in endoscopic images where it is difficult to accurately distinguish different tissues.

Method used

By obtaining the depth of the pixel value of each pixel in the image, the classification category is determined, and the enhancement intensity is calculated based on the degree of diffuse reflection. The pixel value is adjusted to reduce the impact of diffuse reflection and improve color distinction.

Benefits of technology

It achieves adaptive adjustment of target colors in images, reduces the impact of diffuse reflection, improves color differentiation, and enhances the accuracy of image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117237220B_ABST
    Figure CN117237220B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an image processing method and device, electronic equipment and storage medium, the method comprising: obtaining a to-be-processed image, determining the classification category to which each pixel point belongs according to the depth of the target color represented by the pixel value of each pixel point in the to-be-processed image, wherein the classification category is used to identify different depth of the target color, calculating the promotion intensity corresponding to each pixel point based on the diffuse reflection degree of the target color corresponding to the to-be-processed image, for each pixel point, processing the pixel value of the pixel point based on the adjustment mode corresponding to the classification category to which the pixel point belongs and the promotion intensity corresponding to the pixel point, and obtaining a processed image. Embodiments of the present application can realize adaptive adjustment of the differentiation degree of the target color in the image, reduce the influence of diffuse reflection of the target color in the image, and further improve the color differentiation degree of the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, device, electronic device and storage medium. Background Art

[0002] The color distinction of an image has a significant impact on how workers observe and subsequently process the image. In some scenarios, light will refract and reflect, forming a diffuse light field, which results in a decrease in the color distinction of the image. Visually, it looks as if a filter of a specific color is superimposed on the image, seriously affecting subsequent processing based on the image.

[0003] For example, most endoscopic images are primarily red, but different tissues can appear in different shades of red, ranging from deep purple to light red, bright red to dark red, and the color of blood can also darken over time. This allows staff to distinguish different tissues by the different shades of red, allowing them to quickly identify bleeding points or other issues with the help of endoscopic images, allowing them to perform procedures such as hemostasis.

[0004] It can be seen that the color distinction of an image has an important impact on subsequent processing based on the image. Therefore, an image processing method that can improve the color distinction of an image is needed. Summary of the Invention

[0005] The purpose of the embodiments of the present application is to provide an image processing method, apparatus, electronic device, and storage medium to improve the color distinction of an image. The specific technical solution is as follows:

[0006] In a first aspect, an embodiment of the present application provides an image processing method, the method comprising:

[0007] Get the image to be processed;

[0008] Determining the classification category to which each pixel point belongs based on the depth of the target color represented by the pixel value of each pixel point in the image to be processed, wherein the classification category is used to identify different depths of the target color;

[0009] Calculating the lifting intensity corresponding to each pixel based on the diffuse reflection degree of the target color corresponding to the image to be processed;

[0010] For each pixel, based on the adjustment method corresponding to the classification category to which the pixel belongs and the lifting intensity corresponding to the pixel, the pixel value of the pixel is processed to obtain a processed image.

[0011] Optionally, the step of determining the classification category to which each pixel point belongs based on the depth of the target color represented by the pixel value of each pixel point in the image to be processed includes:

[0012] For each pixel, the classification category to which the pixel belongs is determined based on the size relationship between each color space channel value corresponding to the pixel and the corresponding preset channel threshold.

[0013] Optionally, the step of determining, for each pixel, the classification category to which the pixel belongs based on the magnitude relationship between each color space channel value corresponding to the pixel and the corresponding preset channel threshold includes:

[0014] For each pixel, determine the magnitude relationship between each color space channel value corresponding to the pixel and the corresponding preset channel threshold;

[0015] If the size relationship satisfies one of the plurality of preset classification conditions, determining that the classification category to which the pixel point belongs is the preset classification category corresponding to the preset classification condition satisfied by the size relationship;

[0016] If the size relationship does not satisfy the multiple preset classification conditions, it is determined that the classification category to which the pixel point belongs is the preset target category.

[0017] Optionally, the step of calculating the lift intensity corresponding to each pixel point based on the diffuse reflection degree of the target color corresponding to the image to be processed includes:

[0018] Based on the difference between the diffuse reflection degree of the target color corresponding to the image to be processed and the preset adjustment degree, the lifting intensity corresponding to each pixel point is calculated, wherein the preset adjustment degree is used to characterize the adjustment degree of the distinguishability of the target color in the image to be processed.

[0019] Optionally, the step of calculating the boost intensity corresponding to each pixel point based on the difference between the diffuse reflection degree of the target color corresponding to the image to be processed and a preset adjustment degree includes:

[0020] For each pixel, calculating the difference between the preset adjustment degree and the diffuse reflection degree of the target color corresponding to the pixel;

[0021] The difference is normalized to obtain a processing result as the lifting intensity corresponding to the pixel point.

[0022] Optionally, the image to be processed is a frame in a video stream;

[0023] Before the step of calculating the lifting intensity corresponding to each pixel point based on the diffuse reflection degree of the target color corresponding to the image to be processed, the method further includes:

[0024] Obtaining a diffuse reflection degree of the target color corresponding to a previous frame of the image to be processed as the diffuse reflection degree of the target color corresponding to the image to be processed, wherein the diffuse reflection degree of the target color corresponding to the previous frame of the image is determined based on the pixel value of each pixel in the previous frame of the image; or

[0025] Based on the pixel value of each pixel in the image to be processed, the diffuse reflection degree of the target color corresponding to the image to be processed is determined.

[0026] Optionally, the method for determining the degree of diffuse reflection includes:

[0027] For each pixel point of the target image, the diffuse reflection degree of the target color corresponding to the pixel point is calculated based on the color space channel values ​​corresponding to the pixel point and the preset coefficients corresponding to the color space channel values, wherein the target image is the previous frame image or the image to be processed, and the preset coefficients corresponding to the color space channel values ​​are used to characterize the degree of influence of diffuse reflection on the color space channel values.

[0028] Optionally, the step of calculating, for each pixel of the target image, the diffuse reflection degree of the target color corresponding to the pixel according to each color space channel value corresponding to the pixel and a preset coefficient corresponding to each color space channel value, includes:

[0029] For each pixel of the target image, using preset coefficients corresponding to the color space channel values ​​corresponding to the pixel as weights, performing weighted summation on the color space channel values ​​to obtain a first summation result;

[0030] The first summation result is summed with a preset threshold constant to obtain a second summation result as the diffuse reflection degree of the target color corresponding to the pixel point, wherein the preset threshold constant is set based on the boost intensity required for the image to be processed.

[0031] Optionally, the step of processing the pixel value of each pixel based on the adjustment method corresponding to the classification category to which the pixel belongs and the lifting intensity corresponding to the pixel to obtain a processed image includes:

[0032] For each pixel, determine the lift coefficient corresponding to the pixel based on the lift intensity corresponding to the pixel and the target channel threshold corresponding to the pixel, where the target channel threshold is a preset channel threshold used to determine the classification category to which the pixel belongs;

[0033] Based on the adjustment method corresponding to the classification category to which the pixel point belongs and the lifting coefficient corresponding to the pixel point, the pixel value of the pixel point is processed to obtain a processed pixel value corresponding to the pixel point.

[0034] Optionally, the step of processing the pixel value of the pixel point based on the adjustment method corresponding to the classification category to which the pixel point belongs and the lifting coefficient corresponding to the pixel point to obtain the processed pixel value corresponding to the pixel point includes:

[0035] If the classification category to which the pixel point belongs is the preset target category, the pixel value of the pixel point is used as the processed pixel value corresponding to the pixel point;

[0036] If the classification category to which the pixel point belongs is one of the multiple preset classification categories, determining a preset polynomial corresponding to the classification category to which the pixel point belongs;

[0037] The lifting coefficient corresponding to the pixel point is used as the coefficient in the preset polynomial, and the pixel value of the pixel point is used as the variable in the preset polynomial, and the processed pixel value corresponding to the pixel point is calculated according to the preset polynomial.

[0038] Optionally, before the step of determining the classification category to which each pixel point belongs based on the depth of the target color represented by the pixel value of each pixel point in the image to be processed, the method further includes:

[0039] Performing color space conversion processing on the image to be processed according to a conversion method corresponding to the target color space to obtain the image to be processed in the target color space;

[0040] After the step of processing the pixel value of each pixel based on the adjustment method corresponding to the classification category to which the pixel belongs and the lifting intensity corresponding to the pixel to obtain a processed image, the method further includes:

[0041] According to the inverse conversion method corresponding to the target color space, the processed image is subjected to color space inverse conversion processing to obtain a processed image, wherein the processed image has the same color space as that of the image to be processed.

[0042] Optionally, the image to be processed is an image in an endoscopic video stream, and the target color is red.

[0043] In a second aspect, an embodiment of the present application provides an image processing device, the device comprising:

[0044] The image to be processed acquisition module is used to acquire the image to be processed;

[0045] a classification category determination module, configured to determine the classification category to which each pixel in the image to be processed belongs based on the depth of the target color represented by the pixel value of each pixel, wherein the classification category is used to identify different depths of the target color;

[0046] a lifting intensity calculation module, configured to calculate the lifting intensity corresponding to each pixel point based on the diffuse reflection degree of the target color corresponding to the image to be processed;

[0047] The processed image acquisition module is used to process the pixel value of each pixel based on the adjustment method corresponding to the classification category to which the pixel belongs and the lifting intensity corresponding to the pixel to obtain a processed image.

[0048] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0049] Memory for storing computer programs;

[0050] The processor is configured to implement any of the methods described in the first aspect above when executing a program stored in the memory.

[0051] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements any of the methods described in the first aspect above.

[0052] Beneficial effects of the embodiments of the present application:

[0053] In the solution provided by the embodiment of the present application, the electronic device can obtain an image to be processed, and determine the classification category to which each pixel belongs based on the depth of the target color represented by the pixel value of each pixel in the image to be processed, wherein the classification category is used to identify the different depths of the target color, and based on the diffuse reflection degree of the target color corresponding to the image to be processed, the lifting intensity corresponding to each pixel is calculated. For each pixel, based on the adjustment method corresponding to the classification category to which the pixel belongs and the lifting intensity corresponding to the pixel, the pixel value of the pixel is processed to obtain a processed image. Since the classification category is used to identify the different depths of the target color, and the lifting intensity is calculated based on the diffuse reflection degree of the target color, after determining the classification category to which each pixel belongs, the pixel values ​​of the pixels belonging to different classification categories are processed in combination with the lifting intensity, so that the adaptive adjustment of the discrimination degree of the target color in the image can be achieved, reducing the influence of the diffuse reflection of the target color in the image, and thus improving the color discrimination degree of the image. Of course, it is not necessary to achieve all the advantages described above at the same time when implementing any product or method of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0055] Figure 1 A flowchart of an image processing method provided in an embodiment of the present application;

[0056] Figure 2 for Figure 1 A specific flow chart of step S104 in the embodiment shown;

[0057] Figure 3 A specific flow chart of the image processing method provided in the embodiment of the present application;

[0058] Figure 4 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application;

[0059] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0060] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field based on this application are within the scope of protection of this application.

[0061] In order to improve the color distinction of an image, the embodiments of the present application provide an image processing method, apparatus, electronic device, computer-readable storage medium, and computer program product. The following first introduces an image processing method provided by the embodiments of the present application.

[0062] An image processing method provided in an embodiment of the present application can be applied to any device that requires image processing, for example, a laptop computer, a server, an image processor, a desktop computer, etc., which is not specifically limited here. For the sake of clarity, it is referred to as an electronic device below.

[0063] like Figure 1 As shown, an image processing method, the method comprising:

[0064] S101, obtaining an image to be processed;

[0065] S102, determining the classification category to which each pixel in the image to be processed belongs according to the depth of the target color represented by the pixel value of each pixel;

[0066] The classification category is used to identify different shades of the target color.

[0067] S103, calculating the lift intensity corresponding to each pixel based on the diffuse reflection degree of the target color corresponding to the image to be processed;

[0068] S104 : For each pixel point, based on the adjustment method corresponding to the classification category to which the pixel point belongs and the lifting intensity corresponding to the pixel point, the pixel value of the pixel point is processed to obtain a processed image.

[0069] It can be seen that in the solution provided in the embodiment of the present application, the electronic device can obtain the image to be processed, and determine the classification category to which each pixel belongs based on the depth of the target color represented by the pixel value of each pixel in the image to be processed, wherein the classification category is used to identify the different depths of the target color, and based on the diffuse reflection degree of the target color corresponding to the image to be processed, the lifting intensity corresponding to each pixel is calculated, and for each pixel, based on the adjustment method corresponding to the classification category to which the pixel belongs and the lifting intensity corresponding to the pixel, the pixel value of the pixel is processed to obtain a processed image. Since the classification category is used to identify the different depths of the target color, and the lifting intensity is calculated based on the diffuse reflection degree of the target color, after determining the classification category to which each pixel belongs, the pixel values ​​of the pixels belonging to different classification categories are processed in combination with the lifting intensity, so as to achieve adaptive adjustment of the discrimination degree of the target color in the image, reduce the influence of the diffuse reflection of the target color in the image, and thereby improve the color discrimination degree of the image.

[0070] In step S101, the electronic device can acquire an image to be processed, which is a color image. When the image acquisition device acquires the image to be processed, there is a diffuse reflection phenomenon, which causes the color distinction of the image to be processed to decrease. For example, in an application scenario using an endoscope, when the endoscope is introduced into the organ to be pre-inspected, the light source of the endoscope emits light inside the organ, and the light is refracted and reflected, forming a red diffuse reflection light field, which causes the color distinction of the endoscopic image to decrease. Color distinction is an important measurement factor of endoscopic images. The decrease in color distinction of endoscopic images will affect the judgment of staff.

[0071] In one embodiment, the image to be processed may be captured by an image acquisition device and sent to the electronic device. For example, in an application scenario where a worker uses an endoscope, an endoscopic image may be captured and sent to the electronic device in real time so that the electronic device can process the endoscopic image. In another embodiment, the electronic device may obtain a locally stored image as the image to be processed, or it may obtain an image stored by another electronic device as the image to be processed, which is reasonable.

[0072] After the electronic device acquires the image to be processed, it can determine the classification category to which each pixel belongs based on the depth of the target color represented by the pixel value of each pixel in the image to be processed, that is, execute step S102. The classification category is used to identify the different depths of the target color. In other words, in the image to be processed, there are different depths for the target color. The electronic device can classify each pixel based on the depth of the target color represented by the pixel value of each pixel, and then perform targeted processing on the pixel value of each pixel. The target color can be red, blue, green, etc., which is not specifically limited here.

[0073] For example, the image to be processed is an endoscopic image. Endoscopic images are primarily red, with varying shades of red, including dark red, light red, and bright red. Dark red corresponds to category 1, light red corresponds to category 2, and bright red corresponds to category 3. After acquiring the endoscopic image, the electronic device can determine whether each pixel in the endoscopic image belongs to category 1, category 2, or category 3 based on the shade of red represented by the pixel value. If the pixel value of any pixel indicates bright red, the pixel is determined to belong to category 3.

[0074] For example, the image to be processed is a photograph of plants. The image is primarily green, with varying shades of green, including dark green, light green, and scallion green. Dark green corresponds to category 1, light green corresponds to category 2, and scallion green corresponds to category 3. After acquiring the image, the electronic device can determine whether each pixel in the image belongs to category 1, category 2, or category 3 based on the shade of green represented by its pixel value. If any pixel value represents dark green, the pixel is determined to belong to category 1.

[0075] For another example, consider a seascape image, which includes the sea and blue sky, all of which are primarily blue. The shades of blue range from sky blue to azure blue and dark blue, with sky blue corresponding to category 1, azure blue to category 2, and dark blue to category 3. After acquiring the image, the electronic device can determine, based on the shade of blue represented by the pixel value of each pixel in the image, whether each pixel belongs to category 1, category 2, or category 3. If the pixel value of any pixel represents azure blue, the pixel is determined to belong to category 2.

[0076] If light refracts and reflects, creating a diffuse light field, the image's color distinction becomes poor and brightness changes, affecting the ability to distinguish different objects within the image. For example, diffuse reflection can cause different tissues in an endoscopic image to appear as if they were covered by a red filter, reducing the accuracy of identifying different tissues. Another example is when capturing images of green vegetation during ecological research, diffuse reflection can cause different plants in the image to appear as if they were covered by a green filter, reducing the accuracy of identifying the different plants.

[0077] To reduce the impact of diffuse reflection of the target color in the image, the electronic device can calculate the corresponding boost intensity for each pixel based on the diffuse reflection degree of the target color in the image to be processed, thereby executing step S103. The diffuse reflection degree is used to represent the diffuse reflection degree of the target color in the image to be processed. In one embodiment, for each pixel, the electronic device can calculate the corresponding boost intensity based on the diffuse reflection degree of the pixel.

[0078] For example, an endoscopic image includes N pixels, and the diffuse reflection degree of the target color corresponding to the endoscopic image is the diffuse reflection degree of red. The electronic device can calculate the lifting intensity corresponding to each pixel based on the red diffuse reflection degree corresponding to the endoscopic image, that is, it can calculate N lifting intensities.

[0079] After the electronic device obtains the classification category to which each pixel point belongs and the lifting intensity corresponding to each pixel point, for each pixel point, it can process the pixel value of the pixel point based on the adjustment method corresponding to the classification category to which the pixel point belongs and the lifting intensity corresponding to the pixel point. In this way, the processed pixel value corresponding to each pixel point can be obtained, and then the processed image can be obtained, that is, step S104 is executed.

[0080] In one embodiment, the adjustment method corresponding to the classification category can be combined with the boosting intensity. Specifically, for each pixel, the electronic device determines the classification category to which the pixel belongs, thereby determining the adjustment method corresponding to the pixel. The electronic device then substitutes the boosting intensity corresponding to the pixel into the determined adjustment method to obtain the processed pixel value corresponding to the pixel.

[0081] For example, the classification categories include category 1, category 2, and category 3. Category 1 corresponds to adjustment method 1, category 2 corresponds to adjustment method 2, and category 3 corresponds to adjustment method 3. Each adjustment method is a method for adjusting the pixel value of a pixel point in combination with a boosting intensity. If the classification category to which pixel point i belongs is category 2, then the adjustment method for adjusting the pixel value of pixel point i can be determined to be adjustment method 2. The obtained boosting intensity of pixel point i can be substituted into adjustment method 2 to obtain the processed pixel value corresponding to pixel point i.

[0082] It should be noted that the execution order of step S102 and step S103 is not limited here. That is, after the electronic device obtains the classification category of each pixel point and the corresponding lifting intensity of each pixel point, it can process the pixel value of each pixel point.

[0083] In the scheme of this embodiment, since the classification category is used to identify the different shades of the target color, and the lifting intensity is calculated based on the diffuse reflection degree of the target color, after the electronic device determines the classification category to which each pixel point belongs, the pixel values ​​of the pixel points belonging to different classification categories are processed in combination with the lifting intensity, which can achieve adaptive adjustment of the discrimination degree of the target color in the image, reduce the influence of the diffuse reflection of the target color in the image, and thereby improve the color discrimination degree of the image.

[0084] As an implementation of an embodiment of the present application, the step of determining the classification category to which each pixel point belongs based on the depth of the target color represented by the pixel value of each pixel point in the image to be processed may include:

[0085] For each pixel, the classification category to which the pixel belongs is determined based on the size relationship between each color space channel value corresponding to the pixel and the corresponding preset channel threshold.

[0086] Because the pixel value of each pixel can be composed of different color space channel values, the electronic device can determine the classification category of each pixel based on the color space channel values ​​corresponding to each pixel. In one embodiment, for each pixel, the electronic device can determine the classification category of the pixel based on the magnitude relationship between the color space channel values ​​corresponding to the pixel and the corresponding preset channel threshold. In other words, the classification category of the pixel can be determined by combining the color space channel values ​​corresponding to the pixel and the corresponding preset channel threshold.

[0087] The preset channel threshold is the threshold used to compare the color space channel value when determining the classification category of a pixel point, and is set based on the target color. Color spaces can include RGB (Red Green Blue) space, YUV (Luminance Chrominance Chroma), HSV (Hue Saturation Value) space, HLS (Hue Lightness Saturation) space, XYZ space, Lab space, YCbCr space, etc., and are not specifically limited here.

[0088] For example, if the color space of the image to be processed is the HSV color space, then the color space channel values ​​corresponding to each pixel in the image to be processed are H_ori, S_ori, and V_ori, and the preset channel thresholds include th_color1, th_color2, th_color3, th_color4, th_color5, and th_color6. If for any pixel, the color space channel values ​​corresponding to the pixel satisfy H_ori>th_color1, S_ori>th_color2, and V_ori>th_color3, then it can be determined that the classification category to which the pixel belongs is category 1. If the color space channel values ​​corresponding to the pixel satisfy H_ori<th_color4、S_ori> th_color5, V_ori>th_color6, then it can be determined that the classification category to which the pixel belongs is category 2. If the color space channel values ​​corresponding to the pixel do not meet the above two conditions, then the classification category to which the pixel belongs is category 3.

[0089] As can be seen, in this embodiment, for each pixel, the electronic device can determine the classification category to which the pixel belongs based on the magnitude relationship between the color space channel values ​​corresponding to the pixel and the corresponding preset channel thresholds. Comparing the color space channel values ​​with the corresponding preset channel thresholds can better reflect the depth of the target color represented by the pixel value of the pixel point, and can more accurately determine the classification category to which each pixel belongs, so that subsequent processing can be performed on the pixel value of each pixel according to the classification category to which the pixel belongs.

[0090] As an implementation of an embodiment of the present application, the step of determining, for each pixel, the classification category to which the pixel belongs based on the magnitude relationship between each color space channel value corresponding to the pixel and the corresponding preset channel threshold value may include:

[0091] For each pixel point, determine the size relationship between each color space channel value corresponding to the pixel point and the corresponding preset channel threshold; if the size relationship meets one of multiple preset classification conditions, determine that the classification category to which the pixel point belongs is the preset classification category corresponding to the preset classification condition met by the size relationship; if the size relationship does not meet the multiple preset classification conditions, determine that the classification category to which the pixel point belongs is the preset target category.

[0092] Classification categories can be pre-set based on the depth of the target color represented by the pixel values ​​of each pixel point in the image to be processed. The pixel values ​​are composed of different color space channel values, and the channel thresholds can be pre-set. Then, classification conditions are set based on the color space channel values ​​and the corresponding preset channel thresholds.

[0093] Thus, for each pixel, the electronic device can determine the magnitude relationship between each color space channel value corresponding to the pixel and the corresponding preset channel threshold. When the magnitude relationship satisfies one of multiple preset classification conditions, the classification category to which the pixel belongs is determined to be the preset classification category corresponding to the preset classification condition satisfied by the magnitude relationship. When the magnitude relationship does not satisfy multiple preset classification conditions, the classification category to which the pixel belongs is determined to be the preset target category. The preset classification category and the preset target category are both different, pre-set classification categories.

[0094] In one embodiment, for each pixel, the electronic device may determine the classification category color_classiffication to which the pixel belongs according to the following formula based on the relationship between each color space channel value corresponding to the pixel and the corresponding preset channel threshold:

[0095]

[0096] Where A, B, and C are the color space channel values ​​corresponding to the pixel, and th_color1…th_color3n are preset channel thresholds. color_classiffication is used to represent the classification category of the target color to which the pixel belongs. For example, if the target color is red, color_classiffication can be recorded as red_classiffication.

[0097] For example, the image to be processed is an endoscopic image, which is mainly red. The electronic device determines the red category of each pixel point based on the depth of red represented by the pixel value of each pixel point in the endoscopic image. The color space of the endoscopic image is the HSV color space, and the color space channel values ​​corresponding to each pixel point are H_ori, S_ori, and V_ori, where the preset channel thresholds are th_red1, th_red2, th_red3, and th_red4. Then, for each pixel point, the electronic device can determine the red category of the pixel point according to the following formula, where only the H and S color channels are considered in this formula. Different color channels can be considered according to different needs, and no specific limitation is made here.

[0098]

[0099] Among them, th_red1, th_red2, th_red3, and th_red4 can be set according to actual experience. For example, th_red1 is 0.7, th_red2 is 0.9, th_red3 is 0.6, and th_red4 is 0.8.

[0100] As can be seen, in this embodiment, for each pixel, the electronic device can determine the size relationship between each color space channel value corresponding to the pixel and the corresponding preset channel threshold. If the size relationship satisfies one of multiple preset classification conditions, the classification category to which the pixel belongs is determined to be the preset classification category corresponding to the preset classification condition satisfied by the size relationship. If the size relationship does not satisfy multiple preset classification conditions, the classification category to which the pixel belongs is determined to be the preset target category. Since comparing each color space channel value with the corresponding preset channel threshold can better reflect the depth of the target color represented by the pixel value of the pixel, the classification category to which each pixel belongs can be determined more accurately, so that subsequent work can perform corresponding processing on the pixel value of each pixel according to the classification category to which the pixel belongs.

[0101] As an implementation of an embodiment of the present application, the step of calculating the lift intensity corresponding to each pixel based on the diffuse reflection degree of the target color corresponding to the image to be processed may include:

[0102] Based on the difference between the diffuse reflection degree of the target color corresponding to the image to be processed and the preset adjustment degree, the lifting intensity corresponding to each pixel point is calculated, wherein the preset adjustment degree is used to characterize the adjustment degree of the distinguishability of the target color in the image to be processed.

[0103] When the color distinction of the image to be processed is reduced due to diffuse reflection, the electronic device can process the pixel values ​​corresponding to each pixel in the image to be processed based on the diffuse reflection degree of the target color corresponding to the image to be processed. In one embodiment, the electronic device can calculate the enhancement intensity corresponding to each pixel based on the difference between the diffuse reflection degree of the target color corresponding to each pixel in the image to be processed and the preset adjustment degree. The preset adjustment degree is used to represent the adjustment degree of the distinction of the target color in the image to be processed. The preset adjustment degree can be set according to the algorithm level, that is, the enhancement degree of the image to be processed in different scenes is set according to the algorithm.

[0104] That is to say, when the image to be processed is affected by the diffuse reflection of the target color, in order to reduce the influence of the diffuse reflection of the target color, the electronic device can determine the enhancement intensity corresponding to each pixel point according to the preset adjustment degree and the diffuse reflection degree of the target color corresponding to the image to be processed, so as to enhance the color distinction of the target color.

[0105] For example, the preset adjustment level of the image to be processed is isp_params.Level_red, and the diffuse reflection level of pixel i in the image to be processed is L_red. The electronic device can calculate the boost intensity corresponding to pixel i based on the difference between the preset adjustment level isp_params.Level_red and the diffuse reflection level L_red of pixel i. After calculating the boost intensity of each pixel, the color distinction of red in the image to be processed can be improved.

[0106] As can be seen, in this embodiment, the electronic device can calculate the boost intensity corresponding to each pixel based on the difference between the diffuse reflection degree of the target color corresponding to the image to be processed and the preset adjustment degree. In this way, the color distinction of the target color of the image to be processed can be improved according to the boost intensity.

[0107] As an implementation of an embodiment of the present application, the step of calculating the boost intensity corresponding to each pixel point based on the difference between the diffuse reflection degree of the target color corresponding to the image to be processed and the preset adjustment degree may include:

[0108] For each pixel, the difference between the preset adjustment degree and the diffuse reflection degree of the target color corresponding to the pixel is calculated; the difference is normalized to obtain a processing result as the enhancement intensity corresponding to the pixel.

[0109] In order to ensure that the color discrimination of the image to be processed meets the required color discrimination, the desired adjustment degree can be pre-set. For each pixel point, the electronic device can calculate the difference between the preset adjustment degree and the diffuse reflection degree of the target color corresponding to the pixel point to obtain the enhancement intensity corresponding to the pixel point.

[0110] In order to more conveniently analyze and process the lifting intensity of each pixel in the processed image, after calculating the difference corresponding to each pixel, the difference corresponding to each pixel can be normalized to obtain the processing result as the lifting intensity corresponding to the pixel.

[0111] In one embodiment, for each pixel, the electronic device may calculate the boost intensity level_colorC corresponding to the pixel according to the difference between the diffuse reflection degree of the target color corresponding to the pixel and the preset adjustment degree according to the following formula:

[0112] level_colorC=(isp_params.Level_color-L_color) / coe1_ada

[0113] Here, isp_params.Level_color is the preset adjustment level, L_color is the diffuse reflection level of the target color corresponding to the pixel, and coe1_ada is the normalized adjustment coefficient. The preset adjustment level is within a certain range. level_colorC is used to represent the boost intensity of the target color corresponding to the pixel, isp_params.Level_color is used to represent the preset adjustment level of the target color, and L_color is used to represent the diffuse reflection level of the target color corresponding to the pixel. For example, if the target color is red, level_colorC is recorded as level_redC, isp_params.Level_color is recorded as isp_params.Level_red, and L_color is recorded as L_red.

[0114] For example, if the image to be processed is an endoscopic image, which is primarily red, then the diffuse reflection degree of the target color corresponding to each pixel is the red diffuse reflection degree, and the preset adjustment degree is the adjustment degree of the red discrimination. For each pixel, the electronic device can calculate the corresponding boost intensity level_redC according to the following formula based on the difference between the red diffuse reflection degree corresponding to the pixel and the preset red adjustment degree:

[0115] level_redC=(isp_params.Level_red-L_red) / coe1_ada

[0116] Among them, L_red is the red diffuse reflection level corresponding to the pixel point, L_redisp_params.Level_red is the preset red adjustment level, which can be set to 200, and coe1_ada is the normalization adjustment coefficient, which can be set to 120.

[0117] As can be seen, in this embodiment, for each pixel, the electronic device can calculate the difference between the preset adjustment level and the diffuse reflection level of the target color corresponding to the pixel, normalize the difference, and obtain a processing result as the boost intensity corresponding to the pixel. In this way, the color distinction of the target color of the processed image can be improved according to the boost intensity.

[0118] As an implementation of an embodiment of the present application, the above-mentioned image to be processed is a frame in a video stream.

[0119] Before the step of calculating the lifting intensity corresponding to each pixel point based on the diffuse reflection degree of the target color corresponding to the image to be processed, the method may further include:

[0120] Obtaining a diffuse reflection degree of the target color corresponding to a previous frame of the image to be processed as the diffuse reflection degree of the target color corresponding to the image to be processed, wherein the diffuse reflection degree of the target color corresponding to the previous frame of the image is determined based on the pixel value of each pixel in the previous frame of the image; or

[0121] Based on the pixel value of each pixel in the image to be processed, the diffuse reflection degree of the target color corresponding to the image to be processed is determined.

[0122] For the same scene, if the intensity of diffuse reflection effects on any frame in a video stream is the same, then the diffuse reflection degree of the target color corresponding to any frame in the video stream should remain constant when the image to be processed is used. In one embodiment, to ensure the processing rate of the image to be processed, the electronic device can obtain the diffuse reflection degree of the target color corresponding to the previous frame of the image to be processed as the diffuse reflection degree of the target color corresponding to the image to be processed. The diffuse reflection degree of the target color corresponding to the previous frame is determined based on the pixel values ​​of each pixel in the previous frame.

[0123] That is to say, it takes a long time for the electronic device to calculate the diffuse reflection degree of the image to be processed in real time. If the image to be processed is not the first frame image in the video stream, then the diffuse reflection degree of the target color corresponding to the previous frame image of the image to be processed can be obtained, which can reduce the time for calculating the diffuse reflection degree of the target color corresponding to the image to be processed.

[0124] For example, the diffuse reflection degrees of the target color corresponding to the previous frame image of the image to be processed are L_color1, L_color2...L_colorN respectively. The electronic device can obtain the diffuse reflection degrees L_color1, L_color2...L_colorN of the target color corresponding to the previous frame image of the image to be processed as the diffuse reflection degrees of the target color corresponding to the image to be processed.

[0125] In another embodiment, in order to accurately obtain the diffuse reflection degree of the target color corresponding to the image to be processed, the electronic device may determine the diffuse reflection degree of the target color corresponding to the image to be processed based on the pixel value of each pixel point in the image to be processed.

[0126] Exemplarily, the electronic device may determine the diffuse reflection degree of the target color corresponding to the image to be processed based on the diffuse reflection degree reflected by the component included in the pixel value of each pixel point in the image to be processed.

[0127] As can be seen, in this embodiment, the electronic device can obtain the diffuse reflection degree of the target color corresponding to the previous frame of the image to be processed as the diffuse reflection degree of the target color corresponding to the image to be processed, wherein the diffuse reflection degree of the target color corresponding to the previous frame of the image is determined based on the pixel value of each pixel in the previous frame of the image, or the diffuse reflection degree of the target color corresponding to the image to be processed is determined based on the pixel value of each pixel in the image to be processed. Since the diffuse reflection degree of the image to be processed is determined based on the pixel value of each pixel, this can better reflect the diffuse reflection degree of the target color and can intelligently identify the current scene to effectively adjust the internal mapping parameters, so that the processing effect of subsequent images is more in line with the application scenario.

[0128] As an implementation of an embodiment of the present application, the method for determining the diffuse reflection degree may include:

[0129] For each pixel point of the target image, the diffuse reflection degree of the target color corresponding to the pixel point is calculated based on the color space channel values ​​corresponding to the pixel point and the preset coefficients corresponding to the color space channel values, wherein the target image is the previous frame image or the image to be processed, and the preset coefficients corresponding to the color space channel values ​​are used to characterize the degree of influence of diffuse reflection on the color space channel values.

[0130] Since the color spaces of the images to be processed are different, the color space channel values ​​corresponding to each pixel are different. Therefore, the electronic device can determine the diffuse reflection degree of the target color corresponding to each pixel based on the color space channel value corresponding to each pixel.

[0131] In one embodiment, for each pixel of a target image, an electronic device can calculate the diffuse reflection degree of the target color corresponding to the pixel based on the color space channel value corresponding to the pixel value of the pixel and the preset coefficients corresponding to each color space channel value. The target image is the previous frame image or the image to be processed, and the preset coefficients corresponding to the color space channel values ​​are used to characterize the degree of influence of diffuse reflection on the color space channel values. In other words, for any frame image in a video stream, the above method can be used to calculate the diffuse reflection degree of the target color corresponding to the image. The preset coefficients can be set according to actual needs.

[0132] For example, the color space of the image to be processed is the HLS space, and the color space channel values ​​corresponding to each pixel are the H channel value, L channel value, and S channel value, respectively. The preset coefficients corresponding to each color space channel value are coe1, coe2, and coe3, respectively. Then, for each pixel of the target image, the electronic device can calculate the diffuse reflection degree of the target color corresponding to the pixel according to the formula coe1*H+coe2*L+coe3*S based on the H channel value, L channel value, S channel value corresponding to the pixel and the preset coefficients coe1, coe2, and coe3 corresponding to each color space channel value.

[0133] As can be seen, in this embodiment, for each pixel of the target image, the electronic device can calculate the diffuse reflection degree of the target color corresponding to that pixel based on the color space channel values ​​corresponding to that pixel and the preset coefficients corresponding to each color space channel value. Because the diffuse reflection degree of the target image is calculated based on the color space channel values ​​corresponding to each pixel and the preset coefficients corresponding to each color space channel value, it can better reflect the diffuse reflection degree of the target color.

[0134] As an implementation manner of the embodiment of the present application, the step of calculating the degree of diffuse reflection of the target color corresponding to each pixel point of the target image according to the color space channel values corresponding to the pixel point and the preset coefficients corresponding to the color space channel values can include:

[0135] For each pixel point of the target image, the preset coefficients corresponding to the color space channel values corresponding to the pixel point are used as weights to perform weighted summation on the color space channel values to obtain a first summation result; the first summation result and a preset threshold constant are summed to obtain a second summation result as the degree of diffuse reflection of the target color corresponding to the pixel point, wherein the preset threshold constant is set based on the required enhancement intensity of the image to be processed.

[0136] To determine the degree of influence of diffuse reflection on each pixel point in the target image, the degree of diffuse reflection of the color space channel values can be considered. For each pixel point of the target image, the electronic device can use the preset coefficients corresponding to the color space channel values corresponding to the pixel point as weights to perform weighted summation on the color space channel values to obtain a first summation result, and then perform summation on the first summation result and a preset threshold constant to obtain a second summation result as the degree of diffuse reflection of the target color corresponding to the pixel point, wherein the preset threshold constant is set based on the required enhancement intensity of the image to be processed.

[0137] In an implementation manner, for each pixel point of the target image, the electronic device can calculate the degree of diffuse reflection of the target color corresponding to the pixel point according to the color space channel values corresponding to the pixel point and the preset coefficients corresponding to the color space channel values according to the following formula:

[0138] L_color = coel*A + coe2*B + coe3*C + th_1

[0139] Wherein, A, B, C are color space channel values, coel, coe2, coe3 are preset coefficients, and th_1 is a preset threshold constant. Exemplarily, if the image to be processed is an RGB image, A, B, and C can represent R, G, and B values, respectively; if the image to be processed is a YUV image, A, B, and C can represent Y, U, and V values, respectively; if the image to be processed is an XYZ image, A, B, and C can represent X, Y, and Z values, respectively. L_color is used to represent the degree of diffuse reflection of the target color, and if the target color is red, L_color is recorded as L_red.

[0140] In order to combine with the actual scene, when calculating the diffuse reflection degree of the target color corresponding to each pixel point according to the color space channel values ​​corresponding to each pixel point in the target image and the preset coefficients corresponding to each color space channel value, a preset threshold constant determined based on the actual scene can be added.

[0141] For example, the image to be processed is an endoscopic image, and the target color is red. If the endoscopic image is an RGB image, to facilitate image processing, the RGB image can first be converted to an image in the ×YZ color space. In one embodiment, the electronic device can process the RGB values ​​of the endoscopic image according to the following formula:

[0142]

[0143] Wherein, a is the color space channel value corresponding to each pixel point. For example, That is, the color space channel values ​​corresponding to each pixel are normalized and then input into the above formula to obtain the processed RGB value.

[0144] After obtaining the processed RGB values, the electronic device can convert the processed RGB values ​​into XYZ values ​​for each pixel according to the following formula:

[0145]

[0146] After obtaining the XYZ value, the electronic device can calculate the red diffuse reflection level L_red corresponding to the pixel point according to the XYZ color space channel values ​​of the pixel point and the preset coefficients corresponding to the color space channel values ​​according to the following formula:

[0147]

[0148]

[0149] Among them, t is the channel value of each color space, X n =0950456,Y n = 1.0, coe1_reddiff = 80, and th1_reddiff = 10. This normalizes the coefficients and sums. If implementing with an FPGA (Field-Programmable Gate Array), the power series calculation in the above formula can be replaced with a table lookup. If the algorithm does not require high precision, accuracy to three decimal places is sufficient. Using the above formula, the electronic device can traverse the entire endoscope image and calculate the corresponding red diffuse reflectance level for each pixel.

[0150] As can be seen, in this embodiment, for each pixel of the target image, the electronic device can use the preset coefficients corresponding to the color space channel values ​​corresponding to the pixel as weights to perform a weighted summation of the color space channel values ​​to obtain a first summation result. The first summation result is then summed with a preset threshold constant to obtain a second summation result, which serves as the diffuse reflection degree of the target color corresponding to the pixel. Because the diffuse reflection degree of the target image is calculated based on the color space channel values ​​corresponding to each pixel, the preset coefficients corresponding to each color space channel value, and the preset threshold constant, it can better reflect the diffuse reflection degree of the target color.

[0151] As an implementation method of the present application, Figure 2 As shown, the above step of processing the pixel value of each pixel based on the adjustment method corresponding to the classification category to which the pixel belongs and the lifting intensity corresponding to the pixel to obtain the processed image may include:

[0152] S201, for each pixel, determining a lifting coefficient corresponding to the pixel according to a lifting intensity corresponding to the pixel and a target channel threshold corresponding to the pixel;

[0153] The target channel threshold is a preset channel threshold used to determine the classification category to which the pixel point belongs.

[0154] For each pixel, since the electronic device can determine the classification category to which the pixel belongs and obtain the corresponding boosting strength of the pixel, the electronic device can process the pixel value of the pixel according to different classification categories and boosting strengths.

[0155] In one embodiment, for each pixel, the electronic device can determine the lift coefficient corresponding to the pixel based on the lift intensity corresponding to the pixel and the target channel threshold corresponding to the pixel. The target channel threshold is a preset channel threshold used to determine the classification category to which the pixel belongs. If there are multiple preset channel thresholds, the target channel threshold can be one of the preset channel thresholds or multiple of them. In this way, by combining the lift intensity corresponding to the pixel with the preset channel threshold of the classification category to which the pixel belongs, the pixel value of the pixel can be effectively adjusted.

[0156] For example, for a pixel point i of the image to be processed, the electronic device determines that the classification category to which the pixel point i belongs is category 1, and the promotion intensity corresponding to the pixel point is level redC. When it is determined that the classification category to which the pixel point belongs is category 1, the preset channel threshold includes th red1 and th red2, and then th red1 can be used as the target channel threshold, th red2 can be used as the target channel threshold, or th red1 and th red2 can be used as the target channel threshold. The electronic device can determine the promotion coefficient corresponding to the pixel point according to the promotion intensity level redC corresponding to the pixel point and the target channel threshold th red1 and / or th red2 corresponding to the pixel point.

[0157] 5202, based on the adjustment mode corresponding to the classification category to which the pixel point belongs and the promotion coefficient corresponding to the pixel point, the pixel value of the pixel point is processed to obtain the processed pixel value corresponding to the pixel point.

[0158] After the electronic device determines the adjustment mode corresponding to the classification category to which the pixel point belongs and obtains the promotion coefficient corresponding to the pixel point, the pixel value of the pixel point can be processed based on the adjustment mode corresponding to the classification category to which the pixel point belongs and the promotion coefficient corresponding to the pixel point, to obtain the processed pixel value corresponding to the pixel point.

[0159] For example, the adjustment mode corresponding to the classification category 1 is coe11*I in n +coe21*I in n-1 +…coen1*I in +th1, wherein I in is the pixel value of the pixel point of the image to be processed, coe11, coe21, and coen1 are promotion coefficients, and th1 is a preset adjustment threshold. In this way, if the classification category to which the pixel point i in the image to be processed belongs is category 1, the electronic device can process the pixel value of the pixel point according to the adjustment formula coe11*I in n +coe21*I in n-1 +…coen1*I in +th1 and the promotion coefficients coe11, coe21, and coen1 corresponding to the pixel point to obtain the processed pixel value corresponding to the pixel point.

[0160] It can be seen that in this embodiment, for each pixel point, the electronic device can determine the lifting coefficient corresponding to the pixel point based on the lifting intensity corresponding to the pixel point and the target channel threshold corresponding to the pixel point, wherein the target channel threshold is a preset channel threshold for determining the classification category to which the pixel point belongs, and based on the adjustment method corresponding to the classification category to which the pixel point belongs and the lifting coefficient corresponding to the pixel point, the pixel value of the pixel point is processed to obtain the processed pixel value corresponding to the pixel point. Since the process of processing the pixel value of the pixel point takes into account the classification category of the pixel point and the lifting intensity corresponding to the pixel point, and combines the lifting intensity corresponding to the pixel point with the preset channel threshold of the classification category to which the pixel point belongs, the pixel value of the pixel point can be effectively adjusted, and by adjusting different areas of the image to be processed through adaptive parameters, the color distribution of the processed image can be made smoother and closer to the human eye perception.

[0161] As an implementation of an embodiment of the present application, the step of processing the pixel value of the pixel point based on the adjustment method corresponding to the classification category to which the pixel point belongs and the lifting coefficient corresponding to the pixel point to obtain the processed pixel value corresponding to the pixel point may include:

[0162] If the classification category to which the pixel point belongs is the preset target category, the pixel value of the pixel point is used as the processed pixel value corresponding to the pixel point; if the classification category to which the pixel point belongs is one of multiple preset classification categories, determine the preset polynomial corresponding to the classification category to which the pixel point belongs; the lifting coefficient corresponding to the pixel point is used as the coefficient in the preset polynomial, and the pixel value of the pixel point is used as the variable in the preset polynomial, and the processed pixel value corresponding to the pixel point is calculated according to the preset polynomial.

[0163] After determining the classification category to which the pixel point belongs, the electronic device may process the pixel value of the pixel point according to the classification category and the processing method corresponding to the classification category.

[0164] If the classification category to which the pixel point belongs is the preset target category, for example, 0, the electronic device may not adjust the pixel value of the pixel point, that is, use the pixel value of the pixel point as the processed pixel value corresponding to the pixel point.

[0165] In order to facilitate the processing of pixel points of different preset classification categories, a preset polynomial corresponding to each preset classification category can be pre-set. The preset polynomial can process different areas of the image to be processed, including but not limited to stretching, transformation and other operations, so that the distinguishability of the target color of the image to be processed can be improved.

[0166] In this way, if the classification category to which the pixel point belongs is one of the above-mentioned multiple preset classification categories, such as 1, 2, etc., the electronic device can determine the preset polynomial corresponding to the classification category to which the pixel point belongs, and then use the lifting coefficient corresponding to the pixel point as the coefficient in the preset polynomial, and use the pixel value of the pixel point as the variable in the preset polynomial, and calculate the processed pixel value corresponding to the pixel point according to the preset polynomial.

[0167] In one embodiment, the electronic device may calculate the processed pixel value I_output corresponding to the pixel according to the following formula based on the adjustment method corresponding to the classification category to which the pixel belongs and the lifting coefficient corresponding to the pixel:

[0168]

[0169] Among them, coe11, coe12...coenn are the lifting coefficients, color_classiffication is the classification category, n is a positive integer, I in is the pixel value of the pixel in the image to be processed, th1…thn are preset adjustment thresholds. color_classiffication is used to represent the classification category of the target color to which the pixel belongs. If the target color is red, color_classiffication is recorded as red_classiffication.

[0170] For example, the image to be processed is an endoscopic image, and the target color is red. If the endoscopic image is an HSV image, then for each pixel point, the electronic device can calculate the processed numerical results corresponding to each component of the pixel value of the pixel point according to a preset formula based on the adjustment method corresponding to the classification category to which the pixel point belongs and the lifting coefficient corresponding to the pixel point. For example, the processed numerical result corresponding to the S component included in the pixel value of the pixel point is calculated according to the following formula:

[0171]

[0172] After obtaining the numerical result of each component included in the pixel value of the pixel point, the electronic device can obtain the processed pixel value corresponding to the pixel point. When S_output is greater than 1, S_output is set to 1.

[0173] It can be seen that in this embodiment, if the classification category to which the pixel point belongs is a preset target category, the electronic device can use the pixel value of the pixel point as the processed pixel value corresponding to the pixel point. If the classification category to which the pixel point belongs is one of multiple preset classification categories, the electronic device can determine the preset polynomial corresponding to the classification category to which the pixel point belongs, use the lifting coefficient corresponding to the pixel point as the coefficient in the preset polynomial, and use the pixel value of the pixel point as the variable in the preset polynomial to calculate the processed pixel value corresponding to the pixel point according to the preset polynomial. Since the process of processing the pixel value of the pixel point takes into account the classification category of the pixel point and the lifting coefficient corresponding to the pixel point, the pixel value of the pixel point can be effectively processed.

[0174] As an implementation of an embodiment of the present application, before the step of determining the classification category to which each pixel point belongs based on the depth of the target color represented by the pixel value of each pixel point in the image to be processed, the method may further include:

[0175] According to the conversion method corresponding to the target color space, the image to be processed is subjected to color space conversion processing to obtain the image to be processed in the target color space.

[0176] To meet different image processing requirements, such as decomposing and processing the features to be processed separately in a color space, electronic devices can convert the image to be processed into different color spaces. Color spaces can include RGB space, Lab space, YUV space, XYZ space, YCbCr space, etc.

[0177] In one embodiment, the electronic device may perform color space conversion processing on the image to be processed according to a conversion method corresponding to the target color space to obtain the image to be processed in the target color space.

[0178] For example, if the image to be processed is an RGB image and the target color space is the HSV space, that is, the RGB image needs to be converted into an HSV image, the electronic device can perform color space conversion processing on the image to be processed according to the following formula:

[0179]

[0180] H_ori=h / 360

[0181]

[0182] Here we only take the conversion of H and S components as an example. Here, r, g, and b are the RGB color space channel values, max and min are the maximum and minimum values ​​of the RGB color space channel values, and H_ori = h / 360 is used to normalize the H component in the range [0, 360) to between 0 and 1.

[0183] After the step of processing the pixel value of each pixel based on the adjustment method corresponding to the classification category to which the pixel belongs and the lifting intensity corresponding to the pixel to obtain a processed image, the method may further include:

[0184] According to the inverse conversion method corresponding to the target color space, the processed image is subjected to color space inverse conversion processing to obtain a processed image, wherein the processed image has the same color space as that of the image to be processed.

[0185] When an electronic device obtains a processed image to be processed, it is necessary to convert the color space of the processed image to a color space corresponding to the image to be processed. In one embodiment, the electronic device can perform color space inverse conversion on the processed image according to an inverse conversion method corresponding to the target color space, thereby obtaining a processed image, wherein the processed image has the same color space as the image to be processed.

[0186] For example, if the color space corresponding to the image to be processed is the RGB color space, and the color space corresponding to the processed image is the HSV space, then the electronic device needs to convert the color space of the processed image from the HSV space to the RGB space. Then, for each pixel, the color space inverse conversion processing can be performed on the processed image according to the following formula:

[0187]

[0188]

[0189] q=V*(1-f*S)

[0190] p=V*(1-S)

[0191] t=V*(1-(1-f)*S)

[0192]

[0193] Among them, floor is rounded down, H, S, V are the channel values ​​of HSV color space, and h is calculated. i After that, you can use h i The value of determines the value of R, G, and B.

[0194] As can be seen, in this embodiment, the electronic device can perform color space conversion processing on the image to be processed according to the conversion method corresponding to the target color space to obtain the image to be processed in the target color space, and can also perform color space inverse conversion processing on the processed image according to the inverse conversion method corresponding to the target color space to obtain the processed image. In this way, performing target color space conversion on the image to obtain the image to be processed in the target color space can meet image processing requirements and improve image processing efficiency.

[0195] As an implementation of an embodiment of the present application, the above-mentioned image to be processed is an image in an endoscopic video stream, and the above-mentioned target color is red.

[0196] In endoscopy scenarios, the image to be processed can be an image from an endoscopic video stream, i.e., an endoscopic image. This image is typically predominantly red, meaning the target color is red. Specifically, endoscopic images display different reds depending on the tissue they contain. For example, the liver appears dark purple, arterial blood appears bright red, and venous blood appears darker red. Therefore, reducing the impact of diffuse reflection on the image to be processed and improving red discrimination can help personnel make accurate judgments.

[0197] The electronic device can determine the classification category of red to which each pixel point belongs based on the depth of red represented by the pixel value of each pixel point in the image to be processed, and calculate the corresponding boost intensity of each pixel point based on the red diffuse reflection degree corresponding to the image to be processed. Then, for each pixel point, the pixel value of the pixel point is processed based on the adjustment method corresponding to the classification category to which the pixel point belongs and the boost intensity corresponding to the pixel point to obtain the processed image.

[0198] It can be seen that in this embodiment, the image to be processed is an image in the endoscopic video stream, and the target color is red. After the electronic device uses the above-mentioned image processing method to process the image in the endoscopic video stream, it can improve the red distinction of the image, making the color distribution of the processed image smoother and closer to the human eye perception, so as to better assist staff in making judgments.

[0199] Figure 3 This is a specific flow chart of the image processing method provided in the embodiment of the present application. Figure 3 The image processing method provided in the embodiment of the present application is introduced with examples. Figure 3 As shown, the image processing method provided in the embodiment of the present application may include the following steps:

[0200] S301, color space conversion;

[0201] When an electronic device obtains an image to be processed, if the color space corresponding to the image to be processed does not meet the image processing requirements, the electronic device may perform color space conversion processing on the image to be processed according to a conversion method corresponding to the target color space, thereby obtaining an image to be processed in the target color space. For example, if an image I(i, j) is input and the electronic device obtains the image as the image to be processed, and if the image to be processed is an RGB image and the target color space is YUV, the electronic device may perform color space conversion processing on the image to be processed according to a conversion method corresponding to the YUV color space, thereby obtaining an image to be processed in the YUV color space.

[0202] S302, identifying the red tissue classification category;

[0203] If the image to be processed is an endoscopic image and the target color is red, the electronic device can determine the red classification category to which each pixel point belongs based on the depth of red represented by the pixel value of each pixel point in the image to be processed, that is, identify the red tissue classification category.

[0204] For example, deep red corresponds to category 1, purple red corresponds to category 2, and bright red corresponds to category 3. After the electronic device acquires the endoscopic image, if the red color represented by the pixel value of a certain pixel is purple red, it can be determined that the classification category to which the pixel belongs is category 2.

[0205] S303, red diffuse reflection degree estimation;

[0206] After an electronic device acquires an image to be processed, it needs to estimate the diffuse reflection level of the image to be processed, that is, calculate the diffuse reflection level of the image to be processed. For example, if the image to be processed is an endoscopic image, the electronic device needs to calculate the diffuse reflection level of red in the endoscopic image. The electronic device can obtain the diffuse reflection level of red corresponding to the previous frame of the endoscopic image as the diffuse reflection level of the endoscopic image. Alternatively, the diffuse reflection level of red in the endoscopic image can be determined based on the pixel value of each pixel in the endoscopic image.

[0207] S304, adaptive adjustment of algorithm strength;

[0208] After the electronic device obtains the degree of diffuse reflection of the target color corresponding to the to-be-processed image, the enhancement intensity corresponding to each pixel point in the to-be-processed image can be calculated according to the preset adjustment degree and the degree of diffuse reflection. For example, after the electronic device obtains the degree of diffuse reflection of red corresponding to the endoscope image, the enhancement intensity corresponding to each pixel point can be calculated according to the preset adjustment degree isp_params.Level_color and the degree of diffuse reflection L_color, according to the formula level_colorC=(isp_params.Level_color-L_color) / coe1_ada, where coe1_ada is a normalized adjustment coefficient.

[0209] S305, color distinction degree is enhanced;

[0210] For each pixel point, the electronic device can process the pixel value of the pixel point based on the adjustment manner corresponding to the classification category to which the pixel point belongs and the enhancement intensity corresponding to the pixel point, to obtain a processed image.

[0211] For example, after the electronic device obtains the red classification category to which each pixel point in the endoscope image belongs and the enhancement intensity corresponding to each pixel point, for each pixel point, the pixel value of the pixel point can be processed based on the adjustment manner corresponding to the red classification category to which the pixel point belongs and the enhancement intensity corresponding to the pixel point, to obtain the processed pixel value corresponding to each pixel point, and further obtain a processed image, so that the red color distinction degree of the to-be-processed image is enhanced.

[0212] S306, color space reverse conversion.

[0213] After the electronic device obtains the processed image, the color space of the processed image needs to be converted to the same color space as the color space corresponding to the to-be-processed image, that is, the color space of the processed image is reversely converted. For example, the color space of the endoscope image is RGB space, and the color space of the processed image is YUV space. The electronic device needs to convert the color space of the processed image to RGB space according to the conversion mode from YUV space to RGB space, that is, to obtain the output image I_out(i, j).

[0214] It can be seen that in the solution provided in the embodiment of the present application, the electronic device can obtain the image to be processed, and determine the classification category to which each pixel belongs based on the depth of the target color represented by the pixel value of each pixel in the image to be processed, wherein the classification category is used to identify the different depths of the target color, and based on the diffuse reflection degree of the target color corresponding to the image to be processed, the lifting intensity corresponding to each pixel is calculated, and for each pixel, based on the adjustment method corresponding to the classification category to which the pixel belongs and the lifting intensity corresponding to the pixel, the pixel value of the pixel is processed to obtain a processed image. Since the classification category is used to identify the different depths of the target color, and the lifting intensity is calculated based on the diffuse reflection degree of the target color, after determining the classification category to which each pixel belongs, the pixel values ​​of the pixels belonging to different classification categories are processed in combination with the lifting intensity, so as to realize the adaptive adjustment of the discrimination degree of the target color in the image, reduce the influence of the diffuse reflection of the target color in the image, and thereby improve the color discrimination degree of the image.

[0215] Corresponding to the above-mentioned image processing method, an embodiment of the present application further provides an image processing device. The image processing device provided by the embodiment of the present application is introduced below.

[0216] like Figure 4 As shown, an image processing device, the device comprising:

[0217] The image to be processed acquisition module 410 is used to acquire the image to be processed;

[0218] A classification category determination module 420 is configured to determine the classification category to which each pixel in the image to be processed belongs based on the depth of the target color represented by the pixel value of each pixel, wherein the classification category is used to identify different depths of the target color;

[0219] A lifting intensity calculation module 430 is configured to calculate the lifting intensity corresponding to each pixel based on the diffuse reflection degree of the target color corresponding to the image to be processed;

[0220] The processed image acquisition module 440 is used to process the pixel value of each pixel based on the adjustment method corresponding to the classification category to which the pixel belongs and the lifting intensity corresponding to the pixel to obtain a processed image.

[0221] It can be seen that in the scheme provided in the embodiments of the present application, the electronic device can obtain a to-be-processed image, determine the classification category to which each pixel point belongs according to the depth of the target color represented by the pixel value of each pixel point in the to-be-processed image, wherein the classification category is used to identify different depth of the target color, and the promotion intensity corresponding to each pixel point is calculated based on the diffuse reflection degree of the target color corresponding to the to-be-processed image. For each pixel point, the pixel value of the pixel point is processed based on the adjustment mode corresponding to the classification category to which the pixel point belongs and the promotion intensity corresponding to the pixel point, and a processed image is obtained. Since the classification category is used to identify different depth of the target color, and the promotion intensity is calculated based on the diffuse reflection degree of the target color, after determining the classification category to which each pixel point belongs, the pixel value of the pixel point belonging to different classification categories is processed in combination with the promotion intensity, the adaptive adjustment of the distinguishability of the target color in the image can be realized, the influence of the diffuse reflection of the target color in the image is reduced, and then the color distinguishability of the image is improved.

[0222] As an implementation manner of the embodiments of the present application, the classification category determination module 420 can include:

[0223] The classification category determination sub-module is configured to determine, for each pixel point, the classification category to which the pixel point belongs according to the size relationship between the color space channel value corresponding to the pixel point and the corresponding preset channel threshold.

[0224] As an implementation manner of the embodiments of the present application, the classification category determination sub-module can include:

[0225] The size relationship determination unit is configured to determine, for each pixel point, the size relationship between the color space channel value corresponding to the pixel point and the corresponding preset channel threshold.

[0226] The classification category determination unit is configured to determine, if the size relationship satisfies one of the plurality of preset classification conditions, the classification category to which the pixel point belongs as the preset classification category corresponding to the one preset classification condition to which the size relationship satisfies; and determine, if the size relationship does not satisfy the plurality of preset classification conditions, the classification category to which the pixel point belongs as a preset target category.

[0227] As an implementation manner of the embodiments of the present application, the promotion intensity calculation module 430 can include:

[0228] The promotion intensity calculation sub-module is configured to calculate the promotion intensity corresponding to each pixel point based on the difference between the diffuse reflection degree of the target color corresponding to the to-be-processed image and a preset adjustment degree, wherein the preset adjustment degree is used to represent the adjustment degree of the distinguishability of the target color in the to-be-processed image.

[0229] As an implementation of an embodiment of the present application, the above-mentioned lifting strength calculation submodule may include:

[0230] a difference calculation unit, configured to calculate, for each pixel, a difference between a preset adjustment degree and a diffuse reflection degree of the target color corresponding to the pixel;

[0231] The lifting intensity obtaining unit is used to perform normalization processing on the difference to obtain a processing result as the lifting intensity corresponding to the pixel point.

[0232] As an implementation method of the embodiment of the present application, the above-mentioned image to be processed is a frame in a video stream;

[0233] The above device may further include:

[0234] a diffuse reflection degree acquisition module, configured to, before the step of calculating the lifting intensity corresponding to each pixel point based on the diffuse reflection degree of the target color corresponding to the image to be processed, obtain the diffuse reflection degree of the target color corresponding to the previous frame of the image to be processed as the diffuse reflection degree of the target color corresponding to the image to be processed, wherein the diffuse reflection degree of the target color corresponding to the previous frame of the image is determined based on the pixel value of each pixel point in the previous frame of the image; or

[0235] The method is used to determine the diffuse reflection degree of the target color corresponding to the image to be processed based on the pixel value of each pixel point in the image to be processed.

[0236] As an implementation of an embodiment of the present application, the above-mentioned device may further include a diffuse reflection degree determination module, which is used to determine the diffuse reflection degree and may include:

[0237] The diffuse reflection degree calculation submodule is used to calculate the diffuse reflection degree of the target color corresponding to each pixel point of the target image based on the color space channel values ​​corresponding to the pixel point and the preset coefficients corresponding to the color space channel values, wherein the target image is the previous frame image or the image to be processed, and the preset coefficients corresponding to the color space channel values ​​are used to characterize the degree of influence of diffuse reflection on the color space channel values.

[0238] As an implementation of an embodiment of the present application, the diffuse reflection degree calculation submodule may include:

[0239] a summation result obtaining unit, configured to perform weighted summation on each color space channel value corresponding to each pixel point of the target image, using a preset coefficient corresponding to each color space channel value corresponding to the pixel point as a weight, to obtain a first summation result;

[0240] The diffuse reflection degree acquisition unit is used to sum the first summation result and a preset threshold constant to obtain a second summation result as the diffuse reflection degree of the target color corresponding to the pixel point, wherein the preset threshold constant is set based on the boost intensity required for the image to be processed.

[0241] As an implementation of the embodiment of the present application, the processed image acquisition module 440 may include:

[0242] A lift coefficient determination submodule is configured to determine, for each pixel, a lift coefficient corresponding to the pixel based on the lift intensity corresponding to the pixel and a target channel threshold corresponding to the pixel, wherein the target channel threshold is a preset channel threshold for determining the classification category to which the pixel belongs;

[0243] The pixel value acquisition submodule is used to process the pixel value of the pixel point based on the adjustment method corresponding to the classification category to which the pixel point belongs and the lifting coefficient corresponding to the pixel point to obtain the processed pixel value corresponding to the pixel point.

[0244] As an implementation of an embodiment of the present application, the above-mentioned pixel value acquisition submodule may include:

[0245] a first determining unit, configured to, if the classification category to which the pixel point belongs is a preset target category, use the pixel value of the pixel point as the processed pixel value corresponding to the pixel point;

[0246] a preset polynomial determining unit, configured to determine a preset polynomial corresponding to the classification category to which the pixel point belongs if the classification category to which the pixel point belongs is one of the plurality of preset classification categories;

[0247] The second determination unit is used to use the lifting coefficient corresponding to the pixel point as the coefficient in the preset polynomial, and the pixel value of the pixel point as the variable in the preset polynomial, and calculate the processed pixel value corresponding to the pixel point according to the preset polynomial.

[0248] As an implementation of the embodiment of the present application, the above-mentioned device may further include:

[0249] a target color space conversion module, configured to, before the step of determining the classification category to which each pixel point belongs based on the depth of the target color represented by the pixel value of each pixel point in the image to be processed, perform color space conversion processing on the image to be processed according to a conversion method corresponding to the target color space, so as to obtain the image to be processed in the target color space;

[0250] The above device may further include:

[0251] a target color space reverse conversion module, configured to, after the step of processing the pixel value of each pixel point based on the adjustment mode corresponding to the classification category to which the pixel point belongs and the boost intensity corresponding to the pixel point, and obtaining the processed image, perform color space reverse conversion processing on the processed image according to a reverse conversion mode corresponding to the target color space, to obtain a processed image, wherein the color space of the processed image is the same as that of the to-be-processed image.

[0252] As an implementation manner of the embodiment of the present application, the to-be-processed image is an image in an endoscope video stream, and the target color is red.

[0253] The embodiment of the present application further provides an electronic device, as shown in the accompanying drawings, comprising: Figure 5

[0254] a memory 501 configured to store a computer program;

[0255] a processor 502 configured to execute the program stored in the memory 501, to implement the image processing method in any of the above embodiments.

[0256] The electronic device can further comprise a communication bus and / or a communication interface, and the processor 502, the communication interface and the memory 501 can communicate with each other through the communication bus.

[0257] It can be seen that, in the scheme provided by the embodiment of the present application, the electronic device can acquire a to-be-processed image, determine the classification category to which each pixel point belongs according to the depth of the target color represented by the pixel value of each pixel point in the to-be-processed image, wherein the classification category is used to identify different depths of the target color, calculate the boost intensity corresponding to each pixel point based on the diffuse reflection degree of the target color corresponding to the to-be-processed image, process the pixel value of each pixel point based on the adjustment mode corresponding to the classification category to which the pixel point belongs and the boost intensity corresponding to the pixel point, and obtain a processed image. Since the classification category is used to identify different depths of the target color, and the boost intensity is calculated based on the diffuse reflection degree of the target color, after the classification category to which each pixel point belongs is determined, the pixel value of the pixel point belonging to different classification categories is processed in combination with the boost intensity, the adaptive adjustment of the distinguishability of the target color in the image can be realized, the influence of the diffuse reflection of the target color in the image is reduced, and thus the color distinguishability of the image is improved.

[0258] ​The communication bus mentioned in the electronic device mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0259] The communication interface is used for communication between the above electronic device and other devices.

[0260] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0261] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0262] In another embodiment provided by the present application, a computer-readable storage medium is further provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of any of the above-mentioned image processing methods are implemented.

[0263] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any one of the image processing methods in the above embodiments.

[0264] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), etc.

[0265] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0266] Each embodiment in this specification is described in a related manner. Similar portions between embodiments can be referenced to each other. Each embodiment focuses on the differences between other embodiments. In particular, the device, electronic device, computer-readable storage medium, and computer program product embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For related portions, reference can be made to the descriptions of the method embodiments.

[0267] The above description is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application are included in the scope of protection of the present application.

Claims

1. An image processing method, characterized in that: The method comprises: Get the image to be processed; Determining the classification category to which each pixel point belongs based on the depth of the target color represented by the pixel value of each pixel point in the image to be processed, wherein the classification category is used to identify different depths of the target color; Based on the diffuse reflection degree of the target color corresponding to the image to be processed, calculating the lifting intensity corresponding to each pixel point, wherein the lifting intensity is used to improve the color distinction of the target color in the image to be processed; For each pixel point, the boost intensity corresponding to the pixel point is substituted into the adjustment method corresponding to the classification category to which the pixel point belongs, and the pixel value of the pixel point is processed to reduce the influence of the diffuse reflection of the target color in the image to be processed, thereby obtaining a processed image.

2. The method according to claim 1, characterized in that The step of determining the classification category to which each pixel point belongs based on the depth of the target color represented by the pixel value of each pixel point in the image to be processed includes: For each pixel, the classification category to which the pixel belongs is determined based on the size relationship between each color space channel value corresponding to the pixel and the corresponding preset channel threshold.

3. The method according to claim 2, characterized in that The step of determining, for each pixel, the classification category to which the pixel belongs based on the magnitude relationship between each color space channel value corresponding to the pixel and the corresponding preset channel threshold comprises: For each pixel, determine the magnitude relationship between each color space channel value corresponding to the pixel and the corresponding preset channel threshold; If the size relationship satisfies one of the plurality of preset classification conditions, determining that the classification category to which the pixel point belongs is the preset classification category corresponding to the preset classification condition satisfied by the size relationship; If the size relationship does not satisfy the multiple preset classification conditions, it is determined that the classification category to which the pixel point belongs is the preset target category.

4. The method according to claim 1, wherein The step of calculating the lifting intensity corresponding to each pixel point based on the diffuse reflection degree of the target color corresponding to the image to be processed includes: Based on the difference between the diffuse reflection degree of the target color corresponding to the image to be processed and the preset adjustment degree, the lifting intensity corresponding to each pixel point is calculated, wherein the preset adjustment degree is used to characterize the adjustment degree of the distinguishability of the target color in the image to be processed.

5. The method according to claim 4, characterized in that The step of calculating the boost intensity corresponding to each pixel point based on the difference between the diffuse reflection degree of the target color corresponding to the image to be processed and the preset adjustment degree includes: For each pixel, calculating the difference between the preset adjustment degree and the diffuse reflection degree of the target color corresponding to the pixel; The difference is normalized to obtain a processing result as the lifting intensity corresponding to the pixel point.

6. The method according to any one of claims 1 to 5, characterized in that The image to be processed is a frame in a video stream; Before the step of calculating the lifting intensity corresponding to each pixel point based on the diffuse reflection degree of the target color corresponding to the image to be processed, the method further includes: Obtaining a diffuse reflection degree of the target color corresponding to a previous frame of the image to be processed as the diffuse reflection degree of the target color corresponding to the image to be processed, wherein the diffuse reflection degree of the target color corresponding to the previous frame of the image is determined based on the pixel value of each pixel in the previous frame of the image; or Based on the pixel value of each pixel in the image to be processed, the diffuse reflection degree of the target color corresponding to the image to be processed is determined.

7. The method according to claim 6, characterized in that The method for determining the degree of diffuse reflection includes: For each pixel point of the target image, the diffuse reflection degree of the target color corresponding to the pixel point is calculated based on the color space channel values ​​corresponding to the pixel point and the preset coefficients corresponding to the color space channel values, wherein the target image is the previous frame image or the image to be processed, and the preset coefficients corresponding to the color space channel values ​​are used to characterize the degree of influence of diffuse reflection on the color space channel values.

8. The method according to claim 7, characterized in that The step of calculating, for each pixel of the target image, the diffuse reflection degree of the target color corresponding to the pixel according to each color space channel value corresponding to the pixel and the preset coefficient corresponding to each color space channel value, includes: For each pixel of the target image, using preset coefficients corresponding to the color space channel values ​​corresponding to the pixel as weights, performing weighted summation on the color space channel values ​​to obtain a first summation result; The first summation result is summed with a preset threshold constant to obtain a second summation result as the diffuse reflection degree of the target color corresponding to the pixel point, wherein the preset threshold constant is set based on the boost intensity required for the image to be processed.

9. The method according to any one of claims 1 to 5, characterized in that The step of substituting, for each pixel, the boost intensity corresponding to the pixel into an adjustment method corresponding to the classification category to which the pixel belongs, processing the pixel value of the pixel to reduce the influence of diffuse reflection of the target color in the image to be processed, and obtaining a processed image includes: For each pixel, determine the lift coefficient corresponding to the pixel based on the lift intensity corresponding to the pixel and the target channel threshold corresponding to the pixel, where the target channel threshold is a preset channel threshold used to determine the classification category to which the pixel belongs; Based on the adjustment method corresponding to the classification category to which the pixel point belongs and the lifting coefficient corresponding to the pixel point, the pixel value of the pixel point is processed to obtain a processed pixel value corresponding to the pixel point.

10. The method according to claim 9, characterized in that The step of processing the pixel value of the pixel point based on the adjustment method corresponding to the classification category to which the pixel point belongs and the lifting coefficient corresponding to the pixel point to obtain the processed pixel value corresponding to the pixel point includes: If the classification category to which the pixel point belongs is the preset target category, the pixel value of the pixel point is used as the processed pixel value corresponding to the pixel point; If the classification category to which the pixel point belongs is one of the multiple preset classification categories, determining a preset polynomial corresponding to the classification category to which the pixel point belongs; The lifting coefficient corresponding to the pixel point is used as the coefficient in the preset polynomial, and the pixel value of the pixel point is used as the variable in the preset polynomial, and the processed pixel value corresponding to the pixel point is calculated according to the preset polynomial.

11. The method according to any one of claims 1 to 5, characterized in that Before the step of determining the classification category to which each pixel point belongs based on the depth of the target color represented by the pixel value of each pixel point in the image to be processed, the method further includes: Performing color space conversion processing on the image to be processed according to a conversion method corresponding to the target color space to obtain the image to be processed in the target color space; After the step of substituting, for each pixel, the boost intensity corresponding to the pixel into an adjustment method corresponding to the classification category to which the pixel belongs, processing the pixel value of the pixel to reduce the influence of diffuse reflection of the target color in the image to be processed, and obtaining a processed image, the method further includes: According to the inverse conversion method corresponding to the target color space, the processed image is subjected to color space inverse conversion processing to obtain a processed image, wherein the processed image has the same color space as that of the image to be processed.

12. The method according to any one of claims 1 to 5, characterized in that The image to be processed is an image in an endoscope video stream, and the target color is red.

13. An image processing device, characterized in that: The device comprises: The image to be processed acquisition module is used to acquire the image to be processed; a classification category determination module, configured to determine the classification category to which each pixel in the image to be processed belongs based on the depth of the target color represented by the pixel value of each pixel, wherein the classification category is used to identify different depths of the target color; a lifting intensity calculation module, configured to calculate the lifting intensity corresponding to each pixel point based on the diffuse reflection degree of the target color corresponding to the image to be processed, wherein the lifting intensity is used to improve the color distinction of the target color in the image to be processed; The processed image acquisition module is used to substitute the lifting intensity corresponding to each pixel point into the adjustment method corresponding to the classification category to which the pixel point belongs, and process the pixel value of the pixel point to reduce the influence of the diffuse reflection of the target color in the image to be processed, thereby obtaining a processed image.

14. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the method according to any one of claims 1 to 12 when executing a program stored in a memory.

15. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.

Citation Information

Patent Citations

  • Image enhancement method and image enhancement device

    CN101814179A

  • Image highlight removal method based on color partitions

    CN113469895A