Image processing method and device

By monitoring the chromatic difference value of the endoscopic light source in real time and performing white balance correction, the color casting problem caused by the increase in the LED light source temperature and the adjustment of the light source brightness during surgery is solved, and the image display effect and operation are improved. Observation accuracy.

CN119450171APending Publication Date: 2025-02-14QINGDAO HISENSE INTELLIGENT MEDICAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310947690.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-28
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In endoscopic surgery, due to the increase in the temperature of the LED light source, the luminous flux decreases and spectral deviation, combined with the color temperature changes caused by the adjustment of the light source brightness during the operation, the endoscopic image will be color-shape, affecting surgical observation.

Method used

The color sensor collects the R value, G value and B value of the endoscope light source, determines the color difference value of the light source, and determines whether the deviation from the pre-stored initial color difference value is greater than the preset value. If the deviation is greater than the preset value, it is judged that the color temperature changes, and then the acquired endoscopic image is white balanced.

Benefits of technology

It effectively avoids the color cast problem of endoscopic images due to changes in color temperature of light sources, and improves the image display effect and the accuracy of the operation observation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119450171A_ABST
    Figure CN119450171A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an image processing method and equipment, which are used for solving the problem of color cast of an endoscope image in the prior art. In the embodiment of the invention, the electronic equipment determines a color difference value of the endoscope light source according to an R value, a G value and a B value, collected by a color sensor, of the endoscope light source; judging whether the deviation between the color difference value and a pre-stored initial color difference value determined before the operation is greater than a preset value or not; if yes, determining that the color temperature is changed; at the moment, the problem of color cast of the endoscope image occurs; according to the method, the obtained endoscope image is subjected to white balance correction, so that when the endoscope image is subjected to color cast, the endoscope image is subjected to white balance correction, and the problem of color cast of the endoscope image is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of endoscope imaging, and in particular to an image processing method and device. Background Art

[0002] With the development of medical technology, surgery using endoscopes has gradually become a development trend. Among them, surgery using endoscopes usually involves white balance correction by photographing white objects before surgery. However, due to long surgery, the energy input to the light emitting diode (LED) is converted into heat energy in addition to the energy consumed by light emission, which causes the junction temperature of the positive and negative (PN) junctions of the LED to continue to rise. When the junction temperature rises, the luminous flux of the LED will be significantly reduced, and the spectrum of the LED will also shift to the long-wave direction as the temperature rises, and the color temperature of the light source will also change accordingly. In addition, when the surgeon adjusts the brightness of the light source, the color temperature of the light source will also be affected by factors such as the LED light-color electrical properties and the error in the current generated by the hardware. At this time, the white balance of the image performed before the operation fails, and the endoscopic image is prone to color cast, affecting surgical observation. Summary of the invention

[0003] The embodiments of the present application provide an image processing method and device to solve the problem of color cast of endoscopic images in the prior art.

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

[0005] Determine the color difference value of the endoscope light source according to the R value, G value and B value of the endoscope light source collected by the color sensor;

[0006] Determine whether the deviation between the color difference value and the pre-saved initial color difference value determined before the operation is greater than a preset value;

[0007] If so, it is determined that the color temperature has changed; and white balance correction is performed on the acquired endoscopic image.

[0008] In a second aspect, an embodiment of the present application further provides an electronic device, which includes at least a processor and a memory, and the processor is used to implement the steps of any of the above-mentioned image processing methods when executing a computer program stored in the memory.

[0009] In an embodiment of the present application, the electronic device determines the color difference value of the endoscopic light source based on the R value, G value and B value of the endoscopic light source collected by the color sensor; determines whether the deviation between the color difference value and the initial color difference value determined before the operation that is pre-saved is greater than a preset value; if so, determines that the color temperature has changed; at this time, the endoscopic image will have a color cast problem; white balance correction is performed on the acquired endoscopic image, and then when the endoscopic image is color cast, white balance correction is performed on the endoscopic image to avoid the problem of color cast of the endoscopic image. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0011] Figure 1 A schematic diagram of an image processing process provided in an embodiment of the present application;

[0012] Figure 2 A schematic diagram of a process for determining an initial color difference value provided in an embodiment of the present application;

[0013] Figure 3 A detailed process diagram of image processing provided by an embodiment of the present application;

[0014] Figure 4 A schematic diagram of a detailed process for determining a second gain R value, a second gain G value, and a second gain B value provided in an embodiment of the present application;

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

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

[0017] The present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.

[0018] In order to improve the display effect of endoscopic images and facilitate surgical observation, an embodiment of the present application provides an image processing method and device.

[0019] The image processing method includes: determining the color difference value of the endoscope light source according to the R value, G value and B value of the endoscope light source collected by the color sensor; judging whether the deviation between the color difference value and the initial color difference value determined before the operation is greater than a preset value; if so, determining that the color temperature has changed; and performing white balance correction on the acquired endoscope image, thereby improving the display effect of the endoscope image.

[0020] Figure 1 A schematic diagram of an image processing process provided in an embodiment of the present application, the process includes the following steps:

[0021] S101: Determine a color difference value of the endoscope light source according to the R value, G value, and B value of the endoscope light source collected by a color sensor.

[0022] The image processing method provided in the embodiment of the present application is applied to an electronic device, which may be an intelligent device such as an endoscope, a PC or a server.

