[go: up one dir, main page]

CN111738949B - Image brightness adjusting method and device, electronic equipment and storage medium - Google Patents

Image brightness adjusting method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111738949B
CN111738949B CN202010568199.3A CN202010568199A CN111738949B CN 111738949 B CN111738949 B CN 111738949B CN 202010568199 A CN202010568199 A CN 202010568199A CN 111738949 B CN111738949 B CN 111738949B
Authority
CN
China
Prior art keywords
image
value
brightness
display parameter
pixel point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010568199.3A
Other languages
Chinese (zh)
Other versions
CN111738949A (en
Inventor
黄甜甜
尚方信
杨大陆
杨叶辉
王磊
许言午
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202010568199.3A priority Critical patent/CN111738949B/en
Publication of CN111738949A publication Critical patent/CN111738949A/en
Application granted granted Critical
Publication of CN111738949B publication Critical patent/CN111738949B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/92Dynamic range modification of images or parts thereof based on global image properties
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20004Adaptive image processing
    • G06T2207/20008Globally adaptive
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30004Biomedical image processing
    • G06T2207/30041Eye; Retina; Ophthalmic

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

本申请公开了一种图像亮度的调整方法、装置、电子设备及存储介质,涉及人工智能、深度学习以及图像处理领域,具体可应用于眼底影像筛查方面。具体方案为:获取观测图像;其中,观测图像为红绿蓝颜色空间的图像;在观测图像中分离出观测图像对应的背景图;根据背景图确定观测图像对应的显示参数值;根据观测图像对应的显示参数值对观测图像的亮度进行调整。本申请实施例可以根据观测图像本身的亮度分布智能地选择合适的显示参数值,从而使得观测图像的亮度分布更加合理。

The present application discloses a method, device, electronic device and storage medium for adjusting image brightness, which relates to the fields of artificial intelligence, deep learning and image processing, and can be specifically applied to fundus image screening. The specific scheme is: obtaining an observed image; wherein the observed image is an image in a red, green and blue color space; separating a background image corresponding to the observed image from the observed image; determining a display parameter value corresponding to the observed image according to the background image; and adjusting the brightness of the observed image according to the display parameter value corresponding to the observed image. The embodiment of the present application can intelligently select a suitable display parameter value according to the brightness distribution of the observed image itself, thereby making the brightness distribution of the observed image more reasonable.

Description

一种图像亮度的调整方法、装置、电子设备及存储介质Image brightness adjustment method, device, electronic device and storage medium

技术领域Technical Field

本申请涉及计算机技术领域,进一步涉及人工智能、深度学习以及图像处理领域,尤其是一种图像调整方法、装置、电子设备及存储介质。The present application relates to the field of computer technology, and further to the fields of artificial intelligence, deep learning, and image processing, and in particular to an image adjustment method, device, electronic device, and storage medium.

背景技术Background technique

眼底图像自适应亮度调整技术(Fundus image adaptive brightnessadjustment)是指根据眼底图像自身亮度分布自动调节,使得图像质量符合统一规范。在实际业务场景中,因图像采集设备的机型差异、照明不足、成像传感器动态范围太小、技师拍照水平等因素,导致图像采集设备得到的眼底图亮度分布不均,质量欠佳,实际进入算法模型的眼底图像和该模型在初始训练阶段所要求的眼底图像之间存在差距,从而会影响整个系统的性能。因此,在将眼底图像输入至算法模型之前,需要对采集到的眼底图像进行预处理,以减少图像采集设备对原始眼底图像的影响。Fundus image adaptive brightness adjustment technology refers to automatic adjustment based on the brightness distribution of the fundus image itself, so that the image quality meets the unified standard. In actual business scenarios, due to factors such as differences in image acquisition equipment models, insufficient lighting, too small dynamic range of imaging sensors, and technician photography skills, the fundus images obtained by the image acquisition equipment have uneven brightness distribution and poor quality. There is a gap between the fundus images that actually enter the algorithm model and the fundus images required by the model in the initial training stage, which will affect the performance of the entire system. Therefore, before the fundus images are input into the algorithm model, the acquired fundus images need to be preprocessed to reduce the impact of the image acquisition equipment on the original fundus images.

在现有技术中,大多集中在增强视网膜血管,以通过在灰度和彩色视网膜图像中增加血管与视网膜背景之间的对比度来实现更好的血管分割。基于对比度的增强方法主要包括基于直方图、基于过滤器和基于变换这三种方式;例如,红色通道和绿色通道之间的直方图匹配被用作血管分割的预处理步骤,这样可以改善诸如血管之类的总体深色特征的对比度,但会降低明亮对象与微血管瘤(MA)等微小深色物体的对比度;使用匹配的过滤器进行增强可以改善局部对比度并有助于血管切分,但不能保持图像的保真度,它还会影响图像中存在的其他结构;基于轮廓波变换的增强方式,在眼底图对比度差的区域中效果较差。此外,基于亮度的增强方法包括:基于邻域的彩色视网膜图像增强(Colour Retinal ImageEnhancement based on Domain Knowledge)和基于亮度和对比度调整的彩色视网膜图像增强(Color Retinal Image Enhancement Based on Luminosity and ContrastAdjustment)。在基于亮度的增强方法中,针对不同的观测图像使用固定的显示参数值对其进行亮度调整,不能根据观测图像本身的亮度分布智能地选择合适的显示参数值。In the prior art, most of them focus on enhancing retinal blood vessels to achieve better blood vessel segmentation by increasing the contrast between blood vessels and retinal background in grayscale and color retinal images. Contrast-based enhancement methods mainly include three methods: histogram-based, filter-based, and transformation-based. For example, histogram matching between the red channel and the green channel is used as a preprocessing step for blood vessel segmentation, which can improve the contrast of overall dark features such as blood vessels, but reduce the contrast between bright objects and tiny dark objects such as microaneurysms (MAs). Enhancement using matched filters can improve local contrast and help blood vessel segmentation, but it cannot maintain the fidelity of the image, and it will also affect other structures present in the image. The enhancement method based on contourlet transform is less effective in areas with poor contrast in fundus images. In addition, brightness-based enhancement methods include: color retinal image enhancement based on neighborhood (Colour Retinal Image Enhancement based on Domain Knowledge) and color retinal image enhancement based on brightness and contrast adjustment (Color Retinal Image Enhancement Based on Luminosity and Contrast Adjustment). In the brightness-based enhancement method, fixed display parameter values are used to adjust the brightness of different observed images, and the appropriate display parameter values cannot be intelligently selected according to the brightness distribution of the observed image itself.

发明内容Summary of the invention

本申请提供了一种图像亮度的调整方法、装置、设备以及存储介质,可以根据观测图像本身的亮度分布智能地选择合适的显示参数值,从而使得观测图像的亮度分布更加合理。The present application provides a method, apparatus, device and storage medium for adjusting image brightness, which can intelligently select appropriate display parameter values according to the brightness distribution of the observed image itself, thereby making the brightness distribution of the observed image more reasonable.

第一方面,本申请提供了一种图像亮度的调整方法,所述方法包括:In a first aspect, the present application provides a method for adjusting image brightness, the method comprising:

获取观测图像;其中,所述观测图像为红绿蓝颜色空间的图像;Acquire an observed image; wherein the observed image is an image in a red, green, and blue color space;

在所述观测图像中分离出所述观测图像对应的背景图;Separating a background image corresponding to the observed image from the observed image;

根据所述背景图确定所述观测图像对应的显示参数值;Determine a display parameter value corresponding to the observed image according to the background image;

根据所述观测图像对应的显示参数值对所述观测图像的亮度进行调整。The brightness of the observed image is adjusted according to the display parameter value corresponding to the observed image.

第二方面,本申请提供了一种图像亮度的调整装置,所述装置包括:获取模块、分离模块、确定模块和调整模块;其中,In a second aspect, the present application provides a device for adjusting image brightness, the device comprising: an acquisition module, a separation module, a determination module and an adjustment module; wherein:

所述获取模块,用于获取观测图像;其中,所述观测图像为红绿蓝颜色空间的图像;The acquisition module is used to acquire an observed image; wherein the observed image is an image in a red, green and blue color space;

所述分离模块,用于在所述观测图像中分离出所述观测图像对应的背景图;The separation module is used to separate the background image corresponding to the observation image from the observation image;

所述确定模块,用于根据所述背景图确定所述观测图像对应的显示参数值;The determination module is used to determine the display parameter value corresponding to the observed image according to the background image;

所述调整模块,用于根据所述观测图像对应的显示参数值对所述观测图像的亮度进行调整。The adjustment module is used to adjust the brightness of the observed image according to the display parameter value corresponding to the observed image.

第三方面,本申请实施例提供了一种电子设备,包括:In a third aspect, an embodiment of the present application provides an electronic device, including:

一个或多个处理器;one or more processors;

存储器,用于存储一个或多个程序,a memory for storing one or more programs,

当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现本申请任意实施例所述的图像亮度的调整方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the method for adjusting the image brightness described in any embodiment of the present application.

第四方面,本申请实施例提供了一种存储介质,其上存储有计算机程序,该程序被处理器执行时实现本申请任意实施例所述的图像亮度的调整方法。In a fourth aspect, an embodiment of the present application provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the method for adjusting the image brightness described in any embodiment of the present application is implemented.

根据本申请的技术解决了现有技术中针对不同的观测图像使用固定的显示参数值对其进行亮度调整,不能根据观测图像本身的亮度分布智能地选择合适的显示参数值的技术问题,本申请提供的技术方案,可以根据观测图像本身的亮度分布智能地选择合适的显示参数值,从而使得观测图像的亮度分布更加合理。The technology according to the present application solves the technical problem that in the prior art, fixed display parameter values are used to adjust the brightness of different observation images, and appropriate display parameter values cannot be intelligently selected according to the brightness distribution of the observation image itself. The technical solution provided by the present application can intelligently select appropriate display parameter values according to the brightness distribution of the observation image itself, thereby making the brightness distribution of the observation image more reasonable.

应当理解,本部分所描述的内容并非旨在标识本公开的实施例的关键或重要特征,也不用于限制本公开的范围。本公开的其它特征将通过以下的说明书而变得容易理解。It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

附图用于更好地理解本方案,不构成对本申请的限定。其中:The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.

图1是本申请实施例一提供的图像亮度的调整方法的流程示意图;FIG1 is a schematic flow chart of a method for adjusting image brightness provided in Embodiment 1 of the present application;

图2(a)是本申请实施例一提供的眼底图像中的采样点的位置示意图;FIG. 2( a ) is a schematic diagram of the locations of sampling points in a fundus image provided in Example 1 of the present application;

图2(b)是本申请实施例一提供的眼底图像中的采样点的分布示意图;FIG2( b ) is a schematic diagram showing the distribution of sampling points in the fundus image provided in Example 1 of the present application;

图3是本申请实施例二提供的图像亮度的调整方法的流程示意图;FIG3 is a schematic flow chart of a method for adjusting image brightness according to a second embodiment of the present application;

图4是本申请实施例二提供的背景图的结构示意图;FIG4 is a schematic diagram of the structure of a background image provided in Example 2 of the present application;

图5是本申请实施例三提供的图像亮度的调整方法的流程示意图;FIG5 is a schematic diagram of a flow chart of a method for adjusting image brightness provided in Embodiment 3 of the present application;

图6(a)是本申请实施例三提供的亮度漂移因子的结构示意图;FIG6( a ) is a schematic diagram of the structure of a brightness drift factor provided in Embodiment 3 of the present application;

图6(b)是本申请实施例三提供的对比度漂移因子的结构示意图;FIG6( b ) is a schematic diagram of the structure of the contrast drift factor provided in Example 3 of the present application;

图7是本申请实施例三提供的卷积核的结构示意图;FIG7 is a schematic diagram of the structure of a convolution kernel provided in Example 3 of the present application;

图8是本申请实施例三提供的图像亮度调整前后的对比示意图;FIG8 is a schematic diagram showing the comparison of image brightness before and after adjustment provided in Example 3 of the present application;

图9是本申请实施例四提供的图像亮度的调整装置的结构示意图;FIG9 is a schematic diagram of the structure of an apparatus for adjusting image brightness provided in Embodiment 4 of the present application;

图10是本申请实施例四提供的分离模块的结构示意图;FIG10 is a schematic diagram of the structure of a separation module provided in Example 4 of the present application;

图11是本申请实施例四提供的确定模块的结构示意图;FIG11 is a schematic diagram of the structure of a determination module provided in Embodiment 4 of the present application;

图12是本申请实施例四提供的调整模块的结构示意图;FIG12 is a schematic diagram of the structure of an adjustment module provided in Embodiment 4 of the present application;

图13是用来实现本申请实施例的图像亮度的调整方法的电子设备的框图。FIG. 13 is a block diagram of an electronic device for implementing the method for adjusting image brightness according to an embodiment of the present application.

具体实施方式Detailed ways

以下结合附图对本申请的示范性实施例做出说明,其中包括本申请实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本申请的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

实施例一Embodiment 1

图1是本申请实施例一提供的图像亮度的调整方法的流程示意图,该方法可以由图像亮度的调整装置或者电子设备来执行,该装置或者电子设备可以由软件和/或硬件的方式实现,该装置或者电子设备可以集成在任何具有网络通信功能的智能设备中。如图1所示,图像亮度的调整方法可以包括以下步骤:FIG1 is a flow chart of a method for adjusting image brightness provided in Embodiment 1 of the present application. The method can be performed by an image brightness adjustment device or electronic device. The device or electronic device can be implemented by software and/or hardware. The device or electronic device can be integrated into any smart device with network communication function. As shown in FIG1 , the method for adjusting image brightness can include the following steps:

S101、获取观测图像;其中,观测图像为红绿蓝颜色空间的图像。S101, obtaining an observed image; wherein the observed image is an image in a red, green and blue color space.

在本申请的具体实施例中,电子设备可以获取观测图像;其中,观测图像为红绿蓝颜色空间(即RGB空间)的图像。RGB空间以红(Red)、绿(Green)、蓝(Blue)三种基本色为基础,进行不同程度的叠加,产生丰富而广泛的颜色,所以俗称三基色模式。RGB空间是生活中最常用的一个模型,电视机、电脑的显示器等大部分都是采用这种模型。自然界中的任何一种颜色都可以由红、绿、蓝三种色光混合而成,现实生活中人们见到的颜色大多是混合而成的色彩。In a specific embodiment of the present application, an electronic device can obtain an observed image; wherein the observed image is an image in a red, green, and blue color space (i.e., RGB space). The RGB space is based on the three basic colors of red, green, and blue, and performs different degrees of superposition to produce rich and wide colors, so it is commonly known as the three-primary color model. The RGB space is the most commonly used model in life, and most televisions, computer monitors, etc. use this model. Any color in nature can be mixed from the three colors of red, green, and blue, and most of the colors people see in real life are mixed colors.

S102、在观测图像中分离出观测图像对应的背景图。S102: Separate a background image corresponding to the observed image from the observed image.

在本申请的具体实施例中,电子设备可以在观测图像中分离出观测图像对应的背景图。具体地,电子设备可以先在观测图像中分离出观测图像对应的绿色通道(即G通道)图像;然后计算G通道图像中的各个像素点的均值和标准差;其中,G通道图像中的像素点包括:采样点和非采样点;再根据G通道图像中的各个像素点的均值和标准差以及各个像素点的像素值,在G通道图像中分离出G通道图像对应的背景图。In a specific embodiment of the present application, the electronic device can separate the background image corresponding to the observed image from the observed image. Specifically, the electronic device can first separate the green channel (i.e., G channel) image corresponding to the observed image from the observed image; then calculate the mean and standard deviation of each pixel point in the G channel image; wherein the pixel points in the G channel image include: sampling points and non-sampling points; then, based on the mean and standard deviation of each pixel point in the G channel image and the pixel value of each pixel point, separate the background image corresponding to the G channel image from the G channel image.

图2(a)是本申请实施例一提供的眼底图像中的采样点的位置示意图。如图2(a)所示,根据中心区域照明较好,外围区域照明相对较差的特质,因此可以在中心区域采集较少的点作为采样点,在外围区域采集较多的点作为采样点。图2(a)中的横坐标和纵坐标的单位为像素点的基本单位。FIG2(a) is a schematic diagram of the positions of sampling points in the fundus image provided in Example 1 of the present application. As shown in FIG2(a), based on the characteristics that the central area has better illumination and the peripheral area has relatively poor illumination, fewer points can be collected as sampling points in the central area and more points can be collected as sampling points in the peripheral area. The units of the horizontal and vertical axes in FIG2(a) are the basic units of pixels.

图2(b)是本申请实施例一提供的眼底图像中的采样点的分布示意图。如图2(b)所示,以眼底图像的中心点为原点建立极坐标系,眼底图像的采样点分布在以极坐标的原点为圆心五个圆周上;因为每一个采样点的位置是固定的,所以每一个采样点相对于原点的角度和半径是可以预先知道的,这样就可以获取到每一个采样点的极坐标,然后根据极坐标和直角坐标的换算关系,即可计算出每一个采样点的直角坐标。Figure 2(b) is a schematic diagram of the distribution of sampling points in the fundus image provided by Example 1 of the present application. As shown in Figure 2(b), a polar coordinate system is established with the center point of the fundus image as the origin, and the sampling points of the fundus image are distributed on five circles with the origin of the polar coordinates as the center; because the position of each sampling point is fixed, the angle and radius of each sampling point relative to the origin can be known in advance, so that the polar coordinates of each sampling point can be obtained, and then the rectangular coordinates of each sampling point can be calculated according to the conversion relationship between polar coordinates and rectangular coordinates.

S103、根据背景图确定观测图像对应的显示参数值。S103: Determine a display parameter value corresponding to the observed image according to the background image.

在本申请的具体实施例中,电子设备可以根据背景图确定观测图像对应的显示参数值;该显示参数值为gamma值。具体地,电子设备可以先根据预先确定的窗口大小和背景图中的各个像素点的像素值,计算背景图中的各个像素点对应的亮度漂移因子;然后根据背景图中的各个像素点对应的亮度漂移因子,确定观测图像对应的gamma值。In a specific embodiment of the present application, the electronic device can determine the display parameter value corresponding to the observed image based on the background image; the display parameter value is the gamma value. Specifically, the electronic device can first calculate the brightness drift factor corresponding to each pixel in the background image based on the predetermined window size and the pixel value of each pixel in the background image; and then determine the gamma value corresponding to the observed image based on the brightness drift factor corresponding to each pixel in the background image.

S104、根据观测图像对应的显示参数值对观测图像的亮度进行调整。S104: Adjust the brightness of the observed image according to the display parameter value corresponding to the observed image.

在本申请的具体实施例中,电子设备可以根据观测图像对应的显示参数值对观测图像的亮度进行调整。具体地,电子设备可以先根据观测图像对应的gamma值,计算观测图像的亮度增益矩阵;然后根据亮度增益矩阵对观测图像的亮度进行调整。In a specific embodiment of the present application, the electronic device can adjust the brightness of the observed image according to the display parameter value corresponding to the observed image. Specifically, the electronic device can first calculate the brightness gain matrix of the observed image according to the gamma value corresponding to the observed image; and then adjust the brightness of the observed image according to the brightness gain matrix.

本申请实施例提出的图像亮度的调整方法,先获取观测图像;然后在观测图像中分离出观测图像对应的背景图;再根据背景图确定观测图像对应的显示参数值;最后根据观测图像对应的显示参数值对观测图像的亮度进行调整。也就是说,本申请可以在观测图像对应的背景图中确定观测图像对应的显示参数值,从而可以根据观测图像对应的显示参数值对观测图像的亮度进行调整。而在现有的图像亮度的调整方法中,针对不同的观测图像使用固定的显示参数值对其进行亮度调整,不能根据观测图像本身的亮度分布智能地选择合适的显示参数值。因为本申请采用了在观测图像中分离出观测图像对应的背景图,以及根据背景图确定观测图像对应的显示参数值的技术手段,克服了现有技术中针对不同的观测图像使用固定的显示参数值对其进行亮度调整,不能根据观测图像本身的亮度分布智能地选择合适的显示参数值的技术问题,本申请提供的技术方案,可以根据观测图像本身的亮度分布智能地选择合适的显示参数值,从而使得观测图像的亮度分布更加合理;并且,本申请实施例的技术方案实现简单方便、便于普及,适用范围更广。The method for adjusting the image brightness proposed in the embodiment of the present application first obtains the observed image; then separates the background image corresponding to the observed image from the observed image; then determines the display parameter value corresponding to the observed image according to the background image; and finally adjusts the brightness of the observed image according to the display parameter value corresponding to the observed image. That is to say, the present application can determine the display parameter value corresponding to the observed image in the background image corresponding to the observed image, so that the brightness of the observed image can be adjusted according to the display parameter value corresponding to the observed image. In the existing method for adjusting the image brightness, a fixed display parameter value is used to adjust the brightness of different observed images, and the appropriate display parameter value cannot be intelligently selected according to the brightness distribution of the observed image itself. Because the present application adopts the technical means of separating the background image corresponding to the observed image from the observed image, and determining the display parameter value corresponding to the observed image according to the background image, it overcomes the technical problem that the fixed display parameter value is used to adjust the brightness of different observed images in the prior art, and the appropriate display parameter value cannot be intelligently selected according to the brightness distribution of the observed image itself. The technical solution provided by the present application can intelligently select the appropriate display parameter value according to the brightness distribution of the observed image itself, so that the brightness distribution of the observed image is more reasonable; and the technical solution of the embodiment of the present application is simple and convenient to implement, easy to popularize, and has a wider range of application.

实施例二Embodiment 2

图3是本申请实施例二提供的图像亮度的调整方法的流程示意图。如图3所示,图像亮度的调整方法可以包括以下步骤:FIG3 is a flow chart of a method for adjusting image brightness provided in Embodiment 2 of the present application. As shown in FIG3 , the method for adjusting image brightness may include the following steps:

S301、获取观测图像;其中,观测图像为红绿蓝颜色空间的图像。S301, obtaining an observed image; wherein the observed image is an image in a red, green and blue color space.

S302、在观测图像中分离出观测图像对应的绿色通道图像。S302: Separate a green channel image corresponding to the observed image from the observed image.

在本申请的具体实施例中,电子设备可以在观测图像中分离出观测图像对应的G通道图像。因为G通道图像保留了大量的对比度信息,所以在G通道上进行背景图提取操作,使用采样点的均值和标准差从观测图像中提取背景图的像素点。In a specific embodiment of the present application, the electronic device can separate the G channel image corresponding to the observed image from the observed image. Because the G channel image retains a large amount of contrast information, a background image extraction operation is performed on the G channel, and the pixel points of the background image are extracted from the observed image using the mean and standard deviation of the sampling points.

S303、计算绿色通道图像中的各个像素点的均值和标准差;其中,绿色通道图像中的像素点包括:采样点和非采样点。S303, calculating the mean and standard deviation of each pixel in the green channel image; wherein the pixel points in the green channel image include: sampling points and non-sampling points.

在本申请的具体实施例中,电子设备可以计算G通道图像中的各个像素点的均值和标准差;其中,G通道图像中的像素点包括:采样点和非采样点。具体地,电子设备可以先根据预先确定的各个采样点对应的窗口大小,计算各个采样点在G通道图像中的均值和标准差;然后根据各个采样点在G通道中的均值和标准差,计算各个非采样点在G通道中的均值和标准差。假设图2(b)所示的五个圆周距离圆心的距离分别为d1、d2、d3、d4、d5,五个圆周上的采样点对应的窗口大小分别为w1、w2、w3、w4、w5。因此,电子设备可以根据各个采样点对应的窗口大小,计算各个采样点在G通道图像中的均值和标准差;然后在采样点之间进行双线插值计算,获得所有像素点的均值μ(x,y)和方差σ(x,y)。由于不同的采样点与圆心的距离是不同的,所以不同的像素点所采用的窗口大小也是不同的。在实际采用过程中,可以不限于这五个圆周,所以窗口大小也不限于d1-d5这五个取值。In a specific embodiment of the present application, the electronic device can calculate the mean and standard deviation of each pixel point in the G channel image; wherein the pixel points in the G channel image include: sampling points and non-sampling points. Specifically, the electronic device can first calculate the mean and standard deviation of each sampling point in the G channel image according to the predetermined window size corresponding to each sampling point; then calculate the mean and standard deviation of each non-sampling point in the G channel according to the mean and standard deviation of each sampling point in the G channel. Assume that the distances from the center of the five circles shown in FIG2(b) are d1 , d2 , d3 , d4 , d5 , respectively, and the window sizes corresponding to the sampling points on the five circles are w1 , w2 , w3 , w4 , w5 , respectively. Therefore, the electronic device can calculate the mean and standard deviation of each sampling point in the G channel image according to the window size corresponding to each sampling point; then perform bilinear interpolation calculation between the sampling points to obtain the mean μ(x, y) and variance σ(x, y) of all pixel points. Since the distances between different sampling points and the center of the circle are different, the window sizes used for different pixel points are also different. In the actual use process, it is not limited to these five circles, so the window size is not limited to the five values of d1 - d5 .

S304、根据绿色通道图像中的各个像素点的均值和标准差以及各个像素点的像素值,在绿色通道图像中分离出绿色通道图像对应的背景图。S304: Separate a background image corresponding to the green channel image from the green channel image according to the mean and standard deviation of each pixel point in the green channel image and the pixel value of each pixel point.

在本申请的具体实施例中,电子设备可以根据G通道图像中的各个像素点的均值和标准差以及各个像素点的像素值,在G通道图像中分离出G通道图像对应的背景图。图4是本申请实施例二提供的背景图的结构示意图。如图4所示,电子设备可以先在G通道图像中的像素点中提取出一个像素点作为当前像素点,然后根据当前像素点的均值和标准差以及当前像素点的像素值,计算当前像素点对应的马氏距离;若当前像素点对应的马氏距离小于或者等于预设阈值,则电子设备可以将当前像素点作为G通道图像对应的背景图中的一个像素点;若当前像素点对应的马氏距离大于预设阈值,则电子设备可以将当前像素点作为G通道图像对应的前景图中的一个像素点;重复执行上述操作,直到将G通道图像中的各个像素点确定为背景图中的像素点或者前景图中的像素点。具体地,电子设备可以按照以下公式计算当前像素点对应的马氏距离:其中,D(x,y)表示当前像素点对应的马氏距离;G(x,y)表示当前像素点的像素值;μ(x,y)表示当前像素点的均值;σ(x,y)表示当前像素点的标准差。In a specific embodiment of the present application, the electronic device can separate the background image corresponding to the G channel image in the G channel image according to the mean and standard deviation of each pixel point in the G channel image and the pixel value of each pixel point. Figure 4 is a structural schematic diagram of the background image provided in the second embodiment of the present application. As shown in Figure 4, the electronic device can first extract a pixel point from the pixels in the G channel image as the current pixel point, and then calculate the Mahalanobis distance corresponding to the current pixel point according to the mean and standard deviation of the current pixel point and the pixel value of the current pixel point; if the Mahalanobis distance corresponding to the current pixel point is less than or equal to the preset threshold, the electronic device can use the current pixel point as a pixel point in the background image corresponding to the G channel image; if the Mahalanobis distance corresponding to the current pixel point is greater than the preset threshold, the electronic device can use the current pixel point as a pixel point in the foreground image corresponding to the G channel image; repeat the above operation until each pixel point in the G channel image is determined as a pixel point in the background image or a pixel point in the foreground image. Specifically, the electronic device can calculate the Mahalanobis distance corresponding to the current pixel point according to the following formula: Among them, D(x,y) represents the Mahalanobis distance corresponding to the current pixel; G(x,y) represents the pixel value of the current pixel; μ(x,y) represents the mean of the current pixel; σ(x,y) represents the standard deviation of the current pixel.

S305、根据背景图确定观测图像对应的显示参数值。S305: Determine display parameter values corresponding to the observed image according to the background image.

在本申请的具体实施例中,电子设备可以根据背景图确定观测图像对应的显示参数值。具体地,电子设备可以先根据预先确定的窗口大小和背景图中的各个像素点的像素值,计算背景图中的各个像素点对应的亮度漂移因子;然后根据背景图中的各个像素点对应的亮度漂移因子,确定观测图像对应的gamma值。In a specific embodiment of the present application, the electronic device can determine the display parameter value corresponding to the observed image based on the background image. Specifically, the electronic device can first calculate the brightness drift factor corresponding to each pixel in the background image based on a predetermined window size and the pixel value of each pixel in the background image; and then determine the gamma value corresponding to the observed image based on the brightness drift factor corresponding to each pixel in the background image.

S306、根据观测图像对应的显示参数值对观测图像的亮度进行调整。S306: Adjust the brightness of the observed image according to the display parameter value corresponding to the observed image.

本申请实施例提出的图像亮度的调整方法,先获取观测图像;然后在观测图像中分离出观测图像对应的背景图;再根据背景图确定观测图像对应的显示参数值;最后根据观测图像对应的显示参数值对观测图像的亮度进行调整。也就是说,本申请可以在观测图像对应的背景图中确定观测图像对应的显示参数值,从而可以根据观测图像对应的显示参数值对观测图像的亮度进行调整。而在现有的图像亮度的调整方法中,针对不同的观测图像使用固定的显示参数值对其进行亮度调整,不能根据观测图像本身的亮度分布智能地选择合适的显示参数值。因为本申请采用了在观测图像中分离出观测图像对应的背景图,以及根据背景图确定观测图像对应的显示参数值的技术手段,克服了现有技术中针对不同的观测图像使用固定的显示参数值对其进行亮度调整,不能根据观测图像本身的亮度分布智能地选择合适的显示参数值的技术问题,本申请提供的技术方案,可以根据观测图像本身的亮度分布智能地选择合适的显示参数值,从而使得观测图像的亮度分布更加合理;并且,本申请实施例的技术方案实现简单方便、便于普及,适用范围更广。The method for adjusting the image brightness proposed in the embodiment of the present application first obtains the observed image; then separates the background image corresponding to the observed image from the observed image; then determines the display parameter value corresponding to the observed image according to the background image; and finally adjusts the brightness of the observed image according to the display parameter value corresponding to the observed image. That is to say, the present application can determine the display parameter value corresponding to the observed image in the background image corresponding to the observed image, so that the brightness of the observed image can be adjusted according to the display parameter value corresponding to the observed image. In the existing method for adjusting the image brightness, a fixed display parameter value is used to adjust the brightness of different observed images, and the appropriate display parameter value cannot be intelligently selected according to the brightness distribution of the observed image itself. Because the present application adopts the technical means of separating the background image corresponding to the observed image from the observed image, and determining the display parameter value corresponding to the observed image according to the background image, it overcomes the technical problem that the fixed display parameter value is used to adjust the brightness of different observed images in the prior art, and the appropriate display parameter value cannot be intelligently selected according to the brightness distribution of the observed image itself. The technical solution provided by the present application can intelligently select the appropriate display parameter value according to the brightness distribution of the observed image itself, so that the brightness distribution of the observed image is more reasonable; and the technical solution of the embodiment of the present application is simple and convenient to implement, easy to popularize, and has a wider range of application.

实施例三Embodiment 3

图5是本申请实施例三提供的图像亮度的调整方法的流程示意图。如图5所示,图像亮度的调整方法可以包括以下步骤:FIG5 is a flow chart of a method for adjusting image brightness provided in Embodiment 3 of the present application. As shown in FIG5 , the method for adjusting image brightness may include the following steps:

S501、获取观测图像;其中,观测图像为红绿蓝颜色空间的图像。S501, obtaining an observed image; wherein the observed image is an image in a red, green and blue color space.

S502、在观测图像中分离出观测图像对应的绿色通道图像。S502: Separate a green channel image corresponding to the observed image from the observed image.

S503、计算绿色通道图像中的各个像素点的均值和标准差;其中,绿色通道图像中的像素点包括:采样点和非采样点。S503, calculating the mean and standard deviation of each pixel in the green channel image; wherein the pixel points in the green channel image include: sampling points and non-sampling points.

S504、根据绿色通道图像中的各个像素点的均值和标准差以及各个像素点的像素值,在绿色通道图像中分离出绿色通道图像对应的背景图。S504: Separate a background image corresponding to the green channel image from the green channel image according to the mean and standard deviation of each pixel point in the green channel image and the pixel value of each pixel point.

在图像获取过程中,图像亮度和对比度会在原始图像上产生形变,最终得到人眼观测到的图像,该变形可以用以下观测模型描述:I(x,y)=C(x,y)×I0(x,y)+L(x,y);其中,I(x,y)表示观测图像中的每一个像素点的像素值;I0(x,y)表示原始图像中的每一个像素点的像素值;C(x,y)表示原始图像中的每一个像素点对应的对比度漂移因子;L(x,y)表示原始图像中的每一个像素点对应的亮度漂移因子。进一步地,原始图像是指不包含非均匀亮度和对比度影响的理想眼底图,原始图像可以看成理想背景图像和前景图像的叠加组合:其中,/>表示前景图像中的每一个像素点的像素值;表示背景图像中的每一个像素点的像素值。在原始眼底图的前景图像中,/>是眼底网膜区前景,包含血管结构、视盘、视杯和任何可见病变;/>是眼底网膜区背景,不包含血管结构、视盘、视杯和任何可见病变。根据上述观测模型描述可以得到原始图像的公式:/>由此可知,如果可以确定出原始图像中的每一个像素点对应的真实的亮度漂移因子L(x,y)和对比度漂移因子C(x,y),即可根据上述公式获得原始图像中的每一个像素点的像素值I0(x,y)。但是原始图像中的每一个像素点对应的真实的亮度漂移因子L(x,y)和对比度漂移因子C(x,y)通常是未知的,只能从观测图像中的每个像素点的像素值I(x,y)中对其进行估计。因此,上述原始图像的公式可以变成如下形式:其中,I0’(x,y)是对原始图像中的每一个像素点的像素值的估计;L’(x,y)是对原始图像中的每一个像素点对应的亮度漂移因子的估计;C’(x,y)是对原始图像中的每一个像素点对应的对比度漂移因子的估计。为了获得I0’(x,y),必须估计出L’(x,y)和C’(x,y)。前景图的特性差异大,而背景图变化平缓,可以用正态分布来建模:其中,μb为背景图的理想均匀亮度值;σb则反映了背景图在空间域的自然变化特性。During the image acquisition process, the image brightness and contrast will produce deformation on the original image, and finally the image observed by the human eye is obtained. This deformation can be described by the following observation model: I(x,y)=C(x,y)×I 0 (x,y)+L(x,y); where I(x,y) represents the pixel value of each pixel in the observed image; I 0 (x,y) represents the pixel value of each pixel in the original image; C(x,y) represents the contrast drift factor corresponding to each pixel in the original image; L(x,y) represents the brightness drift factor corresponding to each pixel in the original image. Furthermore, the original image refers to an ideal fundus image that does not contain the influence of non-uniform brightness and contrast. The original image can be regarded as a superposition of an ideal background image and a foreground image: Among them,/> Represents the pixel value of each pixel in the foreground image; Represents the pixel value of each pixel in the background image. In the foreground image of the original fundus image, /> It is the foreground of the retinal area of the fundus, including the vascular structure, optic disc, optic cup and any visible lesions;/> It is the background of the retinal area of the fundus, and does not contain vascular structures, optic discs, optic cups, and any visible lesions. According to the above observation model description, the formula for the original image can be obtained: /> It can be seen that if the real brightness drift factor L(x,y) and contrast drift factor C(x,y) corresponding to each pixel in the original image can be determined, the pixel value I 0 (x,y) of each pixel in the original image can be obtained according to the above formula. However, the real brightness drift factor L(x,y) and contrast drift factor C(x,y) corresponding to each pixel in the original image are usually unknown and can only be estimated from the pixel value I(x,y) of each pixel in the observed image. Therefore, the above formula of the original image can be changed to the following form: Among them, I 0' (x, y) is an estimate of the pixel value of each pixel in the original image; L'(x, y) is an estimate of the brightness drift factor corresponding to each pixel in the original image; C'(x, y) is an estimate of the contrast drift factor corresponding to each pixel in the original image. In order to obtain I 0' (x, y), L'(x, y) and C'(x, y) must be estimated. The characteristics of the foreground image vary greatly, while the background image changes slowly, which can be modeled using a normal distribution: Among them, μ b is the ideal uniform brightness value of the background image; σ b reflects the natural variation characteristics of the background image in the spatial domain.

S505、根据预先确定的窗口大小和背景图中的各个像素点的像素值,计算背景图中的各个像素点对应的亮度漂移因子。S505: Calculate a brightness drift factor corresponding to each pixel in the background image according to a predetermined window size and a pixel value of each pixel in the background image.

在本申请的具体实施例中,电子设备可以根据预先确定的窗口大小w0和背景图中的各个像素点的像素值G(x,y),计算背景图中的各个像素均值和标准差,各个像素点的均值即为各个像素点对应的亮度漂移因子L’(x,y);各个像素点的标准差即为各个像素点对应的对比度漂移因子C’(x,y)。In a specific embodiment of the present application, the electronic device can calculate the mean and standard deviation of each pixel in the background image based on a predetermined window size w0 and the pixel value G(x, y) of each pixel in the background image, where the mean of each pixel is the brightness drift factor L'(x, y) corresponding to each pixel; the standard deviation of each pixel is the contrast drift factor C'(x, y) corresponding to each pixel.

图6(a)是本申请实施例三提供的亮度漂移因子的结构示意图;图6(b)是本申请实施例三提供的对比度漂移因子的结构示意图。如图6(a)和图6(b)所示,w0∈(15,25),计算窗口w0×w0中每个像素点(x,y)的均值和标准差,均值则是该像素点对应的亮度漂移因子;标准差则是该像素点对应的对比度漂移因子。图6(a)和图6(b)中的横坐标和纵坐标的单位为像素点的基本单位。Figure 6(a) is a schematic diagram of the structure of the brightness drift factor provided in Example 3 of the present application; Figure 6(b) is a schematic diagram of the structure of the contrast drift factor provided in Example 3 of the present application. As shown in Figures 6(a) and 6(b), w 0 ∈(15,25), the mean and standard deviation of each pixel point (x,y) in the window w 0 ×w 0 are calculated, and the mean is the brightness drift factor corresponding to the pixel point; the standard deviation is the contrast drift factor corresponding to the pixel point. The units of the horizontal and vertical coordinates in Figures 6(a) and 6(b) are the basic units of pixels.

在本申请的具体实施例中,电子设备在计算每个采样点的均值和标准差时,传统的双层循环遍历方式耗时严重,一张背景图的提取需要1.1秒,本申请采用卷积相乘的方式代替图像像素的循环,很大的提升了代码效率。In a specific embodiment of the present application, when the electronic device calculates the mean and standard deviation of each sampling point, the traditional double-layer loop traversal method is very time-consuming, and it takes 1.1 seconds to extract a background image. The present application uses convolution multiplication to replace the loop of image pixels, which greatly improves the code efficiency.

图7是本申请实施例三提供的卷积核的结构示意图。如图7所示,设置一个(w,w)的卷积核k,则L’(x,y)可以由k和G通道图像G(x,y)通过卷积相乘求得:L’(x,y)=k×G(x,y);对于C’(x,y):Figure 7 is a schematic diagram of the structure of the convolution kernel provided in Example 3 of the present application. As shown in Figure 7, a convolution kernel k of (w,w) is set, then L'(x,y) can be obtained by multiplying k and the G channel image G(x,y) by convolution: L'(x,y) = k × G(x,y); for C'(x,y):

则/>其中,i表示G通道图像中的各个像素点的次序;N表示G通道图像中的像素点的数量;xi表示第i个像素点的像素值;μ为第i个像素点至第N个像素点的算数平均值。本申请将背景图提取的过程,由1.1秒降为0.06秒,速度提升了18.3倍,整个自适应亮度调整全流程只需要0.2秒,支持训练过程中进行实时扩增。 Then/> Among them, i represents the order of each pixel in the G channel image; N represents the number of pixels in the G channel image; xi represents the pixel value of the i-th pixel; μ is the arithmetic mean of the i-th pixel to the N-th pixel. This application reduces the background image extraction process from 1.1 seconds to 0.06 seconds, which is 18.3 times faster. The entire adaptive brightness adjustment process only takes 0.2 seconds, and supports real-time amplification during training.

S506、根据背景图中的各个像素点对应的亮度漂移因子,确定观测图像对应的显示参数值。S506: Determine a display parameter value corresponding to the observed image according to a brightness drift factor corresponding to each pixel point in the background image.

在本申请的具体实施例中,电子设备可以根据背景图中的各个像素点对应的亮度漂移因子,确定观测图像对应的显示参数值。具体地,电子设备可以将每一个像素点对应的亮度漂移因子L’(x,y)提取出来,按照从小到大的顺序进行排序,然后在排序结果中获取第p1百分位的数值和第p2百分位的数值,分别记为:img_percentile_p1和img_percentile_p2;其中,p1<p2;根据img_percentile_p1和img_percentile_p2的取值范围确定观测图像I(x,y)的亮度分布所对应的gamma值。较佳地,p1的取值范围为:70~100;p2的取值范围为:10~40。进一步地,若第二百分位对应的数值小于第一数值,则电子设备可以将观测图像对应的gamma值确定为第一gamma值集合内的一个gamma值;若第一百分位对应的数值大于第二数值,则电子设备可以将观测图像对应的gamma值确定为第二gamma值集合内的一个gamma值;若第一百分位对应的数值小于第三数值且第二百分位对应的数值大于第四数值,则电子设备可以将观测图像对应的gamma值确定为第三gamma值集合内的一个gamma值;其中,第一数值小于第四数值;第四数值小于第三数值;第三数值小于第二数值。例如,若img_percentile_p2低于第一阈值th1(th1的取值范围为:15~45),则gamma值取g1(g1的取值范围为:1.9~2.2);若img_percentile_p1高于第二阈值th2(th2取值范围为:170~200),则gamma值取g2(g2的取值范围为:0.5~0.8);若img_percentile_p1低于第三阈值th3(th3的取值范围为:140~160)且img_percentile_p2高于第四阈值th4(th4的取值范围为:70~90),则gamma值取g3(g3的取值范围为:0.9~1.1);其余情况,gamma值取g4(g4的取值范围为:1.5~1.8)。In a specific embodiment of the present application, the electronic device can determine the display parameter value corresponding to the observed image based on the brightness drift factor corresponding to each pixel in the background image. Specifically, the electronic device can extract the brightness drift factor L'(x, y) corresponding to each pixel, sort them in order from small to large, and then obtain the p1th percentile value and the p2th percentile value in the sorting result, respectively recorded as: img_percentile_p1 and img_percentile_p2; wherein, p1<p2; determine the gamma value corresponding to the brightness distribution of the observed image I(x, y) according to the value range of img_percentile_p1 and img_percentile_p2. Preferably, the value range of p1 is: 70~100; the value range of p2 is: 10~40. Further, if the numerical value corresponding to the second percentile is smaller than the first numerical value, the electronic device may determine the gamma value corresponding to the observed image as a gamma value within the first gamma value set; if the numerical value corresponding to the first percentile is greater than the second numerical value, the electronic device may determine the gamma value corresponding to the observed image as a gamma value within the second gamma value set; if the numerical value corresponding to the first percentile is smaller than the third numerical value and the numerical value corresponding to the second percentile is greater than the fourth numerical value, the electronic device may determine the gamma value corresponding to the observed image as a gamma value within the third gamma value set; wherein the first numerical value is smaller than the fourth numerical value; the fourth numerical value is smaller than the third numerical value; and the third numerical value is smaller than the second numerical value. For example, if img_percentile_p2 is lower than the first threshold th1 (the value range of th1 is: 15~45), the gamma value is g1 (the value range of g1 is: 1.9~2.2); if img_percentile_p1 is higher than the second threshold th2 (the value range of th2 is: 170~200), the gamma value is g2 (the value range of g2 is: 0.5~0.8); if img_percentile_p1 is lower than the third threshold th3 (the value range of th3 is: 140~160) and img_percentile_p2 is higher than the fourth threshold th4 (the value range of th4 is: 70~90), the gamma value is g3 (the value range of g3 is: 0.9~1.1); in other cases, the gamma value is g4 (the value range of g4 is: 1.5~1.8).

S507、根据观测图像对应的显示参数值对观测图像的亮度进行调整。S507: Adjust the brightness of the observed image according to the display parameter value corresponding to the observed image.

在本申请的具体实施例中,电子设备可以根据观测图像对应的显示参数值对观测图像的亮度进行调整。具体地,电子设备可以先根据观测图像对应的gamma值,计算观测图像的亮度增益矩阵;然后根据亮度增益矩阵对观测图像的亮度进行调整。由于RGB通道同时包含了亮度信息和颜色信息,它们之间相互关联。为了得到和颜色无关的亮度增益矩阵,可以先将观测图像从RGB空间转换为HSV空间;然后使用观测图像对应的gamma值对观测图像对应的V通道图像的中的各个像素点的亮度进行调整;再根据V通道图像中的各个像素点在调整后的亮度值V’和在调整前的亮度值V,确定出观测图像的亮度增益矩阵G(x,y)=V’/V。为了增强了亮度而保证颜色信息不变,R,G,B三个通道应该以相同的比例调整:其中,r’(x,y)为R通道图像中的各个像素点在调整后的亮度值;r(x,y)为R通道图像中的各个像素点在调整前的亮度值;g’(x,y)为G通道图像中的各个像素点在调整后的亮度值;g(x,y)为G通道图像中的各个像素点在调整前的亮度值;b’(x,y)为B通道图像中的各个像素点在调整后的亮度值;b(x,y)为B通道图像中的各个像素点在调整前的亮度值。所以将G(x,y)分别作用于RGB通道,就得到了亮度调优后的图片。如果直接在RGB空间进行gamma值矫正,则颜色信息也被改变了。亮度增益矩阵,是基于gamma值校正的,是一种更合理的提升亮度的方法。而gamma值的选择决定了对图像亮度调整的方向。In a specific embodiment of the present application, the electronic device can adjust the brightness of the observed image according to the display parameter value corresponding to the observed image. Specifically, the electronic device can first calculate the brightness gain matrix of the observed image according to the gamma value corresponding to the observed image; and then adjust the brightness of the observed image according to the brightness gain matrix. Since the RGB channels contain both brightness information and color information, they are interrelated. In order to obtain a color-independent brightness gain matrix, the observed image can be first converted from the RGB space to the HSV space; then the gamma value corresponding to the observed image is used to adjust the brightness of each pixel in the V channel image corresponding to the observed image; and then the brightness value V' after adjustment and the brightness value V before adjustment of each pixel in the V channel image are determined to be the brightness gain matrix G(x,y)=V'/V of the observed image. In order to enhance the brightness while ensuring that the color information remains unchanged, the three channels of R, G, and B should be adjusted in the same proportion: Among them, r'(x,y) is the brightness value of each pixel in the R channel image after adjustment; r(x,y) is the brightness value of each pixel in the R channel image before adjustment; g'(x,y) is the brightness value of each pixel in the G channel image after adjustment; g(x,y) is the brightness value of each pixel in the G channel image before adjustment; b'(x,y) is the brightness value of each pixel in the B channel image after adjustment; b(x,y) is the brightness value of each pixel in the B channel image before adjustment. So by applying G(x,y) to the RGB channels respectively, we get the image after brightness adjustment. If the gamma value is corrected directly in the RGB space, the color information will also be changed. The brightness gain matrix is based on gamma value correction and is a more reasonable way to increase brightness. The choice of gamma value determines the direction of image brightness adjustment.

图8是本申请实施例三提供的图像亮度调整前后的对比示意图。如图8所示,可以看到原本很暗的地方调整到了正常亮度水平,而原本很亮的地方,比如视盘区,是保持不变的,调整后的图像亮度分布均匀。对于原本图像亮度分布就很均匀的正常眼底图,则gamma值也会自动取为1,即不改变原始分布。本申请可以根据图像自身亮度分布来调整图像亮度,使得图像靠近训练集分布,从而有效应对各种实战场景,使得自动筛查系统能够更准确高质量的进行疾病筛查,尽可能减少因为低质导致的误诊;在自适应调整亮度分布的同时,不改变原始图像颜色分布,保留眼底图的自然度;此外,本申请时间效率高,支持训练过程中实时增强;而现有方法时间均较长,不能支持模型训练时在线处理;而且,本申请还可以进行反向增强,即根据原始图像本身的亮度分布来定一个反向的gamma值,从而在训练过程中模拟真实场景中的低质图,从而使得模型对于亮度分布不均的眼底图更加鲁棒。FIG8 is a schematic diagram of the comparison of the image brightness before and after adjustment provided by the third embodiment of the present application. As shown in FIG8, it can be seen that the originally dark places are adjusted to the normal brightness level, while the originally bright places, such as the optic disc area, remain unchanged, and the brightness distribution of the adjusted image is uniform. For a normal fundus image whose original image brightness distribution is very uniform, the gamma value will also be automatically taken as 1, that is, the original distribution will not be changed. The present application can adjust the image brightness according to the image's own brightness distribution, so that the image is close to the training set distribution, thereby effectively responding to various actual combat scenarios, so that the automatic screening system can perform disease screening more accurately and with high quality, and minimize misdiagnosis caused by low quality; while adaptively adjusting the brightness distribution, the original image color distribution is not changed, and the naturalness of the fundus image is retained; in addition, the present application is time-efficient and supports real-time enhancement during training; while the existing methods are all relatively long, and cannot support online processing during model training; moreover, the present application can also perform reverse enhancement, that is, a reverse gamma value is determined according to the brightness distribution of the original image itself, so as to simulate the low-quality image in the real scene during the training process, so that the model is more robust to fundus images with uneven brightness distribution.

本申请实施例提出的图像亮度的调整方法,先获取观测图像;然后在观测图像中分离出观测图像对应的背景图;再根据背景图确定观测图像对应的显示参数值;最后根据观测图像对应的显示参数值对观测图像的亮度进行调整。也就是说,本申请可以在观测图像对应的背景图中确定观测图像对应的显示参数值,从而可以根据观测图像对应的显示参数值对观测图像的亮度进行调整。而在现有的图像亮度的调整方法中,针对不同的观测图像使用固定的显示参数值对其进行亮度调整,不能根据观测图像本身的亮度分布智能地选择合适的显示参数值。因为本申请采用了在观测图像中分离出观测图像对应的背景图,以及根据背景图确定观测图像对应的显示参数值的技术手段,克服了现有技术中针对不同的观测图像使用固定的显示参数值对其进行亮度调整,不能根据观测图像本身的亮度分布智能地选择合适的显示参数值的技术问题,本申请提供的技术方案,可以根据观测图像本身的亮度分布智能地选择合适的显示参数值,从而使得观测图像的亮度分布更加合理;并且,本申请实施例的技术方案实现简单方便、便于普及,适用范围更广。The method for adjusting the image brightness proposed in the embodiment of the present application first obtains the observed image; then separates the background image corresponding to the observed image from the observed image; then determines the display parameter value corresponding to the observed image according to the background image; and finally adjusts the brightness of the observed image according to the display parameter value corresponding to the observed image. That is to say, the present application can determine the display parameter value corresponding to the observed image in the background image corresponding to the observed image, so that the brightness of the observed image can be adjusted according to the display parameter value corresponding to the observed image. In the existing method for adjusting the image brightness, a fixed display parameter value is used to adjust the brightness of different observed images, and the appropriate display parameter value cannot be intelligently selected according to the brightness distribution of the observed image itself. Because the present application adopts the technical means of separating the background image corresponding to the observed image from the observed image, and determining the display parameter value corresponding to the observed image according to the background image, it overcomes the technical problem that the fixed display parameter value is used to adjust the brightness of different observed images in the prior art, and the appropriate display parameter value cannot be intelligently selected according to the brightness distribution of the observed image itself. The technical solution provided by the present application can intelligently select the appropriate display parameter value according to the brightness distribution of the observed image itself, so that the brightness distribution of the observed image is more reasonable; and the technical solution of the embodiment of the present application is simple and convenient to implement, easy to popularize, and has a wider range of application.

实施例四Embodiment 4

图9是本申请实施例四提供的图像亮度的调整装置的结构示意图。如图9所示,所述装置900包括:获取模块901、分离模块902、确定模块903和调整模块904;其中,FIG9 is a schematic diagram of the structure of an apparatus for adjusting image brightness provided in Embodiment 4 of the present application. As shown in FIG9 , the apparatus 900 includes: an acquisition module 901, a separation module 902, a determination module 903 and an adjustment module 904;

所述获取模块901,用于获取观测图像;其中,所述观测图像为红绿蓝颜色空间的图像;The acquisition module 901 is used to acquire an observed image; wherein the observed image is an image in a red, green and blue color space;

所述分离模块902,用于在所述观测图像中分离出所述观测图像对应的背景图;The separation module 902 is used to separate the background image corresponding to the observation image from the observation image;

所述确定模块903,用于根据所述背景图确定所述观测图像对应的显示参数值;The determination module 903 is used to determine the display parameter value corresponding to the observed image according to the background image;

所述调整模块904,用于根据所述观测图像对应的显示参数值对所述观测图像的亮度进行调整。The adjustment module 904 is used to adjust the brightness of the observed image according to the display parameter value corresponding to the observed image.

图10是本申请实施例四提供的分离模块的结构示意图。如图10所示,所述分离模块902包括:分离子模块9021和第一计算子模块9022;其中,FIG10 is a schematic diagram of the structure of the separation module provided in the fourth embodiment of the present application. As shown in FIG10 , the separation module 902 includes: a separation submodule 9021 and a first calculation submodule 9022;

所述分离子模块9021,用于在所述观测图像中分离出所述观测图像对应的绿色通道图像;The separation submodule 9021 is used to separate a green channel image corresponding to the observation image from the observation image;

所述第一计算子模块9022,用于计算所述绿色通道图像中的各个像素点的均值和标准差;其中,所述绿色通道图像中的像素点包括:采样点和非采样点;The first calculation submodule 9022 is used to calculate the mean and standard deviation of each pixel in the green channel image; wherein the pixel points in the green channel image include: sampling points and non-sampling points;

所述分离子模块9021,还用于根据所述绿色通道图像中的各个像素点的均值和标准差以及各个像素点的像素值,在所述绿色通道图像中分离出所述绿色通道图像对应的背景图。The separation submodule 9021 is further used to separate the background image corresponding to the green channel image from the green channel image according to the mean value and standard deviation of each pixel point in the green channel image and the pixel value of each pixel point.

进一步的,所述第一计算子模块9022,具体用于根据预先确定的各个采样点对应的窗口大小,计算各个采样点在所述绿色通道图像中的均值和标准差;根据各个采样点在所述绿色通道中的均值和标准差,计算各个非采样点在所述绿色通道中的均值和标准差。Furthermore, the first calculation submodule 9022 is specifically used to calculate the mean and standard deviation of each sampling point in the green channel image according to the predetermined window size corresponding to each sampling point; and calculate the mean and standard deviation of each non-sampling point in the green channel according to the mean and standard deviation of each sampling point in the green channel.

进一步的,所述确定模块903,还用于对所述观测图像进行采样,得到所述观测图像的各个采样点;根据所述观测图像中的各个采样点与中心点的距离,确定各个采样点对应的窗口大小。Furthermore, the determination module 903 is further configured to sample the observed image to obtain sampling points of the observed image; and determine the window size corresponding to each sampling point according to the distance between each sampling point in the observed image and the center point.

进一步的,所述分离子模块9021,具体用于在所述绿色通道图像中的像素点中提取出一个像素点作为当前像素点,根据所述当前像素点的均值和标准差以及所述当前像素点的像素值,计算所述当前像素点对应的马氏距离;若所述当前像素点对应的马氏距离小于或者等于预设阈值,则将所述当前像素点作为所述绿色通道图像对应的背景图中的一个像素点;若所述当前像素点对应的马氏距离大于所述预设阈值,则将所述当前像素点作为所述绿色通道图像对应的前景图中的一个像素点;重复执行上述操作,直到将所述绿色通道图像中的各个像素点确定为所述背景图中的像素点或者所述前景图中的像素点。Furthermore, the separation submodule 9021 is specifically used to extract a pixel point from the pixels in the green channel image as the current pixel point, and calculate the Mahalanobis distance corresponding to the current pixel point according to the mean and standard deviation of the current pixel point and the pixel value of the current pixel point; if the Mahalanobis distance corresponding to the current pixel point is less than or equal to a preset threshold, the current pixel point is used as a pixel point in the background image corresponding to the green channel image; if the Mahalanobis distance corresponding to the current pixel point is greater than the preset threshold, the current pixel point is used as a pixel point in the foreground image corresponding to the green channel image; and the above operations are repeated until each pixel point in the green channel image is determined as a pixel point in the background image or a pixel point in the foreground image.

图11是本申请实施例四提供的确定模块的结构示意图。如图11所示,所述确定模块903包括:第二计算子模块9031和确定子模块9032;其中,FIG11 is a schematic diagram of the structure of the determination module provided in the fourth embodiment of the present application. As shown in FIG11 , the determination module 903 includes: a second calculation submodule 9031 and a determination submodule 9032; wherein,

所述第二计算子模块9031,用于根据预先确定的窗口大小和所述背景图中的各个像素点的像素值,计算所述背景图中的各个像素点对应的亮度漂移因子;The second calculation submodule 9031 is used to calculate the brightness drift factor corresponding to each pixel in the background image according to a predetermined window size and a pixel value of each pixel in the background image;

所述确定子模块9032,用于根据所述背景图中的各个像素点对应的亮度漂移因子,确定所述观测图像对应的显示参数值。The determination submodule 9032 is used to determine the display parameter value corresponding to the observed image according to the brightness drift factor corresponding to each pixel point in the background image.

进一步的,所述确定子模块9032,具体用于根据所述背景图中的各个像素点对应的亮度漂移因子,将全部的像素点对应的亮度漂移因子进行排序;在排序后的亮度漂移因子中确定第一百分位对应的数值和第二百分位对应的数值;其中,所述第一百分位小于所述第二百分位;根据所述第一百分位对应的数值和/或所述第二百分位对应的数值的分布区间,确定所述观测图像对应的显示参数值。Furthermore, the determination submodule 9032 is specifically used to sort the brightness drift factors corresponding to all the pixels in the background image according to the brightness drift factors corresponding to each pixel in the background image; determine the numerical value corresponding to the first percentile and the numerical value corresponding to the second percentile in the sorted brightness drift factors; wherein the first percentile is smaller than the second percentile; and determine the display parameter value corresponding to the observed image according to the distribution range of the numerical value corresponding to the first percentile and/or the numerical value corresponding to the second percentile.

进一步的,所述确定子模块9032,具体用于若所述第二百分位对应的数值小于第一数值,则将所述观测图像对应的显示参数值确定为第一显示参数值集合内的一个显示参数值;若所述第一百分位对应的数值大于第二数值,则将所述观测图像对应的显示参数值确定为第二显示参数值集合内的一个显示参数值;若所述第一百分位对应的数值小于第三数值且所述第二百分位对应的数值大于第四数值,则将所述观测图像对应的显示参数值确定为第三显示参数值集合内的一个显示参数值;其中,所述第一数值小于所述第四数值;所述第四数值小于所述第三数值;所述第三数值小于所述第二数值。Furthermore, the determination submodule 9032 is specifically used to determine the display parameter value corresponding to the observed image as a display parameter value within a first display parameter value set if the value corresponding to the second percentile is smaller than the first value; to determine the display parameter value corresponding to the observed image as a display parameter value within a second display parameter value set if the value corresponding to the first percentile is larger than the second value; to determine the display parameter value corresponding to the observed image as a display parameter value within a third display parameter value set if the value corresponding to the first percentile is smaller than a third value and the value corresponding to the second percentile is larger than a fourth value; wherein the first value is smaller than the fourth value; the fourth value is smaller than the third value; and the third value is smaller than the second value.

图12是本申请实施例四提供的调整模块的结构示意图。如图12所示,所述调整模块904包括:第三计算子模块9041和调整子模块9042;其中,FIG12 is a schematic diagram of the structure of the adjustment module provided in the fourth embodiment of the present application. As shown in FIG12, the adjustment module 904 includes: a third calculation submodule 9041 and an adjustment submodule 9042; wherein,

所述第三计算子模块9041,用于根据所述观测图像对应的显示参数值,计算观测图像的亮度增益矩阵;The third calculation submodule 9041 is used to calculate the brightness gain matrix of the observed image according to the display parameter value corresponding to the observed image;

所述调整子模块9042,用于根据所述亮度增益矩阵对所述观测图像的亮度进行调整。The adjustment submodule 9042 is used to adjust the brightness of the observed image according to the brightness gain matrix.

进一步的,所述第三计算子模块9041,具体用于将所述观测图像从所述红绿蓝颜色空间转换为色相饱和度明度空间;使用所述观测图像对应的显示参数值对所述观测图像对应的明度通道图像的中的各个像素点的亮度进行调整;根据所述明度通道图像中的各个像素点在调整后的亮度值和在调整前的亮度值,确定出所述观测图像的亮度增益矩阵。Furthermore, the third calculation submodule 9041 is specifically used to convert the observed image from the red, green and blue color space into a hue, saturation and brightness space; use the display parameter value corresponding to the observed image to adjust the brightness of each pixel in the brightness channel image corresponding to the observed image; and determine the brightness gain matrix of the observed image based on the brightness value of each pixel in the brightness channel image after adjustment and the brightness value before adjustment.

上述图像亮度的调整装置可执行本申请任意实施例所提供的方法,具备执行方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本申请任意实施例提供的图像亮度的调整方法。The above-mentioned image brightness adjustment device can execute the method provided by any embodiment of the present application, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not fully described in this embodiment, please refer to the image brightness adjustment method provided by any embodiment of the present application.

实施例五Embodiment 5

根据本申请的实施例,本申请还提供了一种电子设备和一种可读存储介质。According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.

如图13所示,是根据本申请实施例的图像亮度的调整方法的电子设备的框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本申请的实现。As shown in Figure 13, it is a block diagram of an electronic device according to the method for adjusting the image brightness of an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and/or required herein.

如图13所示,该电子设备包括:一个或多个处理器1301、存储器1302,以及用于连接各部件的接口,包括高速接口和低速接口。各个部件利用不同的总线互相连接,并且可以被安装在公共主板上或者根据需要以其它方式安装。处理器可以对在电子设备内执行的指令进行处理,包括存储在存储器中或者存储器上以在外部输入/输出装置(诸如,耦合至接口的显示设备)上显示GUI的图形信息的指令。在其它实施方式中,若需要,可以将多个处理器和/或多条总线与多个存储器和多个存储器一起使用。同样,可以连接多个电子设备,各个设备提供部分必要的操作(例如,作为服务器阵列、一组刀片式服务器、或者多处理器系统)。图13中以一个处理器1301为例。As shown in Figure 13, the electronic device includes: one or more processors 1301, memory 1302, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input/output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and/or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). In Figure 13, a processor 1301 is taken as an example.

