[go: up one dir, main page]

CN108805834A - A kind of image processing algorithm that endoscope is with an automatic light meter - Google Patents

A kind of image processing algorithm that endoscope is with an automatic light meter Download PDF

Info

Publication number
CN108805834A
CN108805834A CN201810535122.9A CN201810535122A CN108805834A CN 108805834 A CN108805834 A CN 108805834A CN 201810535122 A CN201810535122 A CN 201810535122A CN 108805834 A CN108805834 A CN 108805834A
Authority
CN
China
Prior art keywords
image
integration
endoscope
gamma
coms
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.)
Pending
Application number
CN201810535122.9A
Other languages
Chinese (zh)
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.)
University of Electronic Science and Technology of China
Original Assignee
University of Electronic Science and Technology of China
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 University of Electronic Science and Technology of China filed Critical University of Electronic Science and Technology of China
Priority to CN201810535122.9A priority Critical patent/CN108805834A/en
Publication of CN108805834A publication Critical patent/CN108805834A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/70Circuitry for compensating brightness variation in the scene
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/70Circuitry for compensating brightness variation in the scene
    • H04N23/76Circuitry for compensating brightness variation in the scene by influencing the image signals

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Endoscopes (AREA)

Abstract

The present invention relates to image processing fields, in particular disclose a kind of image processing algorithm that endoscope is with an automatic light meter.When the stick mirror of endoscope is too close to object observing or too far away from object observing, image will appear overexposure, or deficient the case where exposing.The value of the time of integration can be adjusted in real time by the way that the time of integration of COMS in endoscope is substituted into corresponding Gamma functions, and then changes the brightness of image, realize light modulation in real time.

Description

一种内窥镜自动调光的图像处理算法An Image Processing Algorithm for Automatic Light Adjustment of Endoscope

技术领域technical field

本发明涉及图像处理技术领域,尤其涉及一种内窥镜自动调光的图像处理方法。The invention relates to the technical field of image processing, in particular to an image processing method for automatic light adjustment of an endoscope.

技术背景technical background

在医生使用内窥镜观察病人体内状况时,由于内窥镜前端的棒镜需要不停的移动,光源距离人体内部组织的距离忽远忽近,且有些人体组织内部区域会反光,所以医生在外部屏幕上看到的图像可能会过曝或者欠曝。影响医生对于病人的诊断。为了防止此类事情的发生,一般采用自动调光的方法。当画面过亮时系统通过串口向COMS发送指令,把对应积分时间的参数调大,反之,当画面过暗时系统通知COMS调小对应积分时间的参数。When a doctor uses an endoscope to observe the internal conditions of a patient, because the rod mirror at the front end of the endoscope needs to move constantly, the distance between the light source and the internal tissues of the human body fluctuates, and some internal areas of human tissues reflect light, so the doctor The image seen on the external screen may be overexposed or underexposed. affect the doctor's diagnosis of the patient. In order to prevent such things from happening, the method of automatic dimming is generally adopted. When the screen is too bright, the system sends an instruction to COMS through the serial port to increase the parameter corresponding to the integration time. On the contrary, when the screen is too dark, the system notifies COMS to decrease the parameter corresponding to the integration time.

发明内容Contents of the invention

本发明为了解决由于内窥镜棒镜过于靠近或远离观察目标时,会出现过曝或欠曝的情况,影响医生的诊断的问题,提供了一种在自动调光的图像处理算法,能够实现自动调光,消除过曝欠曝的情况,获得高质量的图像。In order to solve the problem that when the rod scope of the endoscope is too close to or far away from the observation target, there will be overexposure or underexposure, which will affect the doctor’s diagnosis, and provides an image processing algorithm for automatic light adjustment, which can realize Automatically adjust light to eliminate overexposure and underexposure and obtain high-quality images.

为解决上述技术问题,本发明采用的一个技术方案是:In order to solve the problems of the technologies described above, a technical solution adopted in the present invention is:

一种内窥镜自动调光的图像处理方法,包括如下内容:An image processing method for automatic light adjustment of an endoscope, comprising the following content:

把内窥镜采集到的每一帧RGB图像转换为YUV图像,转换公式如下:Convert each frame of RGB image collected by the endoscope into a YUV image, the conversion formula is as follows:

从YUV图像中提取Y分量即亮度分量,通过多线程进行处理,一路线程显示,一路线程改变积分时间;Extract the Y component, that is, the brightness component, from the YUV image, and process it through multi-threading. One thread displays, and one thread changes the integration time;