[0023] In order to improve the display effect of the endoscopic image, the electronic device can obtain the R value, G value and B value of the endoscopic light source collected by the color sensor, wherein the color sensor is set in the endoscopic light source host. After the operation begins, the color sensor begins to collect the R value, G value and B value of the endoscopic light source, and sends the collected R value, G value and B value to the electronic device, and the electronic device can obtain the R value, G value and B value of the endoscopic light source collected by the color sensor.

[0024] After the electronic device obtains the R value, G value, and B value of the endoscope light source collected by the color sensor, it can determine the color difference value of the endoscope light source according to the R value, G value, and B value. After obtaining the R value, G value, and B value of a certain light source, how to determine the color difference value of the light source according to the R value, G value, and B value of the light source is an existing technology and will not be repeated here.

[0025] S102: Determine whether the deviation between the color difference value and the pre-saved initial color difference value determined before the operation is greater than a preset value; if so, execute S103.

[0026] In order to effectively solve the problem of color cast of endoscopic images, the electronic device locally pre-saves the initial color difference value determined before the operation. After determining the color difference value of the endoscope light source, the electronic device can determine the deviation between the color difference value and the pre-saved initial color difference value determined before the operation, and judge whether the deviation is greater than a preset value. If the deviation is greater than the preset value, it means that the color temperature has changed, and there is a problem of color cast of the endoscopic image.

[0027] The electronic device may determine the deviation of the color difference value from the initial color difference value determined before the operation and stored in advance using the following formula:

[0028] Δs=|S or -S i |

[0029] Among them, Δs is the deviation, S or The color difference value determined, S i It is the initial color difference value determined before the operation and saved in advance.

[0030] S103: Determine whether the color temperature has changed; and perform white balance correction on the acquired endoscopic image.

[0031] If the deviation between the determined chromatic aberration value of the endoscope and the pre-saved initial chromatic aberration value determined before the operation is greater than a preset value, it is determined that the color temperature has changed. At this time, in order to improve the display effect of the endoscopic image, the electronic device can perform white balance correction on the acquired endoscopic image.

[0032] It should be noted that before the operation, the electronic device first determines the gain value obtained by the initial white balance. When the color temperature changes, the gain value obtained by the initial white balance becomes invalid. If the initial white balance is still used to process the endoscopic image, it will cause the endoscopic image to be color cast. At this time, the electronic device re-performs white balance correction on the endoscopic image. This method overcomes the image color cast problem caused by light source errors and can better solve the problem of endoscopic image color cast.

[0033] The embodiment of the present application is equivalent to disclosing a method for white balance compensation of endoscopic images. The main implementation scheme is that the color sensor monitors the R value, G value and B value of the light source in real time, and obtains the color difference value of the light source at this time according to the R value, G value and B value. According to whether the deviation between the color difference value and the initial color difference value of the endoscopic light source determined before the operation is greater than the preset value, it is judged whether the color temperature of the endoscope has changed significantly. If the color temperature has changed significantly, the white balance correction is performed again. The endoscopic image is further corrected to avoid the color cast of the endoscopic image, improve the image quality of the endoscopic image, and improve the efficiency of the operation.

[0034] Among them, the human visual system has the characteristic of color constancy, so human observation of things is not affected by the color temperature of the light source. However, the image sensor itself does not have this color constancy characteristic. Therefore, the images taken under different light sources will change due to the influence of the light source color temperature. In order to eliminate the influence of the light source color temperature on the imaging of the image sensor, the automatic white balance function is used to correct the endoscope image.

[0035] In an embodiment of the present application, the electronic device determines the color difference value of the endoscopic light source based on the R value, G value and B value of the endoscopic light source collected by the color sensor; determines whether the deviation between the color difference value and the initial color difference value determined before the operation that is pre-saved is greater than a preset value; if so, determines that the color temperature has changed; at this time, the endoscopic image will have a color cast problem; white balance correction is performed on the acquired endoscopic image, and then when the endoscopic image is color cast, white balance correction is performed on the endoscopic image to avoid the problem of color cast of the endoscopic image.

[0036] In order to improve the display effect of the endoscope image, based on the above embodiment, in the embodiment of the present application, the initial color difference value is determined by the following method:

[0037] Obtaining the initial R value, initial G value, and initial B value of the endoscope light source collected by the color sensor before the operation;

[0038] and obtaining a maximum initial value and a minimum initial value among the initial R value, the initial G value and the initial B value;

[0039] The difference between the maximum initial value and the minimum initial value is determined as the initial color difference value.

[0040] When determining the initial color difference value, the electronic device can obtain the initial R value, initial G value and initial B value of the endoscopic light source collected by the color sensor before the operation, and after obtaining the initial T value, initial G value and initial B value of the endoscopic light source, obtain the maximum initial value and the minimum initial value among the initial R value, initial G value and initial B value, and determine the difference between the maximum initial value and the minimum initial value as the initial color difference value of the endoscopic light source.

[0041] Specifically, the initial color difference value can be determined by the following formula:

[0042] Cmax=max(R′,G′,B′)

[0043] Cmin=min(R′,G′,B′)

[0044] S=Cmax-Cmin