存储器1302即为本申请所提供的非瞬时计算机可读存储介质。其中,所述存储器存储有可由至少一个处理器执行的指令,以使所述至少一个处理器执行本申请所提供的图像亮度的调整方法。本申请的非瞬时计算机可读存储介质存储计算机指令,该计算机指令用于使计算机执行本申请所提供的图像亮度的调整方法。The memory 1302 is a non-transient computer-readable storage medium provided in the present application. The memory stores instructions executable by at least one processor to enable the at least one processor to perform the method for adjusting the image brightness provided in the present application. The non-transient computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to perform the method for adjusting the image brightness provided in the present application.

存储器1302作为一种非瞬时计算机可读存储介质,可用于存储非瞬时软件程序、非瞬时计算机可执行程序以及模块,如本申请实施例中的图像亮度的调整方法对应的程序指令/模块(例如,附图9所示的获取模块901、分离模块902、确定模块903和调整模块904)。处理器1301通过运行存储在存储器1302中的非瞬时软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述方法实施例中的图像亮度的调整方法。The memory 1302, as a non-transient computer-readable storage medium, can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions/modules corresponding to the method for adjusting the image brightness in the embodiment of the present application (for example, the acquisition module 901, separation module 902, determination module 903 and adjustment module 904 shown in FIG. 9). The processor 1301 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 1302, that is, implements the method for adjusting the image brightness in the above method embodiment.