判断Y分量中过曝或欠曝的像素是否超过限定值,如果超过则将对应这一帧图像的COMS的积分时间代入到对应参数的Gamma函数并对Gamma变换后的值进行归一化从而改变积分时间,如果未超过则不改变。本文采用的SONY IMX236LLJ-C型COMS积分时间范围为0x0000-0x0465,转换为十进制为0-1125。当积分时间为0时图像最亮,当积分时间为1125时图像最暗。当需要调暗时,对每个像素值进行如下Gamma变换:Determine whether the overexposed or underexposed pixels in the Y component exceed the limit value. If it exceeds, substitute the integration time of COMS corresponding to this frame of image into the Gamma function of the corresponding parameter and normalize the value after Gamma transformation to change Integral time, unchanged if not exceeded. The SONY IMX236LLJ-C type COMS integration time range used in this article is 0x0000-0x0465, which is converted to 0-1125 in decimal. The image is the brightest when the integration time is 0, and the image is the darkest when the integration time is 1125. When dimming is required, the following Gamma transformation is performed on each pixel value:

s=r0.4 s=r 0.4

其中为r为输入像素值,s为输出像素值,Gamma参数为0.4。当需要调亮时,对每个像素值进行如下Gamma变换:Among them, r is the input pixel value, s is the output pixel value, and the Gamma parameter is 0.4. When brightening is required, the following Gamma transformation is performed on each pixel value:

s=r2.5 s=r 2.5

其中Gamma参数为2.5。在进行完Gamma变换后需要进行归一化处理,把处理后的像素值归一化到0-1125之间,最后通过串口发送给COMS。The Gamma parameter is 2.5. After the Gamma transformation, normalization processing is required, and the processed pixel values are normalized to 0-1125, and finally sent to COMS through the serial port.

本发明的有益效果是:区别于现有技术的情况:The beneficial effect of the present invention is: be different from the situation of prior art:

由于在该内窥镜自动调光的图像处理方法中,首先把内窥镜采集到的RGB图像转化为YUV图像,通过多线程把Y分量提取出来,这样在改变亮度的情况下不影响图像的正常显示。接着判断图像的亮度分量中过曝或欠曝的像素是否超标,若没有超标,则不改变COMS积分时间,若是超标,则通过Gamma变化和归一化改变COMS的积分时间,进而改变图像的亮度,去除过曝和欠曝的情况,获得良好的视频图像。In the image processing method for automatic dimming of the endoscope, the RGB image collected by the endoscope is first converted into a YUV image, and the Y component is extracted through multi-threading, so that the brightness of the image will not be affected when changing the brightness. normal display. Then determine whether the overexposed or underexposed pixels in the brightness component of the image exceed the standard. If not, the COMS integration time will not be changed. If it exceeds the standard, the COMS integration time will be changed through Gamma change and normalization, and then the brightness of the image will be changed. , remove overexposure and underexposure, and obtain a good video image.

附图说明Description of drawings

图1为本发明实施例中内窥镜自动调光图像处理方法的步骤流程示意图;Fig. 1 is a schematic flow chart of the steps of an endoscope automatic dimming image processing method in an embodiment of the present invention;

图2为采用的Gamma变换归一化曲线;Fig. 2 is the Gamma transformation normalization curve adopted;

图3为本发明实施例中选取的一张过曝图片;Fig. 3 is an overexposure picture selected in the embodiment of the present invention;

图4为本发明实例中对图3自动调光后的图片;Fig. 4 is the picture after the automatic dimming of Fig. 3 in the example of the present invention;

具体实施方式Detailed ways

本发明为了解决医生在诊断过程中内窥镜出现的图像过曝或者欠曝,影响图像质量的技术问题,提供了一种内窥镜自动调光的图像处理方法,能够去除过曝和欠曝带来的影响,获得高高质量的视频图像。In order to solve the technical problem that the over-exposure or under-exposure of the image in the endoscope during the diagnosis process of the doctor affects the image quality, the present invention provides an image processing method for automatic light adjustment of the endoscope, which can remove the over-exposure and under-exposure Bring the effect to get high quality video images.

为了更好的理解本发明的技术方案,下面将结合说明书附图以及具体的实施方式对本发明技术方案进行详细的说明。In order to better understand the technical solution of the present invention, the technical solution of the present invention will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