[0045] Among them, R′ is the initial R value of the endoscopic light source collected by the color sensor before the operation, G′ is the initial G value of the endoscopic light source collected by the color sensor before the operation, B′ is the initial B value of the endoscopic light source collected by the color sensor before the operation, Cmax is the maximum value among the initial R value, the initial G value and the initial B value, Cmin is the minimum value among the initial R value, the initial G value and the initial B value, and S is the initial color difference value.

[0046] Figure 2A schematic diagram of a process for determining an initial color difference value provided in an embodiment of the present application, the process comprising the following steps:

[0047] S201: Acquire the initial R value, initial G value, and initial B value of the endoscope light source collected by the color sensor before the operation.

[0048] S202: Obtain the maximum initial value and the minimum initial value among the initial R value, the initial G value, and the initial B value.

[0049] S203: Determine the difference between the maximum initial value and the minimum initial value as the initial color difference value.

[0050] In order to determine the color difference value of the endoscope light source, based on the above embodiments, in the embodiment of the present application, the color difference value of the endoscope light source is determined according to the R value, G value and B value of the endoscope light source collected by the color sensor, including:

[0051] Obtain the maximum and minimum values ​​of the R value, G value, and B value of the endoscope light source collected by the color sensor;

[0052] The difference between the maximum value and the minimum value is determined as the color difference value of the endoscope light source.

[0053] After obtaining the R value, G value and B value of the endoscope light source collected by the color sensor, the electronic device can obtain the maximum and minimum values ​​of the R value, G value and B value, and determine the difference between the obtained maximum and minimum values ​​as the color difference value of the endoscope light source.

[0054] In order to improve the display effect of the endoscopic image, on the basis of the above embodiments, in the embodiment of the present application, the method further includes:

[0055] If the deviation between the color difference value and the initial color difference value is not greater than a preset value, the first gain R value, the first gain G value and the first gain B value determined before the operation are used to adjust the pixel R value, the pixel G value and the pixel B value of each pixel point in the acquired endoscopic image to obtain the adjusted endoscopic image.

[0056] If the deviation between the color difference value determined this time and the initial color difference value of the endoscopic light source saved before the operation is not greater than the preset value, it means that the color temperature has not changed significantly. At this time, the electronic device can use the first gain R value, the first gain G value and the first gain B value determined before the operation to adjust the pixel R value, the pixel G value and the pixel B value of each pixel point in the acquired endoscopic image to obtain the adjusted endoscopic image. Specifically, the electronic device can determine, for each pixel in the endoscopic image, the product of the pixel R value of the pixel and the first gain R value determined before the operation. For the sake of distinction, the product is referred to as the first product, and the pixel R value of the pixel is replaced by the first product; determine the product of the pixel G value of the pixel and the first gain G value determined before the operation. For the sake of distinction, the product is referred to as the second product, and the pixel G value of the pixel is replaced by the second product; determine the product of the pixel B value of the pixel and the first gain B value determined before the operation. For the sake of distinction, the product is referred to as the third product, and the pixel B value of the pixel is replaced by the third product.

[0057] Specifically, the electronic device may use the following formula to obtain the adjusted endoscopic image:

[0058] R c =R*R_gain

[0059] G c =G*G_gain

[0060] B c =B*B_gain

[0061] Among them, R c is the R value of a certain pixel after adjustment, R is the pixel R value of the pixel, that is, the R value before adjustment, R_gain is the first gain R value, G c is the G value of the pixel after adjustment, G is the pixel G value of the pixel, that is, the G value before adjustment, G_gain is the first gain G value, B c is the adjusted B value of the pixel, B is the pixel B value of the pixel, that is, the B value before adjustment, and B_gain is the first gain B value.

[0062] In order to accurately perform white balance correction on the endoscopic image, on the basis of the above embodiments, in the embodiment of the present application, the white balance correction on the acquired endoscopic image includes:

[0063] According to the R value, G value, B value of the endoscope light source and the initial R value, initial G value and initial B value of the endoscope light source obtained before the operation, respectively determine the degree of change of the current R value, G value and B value, and determine the R value compensation coefficient, G value compensation coefficient and R value compensation coefficient according to the determined degree of change of the R value, G value and B value;

[0064] The R value compensation coefficient, the G value compensation coefficient and the R value compensation coefficient are used to compensate the first gain R value, the first gain G value and the first gain B value determined before the operation, and the compensated second gain R value, the second gain G value and the second gain B value are determined respectively;

[0065] The pixel R value, pixel G value and pixel B value of each pixel point in the acquired endoscopic image are respectively multiplied by the second gain R value, the second gain G value and the second gain B value to acquire a corrected endoscopic image.

[0066] In order to accurately perform white balance correction on the endoscopic image, the electronic device can determine the degree of change of the current R value, G value and B value according to the R value, G value, B value of the endoscopic light source and the initial R value, initial G value and initial B value of the endoscopic light source obtained before the operation. Specifically, the electronic device can determine the absolute value of the difference between the R value of the endoscopic light source and the initial R value of the endoscopic light source obtained before the operation, and determine the ratio of the absolute value to the initial R value as the degree of change of the current R value; the electronic device can determine the absolute value of the difference between the G value of the endoscopic light source and the initial G value of the endoscopic light source obtained before the operation, and determine the ratio of the absolute value to the initial G value as the degree of change of the current G value; the electronic device can determine the absolute value of the difference between the B value of the endoscopic light source and the initial B value of the endoscopic light source obtained before the operation, and determine the ratio of the absolute value to the initial B value as the degree of change of the current B value.