存储器1302可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据图像亮度的调整方法的电子设备的使用所创建的数据等。此外,存储器1302可以包括高速随机存取存储器,还可以包括非瞬时存储器,例如至少一个磁盘存储器件、闪存器件、或其他非瞬时固态存储器件。在一些实施例中,存储器1302可选包括相对于处理器1301远程设置的存储器,这些远程存储器可以通过网络连接至图像亮度的调整方法的电子设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 1302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of the electronic device of the method for adjusting the image brightness, etc. In addition, the memory 1302 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 1302 may optionally include a memory remotely arranged relative to the processor 1301, and these remote memories may be connected to the electronic device of the method for adjusting the image brightness via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

图像亮度的调整方法的电子设备还可以包括:输入装置1303和输出装置1304。处理器1301、存储器1302、输入装置1303和输出装置1304可以通过总线或者其他方式连接,图13中以通过总线连接为例。The electronic device of the method for adjusting image brightness may further include: an input device 1303 and an output device 1304. The processor 1301, the memory 1302, the input device 1303 and the output device 1304 may be connected via a bus or other means, and FIG13 takes the bus connection as an example.

输入装置1303可接收输入的数字或字符信息,以及产生与图像亮度的调整方法的电子设备的用户设置以及功能控制有关的键信号输入,例如触摸屏、小键盘、鼠标、轨迹板、触摸板、指示杆、一个或者多个鼠标按钮、轨迹球、操纵杆等输入装置。输出装置1304可以包括显示设备、辅助照明装置(例如,LED)和触觉反馈装置(例如,振动电机)等。该显示设备可以包括但不限于,液晶显示器(LCD)、发光二极管(LED)显示器和等离子体显示器。在一些实施方式中,显示设备可以是触摸屏。The input device 1303 can receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device of the image brightness adjustment method, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 1304 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.