本发明实施例提供的一种内窥镜自动调光的图像处理方法,如图1-图3所示,包括:S101,内窥镜采集到RGB图像信号;S102,把采集到的RGB信号通过一路线程输出显示;S103,把采集到的线程转换为YUV格式;S104,把YUV格式中的Y分量即亮度分量通过另一路线程提取;S105,判断Y分量是否存在过曝或者欠曝的情况;S106,如果没有过曝的情况就不改变COMS的积分时间;S107,如果出现过曝或者欠曝的情况,把当时的积分时间值带入Gamma变换中计算出新的积分时间值;S108,对新的积分时间值进行归一化处理,发送给COMS。An image processing method for automatic dimming of an endoscope provided in an embodiment of the present invention, as shown in FIGS. 1-3 , includes: S101, the endoscope collects RGB image signals; One thread output display; S103, convert the collected thread into YUV format; S104, extract the Y component in the YUV format, that is, the brightness component, through another thread; S105, judge whether the Y component is overexposed or underexposed; S106, if there is no overexposure, do not change the integration time of COMS; S107, if overexposure or underexposure occurs, bring the current integration time value into the Gamma transformation to calculate a new integration time value; S108, for The new integration time value is normalized and sent to COMS.

具体的实施方式如下:The specific implementation is as follows:

第一步,内窥镜的图像通过COMS采集传输到后端,格式为RGB格式,并通过一路线程输出显示。In the first step, the image of the endoscope is collected and transmitted to the backend through COMS, the format is RGB format, and output and displayed through one thread.

第二步,把采集到的RGB格式转换为YUV格式,转换的公式如下:The second step is to convert the collected RGB format into YUV format. The conversion formula is as follows:

第三步,把得到的YUV图像通过一路线程提取出来,进行处理。The third step is to extract the obtained YUV image through one thread and process it.

第四步,判断提取出来的Y分量是否存在过曝和欠曝的情况。如果不存在,则不改变积分时间,若存在则统计每一个像素值,判断是否像素值处于40-200之间,如果高于80%的像素处于区间之内则判断图像正常,不需要改变积分时间,如果低于80%则进一步判断低于40的像素比例与高于200的像素比例那个大,若低于40的像素比例大即为欠曝则需要通过Gamma变换调低COMS积分时间即增加亮度,若高于200的像素比例大即为过曝则需要通过Gamma变换调高COMS积分时间即减小亮度。The fourth step is to judge whether the extracted Y component is over-exposed or under-exposed. If it does not exist, do not change the integration time. If it exists, count each pixel value to determine whether the pixel value is between 40-200. If more than 80% of the pixels are within the interval, it is judged that the image is normal and there is no need to change the integration Time, if it is lower than 80%, further judge the ratio of pixels lower than 40 and higher than 200, which is larger, if the ratio of pixels lower than 40 is larger, it means underexposure, and you need to reduce the COMS integration time through Gamma transformation to increase Brightness, if the proportion of pixels higher than 200 is large, it means overexposure, and you need to increase the COMS integration time through Gamma transformation to reduce the brightness.

第五步,本文采用的SONY IMX236LLJ-C型COMS积分时间范围为0x0000-0x0465,转换为十进制为0-1125。当积分时间为0时图像最亮,当积分时间为1125时图像最暗。当需要调暗时,对每个像素值进行如下Gamma变换:In the fifth step, the SONY IMX236LLJ-C type COMS integration time range used in this article is 0x0000-0x0465, which is converted to 0-1125 in decimal. The image is the brightest when the integration time is 0, and the image is the darkest when the integration time is 1125. When dimming is required, the following Gamma transformation is performed on each pixel value:

s=r0.4 s=r 0.4

其中为r为输入像素值,s为输出像素值,Gamma参数为0.4。当需要调亮时,对每个像素值进行如下Gamma变换:Among them, r is the input pixel value, s is the output pixel value, and the Gamma parameter is 0.4. When brightening is required, the following Gamma transformation is performed on each pixel value:

s=r2.5 s=r 2.5

其中Gamma参数为2.5。在进行完Gamma变换后需要进行归一化处理,把处理后的像素值归一化到0-1125之间,最后通过串口发送给COMS。The Gamma parameter is 2.5. After the Gamma transformation, normalization processing is required, and the processed pixel values are normalized to 0-1125, and finally sent to COMS through the serial port.