[0067] When determining the degree of change of the current R value, G value, and B value, the electronic device can determine the R value compensation coefficient, G value compensation coefficient, and R value compensation coefficient according to the determined degree of change of the R value, G value, and B value. Specifically, the R value compensation coefficient, G value compensation coefficient, and R value compensation coefficient can be determined according to the determined degree of change of the R value, G value, and B value, respectively.

[0068] The electronic device uses the R value compensation coefficient, the G value compensation coefficient, and the R value compensation coefficient to compensate the first gain R value, the first gain G value, and the first gain B value that are pre-saved and determined before the operation, and respectively determine the compensated second gain R value, the second gain G value, and the second gain B value. Specifically, the electronic device can respectively determine the product of the R value compensation coefficient, the G value compensation coefficient, and the R value compensation coefficient with the first gain R value, the first gain G value, and the first gain B value, and respectively determine each determined product as the compensated second gain R value, the second gain G value, and the second gain B value.

[0069] After obtaining the second gain R value, the second gain G value, and the second gain B value, the electronic device corrects the endoscopic image according to the obtained second gain R value, the second gain G value, and the second gain B value, and outputs the endoscopic image after white balance compensation. Specifically, the electronic device can multiply the pixel R value, the pixel G value, and the pixel B value of each pixel point in the obtained endoscopic image by the second gain R value, the second gain G value, and the second gain B value, respectively, to obtain the corrected endoscopic image. Specifically, the electronic device can determine, for each pixel in the endoscopic image, the product of the pixel R value of the pixel and the second gain R value determined before the operation. For the sake of distinction, the product is referred to as the fourth product, and the pixel R value of the pixel is replaced by the fourth product; determine the product of the pixel G value of the pixel and the second gain G value determined before the operation. For the sake of distinction, the product is referred to as the fifth product, and the pixel G value of the pixel is replaced by the fifth product; determine the product of the pixel B value of the pixel and the second gain B value determined before the operation. For the sake of distinction, the product is referred to as the sixth product, and the pixel B value of the pixel is replaced by the sixth product.

[0070] Among them, the first gain R value, the first gain G value and the first gain B value are determined in advance according to the white balance correction parameter pair of preset standards such as the brightness and color temperature of the endoscope light source, and are therefore equivalent to performing a preliminary image white balance correction on the endoscope image according to the white balance correction parameters of the preset standards. If the deviation between the current color difference value and the initial color difference value of the electronic device is greater than a preset value, the preset value can be called a color difference tolerance value, and the R value compensation coefficient, the G value compensation coefficient and the B value compensation coefficient are determined according to the R value, G value and B value detected by the current color sensor and the initial R value, initial G value and initial B value, so as to correct the gain value obtained by the initial white balance correction as the gain value of the new white balance correction, and timely correct the gain value of the white balance correction, thereby reducing the color cast of the image quality when the endoscope is used and improving the image quality.

[0071] In order to accurately determine the degree of change of the current R value, G value, and B value, based on the above embodiments, in the embodiment of the present application, the degree of change of the current R value, G value, and B value is determined according to the R value, G value, and B value of the endoscope light source and the initial R value, initial G value, and initial B value of the endoscope light source obtained before the operation, respectively, including:

[0072] The R value, G value and B value of the endoscope light source are respectively divided by the initial R value, initial G value and initial B value of the endoscope light source obtained before the operation to obtain the degree of change of the current R value, G value and B value.

[0073] The electronic device can divide the R value of the endoscopic light source collected by the color sensor by the initial R value of the endoscopic light source obtained before the operation, and determine the obtained ratio as the degree of change of the current R value; divide the G value of the endoscopic light source collected by the color sensor by the initial G value of the endoscopic light source obtained before the operation, and determine the obtained ratio as the degree of change of the current G value; divide the B value of the endoscopic light source collected by the color sensor by the initial B value of the endoscopic light source obtained before the operation, and determine the obtained ratio as the degree of change of the current B value.

[0074] Figure 3 A detailed process diagram of image processing provided in an embodiment of the present application, the process includes the following steps:

[0075] S301: Acquire the R value, G value, and B value of the endoscope light source collected by the collection device.

[0076] S302: Determine the color difference value of the endoscope light source according to the R value, G value and B value of the endoscope light source.

[0077] S303: Determine whether the deviation between the color difference value and the pre-saved initial color difference value determined before the operation is greater than a preset value, if so, execute S304, if not, execute S305.

[0078] S304: Use the first gain R value, the first gain G value and the first gain B value determined before the operation to adjust the pixel R value, the pixel G value and the pixel B value of each pixel point in the acquired endoscopic image, obtain the adjusted endoscopic image, and end.

[0079] S305: Determine the degree of change of the current R value, G value, and B value based on the R value, G value, and B value of the endoscope light source and the initial R value, initial G value, and initial B value of the endoscope light source acquired before the operation, and determine the R value compensation coefficient, G value compensation coefficient, and R value compensation coefficient based on the determined degree of change of the R value, G value, and B value.

[0080] S306: Using the R value compensation coefficient, the G value compensation coefficient and the R value compensation coefficient, the first gain R value, the first gain G value and the first gain B value determined before the operation are compensated, and the compensated second gain R value, the second gain G value and the second gain B value are determined respectively.