此处描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、专用ASIC(专用集成电路)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and/or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

这些计算程序(也称作程序、软件、软件应用、或者代码)包括可编程处理器的机器指令,并且可以利用高级过程和/或面向对象的编程语言、和/或汇编/机器语言来实施这些计算程序。如本文使用的,术语“机器可读介质”和“计算机可读介质”指的是用于将机器指令和/或数据提供给可编程处理器的任何计算机程序产品、设备、和/或装置(例如,磁盘、光盘、存储器、可编程逻辑装置(PLD)),包括,接收作为机器可读信号的机器指令的机器可读介质。术语“机器可读信号”指的是用于将机器指令和/或数据提供给可编程处理器的任何信号。These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and/or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and/or data to a programmable processor.

为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)、互联网和区块链网络。The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.

计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

根据本申请实施例的技术方案,先获取观测图像;然后在观测图像中分离出观测图像对应的背景图;再根据背景图确定观测图像对应的显示参数值;最后根据观测图像对应的显示参数值对观测图像的亮度进行调整。也就是说,本申请可以在观测图像对应的背景图中确定观测图像对应的显示参数值,从而可以根据观测图像对应的显示参数值对观测图像的亮度进行调整。而在现有的图像亮度的调整方法中,针对不同的观测图像使用固定的显示参数值对其进行亮度调整,不能根据观测图像本身的亮度分布智能地选择合适的显示参数值。因为本申请采用了在观测图像中分离出观测图像对应的背景图,以及根据背景图确定观测图像对应的显示参数值的技术手段,克服了现有技术中针对不同的观测图像使用固定的显示参数值对其进行亮度调整,不能根据观测图像本身的亮度分布智能地选择合适的显示参数值的技术问题,本申请提供的技术方案,可以根据观测图像本身的亮度分布智能地选择合适的显示参数值,从而使得观测图像的亮度分布更加合理;并且,本申请实施例的技术方案实现简单方便、便于普及,适用范围更广。According to the technical solution of the embodiment of the present application, the observation image is first obtained; then the background image corresponding to the observation image is separated from the observation image; then the display parameter value corresponding to the observation image is determined according to the background image; finally, the brightness of the observation image is adjusted according to the display parameter value corresponding to the observation image. That is to say, the present application can determine the display parameter value corresponding to the observation image in the background image corresponding to the observation image, so that the brightness of the observation image can be adjusted according to the display parameter value corresponding to the observation image. In the existing image brightness adjustment method, the brightness of different observation images is adjusted using a fixed display parameter value, and the appropriate display parameter value cannot be intelligently selected according to the brightness distribution of the observation image itself. Because the present application adopts the technical means of separating the background image corresponding to the observation image from the observation image, and determining the display parameter value corresponding to the observation image according to the background image, it overcomes the technical problem that the brightness of different observation images is adjusted using a fixed display parameter value in the prior art, and the appropriate display parameter value cannot be intelligently selected according to the brightness distribution of the observation image itself. The technical solution provided by the present application can intelligently select the appropriate display parameter value according to the brightness distribution of the observation image itself, so that the brightness distribution of the observation image is more reasonable; and the technical solution of the embodiment of the present application is simple and convenient to implement, easy to popularize, and has a wider range of application.