通过上述的方案,能够有效消过曝和欠曝的情况,获得高质量的视频图像。Through the above solution, overexposure and underexposure can be effectively eliminated, and high-quality video images can be obtained.

以上所述仅为本发明实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above is only an embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process conversion made by using the description of the present invention and the contents of the accompanying drawings, or directly or indirectly used in other related technical fields , are all included in the scope of patent protection of the present invention in the same way.

Claims (4)

1. a kind of image processing algorithm that endoscope is with an automatic light meter, which is characterized in that including following content:
The collected each frame RGB image of endoscope is converted to YUV image, conversion formula is as follows:
Y-component, that is, luminance component is extracted from YUV image, is handled by multithreading, all the way thread display, thread changes all the way Become the time of integration;
Judge overexposure in Y-component or owe whether the pixel exposed is more than limit value, if it exceeds then by this corresponding frame image The time of integration of COMS is updated to the Gamma functions of corresponding parameter and is normalized to change to the value after Gamma transformation The time of integration does not change if being less than.
2. endoscope image processing method with an automatic light meter according to claim 1, which is characterized in that mutual not shadow between thread It rings, is exported not interfering with image during thus with an automatic light meter by the change time of integration, image shows to be not in prolong Late.
3. endoscope image processing method with an automatic light meter according to claim 1, which is characterized in that count each pixel Value, judges whether that pixel value is between 40-200, judges that image is normal if the pixel higher than 80% is within section, The time of integration is had no need to change, the pixel ratio less than 40 and the pixel ratio higher than 200 are further judged if less than 80% That is big for example, if the pixel ratio less than 40 greatly if the COMS times of integration turned down by Gamma transformation increase brightness, if being higher than 200 pixel ratio is then converted by Gamma the i.e. reduction brightness of the COMS times of integration is turned up greatly.
4. endoscope image processing method with an automatic light meter according to claim 1, which is characterized in that the SONY used herein The IMX236LLJ-C type COMS times of integration ranging from 0x0000-0x0465, it is 0-1125 to be converted to the decimal system.Work as the time of integration Image is most bright when being 0, and when the time of integration is 1125, image is most dark.When needing to dim, each pixel value is carried out as follows Gamma is converted:
S=r0.4
Wherein be r it is input pixel value, s is output pixel value, and Gamma parameters are 0.4.When needing to lighten, to each pixel Value carries out following Gamma transformation:
S=r2.5
Wherein Gamma parameters are 2.5.It needs to be normalized after having carried out Gamma transformation, treated pixel value It normalizes between 0-1125, COMS is sent to finally by serial ports.
CN201810535122.9A 2018-05-28 2018-05-28 A kind of image processing algorithm that endoscope is with an automatic light meter Pending CN108805834A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810535122.9A CN108805834A (en) 2018-05-28 2018-05-28 A kind of image processing algorithm that endoscope is with an automatic light meter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810535122.9A CN108805834A (en) 2018-05-28 2018-05-28 A kind of image processing algorithm that endoscope is with an automatic light meter

Publications (1)

Publication Number Publication Date
CN108805834A true CN108805834A (en) 2018-11-13

Family

ID=64089322

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810535122.9A Pending CN108805834A (en) 2018-05-28 2018-05-28 A kind of image processing algorithm that endoscope is with an automatic light meter

Country Status (1)