[0081] S307: Multiply the pixel R value, pixel G value and pixel B value of each pixel point in the acquired endoscopic image by the second gain R value, the second gain G value and the second gain B value respectively to acquire a corrected endoscopic image.

[0082] In order to determine the R value compensation coefficient, the G value compensation coefficient and the R value compensation coefficient, based on the above embodiments, in the embodiment of the present application, the R value compensation coefficient, the G value compensation coefficient and the R value compensation coefficient are determined according to the determined degree of change of the R value, the G value and the B value, including:

[0083] The product of the change degree of the R value and the change degree of the G value is determined as the R value compensation coefficient;

[0084] The product of the change degree of the B value and the change degree of the G value is determined as the B value compensation coefficient;

[0085] And the preset value is determined as the G-value compensation coefficient.

[0086] The electronic device may determine the product of the change degree of the R value and the change degree of the G value as the R value compensation coefficient; determine the product of the change degree of the B value and the change degree of the G value as the B value compensation coefficient; and determine a preset value as the G value compensation coefficient, wherein the preset value is a value greater than 0, for example, 1. This method may be referred to as determining the compensation coefficient based on the G value of the light source.

[0087] Electronic equipment can use the following formula to determine the R value compensation coefficient, G value compensation coefficient and R value compensation coefficient:

[0088] Cg=1

[0089]

[0090]

[0091] Wherein, Cg is the G value compensation coefficient, 1 is the preset value, Cr is the R value compensation coefficient, G" is the R value of the endoscope light source collected by the color sensor, and G' is the initial R value of the endoscope light source obtained before the operation. is the degree of change of the G value, R" is the R value of the endoscope light source collected by the color sensor, and R' is the initial R value of the endoscope light source obtained before the operation. is the change degree of R value, Cb is the B value compensation coefficient, B" is the B value of the endoscope light source collected by the color sensor, B' is the initial B value of the endoscope light source obtained before the operation, is the degree of change of B value.

[0092] Figure 4 A detailed process diagram of determining a second gain R value, a second gain G value, and a second gain B value provided in an embodiment of the present application, the process includes the following steps:

[0093] S401: The R value, G value and B value of the endoscope light source are divided by the initial R value, initial G value and initial B value of the endoscope light source obtained before the operation to obtain the degree of change of the current R value, G value and B value.

[0094] S402: Determine the product of the change degree of the R value and the change degree of the G value as the R value compensation coefficient; determine the product of the change degree of the B value and the change degree of the G value as the B value compensation coefficient; and determine the preset value as the G value compensation coefficient.

[0095] S403: Using the R value compensation coefficient, the G value compensation coefficient and the R value compensation coefficient, the first gain R value, the first gain G value and the first gain B value determined before the operation are compensated, and the compensated second gain R value, the second gain G value and the second gain B value are determined respectively.

[0096] In order to determine the second gain R value, the second gain G value and the second gain B value, based on the above embodiments, in the embodiment of the present application, the R value compensation coefficient, the G value compensation coefficient and the R value compensation coefficient are used to compensate the first gain R value, the first gain G value and the first gain B value determined before the operation, and the compensated second gain R value, the second gain G value and the second gain B value are respectively determined, including:

[0097] Determine the second gain R value by multiplying the R value compensation coefficient by the first gain R value determined before the operation;

[0098] Determine the second gain B value by multiplying the B value compensation coefficient by the first gain B value determined before the operation;

[0099] The product of the G value compensation coefficient and the first gain G value determined before the operation is determined as the second gain G value.

[0100] The electronic device can determine the product of the determined R value compensation coefficient and the first gain R value determined before the operation as the second gain R value; determine the product of the determined B value compensation coefficient and the first gain B value determined before the operation as the second gain B value; and determine the product of the determined G value compensation coefficient and the first gain G value determined before the operation as the second gain G value.

[0101] Specifically, the electronic device may determine the second gain R value, the second gain G value, and the second gain B value using the following formula:

[0102] R_gain′=R_gain*Cr

[0103] G_gain′=G_gain*Cg

[0104] B_gain′=B_gain*Cb

[0105] Among them, R_gain′ is the second gain R value, R_gain is the first gain R value, Cr is the R value compensation coefficient, G_gain′ is the second gain G value, G_gain is the first gain G value, Cg is the G value compensation coefficient, B_gain′ is the second gain B value, B_gain is the first gain B value, and Cb is the B value compensation coefficient.

[0106] In order to determine the first gain R value, the first gain G value and the first gain B value, on the basis of the above embodiments, in the embodiment of the present application, the first gain R value, the first gain G value and the first gain B value are determined by the following method:

[0107] Obtain the brightness and color temperature of the endoscope light source before surgery;

[0108] The brightness and color temperature are processed using a white balance algorithm to obtain a processed first gain R value, a first gain G value, and a first gain B value.

[0109] In order to determine the first gain R value, the first gain G value, and the first gain B value, the electronic device can obtain the brightness and color temperature of the endoscope light source before the operation. Specifically, how the electronic device obtains the brightness and color temperature of a certain light source is a prior art and will not be described in detail here. After obtaining the brightness and color temperature of the endoscope light source before the operation, the electronic device can use a white balance algorithm to process the obtained brightness and color temperature to obtain the processed first gain R value, first gain G value, and first gain B value. Specifically, how to use a white balance algorithm to determine the first gain R value, first gain G value, and first gain B value is a prior art and will not be described in detail here.