应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本申请中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本申请公开的技术方案所期望的结果,本文在此不进行限制。It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

上述具体实施方式,并不构成对本申请保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本申请的精神和原则之内所作的修改、等同替换和改进等,均应包含在本申请保护范围之内。The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims (18)

1. A method for adjusting brightness of an image, the method comprising:
obtaining an observation image; wherein the observed image is an image of red, green and blue color space;
separating a background image corresponding to the observed image from the observed image;
calculating brightness drift factors corresponding to all pixel points in the background image according to the predetermined window size and the pixel values of all pixel points in the background image; ordering the brightness drift factors corresponding to all the pixel points according to the brightness drift factors corresponding to all the pixel points in the background image; determining a value corresponding to the first percentile and a value corresponding to the second percentile in the sorted brightness drift factors; wherein the first percentile is less than the second percentile; according to the value corresponding to the first percentile and/or the distribution interval of the value corresponding to the second percentile, determining the display parameter value corresponding to the observed image;
And adjusting the brightness of the observation image according to the display parameter value corresponding to the observation image.
2. The method of claim 1, wherein separating a background map from the observed image comprises:
separating a green channel image corresponding to the observation image from the observation image;
calculating the mean value and standard deviation of each pixel point in the green channel image; wherein, the pixel point in the green channel image includes: sampling points and non-sampling points;
and separating a background image corresponding to the green channel image from the green channel image according to the mean value and standard deviation of each pixel point in the green channel image and the pixel value of each pixel point.
3. The method of claim 2, wherein the calculating the mean and standard deviation of each pixel in the green channel image comprises:
calculating the mean value and standard deviation of each sampling point in the green channel image according to the predetermined window size corresponding to each sampling point;
and calculating the mean value and the standard deviation of each non-sampling point in the green channel according to the mean value and the standard deviation of each sampling point in the green channel.
4. A method according to claim 3, characterized in that before said calculating the mean and standard deviation of the respective sampling points in the green channel image, the method further comprises:
sampling the observation image to obtain each sampling point of the observation image;
and determining the size of a window corresponding to each sampling point according to the distance between each sampling point and the center point in the observed image.
5. The method according to claim 2, wherein the separating the background image corresponding to the green channel image from the green channel image according to the mean and standard deviation of each pixel point and the pixel value of each pixel point includes:
extracting a pixel point from the pixel points in the green channel image as a current pixel point, and calculating the mahalanobis distance corresponding to the current pixel point according to the mean value and standard deviation of the current pixel point and the pixel value of the current pixel point;
if the mahalanobis distance corresponding to the current pixel point is smaller than or equal to a preset threshold value, the current pixel point is used as one pixel point in the background image corresponding to the green channel image; if the mahalanobis distance corresponding to the current pixel point is larger than the preset threshold value, the current pixel point is used as one pixel point in the foreground image corresponding to the green channel image; and repeatedly executing the operation until each pixel point in the green channel image is determined as the pixel point in the background image or the pixel point in the foreground image.
6. The method according to claim 1, wherein determining the display parameter value corresponding to the observed image for the distribution interval of the values corresponding to the first percentile and/or the values corresponding to the second percentile comprises:
if the value corresponding to the second percentile is smaller than the first value, determining the display parameter value corresponding to the observed image as one display parameter value in the first display parameter value set;
if the value corresponding to the first percentile is larger than the second value, determining the display parameter value corresponding to the observation image as one display parameter value in a second display parameter value set;
if the value corresponding to the first percentile is smaller than the third value and the value corresponding to the second percentile is larger than the fourth value, determining the display parameter value corresponding to the observed image as one display parameter value in a third display parameter value set; wherein the first value is less than the fourth value; the fourth value is less than the third value; the third value is less than the second value.
7. The method according to claim 1, wherein adjusting the brightness of the observed image according to the display parameter value corresponding to the observed image comprises:
Calculating a brightness gain matrix of the observation image according to the display parameter value corresponding to the observation image;
and adjusting the brightness of the observed image according to the brightness gain matrix.
8. The method of claim 7, wherein calculating a brightness gain matrix of the observed image based on the display parameter values corresponding to the observed image comprises:
converting the observed image from the red, green, and blue color space to a hue saturation brightness space;
adjusting the brightness of each pixel point in the brightness channel image corresponding to the observed image by using the display parameter value corresponding to the observed image;
and determining a brightness gain matrix of the observed image according to the brightness value of each pixel point in the brightness channel image after adjustment and the brightness value before adjustment.
9. An apparatus for adjusting brightness of an image, the apparatus comprising: the device comprises an acquisition module, a separation module, a determination module and an adjustment module; wherein,
the acquisition module is used for acquiring an observation image; wherein the observed image is an image of red, green and blue color space;
the separation module is used for separating a background image corresponding to the observation image from the observation image;
The determining module is used for determining a display parameter value corresponding to the observation image according to the background image; wherein the determining module comprises: the second calculation submodule and the determination submodule; the second calculation sub-module is used for calculating brightness drift factors corresponding to all pixel points in the background image according to the predetermined window size and the pixel values of all pixel points in the background image; the determination submodule is used for sequencing the brightness drift factors corresponding to all the pixel points according to the brightness drift factors corresponding to all the pixel points in the background image; determining a value corresponding to the first percentile and a value corresponding to the second percentile in the sorted brightness drift factors; wherein the first percentile is less than the second percentile; according to the value corresponding to the first percentile and/or the distribution interval of the value corresponding to the second percentile, determining the display parameter value corresponding to the observed image;
the adjusting module is used for adjusting the brightness of the observation image according to the display parameter value corresponding to the observation image.
10. The apparatus of claim 9, wherein the separation module comprises: a separation sub-module and a first calculation sub-module; wherein,
The separation submodule is used for separating a green channel image corresponding to the observation image from the observation image;
the first computing submodule is used for computing the mean value and standard deviation of each pixel point in the green channel image; wherein, the pixel point in the green channel image includes: sampling points and non-sampling points;
the separation submodule is further used for separating a background image corresponding to the green channel image from the green channel image according to the mean value and standard deviation of each pixel point in the green channel image and the pixel value of each pixel point.
11. The apparatus according to claim 10, wherein:
the first calculating submodule is specifically used for calculating the mean value and standard deviation of each sampling point in the green channel image according to the window size corresponding to each predetermined sampling point; and calculating the mean value and the standard deviation of each non-sampling point in the green channel according to the mean value and the standard deviation of each sampling point in the green channel.
12. The apparatus according to claim 11, wherein:
the determining module is further used for sampling the observation image to obtain each sampling point of the observation image; and determining the size of a window corresponding to each sampling point according to the distance between each sampling point and the center point in the observed image.
13. The apparatus according to claim 10, wherein:
the separation submodule is specifically configured to extract a pixel point from pixel points in the green channel image as a current pixel point, and calculate a mahalanobis distance corresponding to the current pixel point according to a mean value and a standard deviation of the current pixel point and a pixel value of the current pixel point; if the mahalanobis distance corresponding to the current pixel point is smaller than or equal to a preset threshold value, the current pixel point is used as one pixel point in the background image corresponding to the green channel image; if the mahalanobis distance corresponding to the current pixel point is larger than the preset threshold value, the current pixel point is used as one pixel point in the foreground image corresponding to the green channel image; and repeatedly executing the operation until each pixel point in the green channel image is determined as the pixel point in the background image or the pixel point in the foreground image.
14. The apparatus according to claim 9, wherein:
the determining submodule is specifically configured to determine a display parameter value corresponding to the observed image as one display parameter value in the first display parameter value set if the value corresponding to the second percentile is smaller than the first value; if the value corresponding to the first percentile is larger than the second value, determining the display parameter value corresponding to the observation image as one display parameter value in a second display parameter value set; if the value corresponding to the first percentile is smaller than the third value and the value corresponding to the second percentile is larger than the fourth value, determining the display parameter value corresponding to the observed image as one display parameter value in a third display parameter value set; wherein the first value is less than the fourth value; the fourth value is less than the third value; the third value is less than the second value.
15. The apparatus of claim 9, wherein the adjustment module comprises: a third calculation sub-module and an adjustment sub-module; wherein,
the third calculation sub-module is used for calculating a brightness gain matrix of the observed image according to the display parameter value corresponding to the observed image;
and the adjustment submodule is used for adjusting the brightness of the observation image according to the brightness gain matrix.
16. The apparatus according to claim 15, wherein:
the third calculation sub-module is specifically configured to convert the observed image from the red, green and blue color space to a hue saturation brightness space; adjusting the brightness of each pixel point in the brightness channel image corresponding to the observed image by using the display parameter value corresponding to the observed image; and determining a brightness gain matrix of the observed image according to the brightness value of each pixel point in the brightness channel image after adjustment and the brightness value before adjustment.
17. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
18. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-8.
CN202010568199.3A 2020-06-19 2020-06-19 Image brightness adjusting method and device, electronic equipment and storage medium Active CN111738949B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010568199.3A CN111738949B (en) 2020-06-19 2020-06-19 Image brightness adjusting method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010568199.3A CN111738949B (en) 2020-06-19 2020-06-19 Image brightness adjusting method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111738949A CN111738949A (en) 2020-10-02
CN111738949B true CN111738949B (en) 2024-04-05