Country Link
CN (1) CN108805834A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021147500A1 (en) * 2020-01-23 2021-07-29 腾讯科技(深圳)有限公司 Endoscope image processing method and apparatus, and electronic device and storage medium
CN115002355A (en) * 2022-07-01 2022-09-02 重庆金山医疗技术研究院有限公司 Image shooting parameter adjusting method and device and capsule type endoscope

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090051794A1 (en) * 2005-03-15 2009-02-26 Omron Corporation Image processing apparatus, image processing method, image processing system, program and recording medium
CN103489160A (en) * 2013-09-06 2014-01-01 深圳先进技术研究院 CMOS sensing image visibility enhancing algorithm
CN104580923A (en) * 2014-12-30 2015-04-29 重庆金山科技(集团)有限公司 Exposure device and exposure method for electronic endoscope
CN105894536A (en) * 2016-03-30 2016-08-24 中国农业大学 Method and system for analyzing livestock behaviors on the basis of video tracking
CN107231530A (en) * 2017-06-22 2017-10-03 维沃移动通信有限公司 A kind of photographic method and mobile terminal
CN107590791A (en) * 2017-09-22 2018-01-16 深圳市华星光电半导体显示技术有限公司 Image enchancing method and image processing apparatus
CN107907223A (en) * 2017-11-14 2018-04-13 电子科技大学 A kind of image processing method for removing sunlight and disturbing train wheel thermography

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090051794A1 (en) * 2005-03-15 2009-02-26 Omron Corporation Image processing apparatus, image processing method, image processing system, program and recording medium
CN103489160A (en) * 2013-09-06 2014-01-01 深圳先进技术研究院 CMOS sensing image visibility enhancing algorithm
CN104580923A (en) * 2014-12-30 2015-04-29 重庆金山科技(集团)有限公司 Exposure device and exposure method for electronic endoscope
CN105894536A (en) * 2016-03-30 2016-08-24 中国农业大学 Method and system for analyzing livestock behaviors on the basis of video tracking
CN107231530A (en) * 2017-06-22 2017-10-03 维沃移动通信有限公司 A kind of photographic method and mobile terminal
CN107590791A (en) * 2017-09-22 2018-01-16 深圳市华星光电半导体显示技术有限公司 Image enchancing method and image processing apparatus
CN107907223A (en) * 2017-11-14 2018-04-13 电子科技大学 A kind of image processing method for removing sunlight and disturbing train wheel thermography

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
ZOHAIR AL-AMEEN ET AL: "An innovative technique for contrast enhancement of computed tomography images using normalized gamma-corrected contrast-limited adaptive histogram equalization", 《EURASIP JOURNAL ON ADVANCES IN SIGNAL PROCESSING VOLUME》 *
胡晓东: "基于积分时间和增益可调的CMOS驱动设计", 《科学技术与工程》 *
胡濒等: "一种基于多线程技术的并行FFVr算法", 《天津工业大学学报》 *
苏宏武等: "基于平均和峰值灰度加权的自动调光系统", 《光子学报》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021147500A1 (en) * 2020-01-23 2021-07-29 腾讯科技(深圳)有限公司 Endoscope image processing method and apparatus, and electronic device and storage medium
US12315144B2 (en) 2020-01-23 2025-05-27 Tencent Technology (Shenzhen) Company Limited Endoscopic image processing method and apparatus, electronic device, and storage medium
CN115002355A (en) * 2022-07-01 2022-09-02 重庆金山医疗技术研究院有限公司 Image shooting parameter adjusting method and device and capsule type endoscope

Similar Documents

Publication Publication Date Title
CN105578068B (en) A kind of generation method of high dynamic range images, device and mobile terminal
JP6111336B2 (en) Image processing method and apparatus
CN108650473B (en) Method and system for automatically adjusting brightness of endoscope L ED lamp
WO2013157201A1 (en) Image processing device, image processing method, program, and storage medium
CN108616689B (en) Portrait-based high dynamic range image acquisition method, device and equipment
JP2012109900A (en) Photographing device, photographing method and program
CN108337446B (en) High dynamic range image acquisition method, device and equipment based on double cameras
CN102970916A (en) Endoscope device and method for controlling endoscope device
JP2008048251A (en) Photographing apparatus and photographing method
CN101404728A (en) Digital image exposure regulation method and apparatus
CN108805834A (en) A kind of image processing algorithm that endoscope is with an automatic light meter
US11936989B2 (en) Apparatuses, systems, and methods for gaze-based auto-exposure management of image frames
JP2008206111A (en) Photographing apparatus and photographing method
CN108668090B (en) Optical apparatus and automatic exposure method thereof
CN116055893A (en) Image brightness adjusting method, light adjusting device and endoscope
JP4796557B2 (en) Imaging device
CN115813314A (en) Image brightness adjusting method, light adjusting device and endoscope
CN112566539B (en) Medical control device and medical observation device
US20230255460A1 (en) Image processing apparatus and image processing method
US12211240B2 (en) Apparatuses, systems, and methods for managing auto-exposure of image frames based on signal region size
JP4459506B2 (en) Automatic dimming device for endoscope and electronic endoscope device
CN118200746A (en) Image stitching method and device
JP6893068B1 (en) Image processing method
CN109102481B (en) Automatic wide dynamic processing algorithm based on illumination analysis
CN116437221B (en) Method and system for intercepting endoscope video image

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
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20181113