[0110] Figure 5 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application; the device includes:

[0111] A determination module 501 is used to determine the color difference value of the endoscope light source according to the R value, G value and B value of the endoscope light source collected by the color sensor;

[0112] A judgment module 502 is used to judge whether the deviation between the color difference value and the initial color difference value determined before the operation is saved in advance is greater than a preset value;

[0113] The processing module 503 is used to determine whether the color temperature has changed if the deviation between the color difference value and the initial color difference value determined before the operation is saved is greater than a preset value; and perform white balance correction on the acquired endoscopic image.

[0114] Furthermore, the processing module 503 is also used to obtain the initial R value, initial G value and initial B value of the endoscope light source collected by the color sensor before the operation; and obtain the maximum initial value and the minimum initial value among the initial R value, the initial G value and the initial B value; and determine the difference between the maximum initial value and the minimum initial value as the initial color difference value.

[0115] Furthermore, the determination module 501 is specifically used to obtain the maximum and minimum values ​​of the R value, G value and B value of the endoscope light source collected by the color sensor; and determine the difference between the maximum value and the minimum value as the color difference value of the endoscope light source.

[0116] Furthermore, the processing module 503 is also used to adjust the pixel R value, pixel G value and pixel B value of each pixel point in the acquired endoscopic image using the first gain R value, the first gain G value and the first gain B value determined before the operation if the deviation between the color difference value and the initial color difference value is not greater than a preset value, so as to obtain an adjusted endoscopic image.

[0117] Furthermore, the processing module 503 is specifically used to determine the degree of change of the current R value, G value, and B value according to the R value, G value, and B value of the endoscopic light source and the initial R value, initial G value, and initial B value of the endoscopic light source acquired before the operation, and determine the R value compensation coefficient, G value compensation coefficient, and R value compensation coefficient according to the determined degree of change of the R value, G value, and B value; use the R value compensation coefficient, G value compensation coefficient, and R value compensation coefficient to compensate the first gain R value, first gain G value, and first gain B value determined before the operation that are pre-saved, and determine the compensated second gain R value, second gain G value, and second gain B value, respectively; multiply the pixel R value, pixel G value, and pixel B value of each pixel point in the acquired endoscopic image by the second gain R value, the second gain G value, and the second gain B value, respectively, to obtain a corrected endoscopic image.

[0118] Furthermore, the processing module 503 is specifically used to divide the R value, G value and B value of the endoscope light source by the initial R value, initial G value and initial B value of the endoscope light source obtained before the operation, so as to obtain the degree of change of the current R value, G value and B value.

[0119] Furthermore, the processing module 503 is specifically used to determine the product of the change degree of the R value and the change degree of the G value as the R value compensation coefficient; determine the product of the change degree of the B value and the change degree of the G value as the B value compensation coefficient; and determine the preset value as the G value compensation coefficient.

[0120] Furthermore, the processing module 503 is specifically used to determine the second gain R value by multiplying the R value compensation coefficient and the first gain R value determined before the operation; determine the second gain B value by multiplying the B value compensation coefficient and the first gain B value determined before the operation; and determine the second gain G value by multiplying the G value compensation coefficient and the first gain G value determined before the operation.

[0121] Furthermore, the processing module 503 is also used to obtain the brightness and color temperature of the endoscope light source before surgery; and use a white balance algorithm to process the brightness and color temperature to obtain the processed first gain R value, first gain G value and first gain B value.

[0122] Based on the above embodiments, the present application also provides an electronic device, such as Figure 6 As shown, it includes: a processor 601 , a communication interface 602 , a memory 603 and a communication bus 604 , wherein the processor 601 , the communication interface 602 , and the memory 603 communicate with each other via the communication bus 604 .

[0123] The memory 603 stores a computer program. When the program is executed by the processor 601, the processor 601 performs the following steps:

[0124] Determine the color difference value of the endoscope light source according to the R value, G value and B value of the endoscope light source collected by the color sensor;

[0125] Determine whether the deviation between the color difference value and the pre-saved initial color difference value determined before the operation is greater than a preset value;

[0126] If so, it is determined that the color temperature has changed; and white balance correction is performed on the acquired endoscopic image.

[0127] Furthermore, the processor 601 is also used to obtain the initial R value, initial G value and initial B value of the endoscope light source collected by the color sensor before the operation;

[0128] and obtaining a maximum initial value and a minimum initial value among the initial R value, the initial G value and the initial B value;

[0129] The difference between the maximum initial value and the minimum initial value is determined as the initial color difference value.

[0130] Further, the processor 601 is specifically used to obtain the maximum value and the minimum value among the R value, G value and B value of the endoscope light source collected by the color sensor;

[0131] The difference between the maximum value and the minimum value is determined as the color difference value of the endoscope light source.

[0132] Furthermore, the processor 601 is also used to adjust the pixel R value, pixel G value and pixel B value of each pixel point in the acquired endoscopic image using the first gain R value, the first gain G value and the first gain B value determined before the operation if the deviation between the color difference value and the initial color difference value is not greater than a preset value, so as to obtain an adjusted endoscopic image.

[0133] Further, the processor 601 is specifically used to determine the degree of change of the current R value, G value, and B value according to the R value, G value, and B value of the endoscope light source and the initial R value, initial G value, and initial B value of the endoscope light source obtained before the operation, and determine the R value compensation coefficient, the G value compensation coefficient, and the R value compensation coefficient according to the determined degree of change of the R value, G value, and B value;

[0134] The R value compensation coefficient, the G value compensation coefficient and the R value compensation coefficient are used to compensate the first gain R value, the first gain G value and the first gain B value determined before the operation, and the compensated second gain R value, the second gain G value and the second gain B value are determined respectively;

[0135] The pixel R value, pixel G value and pixel B value of each pixel point in the acquired endoscopic image are respectively multiplied by the second gain R value, the second gain G value and the second gain B value to acquire a corrected endoscopic image.

[0136] Furthermore, the processor 601 is specifically used to divide the R value, G value and B value of the endoscope light source by the initial R value, initial G value and initial B value of the endoscope light source obtained before the operation, so as to obtain the degree of change of the current R value, G value and B value.

[0137] Further, the processor 601 is specifically configured to determine the product of the change degree of the R value and the change degree of the G value as the R value compensation coefficient;

[0138] The product of the change degree of the B value and the change degree of the G value is determined as the B value compensation coefficient;

[0139] And the preset value is determined as the G-value compensation coefficient.

[0140] Further, the processor 601 is specifically configured to determine the product of the R value compensation coefficient and the first gain R value determined before the operation as the second gain R value;

[0141] Determine the second gain B value by multiplying the B value compensation coefficient by the first gain B value determined before the operation;

[0142] The product of the G value compensation coefficient and the first gain G value determined before the operation is determined as the second gain G value.

[0143] Furthermore, the processor 601 is also used to obtain the brightness and color temperature of the endoscope light source before surgery;

[0144] The brightness and color temperature are processed using a white balance algorithm to obtain a processed first gain R value, a first gain G value, and a first gain B value.

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

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

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

[0148] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.

[0149] On the basis of the above embodiments, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program executable by an electronic device, and when the program is run on the electronic device, the electronic device implements the following steps when executing:

[0150] The memory stores a computer program, and when the program is executed by the processor, the processor performs the following steps:

[0151] Determine the color difference value of the endoscope light source according to the R value, G value and B value of the endoscope light source collected by the color sensor;

[0152] Determine whether the deviation between the color difference value and the pre-saved initial color difference value determined before the operation is greater than a preset value;

[0153] If so, it is determined that the color temperature has changed; and white balance correction is performed on the acquired endoscopic image.

[0154] In a possible implementation manner, the initial color difference value is determined by:

[0155] Obtaining the initial R value, initial G value, and initial B value of the endoscope light source collected by the color sensor before the operation;

[0156] and obtaining a maximum initial value and a minimum initial value among the initial R value, the initial G value and the initial B value;

[0157] The difference between the maximum initial value and the minimum initial value is determined as the initial color difference value.

[0158] In a possible implementation, determining the color difference value of the endoscope light source according to the R value, G value, and B value of the endoscope light source collected by the color sensor includes:

[0159] Obtain the maximum and minimum values ​​of the R value, G value, and B value of the endoscope light source collected by the color sensor;

[0160] The difference between the maximum value and the minimum value is determined as the color difference value of the endoscope light source.

[0161] In a possible implementation, the method further includes:

[0162] If the deviation between the color difference value and the initial color difference value is not greater than a preset value, the first gain R value, the first gain G value and the first gain B value determined before the operation are used to adjust the pixel R value, the pixel G value and the pixel B value of each pixel point in the acquired endoscopic image to obtain the adjusted endoscopic image.

[0163] In a possible implementation, performing white balance correction on the acquired endoscopic image includes:

[0164] According to the R value, G value, B value of the endoscope light source and the initial R value, initial G value and initial B value of the endoscope light source obtained before the operation, respectively determine the degree of change of the current R value, G value and B value, and determine the R value compensation coefficient, G value compensation coefficient and R value compensation coefficient according to the determined degree of change of the R value, G value and B value;

[0165] The R value compensation coefficient, the G value compensation coefficient and the R value compensation coefficient are used to compensate the first gain R value, the first gain G value and the first gain B value determined before the operation, and the compensated second gain R value, the second gain G value and the second gain B value are determined respectively;

[0166] The pixel R value, pixel G value and pixel B value of each pixel point in the acquired endoscopic image are respectively multiplied by the second gain R value, the second gain G value and the second gain B value to acquire a corrected endoscopic image.

[0167] In a possible implementation, determining the degree of change of the current R value, G value, and B value according to the R value, G value, and B value of the endoscope light source and the initial R value, initial G value, and initial B value of the endoscope light source obtained before the operation includes:

[0168] The R value, G value and B value of the endoscope light source are respectively divided by the initial R value, initial G value and initial B value of the endoscope light source obtained before the operation to obtain the degree of change of the current R value, G value and B value.

[0169] In a possible implementation manner, determining the R value compensation coefficient, the G value compensation coefficient, and the R value compensation coefficient according to the determined degree of change of the R value, the G value, and the B value includes:

[0170] The product of the change degree of the R value and the change degree of the G value is determined as the R value compensation coefficient;

[0171] The product of the change degree of the B value and the change degree of the G value is determined as the B value compensation coefficient;

[0172] And the preset value is determined as the G-value compensation coefficient.

[0173] In a possible implementation, the R value compensation coefficient, the G value compensation coefficient, and the R value compensation coefficient are used to compensate the first gain R value, the first gain G value, and the first gain B value determined before the operation, and the compensated second gain R value, the second gain G value, and the second gain B value are respectively determined, including:

[0174] Determine the second gain R value by multiplying the R value compensation coefficient by the first gain R value determined before the operation;

[0175] Determine the second gain B value by multiplying the B value compensation coefficient by the first gain B value determined before the operation;

[0176] The product of the G value compensation coefficient and the first gain G value determined before the operation is determined as the second gain G value.

[0177] In a possible implementation manner, the first gain R value, the first gain G value, and the first gain B value are determined by:

[0178] Obtain the brightness and color temperature of the endoscope light source before surgery;

[0179] The brightness and color temperature are processed using a white balance algorithm to obtain a processed first gain R value, a first gain G value, and a first gain B value.

[0180] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0181] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0182] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0183] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0184] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. An image processing method, characterized in that: The method comprises: Determine the color difference value of the endoscope light source according to the R value, G value and B value of the endoscope light source collected by the color sensor; Determine whether the deviation between the color difference value and the pre-saved initial color difference value determined before the operation is greater than a preset value; If so, it is determined that the color temperature has changed; and white balance correction is performed on the acquired endoscopic image.

2. The method according to claim 1, characterized in that The initial color difference value is determined by: Obtaining the initial R value, initial G value, and initial B value of the endoscope light source collected by the color sensor before the operation; and obtaining a maximum initial value and a minimum initial value among the initial R value, the initial G value and the initial B value; The difference between the maximum initial value and the minimum initial value is determined as the initial color difference value.

3. The method according to claim 1, characterized in that Determining the color difference value of the endoscope light source according to the R value, G value and B value of the endoscope light source collected by the color sensor includes: Obtain the maximum and minimum values ​​of the R value, G value, and B value of the endoscope light source collected by the color sensor; The difference between the maximum value and the minimum value is determined as the color difference value of the endoscope light source.

4. The method according to claim 1, characterized in that: The method further comprises: If the deviation between the color difference value and the initial color difference value is not greater than a preset value, the first gain R value, the first gain G value and the first gain B value determined before the operation are used to adjust the pixel R value, the pixel G value and the pixel B value of each pixel point in the acquired endoscopic image to obtain the adjusted endoscopic image.

5. The method according to claim 1, characterized in that The white balance correction of the acquired endoscopic image comprises: According to the R value, G value, B value of the endoscope light source and the initial R value, initial G value and initial B value of the endoscope light source obtained before the operation, respectively determine the degree of change of the current R value, G value and B value, and determine the R value compensation coefficient, G value compensation coefficient and R value compensation coefficient according to the determined degree of change of the R value, G value and B value; The R value compensation coefficient, the G value compensation coefficient and the R value compensation coefficient are used to compensate the first gain R value, the first gain G value and the first gain B value determined before the operation, and the compensated second gain R value, the second gain G value and the second gain B value are determined respectively; The pixel R value, pixel G value and pixel B value of each pixel point in the acquired endoscopic image are respectively multiplied by the second gain R value, the second gain G value and the second gain B value to acquire a corrected endoscopic image.

6. The method according to claim 5, characterized in that Determining the degree of change of the current R value, G value, and B value according to the R value, G value, and B value of the endoscope light source and the initial R value, initial G value, and initial B value of the endoscope light source obtained before the operation includes: The R value, G value and B value of the endoscope light source are respectively divided by the initial R value, initial G value and initial B value of the endoscope light source obtained before the operation to obtain the degree of change of the current R value, G value and B value.

7. The method according to claim 5, characterized in that Determining the R value compensation coefficient, the G value compensation coefficient and the R value compensation coefficient according to the determined change degrees of the R value, the G value and the B value includes: The product of the change degree of the R value and the change degree of the G value is determined as the R value compensation coefficient; The product of the change degree of the B value and the change degree of the G value is determined as the B value compensation coefficient; And the preset value is determined as the G-value compensation coefficient.

8. The method according to claim 5, characterized in that The R value compensation coefficient, the G value compensation coefficient and the R value compensation coefficient are used to compensate the first gain R value, the first gain G value and the first gain B value determined before the operation, and the compensated second gain R value, the second gain G value and the second gain B value are respectively determined, including: Determine the product of the R value compensation coefficient and the first gain R value determined before the operation as the second gain R value; Determine the second gain B value by multiplying the B value compensation coefficient by the first gain B value determined before the operation; The product of the G value compensation coefficient and the first gain G value determined before the operation is determined as the second gain G value.

9. The method according to any one of claims 4 to 8, characterized in that: The first gain R value, the first gain G value and the first gain B value are determined by the following method: Obtain the brightness and color temperature of the endoscope light source before surgery; The brightness and color temperature are processed using a white balance algorithm to obtain a processed first gain R value, a first gain G value, and a first gain B value.

10. An electronic device, characterized in that: The electronic device comprises at least a processor and a memory, and the processor is configured to execute the steps of the image processing method according to any one of claims 1 to 9 when executing a computer program stored in the memory.