Family

ID=72651857

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010568199.3A Active CN111738949B (en) 2020-06-19 2020-06-19 Image brightness adjusting method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111738949B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112991206B (en) * 2021-03-10 2023-11-10 北京百度网讯科技有限公司 Image processing method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103310422A (en) * 2013-06-28 2013-09-18 新晨易捷(北京)科技有限公司 Image acquiring method and device
CN106558031A (en) * 2016-12-02 2017-04-05 北京理工大学 A kind of image enchancing method of the colored optical fundus figure based on imaging model
CN108510473A (en) * 2018-03-09 2018-09-07 天津工业大学 The FCN retinal images blood vessel segmentations of convolution and channel weighting are separated in conjunction with depth
CN110399929A (en) * 2017-11-01 2019-11-01 腾讯科技(深圳)有限公司 Fundus image classification method, device, and computer-readable storage medium
CN110473176A (en) * 2019-07-29 2019-11-19 腾讯医疗健康(深圳)有限公司 Image processing method and device, method for processing fundus images, electronic equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7978900B2 (en) * 2008-01-18 2011-07-12 Mitek Systems, Inc. Systems for mobile image capture and processing of checks
JP6066595B2 (en) * 2011-07-29 2017-01-25 キヤノン株式会社 Fundus image processing apparatus, fundus image processing method, and program

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103310422A (en) * 2013-06-28 2013-09-18 新晨易捷(北京)科技有限公司 Image acquiring method and device
CN106558031A (en) * 2016-12-02 2017-04-05 北京理工大学 A kind of image enchancing method of the colored optical fundus figure based on imaging model
CN110399929A (en) * 2017-11-01 2019-11-01 腾讯科技(深圳)有限公司 Fundus image classification method, device, and computer-readable storage medium
CN108510473A (en) * 2018-03-09 2018-09-07 天津工业大学 The FCN retinal images blood vessel segmentations of convolution and channel weighting are separated in conjunction with depth
CN110473176A (en) * 2019-07-29 2019-11-19 腾讯医疗健康(深圳)有限公司 Image processing method and device, method for processing fundus images, electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
低光照彩色图像增强算法研究;黄丽雯;王勃;宋涛;黄俊木;;重庆理工大学学报(自然科学)(第01期);全文 *
基于背景估计和同态滤波的眼底图像归一化;易瑶;张东波;李雄;王耀南;;计算机工程(第14期);全文 *

