Light source and automatic exposure linkage control method and system
Through the linkage control method of light source and automatic exposure, the brightness and exposure parameters of the endoscope light source are automatically adjusted, which solves the problems of unstable image brightness and short light source life, and achieves images with stable brightness and extended light source life.
Patent Information
- Application Number
- CN202410834515.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-09-10
Smart Images

Figure CN118632130A
Abstract
Description
Technical Field
[0001] The present application relates to the field of camera control technology, and in particular to a light source and automatic exposure linkage control method and system. Background Art
[0002] During endoscopic surgery, different tissue locations have different brightness, and the changing imaging environment will affect the stability of image brightness. In theory, there are two ways to obtain an ideal image with stable brightness: (1) adjust the image brightness through post-processing of the image algorithm. However, the image obtained by this method is easily distorted and has high requirements for algorithm implementation. (2) compensate for the background brightness of the imaging environment by adjusting the brightness of the light source. This method has a realistic imaging effect and is relatively simple to implement.
[0003] Among the endoscope products currently available on the market, there are two modes for light source adjustment: automatic and manual adjustment: (1) Manual adjustment mode: The automatic exposure algorithm only controls the exposure time T and exposure gain G of the image sensor, but has no automatic adjustment function for the light source. The light source position needs to be adjusted manually, which cannot meet the brightness compensation requirements for real-time changes in background brightness. The position adjustment also has gradient errors between positions, and the adjustment effect is poor. (2) Automatic adjustment mode: The automatic adjustment function of the light source is implemented in the algorithm principle by dynamically adjusting the exposure time T, light source position L, and exposure gain G for each frame of the image. Taking a refresh rate of 60fps as an example, the light source needs to be adjusted 60 times per second, which poses a great challenge to the output power and service life of the light source. Summary of the invention
[0004] In response to the problems in the prior art, the purpose of the present application is to provide a method and system for controlling a light source and automatic exposure in linkage, which can automatically and linkage adjust the brightness of the light source and exposure parameters to provide an image with stable brightness, and can also avoid frequent changes in the light source power and extend the service life of the light source.
[0005] The present application provides a method for controlling a light source and automatic exposure linkage, including:
[0006] Obtain the alternative exposure parameters for the next frame and the light source position for the current frame;
[0007] Determine whether the light source position needs to be adjusted according to the frame number of the current frame;
[0008] If the light source position needs to be adjusted, the light source position of the next frame is determined based on the position adjustment algorithm according to the alternative exposure parameters of the next frame and the light source position of the current frame;
[0009] Determine whether the light source position of the next frame is the same as the light source position of the current frame;
[0010] If they are the same, the candidate exposure parameters of the next frame are used as the actual exposure parameters of the next frame; if they are different, the actual exposure parameters of the current frame are used as the actual exposure parameters of the next frame;
[0011] The actual exposure parameters of the next frame are sent to the image sensor, and the light source is controlled according to the light source position of the next frame.
[0012] In some embodiments, the step of obtaining the candidate exposure parameters of the next frame and the light source position of the current frame includes the following steps:
[0013] Receive the current frame image and calculate the deviation value between the brightness of the current frame image and the target brightness;
[0014] If the deviation value is within the allowable deviation range, there is no need to execute the dimming algorithm of the automatic exposure algorithm, and the actual exposure parameter of the current frame is set as the candidate exposure parameter of the next frame;
[0015] If the deviation value is outside the allowable deviation range, a dimming algorithm of the automatic exposure algorithm is executed to calculate alternative exposure parameters for the next frame.
[0016] In some embodiments, judging whether the light source position needs to be adjusted according to the frame number of the current frame includes the following steps:
[0017] Determine the count value of the frame counter according to the frame number of the current frame and determine whether the count value of the current frame counter is greater than the image frame number threshold;
[0018] If yes, determining the light source position of the next frame based on the position adjustment algorithm according to the candidate exposure parameters of the next frame and the light source position of the current frame, and clearing the count value of the frame counter;
[0019] If not, the light source gear position of the current frame is used as the light source gear position of the next frame.
[0020] In some embodiments, the exposure parameters include exposure time and exposure gain;
[0021] According to the alternative exposure parameters of the next frame and the light source position of the current frame, the light source position of the next frame is determined based on the position adjustment algorithm, including the following steps:
[0022] Determining whether the candidate exposure gain of the next frame is greater than a first gain threshold;
[0023] If yes, judging whether to increase the light source position according to the alternative exposure gain of the next frame and the light source position of the current frame, and determining the light source position of the next frame according to the judgment result;
[0024] If not, it is determined whether to reduce the light source position according to the candidate exposure time of the next frame and the light source position of the current frame, and the light source position of the next frame is determined according to the determination result.
[0025] In some embodiments, when the candidate exposure gain of the next frame is greater than the first gain threshold, determining whether to increase the light source position according to the candidate exposure gain of the next frame and the light source position of the current frame includes the following steps:
[0026] Determine whether the candidate exposure gain of the next frame is less than a second gain threshold, and the second gain threshold is greater than the first gain threshold;
[0027] If yes, determine whether to increase the light source position according to the light source position of the current frame;
[0028] If not, the light source gear position of the current frame is increased to obtain the light source gear position of the next frame.
[0029] In some embodiments, when the candidate exposure gain of the next frame is greater than the first gain threshold and less than the second gain threshold, the step of determining whether to increase the light source position according to the light source position of the current frame includes the following steps:
[0030] Determine whether the light source gear position of the current frame is greater than or equal to a first gear position threshold;
[0031] If yes, keep the light source position of the current frame unchanged and use it as the light source position of the next frame;
[0032] If not, the light source gear position of the current frame is added as the light source gear position of the next frame.
[0033] In some embodiments, when the candidate exposure gain of the next frame is less than or equal to the first gain threshold, determining whether to reduce the light source position according to the candidate exposure time of the next frame and the light source position of the current frame includes the following steps:
[0034] comparing the candidate exposure time of the next frame with a first time threshold and a second time threshold, the second time threshold being greater than the first time threshold;
[0035] If the candidate exposure time of the next frame is less than or equal to the first time threshold, reducing the light source gear position of the current frame to obtain the light source gear position of the next frame;
[0036] If the candidate exposure time of the next frame is greater than the first time threshold and less than the second time threshold, it is determined whether to reduce the light source position according to the light source position of the current frame.
[0037] In some embodiments, when the alternative exposure gain of the next frame is less than or equal to the first gain threshold, and the alternative exposure time of the next frame is greater than the first time threshold and less than the second time threshold, the step of determining whether to reduce the light source position according to the light source position of the current frame includes the following steps:
[0038] Determine whether the light source gear position of the current frame is less than or equal to a second gear position threshold;
[0039] If not, reducing the light source gear position of the current frame to obtain the light source gear position of the next frame;
[0040] If yes, the light source position of the current frame is kept unchanged and is used as the light source position of the next frame.
[0041] The embodiment of the present application further provides a light source and automatic exposure linkage control system, which is applied to the light source and automatic exposure linkage control method, and the system includes:
[0042] A parameter acquisition module is used to obtain the candidate exposure parameters of the next frame and the light source position of the current frame;
[0043] A light source adjustment module is used to determine whether the light source position needs to be adjusted according to the frame number of the current frame. If the light source position needs to be adjusted, the light source position of the next frame is determined based on the position adjustment algorithm according to the alternative exposure parameters of the next frame and the light source position of the current frame;
[0044] The gear detection module is used to determine whether the light source gear of the next frame is the same as the light source gear of the current frame; if they are the same, the alternative exposure parameters of the next frame are used as the actual exposure parameters of the next frame; if they are different, the actual exposure parameters of the current frame are used as the actual exposure parameters of the next frame;
[0045] The parameter sending module is used to send the actual exposure parameters of the next frame to the image sensor and control the light source according to the light source gear position of the next frame.
[0046] In some embodiments, the parameter acquisition module is used to acquire the candidate exposure parameters of the next frame by adopting the following steps:
[0047] Receive the current frame image and calculate the deviation value between the brightness of the current frame image and the target brightness;
[0048] If the deviation value is within the allowable deviation range, there is no need to execute the dimming algorithm of the automatic exposure algorithm, and the actual exposure parameter of the current frame is set as the candidate exposure parameter of the next frame;
[0049] If the deviation value is outside the allowable deviation range, a dimming algorithm of the automatic exposure algorithm is executed to calculate an alternative exposure parameter for the next frame;
[0050] The light source adjustment module is used to determine whether the light source position needs to be adjusted according to the frame number of the current frame by using the following steps:
[0051] Determine the count value of the frame counter according to the frame number of the current frame and determine whether the count value of the current frame counter is greater than the image frame number threshold;
[0052] If yes, determining the light source position of the next frame based on the position adjustment algorithm according to the candidate exposure parameters of the next frame and the light source position of the current frame, and clearing the count value of the frame counter;
[0053] If not, the light source gear position of the current frame is used as the light source gear position of the next frame.
[0054] The light source and automatic exposure linkage control method and system provided in this application have the following advantages:
[0055] By adopting the present application, the light source brightness and exposure parameters can be automatically and linked to achieve linkage control of the light source brightness and exposure parameters, avoid sudden changes in image brightness, provide images with stable brightness, thereby increasing the imaging effect, and at the same time reduce the frequency of light source gear adjustment, avoid frequent changes in light source power, and extend the service life of the light source. The light source and automatic exposure linkage control method and system can be deployed in the controller of an endoscope to improve the imaging effect of an endoscope image sensor, and can also be applied to the controllers of other products involving the cooperation of light sources and image sensors to achieve linkage control of light sources and image sensors, and obtain captured images with stable brightness. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings.
[0057] Figure 1 is a flow chart of a method for controlling a light source and automatic exposure linkage according to an embodiment of the present application;
[0058] Figure 2 is a flow chart of a light source and automatic exposure linkage control method of a specific example of the present application;
[0059] Figure 3 is a flow chart of a light source adjustment algorithm of a specific example of the present application;
[0060] Figure 4 is a flow chart of a light source position detection algorithm according to an embodiment of the present application;
[0061] Figure 5 It is a structural block diagram of a light source and automatic exposure linkage control system according to an embodiment of the present application. DETAILED DESCRIPTION
[0062] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that the present application will be comprehensive and complete and the concepts of the example embodiments will be fully conveyed to those skilled in the art. The same reference numerals in the figures represent the same or similar structures, and thus their repeated descriptions will be omitted. "Or" and "or" in the specification may both mean "and" or "or". Although "first" or "second" etc. are used in this specification to represent certain features, they are only used to represent the function and are not used as a limitation on the number and importance of specific features.
[0063] In order to solve the technical problems in the prior art, the present application provides a method and system for controlling a light source and automatic exposure in linkage, which can automatically and linkage adjust the brightness of the light source and the exposure parameters to provide an image with stable brightness, and can also avoid frequent changes in the power of the light source and extend the service life of the light source. In the following embodiments, the method and system for controlling a light source and automatic exposure in linkage are used as an example for explanation, but the present application is not limited to this. In other embodiments, the method and system can also be applied to the controllers of other products involving the cooperation of light sources and image sensors, all of which fall within the scope of protection of the present application.
[0064] In this embodiment, the endoscope includes a light source, an image sensor and a controller. The light source is used to illuminate the observed tissue, the image sensor user takes an image of the observed tissue, and the controller is used to coordinate and control the operation of various components of the endoscope. The light source and the automatic exposure linkage control method are deployed in the controller, for example. The controller is also configured with an automatic exposure algorithm, which mainly includes a photometric algorithm and a dimming algorithm. The photometric algorithm is used to calculate the brightness value of the current image (such as counting the brightness values of each pixel in the image and averaging, or using other algorithms), and the dimming algorithm is responsible for adjusting the exposure parameters (exposure time and exposure gain) according to the brightness value measured by the photometric algorithm to achieve the purpose of stabilizing the image brightness. The photometric algorithm and dimming algorithm used in this embodiment are, for example, the photometric algorithm and dimming algorithm in existing endoscopes.
[0065] Figure 1 A flow chart of a method for controlling a light source and automatic exposure linkage according to an embodiment of the present application is shown. Figure 2The flowchart of the method in a specific example is shown. In this embodiment, the exposure parameters include exposure time T and exposure gain G. The current frame is the Nth frame, the next frame is the N+1th frame, the light source position of the current frame is LSN, and the light source position of the next frame is LSN+1. The exposure parameters of the current frame include exposure time TN and exposure gain GN, and the exposure parameters of the next frame include exposure time TN+1 and exposure gain GN+1. The image brightness is represented by L, and the image brightness value of the current frame is LN. The target brightness is L-tar, and the deviation between the image brightness value of the current frame and the target brightness is represented by L-Diff. The specific value of the target brightness can be set as needed to keep the captured image stable within a reasonable range around the target brightness (Ltar±L-Diff-thr), where L-Diff-thr is a preset deviation threshold. The larger the L-Diff-thr is set, the higher the stability of the image, but the adjustment of the light source and automatic exposure parameters may be more frequent.
[0066] like Figure 1 As shown, in one embodiment of the present application, the light source and automatic exposure linkage control method includes the following steps:
[0067] S100: Obtaining candidate exposure parameters for the next frame and light source position for the current frame;
[0068] like Figure 2 As shown, step S100 includes the following steps:
[0069] Receive the current frame image, and obtain the brightness value LN of the current frame image based on the light metering algorithm;
[0070] Calculate the deviation value L-Diff=|LN-Ltar| between the brightness LN of the current frame image and the target brightness Ltar;
[0071] If the deviation value L-Diff is within the allowable deviation range (for example, less than the preset deviation threshold L-Diff-thr), it means that the image brightness is still within a stable and acceptable range, and there is no need to execute the dimming algorithm of the automatic exposure algorithm. The actual exposure parameters (exposure time TN, exposure gain GN) of the current frame are set as the alternative exposure parameters (exposure time TN+1, exposure gain GN+1) of the next frame; the actual exposure parameters of the current frame are the exposure parameters actually used when the current frame image is captured;
[0072] If the deviation value is outside the allowable deviation range (for example, greater than or equal to the preset deviation threshold L-Diff-thr), the automatic exposure stage is entered, the dimming algorithm of the automatic exposure algorithm is executed, and the alternative exposure parameters of the next frame are calculated;
[0073] S200: judging whether it is necessary to adjust the light source position according to the frame number of the current frame;
[0074] Specifically, when the frame number of the current frame does not meet the conditions for adjusting the light source gear, the current frame is not allowed to adjust the light source gear. Only when the frame number of the current frame meets the conditions for adjusting the light source gear, the current frame is allowed to adjust the light source gear. Therefore, frequent adjustment of the light source gear is effectively avoided, which is not likely to cause frequent changes in light source power, and is conducive to extending the service life of the light source.
[0075] S300: if the light source position needs to be adjusted, the light source position of the next frame is determined based on a position adjustment algorithm according to the candidate exposure parameters of the next frame and the light source position of the current frame;
[0076] The present application controls the light source position of the next frame based on the alternative exposure parameters of the next frame and the light source position of the current frame, so that the entire control system can control the light source brightness and automatic exposure parameters in a linked manner. When controlling the light source brightness, the alternative exposure parameters of the next frame are combined for linkage adjustment, which is conducive to providing an image with stable brightness.
[0077] The above step S200 is implemented by a frame number control algorithm, and the above step S300 is implemented by a gear detection algorithm. Both the frame number control algorithm and the gear detection algorithm are part of the light source adjustment algorithm.
[0078] like Figure 2 As shown, the input of the light source adjustment algorithm includes the frame number FrameN of the current frame, the light source position LSN of the current frame, the alternative exposure time TN+1 of the next frame, and the alternative exposure gain GN+1 of the next frame, and the output includes the light source position LSN+1 of the next frame; the specific implementation method of the light source adjustment algorithm will be combined with the following Figure 3 Further details:
[0079] S400: Determine whether the light source position of the next frame is the same as the light source position of the current frame;
[0080] S500: If they are the same, the candidate exposure parameters of the next frame are used as the actual exposure parameters of the next frame; that is, when the light source position does not change, if the ambient brightness changes, the exposure parameters can be adjusted to provide an image with stable brightness;
[0081] S600: If they are different, the actual exposure parameter of the current frame is used as the actual exposure parameter of the next frame; that is, when the light source position changes, in order to avoid a sudden change in image brightness caused by a simultaneous change in the exposure parameter and the light source position, only the light source position is adjusted without adjusting the exposure parameter, thereby facilitating better maintenance of image brightness stability;
[0082] The above steps S400 to S600 are implemented by a light source position detection algorithm, such as Figure 2As shown, the input of the light source gear detection algorithm includes the actual exposure time TN of the current frame, the actual exposure gain GN, the alternative exposure time TN+1 of the next frame, the alternative exposure gain GN+1, the light source gear LSN of the current frame, and the light source gear LSN+1 of the next frame, and the output includes the actual exposure parameters of the next frame and the light source gear of the next frame; the specific implementation method of the light source gear detection algorithm will be combined with the following Figure 4 Further details:
[0083] S700: sending the actual exposure parameters of the next frame to the image sensor, and controlling the light source according to the light source position of the next frame;
[0084] After determining the actual exposure parameters of the next frame and the light source position of the next frame, the light source can emit light corresponding to the light source position of the next frame to illuminate the observed object, and the image sensor captures the next frame of image based on the actual exposure parameters of the next frame (exposure time and exposure gain).
[0085] Therefore, by adopting the light source and automatic exposure linkage control method of the present application, the light source brightness and exposure parameters can be automatically adjusted to achieve linkage control of the light source brightness and exposure parameters, avoid sudden changes in image brightness, provide an image with stable brightness, thereby increasing the imaging effect, and at the same time reduce the frequency of light source gear adjustment, avoid frequent changes in light source power, and extend the service life of the light source.
[0086] like Figure 3 As shown, in this embodiment, the number of frames is represented by Frames, the number of image frames of the current frame is FramesN, and the image frame number threshold is set to Frames-thr. The step S200: judging whether the light source gear needs to be adjusted according to the number of frames of the current frame, includes the following steps:
[0087] Determine the count value of the frame counter according to the frame number of the current frame and determine whether the count value of the current frame counter is greater than the image frame number threshold;
[0088] Specifically, each time the frame number FrameN of a frame is obtained, the count value counter of the frame counter is increased by 1, and it is determined whether the count value counter of the current frame counter is greater than the image frame number threshold Frames-thr; the value of the image frame number threshold Frames-thr can be set as needed. The larger the image frame number threshold is set, the longer the interval time of the light source gear adjustment is, the fewer the number of light source gear adjustments is, but the lower the sensitivity to the ambient brightness change is, on the contrary, the smaller the image frame number threshold is set, the shorter the interval time of the light source gear condition is, the more the number of light source gear adjustments is, the more frequent the light source brightness changes are, and the higher the sensitivity to the ambient brightness change is;
[0089] If yes, continue to execute step S300, that is, according to the alternative exposure parameters of the next frame (exposure time TN+1, exposure gain GN+1) and the light source gear position (LSN) of the current frame, determine the light source gear position (LSN+1) of the next frame based on the gear adjustment algorithm, and clear the count value counter of the frame counter;
[0090] If not, the light source position is not allowed to be adjusted to avoid too frequent adjustment of the light source position. Specifically, the light source position LSN of the current frame is used as the light source position LSN+1 of the next frame, LSN+1=LSN, that is, the light source position LSN of the current frame is assigned to the light source position LSN+1 of the next frame, and then step S400 is continued.
[0091] like Figure 3 As shown, in this embodiment, the light source position of the next frame is determined in step S300 according to the alternative exposure parameters of the next frame, the light source position of the current frame, the various thresholds of the exposure parameters, and the position threshold. Here, a first gain threshold and a second gain threshold are set for the exposure gain, and the second gain threshold is greater than the first gain threshold. The first gain threshold is generally set to be smaller. In this embodiment, the minimum gain threshold is exemplarily set to the first gain threshold, represented by Gmin, and the second gain threshold is represented by Gsec-thr. A first time threshold and a second time threshold are set for the exposure time, and the second time threshold is greater than the first time threshold. The second time threshold is generally set to be larger. In this embodiment, the maximum time threshold is exemplarily set to the second time threshold, represented by Tmax, and the first time threshold is represented by Tfir-thr. For the light source position, a first gear threshold, a second gear threshold, and a maximum gear threshold that increase in sequence are set. The first gear threshold is represented by LSfir-thr, the second gear threshold is represented by LSsec-thr, and the maximum gear threshold is represented by LS-max. The minimum light source gear is 1, and it increases or decreases by 1 gear each time it is adjusted. 1 <LSfir-thr<LSsec-thr<LS-max。
[0092] like Figure 3 As shown, in step S300, according to the candidate exposure parameters of the next frame and the light source position of the current frame, the light source position of the next frame is determined based on the position adjustment algorithm, including the following steps:
[0093] Determine whether the candidate exposure gain GN+1 of the next frame is greater than the first gain threshold Gmin;
[0094] If yes, judging whether to increase the light source gear position according to the alternative exposure gain GN+1 of the next frame and the light source gear position LSN of the current frame, and determining the light source gear position LSN+1 of the next frame according to the judgment result;
[0095] If not, it is determined whether to reduce the light source gear position according to the candidate exposure time TN+1 of the next frame and the light source gear position LSN of the current frame, and the light source gear position LSN+1 of the next frame is determined according to the determination result.
[0096] Therefore, in the adjustment of exposure time and exposure gain, the exposure time has a higher priority than the exposure gain. The exposure time is adjusted first, and then the exposure gain is adjusted. The light source position is to maintain a balance between the exposure time and the exposure gain. When the exposure gain is less than or equal to the minimum gain threshold, you only need to adjust the exposure time to make the brightness of the captured image reach the target brightness. There is no need to adjust the exposure gain during the entire adjustment process. At the same time, it is necessary to avoid setting the light source position too high at this time. Therefore, it is necessary to further determine whether to reduce the light source position. Reducing the light source position is conducive to reducing the light source output power and further extending the service life of the light source.
[0097] When the exposure gain is greater than the minimum gain threshold, the exposure gain needs to be adjusted to maintain image stability. At the same time, it is necessary to avoid the image noise problem caused by the exposure gain being too high due to the light source gear being set too low. Therefore, it is necessary to further determine whether to increase the light source gear in exchange for a decrease in exposure gain.
[0098] In this embodiment, when the candidate exposure gain GN+1 of the next frame is greater than the first gain threshold Gmin, judging whether to increase the light source gear position according to the candidate exposure gain GN+1 of the next frame and the light source gear position LSN of the current frame includes the following steps:
[0099] Determine whether the candidate exposure gain GN+1 of the next frame is less than a second gain threshold Gsec-thr;
[0100] If yes, determine whether to increase the light source position according to the light source position LSN of the current frame;
[0101] If not, then the excessive exposure gain will cause a serious image noise problem, and the light source gear LSN of the current frame should be increased to obtain the light source gear LSN+1 of the next frame. For example, the light source gear LSN of the current frame can be increased by one gear in exchange for a decrease in the exposure gain of the next frame, which is conducive to reducing image noise and further improving the imaging effect of the image sensor.
[0102] In this embodiment, when the candidate exposure gain GN+1 of the next frame is greater than the first gain threshold Gmin and less than the second gain threshold Gsec-thr, the step of determining whether to increase the light source position according to the light source position LSN of the current frame includes the following steps:
[0103] Determine whether the light source gear position LSN of the current frame is greater than or equal to a first gear position threshold LSfir-thr;
[0104] If yes, since the current light source gear LSN is already at a relatively high gear, keep the light source gear LSN of the current frame unchanged and use it as the light source gear LSN+1 of the next frame to avoid too frequent switching of the light source gear and to avoid too high output power due to setting the light source gear LSN too high.
[0105] If not, the light source gear LSN of the current frame is increased as the light source gear LSN+1 of the next frame. For example, the light source gear LSN of the current frame can be increased by one gear in exchange for a decrease in the exposure gain of the next frame, which is beneficial to reduce image noise and further improve the imaging effect of the image sensor.
[0106] In this embodiment, when the candidate exposure gain GN+1 of the next frame is less than or equal to the first gain threshold Gmin, judging whether to reduce the light source position according to the candidate exposure time TN+1 of the next frame and the light source position LSN of the current frame includes the following steps:
[0107] Compare the candidate exposure time TN+1 of the next frame with the first time threshold Tfir-thr and the second time threshold Tmax;
[0108] If the alternative exposure time TN+1 of the next frame is less than or equal to the first time threshold Tfir-thr, then the light source gear LSN of the current frame must be reduced to obtain the light source gear LSN+1 of the next frame. For example, the light source gear LSN of the current frame can be reduced by one gear. When processing the next frame of image, the dimming algorithm of the automatic exposure algorithm will recalculate the exposure time and exposure gain based on the reduced light source gear, which will increase the exposure time. The increase in exposure time will not affect the entire imaging system and hardware system, and the reduction in the light source gear can reduce the output power of the light source and extend the service life of the light source.
[0109] If the alternative exposure time TN+1 of the next frame is greater than the first time threshold Tfir-thr and less than the second time threshold Tmax, it is necessary to make a judgment in combination with the light source position LSN of the current frame, that is, to judge whether to reduce the light source position according to the light source position LSN of the current frame.
[0110] In this embodiment, when the candidate exposure gain GN+1 of the next frame is less than or equal to the first gain threshold Gmin, and the candidate exposure time TN+1 of the next frame is greater than the first time threshold Tfir-thr and less than the second time threshold Tmax, the step of determining whether to reduce the light source position according to the light source position LSN of the current frame includes the following steps:
[0111] Determine whether the light source gear position LSN of the current frame is less than or equal to the second gear position threshold LSsec-thr;
[0112] If not, then reduce the light source gear position LSN of the current frame to obtain the light source gear position of the next frame. For example, the light source gear position LSN of the current frame can be reduced by one gear to increase the exposure time of the next frame, and is conducive to reducing the output power of the light source and extending the service life of the light source;
[0113] If so, since the light source position is already at a relatively low position, in order to ensure the imaging effect, the light source position LSN of the current frame is kept unchanged and used as the light source position of the next frame to avoid switching the light source position too frequently and ensure that the image has good brightness stability.
[0114] The following describes the implementation process of the above-mentioned gear adjustment algorithm by assigning exemplary values to each of the above-mentioned thresholds. Specifically, it is assumed that the first time threshold is 500, the second time threshold is the maximum time threshold and is set to 1080, the first gain threshold is the minimum gain threshold and is set to 1, the second gain threshold is 5, the first gear threshold is 10, the second gear threshold is 16, and the maximum gear threshold is 20. However, it can be understood that the values set here are only examples and are not intended to limit the scope of protection of this application. The values of each threshold can be set and adjusted as needed. The gear adjustment algorithm exemplarily includes the following steps:
[0115] When the alternative exposure gain of the next frame is 1 and the alternative exposure time of the next frame is less than or equal to 500, no matter what the light source position of the current frame is, the light source position needs to be reduced in exchange for an increase in exposure time. Reducing the light source position can reduce the light source output power and extend the light source life.
[0116] When the alternative exposure gain of the next frame is 1 and the alternative exposure time of the next frame is greater than 500 and less than 1080, if the light source level of the current frame is greater than 16, the light source level needs to be reduced in exchange for an increase in exposure time. If the light source level of the current frame is less than or equal to 16, the light source level is kept unchanged to avoid frequent switching of the light source level.
[0117] When the alternative exposure gain of the next frame is greater than 1 and less than 5, if the light source position of the current frame is greater than or equal to 10, the light source position remains unchanged to avoid frequent switching of the light source position. If the light source position of the current frame is less than 10, the light source position needs to be increased in exchange for a reduction in exposure gain, thereby reducing image noise and improving imaging effects.
[0118] When the alternative exposure gain of the next frame is greater than or equal to 5, the image noise problem caused by the excessive exposure gain is more serious. No matter what the light source position of the current frame is, it is necessary to increase the light source position in exchange for a reduction in exposure gain, reduce image noise, and improve imaging effects.
[0119] Combine the following Figure 4The implementation process of the light source position detection algorithm in this embodiment is specifically introduced. The input of the light source position detection algorithm includes the actual exposure time TN of the current frame, the actual exposure gain GN, the alternative exposure time TN+1 of the next frame, the alternative exposure gain GN+1, the light source position LSN of the current frame, and the light source position LSN+1 of the next frame, and the output includes the actual exposure parameters of the next frame and the light source position of the next frame.
[0120] like Figure 4 As shown, corresponding to step S400, it is determined whether the light source position LSN+1 of the next frame is the same as the light source position LSN of the current frame;
[0121] If they are the same, corresponding to step S500, the alternative exposure parameters of the next frame (alternative exposure time TN+1 and alternative exposure gain GN+1) are used as the actual exposure parameters of the next frame; that is, when the light source position does not change, if the ambient brightness changes, the exposure parameters can be adjusted to provide an image with stable brightness;
[0122] If they are different, corresponding to step S600, the actual exposure parameters of the current frame (exposure time TN and exposure gain GN) are used as the actual exposure parameters of the next frame; that is, when the light source position changes, in order to avoid a sudden change in image brightness due to simultaneous changes in the exposure parameters and the light source position, only the light source position is adjusted without adjusting the exposure parameters, which is beneficial to maintaining the stability of the image brightness.
[0123] like Figure 5 As shown, the embodiment of the present application further provides a light source and automatic exposure linkage control system, which is applied to the light source and automatic exposure linkage control method, and the system includes:
[0124] The parameter acquisition module M100 is used to acquire the candidate exposure parameters of the next frame and the light source position of the current frame;
[0125] The light source adjustment module M200 is used to execute the above-mentioned light source adjustment algorithm, specifically including executing the above-mentioned frame number control algorithm, judging whether it is necessary to adjust the light source gear according to the frame number of the current frame, and if it is necessary to adjust the light source gear, executing the above-mentioned gear adjustment algorithm, and determining the light source gear of the next frame based on the gear adjustment algorithm according to the alternative exposure parameters of the next frame and the light source gear of the current frame;
[0126] The gear detection module M300 is used to execute the above-mentioned light source gear detection algorithm to determine whether the light source gear of the next frame is the same as the light source gear of the current frame; if they are the same, the alternative exposure parameters of the next frame are used as the actual exposure parameters of the next frame; if they are different, the actual exposure parameters of the current frame are used as the actual exposure parameters of the next frame;
[0127] The parameter sending module M400 is used to send the actual exposure parameters of the next frame to the image sensor and control the light source according to the light source gear position of the next frame.
[0128] By adopting the light source and automatic exposure linkage control system of the present application, the light source brightness and exposure parameters can be automatically adjusted to realize the linkage control of the light source brightness and exposure parameters. Through the gear detection processing of the gear detection module M300, sudden changes in image brightness can be avoided, and images with stable brightness can be provided, thereby improving the imaging effect. At the same time, through the frame number control of the light source adjustment module M200, the frequency of light source gear adjustment can be reduced, thereby avoiding frequent changes in light source power and extending the service life of the light source.
[0129] like Figure 2 As shown, in this embodiment, the parameter acquisition module M100 is used to acquire the candidate exposure parameters of the next frame by adopting the following steps:
[0130] Receive the current frame image, and calculate the deviation value L-Diff=|LN-Ltar| between the brightness LN of the current frame image and the target brightness Ltar;
[0131] If the deviation value L-Diff is within the allowable deviation range (less than the preset deviation threshold L-Diff-thr), there is no need to execute the dimming algorithm of the automatic exposure algorithm, and the actual exposure parameters (exposure time TN, exposure gain GN) of the current frame are set as the alternative exposure parameters (exposure time TN+1, exposure gain GN+1) of the next frame;
[0132] If the deviation value is outside the allowable deviation range (greater than or equal to the preset deviation threshold L-Diff-thr), the dimming algorithm of the automatic exposure algorithm is executed to calculate the alternative exposure parameters of the next frame (exposure time TN+1, exposure gain GN+1).
[0133] like Figure 3 As shown, in this embodiment, the light source adjustment module M200 is used to determine whether the light source position needs to be adjusted according to the frame number of the current frame by using the following steps:
[0134] Determine the count value of the frame counter according to the frame number of the current frame and determine whether the count value of the current frame counter is greater than the image frame number threshold;
[0135] Specifically, each time the number of a frame is obtained, the count value counter of the frame counter is increased by 1, and it is determined whether the count value counter of the current frame counter is greater than the image frame number threshold Frames-thr;
[0136] If yes, then determine the light source position (LSN+1) of the next frame based on the position adjustment algorithm according to the alternative exposure parameters of the next frame (exposure time TN+1, exposure gain GN+1) and the light source position (LSN) of the current frame, and clear the count value counter of the frame counter;
[0137] If not, the light source gear position LSN of the current frame is used as the light source gear position LSN+1 of the next frame, that is, LSN+1=LSN, that is, the light source gear position LSN of the current frame is used to assign a value to the light source gear position LSN+1 of the next frame.
[0138] The specific functions of each module in the light source and automatic exposure linkage control system can be implemented by adopting the specific implementation methods of each step in the above-mentioned light source and automatic exposure linkage control method, which will not be described in detail here.
[0139] The above content is a further detailed description of the present application in combination with specific preferred implementation methods, and it cannot be determined that the specific implementation of the present application is limited to these descriptions. For ordinary technicians in the technical field to which the present application belongs, several simple deductions or substitutions can be made without departing from the concept of the present application, which should be deemed to fall within the scope of protection of the present application.
Claims
1. A light source and automatic exposure linkage control method, characterized in that: include: Obtain the alternative exposure parameters for the next frame and the light source position for the current frame; Determine whether the light source position needs to be adjusted according to the frame number of the current frame; If the light source position needs to be adjusted, the light source position of the next frame is determined based on the position adjustment algorithm according to the alternative exposure parameters of the next frame and the light source position of the current frame; Determine whether the light source position of the next frame is the same as the light source position of the current frame; If they are the same, the candidate exposure parameters of the next frame are used as the actual exposure parameters of the next frame; if they are different, the actual exposure parameters of the current frame are used as the actual exposure parameters of the next frame; The actual exposure parameters of the next frame are sent to the image sensor, and the light source is controlled according to the light source position of the next frame.
2. The light source and automatic exposure linkage control method according to claim 1, characterized in that: The step of obtaining the candidate exposure parameters for the next frame and the light source position for the current frame includes the following steps: Receive the current frame image and calculate the deviation value between the brightness of the current frame image and the target brightness; If the deviation value is within the allowable deviation range, there is no need to execute the dimming algorithm of the automatic exposure algorithm, and the actual exposure parameter of the current frame is set as the candidate exposure parameter of the next frame; If the deviation value is outside the allowable deviation range, a dimming algorithm of the automatic exposure algorithm is executed to calculate alternative exposure parameters for the next frame.
3. The light source and automatic exposure linkage control method according to claim 1, characterized in that: The step of judging whether the light source position needs to be adjusted according to the frame number of the current frame comprises the following steps: Determine the count value of the frame counter according to the frame number of the current frame and determine whether the count value of the current frame counter is greater than the image frame number threshold; If yes, determining the light source position of the next frame based on the position adjustment algorithm according to the candidate exposure parameters of the next frame and the light source position of the current frame, and clearing the count value of the frame counter; If not, the light source gear position of the current frame is used as the light source gear position of the next frame.
4. The light source and automatic exposure linkage control method according to claim 1, characterized in that: The exposure parameters include exposure time and exposure gain; According to the alternative exposure parameters of the next frame and the light source position of the current frame, the light source position of the next frame is determined based on the position adjustment algorithm, including the following steps: Determining whether the candidate exposure gain of the next frame is greater than a first gain threshold; If yes, judging whether to increase the light source position according to the alternative exposure gain of the next frame and the light source position of the current frame, and determining the light source position of the next frame according to the judgment result; If not, it is determined whether to reduce the light source position according to the candidate exposure time of the next frame and the light source position of the current frame, and the light source position of the next frame is determined according to the determination result.
5. The light source and automatic exposure linkage control method according to claim 4, characterized in that: When the candidate exposure gain of the next frame is greater than the first gain threshold, judging whether to increase the light source position according to the candidate exposure gain of the next frame and the light source position of the current frame includes the following steps: Determine whether the candidate exposure gain of the next frame is less than a second gain threshold, and the second gain threshold is greater than the first gain threshold; If yes, determine whether to increase the light source position according to the light source position of the current frame; If not, the light source gear position of the current frame is increased to obtain the light source gear position of the next frame.
6. The light source and automatic exposure linkage control method according to claim 5, characterized in that: When the candidate exposure gain of the next frame is greater than the first gain threshold and less than the second gain threshold, the step of determining whether to increase the light source position according to the light source position of the current frame comprises the following steps: Determine whether the light source gear position of the current frame is greater than or equal to a first gear position threshold; If yes, keep the light source position of the current frame unchanged and use it as the light source position of the next frame; If not, the light source gear position of the current frame is added as the light source gear position of the next frame.
7. The light source and automatic exposure linkage control method according to claim 4, characterized in that: When the candidate exposure gain of the next frame is less than or equal to the first gain threshold, judging whether to reduce the light source position according to the candidate exposure time of the next frame and the light source position of the current frame includes the following steps: comparing the candidate exposure time of the next frame with a first time threshold and a second time threshold, the second time threshold being greater than the first time threshold; If the candidate exposure time of the next frame is less than or equal to the first time threshold, reducing the light source gear position of the current frame to obtain the light source gear position of the next frame; If the candidate exposure time of the next frame is greater than the first time threshold and less than the second time threshold, it is determined whether to reduce the light source position according to the light source position of the current frame.
8. The light source and automatic exposure linkage control method according to claim 7, characterized in that: When the alternative exposure gain of the next frame is less than or equal to the first gain threshold, and the alternative exposure time of the next frame is greater than the first time threshold and less than the second time threshold, the step of determining whether to reduce the light source position according to the light source position of the current frame comprises the following steps: Determine whether the light source gear position of the current frame is less than or equal to a second gear position threshold; If not, reducing the light source gear position of the current frame to obtain the light source gear position of the next frame; If yes, the light source position of the current frame is kept unchanged and is used as the light source position of the next frame.
9. A light source and automatic exposure linkage control system, characterized in that: The light source and automatic exposure linkage control method applied to any one of claims 1 to 8, the system comprising: A parameter acquisition module is used to obtain the candidate exposure parameters of the next frame and the light source position of the current frame; A light source adjustment module is used to determine whether the light source position needs to be adjusted according to the frame number of the current frame. If the light source position needs to be adjusted, the light source position of the next frame is determined based on the position adjustment algorithm according to the alternative exposure parameters of the next frame and the light source position of the current frame; The gear detection module is used to determine whether the light source gear of the next frame is the same as the light source gear of the current frame; if they are the same, the alternative exposure parameters of the next frame are used as the actual exposure parameters of the next frame; if they are different, the actual exposure parameters of the current frame are used as the actual exposure parameters of the next frame; The parameter sending module is used to send the actual exposure parameters of the next frame to the image sensor and control the light source according to the light source gear position of the next frame.
10. The light source and automatic exposure linkage control system according to claim 9, characterized in that: The parameter acquisition module is used to acquire the candidate exposure parameters of the next frame by adopting the following steps: Receive the current frame image and calculate the deviation value between the brightness of the current frame image and the target brightness; If the deviation value is within the allowable deviation range, there is no need to execute the dimming algorithm of the automatic exposure algorithm, and the actual exposure parameter of the current frame is set as the candidate exposure parameter of the next frame; If the deviation value is outside the allowable deviation range, a dimming algorithm of the automatic exposure algorithm is executed to calculate an alternative exposure parameter for the next frame; The light source adjustment module is used to determine whether the light source position needs to be adjusted according to the frame number of the current frame by using the following steps: Determine the count value of the frame counter according to the frame number of the current frame and determine whether the count value of the current frame counter is greater than the image frame number threshold; If yes, determining the light source position of the next frame based on the position adjustment algorithm according to the candidate exposure parameters of the next frame and the light source position of the current frame, and clearing the count value of the frame counter; If not, the light source gear position of the current frame is used as the light source gear position of the next frame.
