Image metering exposure processing method, system, terminal device and storage medium
By calculating the partition brightness and adjusting the exposure parameters of the endoscopic image sensor, the problem of underexposure or overexposure of endoscopic images is solved, and the image detail presentation and diagnostic efficiency are improved.
Patent Information
- Application Number
- CN202310196664.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2043-02-23
AI Technical Summary
Existing endoscopes are prone to underexposure or overexposure when using global or local window metering, resulting in indistinguishable image details.
By partitioning the image output by the endoscope image sensor, the brightness data of each sub-image is calculated, and the exposure parameters are adjusted according to this data to ensure that the overall brightness of the image is within a preset range.
The exposure effect of endoscope-collected images is improved, the presentation of image details is enhanced, and the diagnostic efficiency is improved.
Smart Images

Figure CN116366985B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of endoscopes, and in particular to an image photometry exposure processing method, system, terminal device and storage medium. Background Art
[0002] Automatic exposure technology is widely used in the camera field. To achieve automatic exposure, a metering algorithm must first be used to evaluate the brightness of the current image. Common metering algorithms include global average metering, local window metering, and multi-spot metering.
[0003] Generally speaking, for different shooting scenarios, we need to manually select different metering methods based on the current scene to achieve the best shooting effect. When using an endoscope, we often encounter scenes where human mucous membranes reflect light. When there is reflection, metering based on the global or local window often causes the target to be too bright or too dark, making it difficult to distinguish details in the picture. Summary of the Invention
[0004] The main technical problem solved by the present invention is that the image sensor of the existing endoscope adopts a global or local window to measure light when in use, resulting in the problem of underexposure or overexposure.
[0005] According to a first aspect, an embodiment provides an image metering exposure processing method, comprising:
[0006] Obtain image information output by the image sensor of the endoscope and obtain an original image corresponding to the current frame;
[0007] The original image is partitioned to obtain multiple sub-images. The resolution of each sub-image is the same. The number of sub-images is x×y, and the resolution of the sub-image is am×bn. x, y, m, and n are all positive integers, and a and b are positive integers greater than or equal to 2.
[0008] Perform brightness calculation on the sub-images to obtain first brightness data Y1 corresponding to each sub-image, where the number of first brightness data Y1 is x×y;
[0009] Calculate the third brightness data Y3 of the original image according to the x×y first brightness data Y1;
[0010] Determining whether the third brightness data Y3 satisfies a preset brightness range; if the third brightness data Y3 satisfies the preset brightness range, it indicates that the exposure parameters of the image sensor are reasonable;
[0011] When the third brightness data Y3 is less than the minimum value of the preset brightness range, the brightness of the sub-image corresponding to the maximum value of the first brightness data Y1 is lowered, and the exposure time or gain of the original image is increased to increase the third brightness data Y3 of the original image to within the preset brightness range;
[0012] When the third brightness data Y3 is greater than the maximum value of the preset brightness range, the exposure time or gain of the original image is reduced so that the third brightness data Y3 of the original image is reduced to within the preset brightness range.
[0013] In one embodiment, before calculating the third brightness data Y3 of the original image based on the x×y first brightness data Y1, the method further includes:
[0014] All first brightness data Y1 are sorted by size, and the exposure upper limit of the image sensor is adjusted according to the maximum value in the first brightness data Y1 so that the exposure upper limit is equal to the maximum value Y1max in the first brightness data Y1; and the first brightness data Y1 after the exposure upper limit adjustment is obtained.
[0015] In one embodiment, after calculating the third brightness data Y3 of the original image based on the x×y first brightness data Y1, and the third brightness data Y3 satisfies a preset brightness range, the method further includes:
[0016] Compare the first brightness data Y1 of each sub-image with the third brightness data Y3 of the original image, and adjust the brightness of the sub-image according to the magnitude relationship between the first brightness data Y1 and the third brightness data Y3;
[0017] When the first brightness data Y1 is less than the third brightness data Y3, the brightness of the sub-image is increased; when the first brightness data Y1 is greater than the third brightness data Y3, the brightness of the sub-image is decreased;
[0018] The brightness relationship between all sub-images after brightness adjustment remains consistent with the brightness relationship before brightness adjustment, and the difference between the third brightness data after brightness adjustment and the third brightness data before brightness adjustment satisfies a preset difference range.
[0019] In one embodiment, performing brightness calculation on the sub-images to obtain first brightness data Y1 corresponding to each sub-image includes:
[0020] Calculate the second brightness data Y2 of each pixel area consisting of a×b pixels in the sub-image according to the color filter array of the original image, and obtain m×n second brightness data Y2 corresponding to one sub-image;
[0021] The first brightness data Y1 of the sub-image is calculated based on the m×n second brightness data Y2.
[0022] In one embodiment, the image sensor is a CMOS sensor or a CCD sensor, and the original image is a RAW image;
[0023] Calculating the second brightness data Y2 of each pixel area consisting of a×b pixels in the sub-image according to the color filter array of the original image includes:
[0024] The second brightness data Y2 is calculated using the following formula:
[0025] Y2=0.299×R+0.587×(Gr+Gb) / 2+0.114×B;
[0026] Among them, R represents the red pixel value in the color filter array, Gr represents the green pixel value adjacent to the red pixel in the same row, B represents the blue pixel value in the color filter array, and Gb represents the green pixel value adjacent to the blue pixel in the same row.
[0027] In one embodiment, calculating the first brightness data Y1 of the sub-image based on the m×n second brightness data Y2 includes:
[0028] A second average value of the m×n second brightness data Y2 is calculated, and the second average value is used as the first brightness data Y1 of the sub-image.
[0029] In one embodiment, calculating the third brightness data Y3 of the original image based on the x×y first brightness data Y1 includes:
[0030] A first average value of the x×y first brightness data Y1 is calculated, and the first average value is used as the third brightness data Y3 of the original image.
[0031] According to a second aspect, an embodiment provides an image metering exposure processing system, comprising:
[0032] An image acquisition module is used to obtain image information output by the image sensor of the endoscope and obtain an original image corresponding to the current frame;
[0033] A partitioned photometry module is configured to partition an original image to obtain a plurality of sub-images, each having the same resolution. The number of sub-images is x×y, and the resolution of the sub-images is am×bn, where x, y, m, and n are all positive integers, and a and b are positive integers greater than or equal to 2. The module also performs brightness calculation on the sub-images to obtain first brightness data Y1 corresponding to each sub-image, where the number of first brightness data Y1 is x×y.
[0034] An exposure processing module; used to calculate the third brightness data Y3 of the original image based on x×y first brightness data Y1; determine whether the third brightness data Y3 meets the preset brightness range; when the third brightness data Y3 meets the preset brightness range, it indicates that the exposure parameters of the image sensor are reasonable; when the third brightness data Y3 is less than the minimum value of the preset brightness range, the brightness of the sub-image corresponding to the maximum value of the first brightness data Y1 is lowered, and the exposure time or gain of the original image is increased to increase the third brightness data Y3 of the original image to within the preset brightness range; when the third brightness data Y3 is greater than the maximum value of the preset brightness range, the exposure time or gain of the original image is reduced to reduce the third brightness data Y3 of the original image to within the preset brightness range.
[0035] According to the third aspect, an embodiment provides a terminal device, including:
[0036] Memory, used to store programs;
[0037] A processor is configured to implement the method described in the first aspect by executing the program stored in the memory.
[0038] According to a fourth aspect, an embodiment provides a computer-readable storage medium, on which a program is stored. The program can be executed by a processor to implement the method described in the first aspect.
[0039] According to the image metering exposure processing method, system, terminal device and storage medium of the above-mentioned embodiment, by partitioning and calculating the brightness of each frame of the original image, a third brightness data for evaluating the current brightness of the original image is obtained. Based on the comparison between the third brightness data and the preset brightness range, real-time adjustments are made to the image for reflections, excessive darkness or excessive brightness, so that the details of the image captured by the endoscope are well presented, solving the problem of underexposure or overexposure. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 Flowchart (1) of an image metering exposure processing method provided in one embodiment of the present application;
[0041] Figure 2 A schematic structural diagram of an image metering and exposure processing system provided in one embodiment of the present application;
[0042] Figure 3 A schematic diagram of an original image and a sub-image provided in one embodiment of the present application;
[0043] Figure 4 A schematic diagram of a sub-image and a pixel area provided in one embodiment of the present application;
[0044] Figure 5Flowchart (II) of an image metering exposure processing method provided in one embodiment of the present application;
[0045] Figure 6 A schematic diagram of the effects of an original image and the original image after exposure processing provided in one embodiment of the present application.
[0046] Reference numerals: 10 - image acquisition module; 20 - partitioned light metering module; 30 - exposure processing module. DETAILED DESCRIPTION
[0047] The present invention will be further described in detail below by means of specific embodiments in conjunction with the accompanying drawings. Similar elements in different embodiments are numbered with associated similar elements. In the following embodiments, many detailed descriptions are provided to enable the present application to be better understood. However, those skilled in the art will readily appreciate that some of the features may be omitted in different circumstances, or may be replaced by other elements, materials, or methods. In some cases, some operations related to the present application are not shown or described in the specification. This is to avoid the core portion of the present application being overwhelmed by excessive descriptions, and for those skilled in the art, it is not necessary to describe these related operations in detail. They will fully understand the related operations based on the description in the specification and the general technical knowledge in the art.
[0048] In addition, the features, operations, or characteristics described in the specification may be combined in any appropriate manner to form various embodiments. Furthermore, the steps or actions in the method description may be reordered or adjusted in a manner readily apparent to those skilled in the art. Therefore, the various sequences in the specification and drawings are provided solely for the purpose of clearly describing a particular embodiment and are not intended to be mandatory, unless otherwise specified.
[0049] The serial numbers assigned to components herein, such as "first," "second," etc., are used solely to distinguish the objects being described and do not convey any sequential or technical meaning. References to "connection" and "coupling" herein, unless otherwise specified, include both direct and indirect connections (couplings).
[0050] In the field of endoscopy technology, an endoscope needs to be placed inside the body to acquire images, relying on the endoscope's light source for illumination. Due to the limitations of the endoscope's operating environment and light source, the captured images often suffer from local reflections or overall underexposure resulting in overall darkness or overexposure resulting in overall brightness. It is difficult to observe the details of the area to be treated in real-time captured images, and it is difficult for users to quickly make a diagnosis by observing the images.
[0051] The applicant's research found that most existing endoscopes use existing photometric algorithms for automatic exposure and overall image exposure. However, based on the environment in which the endoscope is used, the image quality obtained by this automatic exposure method is poor. In order to improve the efficiency of endoscopic diagnosis, it is necessary to improve the photometric algorithm (that is, how to evaluate the brightness of the image).
[0052] In an embodiment of the present application, the applicant has discovered through research that the original image can be partitioned and the partition brightness calculated, and the third brightness data Y3 of the original image can be calculated based on the first brightness data Y1 of each partition (sub-image). The brightness evaluation takes into account the brightness of each partition, so as to adjust the exposure parameters and obtain an image with more appropriate brightness. The image can show more details and improve the efficiency of endoscopic diagnosis.
[0053] like Figure 1 As shown, an embodiment of the present application provides an image metering exposure processing system, which may include an image acquisition module 10, a partitioned metering module 20, and an exposure processing module 30. Each of the above modules may be a functional module implemented by a processing chip, or multiple modules may be implemented by the same processing chip.
[0054] The image acquisition module 10 is used to acquire image information output by the endoscope's image sensor and obtain a raw image corresponding to the current frame. The image acquisition module 10 is electrically connected to the endoscope's image sensor, acquires image information output by the endoscope, and transmits the raw image corresponding to each frame to the zoned photometry module 20. The specific hardware form of the image acquisition module 10 can be adapted to the model of the endoscope's image sensor.
[0055] The partitioned photometry module 20 is used to partition the original image to obtain multiple sub-images, each of which has the same resolution. The number of sub-images is x×y, and the resolution of the sub-image is am×bn, where x, y, m, and n are all positive integers, and a and b are positive integers greater than or equal to 2; the brightness of the sub-images is calculated to obtain the first brightness data Y1 corresponding to each sub-image, and the number of first brightness data Y1 is x×y. In the embodiment of the present application, a=2 and b=2 are used as an example, but other implementation forms are not limited. The partitioned photometry module 20 performs brightness calculation (photometry) on each sub-image to obtain multiple first brightness data Y1 for providing more dimensional weight considerations for the overall photometry of the original image, so that the overall photometry of the original image is more in line with the endoscope usage scenario, and ultimately the exposure effect is better.
[0056] The exposure processing module 30 is configured to calculate third brightness data Y3 of the original image according to the x×y first brightness data Y1 , and determine whether the third brightness data Y3 meets a preset brightness range.
[0057] When the third brightness data Y3 meets the preset brightness range, it indicates that the exposure parameters of the image sensor are reasonable. The specific preset brightness range can be adjusted according to the observation needs of the endoscope or the requirements of the display device. This application does not limit the specific range.
[0058] When the third brightness data Y3 is less than the minimum value of the preset brightness range, the brightness of the sub-image corresponding to the maximum value Y1max of the first brightness data Y1 is lowered, and the exposure time or gain of the original image is increased to bring the third brightness data Y3 of the original image within the preset brightness range. When the third brightness data Y3 is less than the minimum value of the preset brightness range, it indicates that the overall image brightness is insufficient and some areas are reflective. Therefore, on the one hand, the overall image brightness needs to be increased, and on the other hand, the brightness of the reflective areas needs to be adjusted. After the adjustment is completed, the third brightness data Y3 of the image is recalculated and compared with the preset brightness range again until the third brightness data Y3 meets the preset brightness range.
[0059] When the third brightness data Y3 exceeds the maximum value of the preset brightness range, the exposure time or gain of the original image is reduced to bring the third brightness data Y3 of the original image down to within the preset brightness range. When the third brightness data Y3 exceeds the maximum value of the preset brightness range, it indicates that the overall image brightness is too high and needs to be adjusted down. After the adjustment, the third brightness data Y3 of the image is recalculated and compared with the preset brightness range again until the third brightness data Y3 meets the preset brightness range.
[0060] The following describes the specific process of the image metering exposure processing method of the image metering exposure processing system. Figure 2 and Figure 5 As shown, the method may include the following steps:
[0061] Step 1: Obtain image information output by the image sensor of the endoscope and obtain an original image corresponding to the current frame.
[0062] Step 2: Partition the original image to obtain multiple sub-images. The resolution of each sub-image is the same. The number of sub-images is x×y, and the resolution of the sub-image is am×bn. x, y, m, and n are all positive integers, and a and b are positive integers greater than or equal to 2.
[0063] For example, Figure 3 As shown in the figure, after partitioning an original image, four sub-images (2×2) are obtained. It should be noted that the number of sub-images is only an example and should be considered based on computational time and the size of the original image. Therefore, the more sub-images there are, the more computational effort and computational time are required for subsequent brightness calculations. Image size also limits the number of sub-images; lower-resolution images obviously require fewer sub-images.
[0064] Step 3: Calculate the brightness of the sub-images to obtain first brightness data Y1 corresponding to each sub-image. The number of first brightness data Y1 is x×y.
[0065] In some embodiments, step 3 may include:
[0066] Step 310 : Calculate the second brightness data Y2 of each pixel area consisting of a×b pixels in the sub-image according to the color filter array of the original image. m×n second brightness data Y2 are calculated for each sub-image.
[0067] like Figure 4 As shown, each sub-image can be further divided into a plurality of pixel areas, and then the second brightness data Y2 of each pixel area is calculated.
[0068] For example, in some embodiments, the image sensor may be a CMOS sensor or a CCD sensor, and the original image may be a RAW image.
[0069] The above step 310 may include:
[0070] Each pixel area may have 2×2 pixels. In this case, the second brightness data Y2 may be calculated using the following formula:
[0071] Y2=0.299×R+0.587×(Gr+Gb) / 2+0.114×B.
[0072] Among them, R represents the red pixel value in the color filter array, Gr represents the green pixel value adjacent to the red pixel in the same row, B represents the blue pixel value in the color filter array, and Gb represents the green pixel value adjacent to the blue pixel in the same row.
[0073] Step 320 : Calculate the first brightness data Y1 of the sub-image according to the m×n second brightness data Y2 .
[0074] In some embodiments, calculating the first brightness data Y1 of the sub-image based on the m×n second brightness data Y2 may include:
[0075] A second average value of the m×n second brightness data Y2 is calculated, and the second average value is used as the first brightness data Y1 of the sub-image.
[0076] In the above step 3, the first brightness data Y1 of the sub-image is calculated by the second brightness data Y2 of multiple pixel areas, so that the brightness data of a sub-image takes each pixel area into consideration, and the calculated first brightness data Y1 is more reasonable.
[0077] It should be noted that the size of the pixel area is not limited, and the calculation method of the second brightness data Y2 of the specific pixel area can be set according to actual conditions. The second brightness data Y2 of the pixel area also takes into account the pixel value of each pixel point.
[0078] In some embodiments, after step 3 and before step 4, the method may further include:
[0079] Step 330 , sort all first brightness data Y1 by size, adjust the exposure upper limit of the image sensor according to the maximum value in the first brightness data Y1 so that the exposure upper limit is equal to the maximum value Y1max in the first brightness data Y1 ; obtain the first brightness data Y1 after the exposure upper limit adjustment.
[0080] By adjusting the exposure upper limit of the image sensor, the exposure level is adjusted to avoid overexposure of the original image; sorting can also provide an adjustment range when performing local brightness adjustments later, which can avoid over-adjustment.
[0081] Step 4: Calculate the third brightness data Y3 of the original image based on the x×y first brightness data Y1.
[0082] In some embodiments, step 4 may include:
[0083] A first average value of the x×y first brightness data Y1 is calculated, and the first average value is used as the third brightness data Y3 of the original image.
[0084] In other embodiments, the third brightness data Y3 of the original image may be obtained by calculating the weighted average value, median, etc. of the x×y first brightness data Y1.
[0085] Step 5: Figure 5 As shown, it is determined whether the third brightness data Y3 meets the preset brightness range.
[0086] When the third brightness data Y3 satisfies the preset brightness range, it indicates that the exposure parameters of the image sensor are reasonable. The specific preset brightness range can be adjusted according to the observation needs of the endoscope or the requirements of the display device, and this application does not limit the specific range.
[0087] When the third brightness data Y3 is less than the minimum value of the preset brightness range, the brightness of the sub-image corresponding to the maximum value Y1max of the first brightness data Y1 is lowered, and the exposure time or gain of the original image is increased to bring the third brightness data Y3 of the original image within the preset brightness range. When the third brightness data Y3 is less than the minimum value of the preset brightness range, it indicates that the overall image brightness is insufficient and some areas are reflective. Therefore, on the one hand, the overall image brightness needs to be increased, and on the other hand, the brightness of the reflective areas needs to be adjusted. After the adjustment is completed, the third brightness data Y3 of the image is recalculated and compared with the preset brightness range again until the third brightness data Y3 meets the preset brightness range.
[0088] When the third brightness data Y3 exceeds the maximum value of the preset brightness range, the exposure time or gain of the original image is reduced to bring the third brightness data Y3 of the original image down to within the preset brightness range. When the third brightness data Y3 exceeds the maximum value of the preset brightness range, it indicates that the overall image brightness is too high and needs to be adjusted down. After the adjustment, the third brightness data Y3 of the image is recalculated and compared with the preset brightness range again until the third brightness data Y3 meets the preset brightness range.
[0089] In some embodiments, after step 5, and if the third brightness data Y3 satisfies the preset brightness range, the method may further include step 6;
[0090] Step 6: Compare the first brightness data Y1 of each sub-image with the third brightness data Y3 of the original image, and adjust the brightness of the sub-image according to the magnitude relationship between the first brightness data Y1 and the third brightness data Y3.
[0091] Among them, when the first brightness data Y1 is less than the third brightness data Y3, the brightness of the sub-image is increased; when the first brightness data Y1 is greater than the third brightness data Y3, the brightness of the sub-image is reduced; the brightness relationship between all sub-images after brightness adjustment is consistent with the brightness relationship before brightness adjustment, and the difference between the third brightness data after brightness adjustment and the third brightness data before brightness adjustment meets the preset difference range.
[0092] For example, the brightness can be increased or decreased by 5% each time. Through the user's operation, step 6 is repeated, and the superimposed adjustment can be repeated until the user's needs are met.
[0093] Based on step 330, in step 6, to improve the brightness uniformity of the original image, the brightness of each sub-image is adjusted. This has two prerequisites: first, the brightness of each sub-image must remain consistent before and after the adjustment. Second, the overall brightness Y3 of the original image must remain substantially unchanged, for example, within a preset difference range of 2%.
[0094] The image metering exposure processing method provided in this application is implemented by a terminal device, which may include a memory and a processor. For example, the terminal device may be a computer, server, or other device with computing and data processing capabilities.
[0095] A memory is used to store a program. A processor is used to implement the image metering exposure processing method described in the above embodiment by executing the program stored in the memory.
[0096] The image metering exposure processing method, system, terminal device and storage medium provided in the present application obtain a third brightness data for evaluating the current brightness of the original image by partitioning each frame of the original image and calculating the brightness. Based on the comparison between the third brightness data and the preset brightness range, real-time adjustments are made to the image if there is reflection, excessive darkness or excessive brightness, so that the details of the image captured by the endoscope are well presented, solving the problem of underexposure or overexposure.
[0097] Furthermore, in scenes with reflections, because the picture details in the reflective area have been lost, by reducing the metering weight of the reflective area, the brightness of other normal areas is improved, more picture details can be captured, thereby improving the detail performance of the entire picture.
[0098] At the same time, because the human eye's ability to distinguish brightness is higher at the average brightness of the picture, by comparing the brightness of different areas (areas corresponding to sub-images) with the average brightness of the entire picture, the brightness of different areas is improved to reduce the difference with the average brightness of the picture, thereby improving the detail distinguishability and brightness uniformity of the entire picture.
[0099] The above is an explanation of the image metering exposure processing method and system provided in this application. A more specific embodiment is used below for further explanation.
[0100] like Figure 5 and Figure 6 As shown, the current raw image (original image) is divided into x×y regions (sub-images) based on resolution. The resolution of each region is 2m×2n (m and n are positive integers). Luminance statistics are then performed on each region. According to the Bayer format of the raw image, a second luminance data point Y2 is calculated for every four pixels (corresponding to a 2×2 pixel region) using the formula Y2 = 0.299×R + 0.587×(Gr+Gb) / 2 + 0.114×B. The m×n calculated second luminance data points Y2 are averaged to obtain the first luminance data point Y1 for each region. X×y Y1 points are then calculated using the same method.
[0101] Sort the x×y first brightness data points Y1 and adjust the upper exposure limit of the sensor (endoscope image sensor) so that the maximum value of the first brightness data Y1 is within the set upper exposure limit range. After the adjustment, average the x×y first brightness data points Y1 to obtain the third brightness data Y3 for the entire image. The value of the third brightness data Y3 is used to determine the current scene and adjust the corresponding metering method.
[0102] If the third brightness data Y3 is within the preset picture brightness range, it means that the current exposure is appropriate.
[0103] If the third brightness data Y3 is less than the pre-set minimum brightness value of the picture, it means that the entire picture is currently dark and there is reflection in the picture. At this time, the metering method should be changed, and the weight of the reflective area in the picture (that is, the brightness data is within the upper exposure limit) should be lowered. Continue to increase the exposure time or gain so that the calculated third brightness data Y3 is within the pre-set picture brightness range.
[0104] If the third brightness data Y3 is greater than the preset maximum brightness of the screen, it means that the entire screen is currently brighter, and the exposure time or gain should be reduced so that the calculated third brightness data Y3 is within the preset screen brightness range.
[0105] After the sensor exposure adjustment is completed, the first brightness data Y1 of the x×y zones is compared with the third brightness data Y3 of the entire image, and a digital gain Dgain is assigned to each zone. For zones where the first brightness data Y1 is less than the third brightness data Y3, the digital gain is increased to increase the brightness. For zones where the first brightness data Y1 is greater than the third brightness data Y3, the digital gain is decreased to reduce the brightness. The digital gain adjustment should not change the brightness relationship between zones (i.e., the brightness of the zone with higher original brightness remains greater than that of the surrounding zones after the digital gain adjustment, but the difference between the two is smaller), thereby improving the brightness uniformity of the entire image.
[0106] like Figure 6 As shown, through the image metering exposure processing method and system provided by this application, Figure 6 After processing the image (A) in Figure 6 As shown in (B), the processed image can observe more details and has better overall brightness uniformity, making the user more efficient in diagnosing with the endoscope.
[0107] Those skilled in the art will appreciate that all or part of the functions of the various methods in the above embodiments can be implemented by hardware or by computer program. When all or part of the functions in the above embodiments are implemented by computer program, the program can be stored in a computer-readable storage medium, and the storage medium can include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to implement the above functions. For example, the program is stored in the memory of the device, and when the program in the memory is executed by the processor, all or part of the above functions can be implemented. In addition, when all or part of the functions in the above embodiments are implemented by computer program, the program can also be stored in a storage medium such as a server, another computer, disk, optical disk, flash disk or mobile hard disk, and saved in the memory of the local device by downloading or copying, or the system of the local device is updated. When the program in the memory is executed by the processor, all or part of the functions in the above embodiments can be implemented.
[0108] This document is described with reference to various exemplary embodiments. However, those skilled in the art will recognize that changes and modifications may be made to the exemplary embodiments without departing from the scope of this document. For example, the various operational steps and components used to perform the operational steps may be implemented in different ways (e.g., one or more steps may be deleted, modified, or incorporated into other steps) depending on the specific application or considering any number of cost functions associated with the operation of the system.
[0109] Although the principles of this invention have been shown in various embodiments, many modifications of structure, arrangement, proportion, elements, materials and components that are particularly suitable for specific environments and operational requirements can be used without departing from the principles and scope of this invention. The above modifications and other changes or amendments are intended to be included within the scope of this invention.
[0110] The foregoing detailed description has been described with reference to various embodiments. However, those skilled in the art will recognize that various modifications and changes can be made without departing from the scope of this disclosure. Therefore, the present disclosure will be considered in an illustrative rather than a restrictive sense, and all such modifications will be included within its scope. Similarly, the advantages, other advantages and solutions to the problems of the various embodiments have been described above. However, the benefits, advantages, solutions to the problems and any elements that can produce these, or make them more specific, should not be interpreted as critical, required or necessary. The term "comprising" and any other variants used in this article are all non-exclusive inclusions, so that a process, method, article or device that includes a list of elements includes not only these elements, but also other elements that are not explicitly listed or do not belong to the process, method, system, article or device. In addition, the term "coupled" and any other variants used in this article refer to physical connections, electrical connections, magnetic connections, optical connections, communication connections, functional connections and / or any other connections.
[0111] Those skilled in the art will recognize that many changes can be made to the details of the above embodiments without departing from the basic principles of the invention. Therefore, the scope of the present invention should be determined solely by the claims.
Claims
1. An image metering exposure processing method, characterized in that: include: Obtain image information output by the image sensor of the endoscope and obtain an original image corresponding to the current frame; Partitioning the original image to obtain a plurality of sub-images, each of which has the same resolution, the number of the sub-images is x×y, the resolution of the sub-images is am×bn, where x, y, m, and n are all positive integers, and a and b are positive integers greater than or equal to 2; Performing brightness calculation on the sub-images to obtain first brightness data Y1 corresponding to each sub-image, where the number of first brightness data Y1 is x×y; Calculating third brightness data Y3 of the original image based on the x×y pieces of first brightness data Y1; before calculating the third brightness data Y3 of the original image based on the x×y pieces of first brightness data Y1, the method further includes: sorting all of the first brightness data Y1 by size, adjusting an upper exposure limit of an image sensor based on a maximum value among the first brightness data Y1 so that the upper exposure limit is equal to the maximum value Y1max among the first brightness data Y1, and obtaining the first brightness data Y1 after the exposure limit adjustment; determining whether the third brightness data Y3 satisfies a preset brightness range, and adjusting a light metering method and an exposure parameter according to the third brightness data; when the third brightness data Y3 satisfies the preset brightness range, it indicates that the exposure parameter of the image sensor is reasonable; When the third brightness data Y3 is less than the minimum value of the preset brightness range, the brightness of the sub-image corresponding to the maximum value of the first brightness data Y1 is lowered, and the exposure time or gain of the original image is increased to increase the third brightness data Y3 of the original image to be within the preset brightness range; When the third brightness data Y3 is greater than the maximum value of the preset brightness range, the exposure time or gain of the original image is reduced so that the third brightness data Y3 of the original image is reduced to within the preset brightness range.
2. The method according to claim 1, wherein After calculating the third brightness data Y3 of the original image based on the x×y first brightness data Y1, and the third brightness data Y3 satisfies a preset brightness range, the method further includes: comparing the first brightness data Y1 of each sub-image with the third brightness data Y3 of the original image, and adjusting the brightness of the sub-image according to the magnitude relationship between the first brightness data Y1 and the third brightness data Y3; When the first brightness data Y1 is less than the third brightness data Y3, the brightness of the sub-image is increased; when the first brightness data Y1 is greater than the third brightness data Y3, the brightness of the sub-image is decreased; The brightness relationship between all the sub-images after brightness adjustment remains consistent with the brightness relationship before brightness adjustment, and the difference between the third brightness data after brightness adjustment and the third brightness data before brightness adjustment meets the preset difference range.
3. The method according to any one of claims 1 to 2, wherein Performing brightness calculation on the sub-images to obtain first brightness data Y1 corresponding to each sub-image includes: Calculating second brightness data Y2 for each pixel area consisting of a×b pixels in the sub-image according to the color filter array of the original image, and obtaining m×n pieces of the second brightness data Y2 corresponding to one sub-image; The first brightness data Y1 of the sub-image is calculated based on the m×n second brightness data Y2.
4. The method according to claim 3, wherein The image sensor is a CMOS sensor or a CCD sensor, and the original image is a RAW image; Calculating second brightness data Y2 of each pixel area consisting of a×b pixels in the sub-image according to the color filter array of the original image includes: The second brightness data Y2 is calculated using the following formula: Y2=0.299×R+0.587×(Gr+Gb) / 2+0.114×B; Among them, R represents the red pixel value in the color filter array, Gr represents the green pixel value adjacent to the red pixel in the same row, B represents the blue pixel value in the color filter array, and Gb represents the green pixel value adjacent to the blue pixel in the same row.
5. The method according to claim 3, wherein The first brightness data Y1 of the sub-image is calculated based on the m×n second brightness data Y2, including: Calculate a second average value of m×n pieces of the second brightness data Y2, and use the second average value as the first brightness data Y1 of the sub-image.
6. The method according to claim 1, wherein The third brightness data Y3 of the original image is calculated based on the x×y pieces of the first brightness data Y1, including: Calculate a first average value of the x×y first brightness data Y1, and use the first average value as the third brightness data Y3 of the original image.
7. An image metering exposure processing system, characterized in that: include: An image acquisition module is used to obtain image information output by the image sensor of the endoscope and obtain an original image corresponding to the current frame; a partitioned photometry module, configured to partition the original image to obtain a plurality of sub-images, each having the same resolution, the number of sub-images being x×y, the resolution of each sub-image being am×bn, where x, y, m, and n are all positive integers, and a and b are positive integers greater than or equal to 2; and perform brightness calculation on the sub-images to obtain first brightness data Y1 corresponding to each sub-image, the number of first brightness data Y1 being x×y. Exposure processing module; Used to calculate the third brightness data Y3 of the original image based on the x×y first brightness data Y1; wherein, before calculating the third brightness data Y3 of the original image based on the x×y first brightness data Y1, it also includes: sorting all the first brightness data Y1 by size, adjusting the exposure upper limit of the image sensor according to the maximum value in the first brightness data Y1, so that the exposure upper limit is equal to the maximum value Y1max in the first brightness data Y1, and obtaining the first brightness data Y1 after the exposure upper limit adjustment; judging whether the third brightness data Y3 meets the preset brightness range, and adjusting the measurement according to the third brightness data light mode and exposure parameters; when the third brightness data Y3 meets the preset brightness range, it indicates that the exposure parameters of the image sensor are reasonable; when the third brightness data Y3 is less than the minimum value of the preset brightness range, the brightness of the sub-image corresponding to the maximum value of the first brightness data Y1 is lowered, and the exposure time or gain of the original image is increased to increase the third brightness data Y3 of the original image to within the preset brightness range; when the third brightness data Y3 is greater than the maximum value of the preset brightness range, the exposure time or gain of the original image is reduced to reduce the third brightness data Y3 of the original image to within the preset brightness range.
8. A terminal device, characterized in that: include: Memory, used to store programs; A processor, configured to implement the method according to any one of claims 1 to 7 by executing the program stored in the memory.
9. A computer-readable storage medium, characterized in that The medium stores a program, which can be executed by a processor to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Picture processing device and system and recorder
CN114219735A