Also Published As

Publication number Publication date
CN111738949A (en) 2020-10-02

Similar Documents

Publication Publication Date Title
CN108520504B (en) End-to-end blurred image blind restoration method based on generation countermeasure network
US20230215132A1 (en) Method for generating relighted image and electronic device
US11727543B2 (en) Systems and methods for content-aware enhancement of images
JP5440241B2 (en) Image enhancement device, image enhancement method, and image enhancement program
WO2023273340A1 (en) Method and apparatus for generating relighting image, and electronic device
JP2017517818A (en) Method and system for processing the color of a digital image
CN110473176B (en) Image processing method and device, fundus image processing method and electronic equipment
CN112541924B (en) Fundus image generation method, device, equipment and storage medium
CN114529946A (en) Pedestrian re-identification method, device, equipment and storage medium based on self-supervision learning
CN112328345A (en) Method and device for determining theme color, electronic equipment and readable storage medium
CN117793538B (en) Automatic image exposure correction and enhancement method and device
CN110473152A (en) Based on the image enchancing method for improving Retinex algorithm
CN114581318A (en) Method and system for image enhancement with low illumination
CN109616080B (en) A special-shaped screen contour compensation method and terminal
CN114266803A (en) Image processing method, image processing device, electronic equipment and storage medium
CN111738949B (en) Image brightness adjusting method and device, electronic equipment and storage medium
CN113870142B (en) Method and device for enhancing image contrast
CN116468636A (en) Low illumination enhancement method, device, electronic device and readable storage medium
CN111739008B (en) Image processing method, device, equipment and readable storage medium
CN115775215A (en) Image processing method, device, electronic device and storage medium
CN112150461B (en) Methods and devices for assessing head-to-tail clarity of cell images
Han et al. Low brightness PCB image enhancement algorithm for FPGA
CN108564534A (en) A kind of picture contrast method of adjustment based on retrieval
CN118195978A (en) Image enhancement method under low illumination scene
CN112288697A (en) Method and device for quantifying degree of abnormality, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant