WO2020252739A1 - Method and apparatus for acquiring gain coefficient - Google Patents
Method and apparatus for acquiring gain coefficient Download PDFInfo
- Publication number
- WO2020252739A1 WO2020252739A1 PCT/CN2019/092060 CN2019092060W WO2020252739A1 WO 2020252739 A1 WO2020252739 A1 WO 2020252739A1 CN 2019092060 W CN2019092060 W CN 2019092060W WO 2020252739 A1 WO2020252739 A1 WO 2020252739A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- image sensor
- gain
- adjusted
- image
- image sensors
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N25/00—Circuitry of solid-state image sensors [SSIS]; Control thereof
- H04N25/50—Control of the SSIS exposure
- H04N25/57—Control of the dynamic range
Definitions
- the present invention relates to the technical field of image processing, and in particular to a method and device for obtaining a gain coefficient.
- binocular cameras are usually used to shoot pictures in the environment to obtain binocular images. Compared with the monocular images obtained by monocular cameras, the pictures can be restored more vividly, thereby improving the shooting effect.
- the embodiment of the present invention provides a method and device for obtaining a gain coefficient, which improves the accuracy of the gain coefficient when calculating the gain coefficient corresponding to the image sensor.
- an embodiment of the present invention provides a method for obtaining a gain coefficient, which is applied to two preset image sensors, and the method for obtaining a gain coefficient may include:
- the brightness matrices of the two image sensors calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value; wherein, each of the two sensors The corresponding gain coefficient is used to determine whether it is necessary to adjust the gain of the two image sensors.
- an embodiment of the present invention provides a gain coefficient obtaining device, which is applied to two preset image sensors, and the gain coefficient obtaining device includes: a memory and a processor;
- the memory is used to store program code
- the processor is configured to call the program code, and when the program code is executed, to perform the following operations:
- an embodiment of the present invention provides a computer storage medium, which is characterized by comprising a readable storage medium and a computer program, and the computer program is used to implement the gain coefficient of any one of the above-mentioned first aspects.
- the present invention provides a program product.
- the program product includes a computer program (ie, an execution instruction), and the computer program is stored in a readable storage medium.
- the processor may read the computer program from a readable storage medium, and the processor executes the computer program to implement the method for obtaining the gain coefficient according to any one of the above-mentioned first aspects.
- the method of brightness mean square error is adopted.
- the respective gain coefficients of the two image sensors increase the accuracy of the gain coefficients compared with the gain coefficients corresponding to the image sensors calculated according to their own photographing experience in the prior art .
- Figure 1 is an application scenario diagram provided by an embodiment of the present invention.
- FIG. 2 is a schematic flowchart of a method for obtaining gain coefficients according to an embodiment of the present invention
- FIG. 3 is a schematic flowchart of another method for obtaining gain coefficients according to an embodiment of the present invention.
- FIG. 4 is a schematic flowchart of a method for adjusting gain provided by an embodiment of the present invention.
- FIG. 5 is a schematic diagram of brightness comparison of an image provided by an embodiment of the present invention.
- FIG. 6 is a schematic structural diagram of a gain coefficient obtaining apparatus provided by an embodiment of the present invention.
- “at least one” refers to one or more, and “multiple” refers to two or more.
- “And/or” describes the association relationship of the associated objects, indicating that there can be three relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone. A and B can be singular or plural.
- the character "/" generally indicates that the associated objects before and after are in an "or" relationship.
- Figure 1 is a diagram of an application scenario provided by an embodiment of the present invention.
- a user uses a camera including binocular cameras to take pictures in the environment
- the image sensors in different cameras have a certain gain difference
- the user needs to be based on their own
- calculate the gain coefficient corresponding to the image sensor and adjust the brightness of the image output by the image sensor according to the calculated gain coefficient, so that the brightness of the final output image of the two image cameras is as close as possible.
- the accuracy of the calculated gain coefficient will not be high.
- the embodiment of the present invention provides a method for obtaining the gain coefficient, which can be applied to two preset image sensors.
- the respective gain coefficients of the sensors determine whether it is necessary to adjust the gain of the two image sensors. It can be seen that when calculating the respective gain coefficients of the two image sensors, the brightness mean square error method is used.
- the brightness mean square error of the two image sensors is calculated to reach a minimum value.
- the gain coefficients corresponding to the two image sensors are compared with the gain coefficients corresponding to the image sensors calculated according to their own photographing experience in the prior art, which improves the accuracy of the gain coefficients.
- the brightness matrix of the image sensor can be understood as a matrix for indicating the brightness of the image sensor.
- the gain of the image sensor can be calculated according to the gain coefficient corresponding to the image sensor, so that the image brightness of the image sensor is adjusted by the gain of the image sensor, so that the image brightness of the image sensor meets the requirements. For example, the image brightness of the image sensor reaches a threshold, or the image brightness of the image sensor is as consistent as possible with the brightness of another image sensor.
- FIG. 2 is a schematic flowchart of a method for obtaining gain coefficients according to an embodiment of the present invention, which is applied to two preset image sensors.
- the method for obtaining gain coefficients may be The acquisition device for the gain coefficient can be set independently or in the camera.
- the method for obtaining the gain coefficient may include:
- the brightness of the image sensor affects the calculation of the gain coefficient, that is, the brightness of the image sensor is used as an influencing factor of the gain coefficient. Therefore, when calculating the gain coefficient corresponding to the image sensor, it is necessary to obtain the information indicating the image sensor of the two image sensors.
- the respective gain coefficients of the two sensors are used to determine whether it is necessary to adjust the gain of the two image sensors.
- the mean square error method is used. According to the brightness matrix of the two image sensors, the brightness mean square error of the two image sensors is calculated separately when the minimum value is reached. Compared with the gain coefficients corresponding to the image sensors calculated according to the photographing experience in the prior art, the gain coefficients corresponding to the two image sensors improve the accuracy of the gain coefficients.
- the two image sensors may be the first sensor and the second image sensor.
- the first image sensor may be a left-eye image sensor or a right-eye image sensor
- the second image sensor may be a right-eye sensor or a left-eye image sensor.
- the first image sensor is the left-eye image sensor and the second image sensor is the right-eye sensor as an example for description, but it does not mean that the embodiment of the present invention is limited to this.
- the two image sensors can be calculated when the brightness mean square error of the two image sensors reaches a minimum value.
- the respective gain coefficients in at least two different scenes, according to the brightness matrix of the two image sensors, the two image sensors can be calculated when the brightness mean square error of the two image sensors reaches a minimum value.
- the gains of the first image sensor and the second image sensor are adjusted at the same time, when the brightness mean square error of the two image sensors is calculated to reach a minimum value, the first image sensor and the second image sensor Each corresponding gain coefficient, so as to obtain the respective gain coefficients of the first image sensor and the second image sensor when the brightness mean square error of the two image sensors reaches a minimum value.
- the gains of the first image sensor and the second image sensor are adjusted at the same time. Calculated. It should be noted that adjusting the gains of the first image sensor and the second image sensor at the same time cannot be limited to being understood as adjusting the gains of the first image sensor and the second image sensor at the same time, but can also be understood as adjusting the gains of the first image sensor.
- the gain of the sensor adjusts the gain of the second image sensor.
- the first image sensor when adjusting the first image sensor, calculate the gain coefficient corresponding to the first image sensor when the brightness mean square error of the two image sensors reaches a minimum value; when adjusting the second image sensor, calculate When the brightness mean square error of the two image sensors reaches a minimum value, the corresponding gain coefficient of the second image sensor is obtained, so that when the brightness mean square error of the two image sensors reaches a minimum value, the first image sensor and the second image sensor respectively The corresponding gain factor.
- At least two A possible implementation is to calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value.
- the images of the two image sensors can be regarded as an entire area, and the brightness mean square error of the two image sensors can be calculated to reach a minimum value according to the brightness matrix and weight matrix of the entire area of the image.
- the two image sensors respectively correspond to the gain coefficient.
- the images of the two image sensors are taken as an entire area, and the brightness mean square error of the two image sensors is calculated according to the brightness matrix and weight matrix of the entire area of the image.
- the respective gain coefficients of the two image sensors can be understood as calculating the respective gain coefficients of the two image sensors based on the brightness mean square error of the global average.
- the method of calculating the respective gain coefficients of the two image sensors based on the global average of the brightness mean square error method improves the gain coefficient compared with calculating the gain coefficients corresponding to the image sensors according to one's own photographing experience in the prior art Accuracy.
- the images of the two image sensors can be partitioned separately to generate P partitions respectively; P is an integer greater than or equal to 2; and then according to the brightness matrix and weight matrix of each partition Calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value.
- the images of the two image sensors are first partitioned to generate P partitions, and then the two images are calculated according to the brightness matrix and weight matrix of each partition.
- the respective gain coefficients of the two image sensors can be understood as calculating the respective gain coefficients of the two image sensors based on the brightness mean square error of the partition.
- the method of calculating the respective gain coefficients of the two image sensors based on the partition-based brightness mean square error method improves the accuracy of the gain coefficients compared with calculating the gain coefficients corresponding to the image sensors based on one's own photographing experience in the prior art degree.
- the image and the image of the second sensor are separately processed to generate P partitions, where P can be represented by N ⁇ M, that is, divided into N ⁇ M partitions, and the brightness matrix corresponding to the image of the first image sensor is A N ⁇ M ,
- the weight matrix corresponding to the image of the first image sensor is AW N ⁇ M
- the brightness matrix corresponding to the image of the second image sensor is B N ⁇ M
- the weight matrix corresponding to the image of the second image sensor is BW N ⁇ M , which defines
- the brightness mean square error MSE of the two image sensors is formula (1):
- a i ⁇ j represents the brightness matrix corresponding to the i ⁇ j partition in the N ⁇ M partitions of the image of the first image sensor
- AW i ⁇ j represents the brightness matrix of the N ⁇ M partition of the image of the first image sensor.
- the weight matrix corresponding to i ⁇ j partitions B i ⁇ j represents the brightness matrix corresponding to the i ⁇ j partition in the N ⁇ M partitions of the image of the second image sensor
- BW i ⁇ j represents the image of the second image sensor
- i is an integer greater than or equal to 1 and less than or equal to N
- j is an integer greater than or equal to 1 and less than or equal to M.
- the brightness mean square error MSE function of the first image sensor when only the gain of the first image sensor is adjusted, can be expressed as formula (2); when only the gain of the second image sensor is adjusted , The brightness mean square error MSE function of the second image sensor can be expressed as formula (3).
- k a represents the gain coefficient corresponding to the first image sensor
- k b represents the gain coefficient corresponding to the second image sensor.
- the gain coefficient corresponding to the first image sensor is the ratio of the gain of the first image sensor to the gain of the second image sensor
- the gain coefficient corresponding to the second image sensor is the sum of the gain of the second image sensor The ratio of the gain of the first image sensor.
- the gain coefficient k a corresponding to the first image sensor can be obtained due to the reciprocity of k a and k b .
- formula (3) is first derived to obtain the gain coefficient k b corresponding to the second image sensor, and then according to k a
- the gain coefficient k a corresponding to the first image sensor can be obtained by the reciprocity of k b and k b .
- formula (2) can also be derived first to obtain the gain coefficient k a corresponding to the first image sensor, and then according to k a and The reciprocity of k b can obtain the gain coefficient k b corresponding to the second image sensor.
- the embodiment of the present invention only derives formula (3) first to obtain the gain coefficient k b corresponding to the second image sensor, and then obtains the gain corresponding to the first image sensor according to the reciprocity of k a and k b
- the coefficient k a is described as an example, but it does not mean that the embodiment of the present invention is limited thereto.
- the mean square error method is used. According to the brightness matrix and weight matrix of the two image sensors, the brightness mean square error of the two image sensors is calculated to reach the extreme When the value is small, the respective gain coefficients of the two image sensors improve the accuracy of the gain coefficients compared with the gain coefficients corresponding to the image sensors calculated according to one's own photographing experience in the prior art.
- the brightness mean square error method is used to calculate the respective gain coefficients of the two image sensors.
- a histogram can also be used.
- the mean square error method or other gain coefficient calculation methods calculate the respective gain coefficients of the two image sensors.
- the embodiment of the present invention is only described by using the method of luminance mean square error to calculate the respective gain coefficients of two image sensors as an example, but it does not mean that the embodiment of the present invention is limited to this.
- the corresponding gain coefficients of the two image sensors can also be The gain coefficient of determines whether to adjust the gain of the two image sensors, so as to adjust the brightness of the image output by the image sensor according to the adjusted gain, that is, perform brightness equalization on the brightness of the image output by the two image sensors.
- FIG. 4 is a schematic flowchart of a method for adjusting gain according to an embodiment of the present invention.
- the method for obtaining gain coefficients may further include:
- the An image sensor is the image sensor to be adjusted; when the gain coefficient corresponding to the second image sensor is greater than the preset threshold, the second image sensor is determined to be the image sensor to be adjusted.
- the gain coefficient corresponding to the first image sensor is greater than the preset threshold, and the gain coefficient corresponding to the second image sensor is less than the preset threshold, it is determined that the first image sensor is the image sensor to be adjusted; when the second image sensor corresponds to When the gain coefficient is greater than the preset threshold, and the gain coefficient corresponding to the first image sensor is less than the preset threshold, it is determined that the second image sensor is the image sensor to be adjusted.
- the preset threshold may be 1, or 1.01, of course, it may also be 0.99, which can be specifically set according to actual needs.
- the specific value of the preset threshold is not further limited in the embodiment of the present invention.
- the preset threshold may be set to 1.
- the gain coefficient k a corresponding to the first image sensor is between the preset threshold 1
- the size relationship, and/or determine the size relationship between the gain coefficient k b corresponding to the second image sensor and the preset threshold 1, that is, through at least three possible implementations, the first image sensor and the second image sensor determine The image sensor to be adjusted.
- the magnitude relationship between the gain coefficient k a corresponding to the first image sensor and the preset threshold 1 can be determined first, and if the gain coefficient corresponding to the first image sensor is greater than the preset threshold 1, then directly The first image sensor is determined as the image sensor to be adjusted, and there is no need to determine the magnitude relationship between the gain coefficient k b corresponding to the second image sensor and the preset threshold 1; on the contrary, if the gain coefficient corresponding to the first image sensor is less than the preset threshold value 1.
- Set the threshold value 1 it is necessary to further determine the magnitude relationship between the gain coefficient k b corresponding to the second image sensor and the preset threshold value 1. If the gain coefficient k b corresponding to the second image sensor is greater than the preset threshold value 1, the second image sensor The image sensor is determined to be the image sensor to be adjusted.
- the magnitude relationship between the gain coefficient k b corresponding to the second image sensor and the preset threshold 1 may be determined first, and if the gain coefficient corresponding to the second image sensor is greater than the preset threshold 1, then The second image sensor is directly determined as the image sensor to be adjusted, and there is no need to determine the magnitude relationship between the gain coefficient k a corresponding to the first image sensor and the preset threshold 1; on the contrary, if the gain coefficient k corresponding to the second image sensor is b is less than the preset threshold 1, it is necessary to further determine the magnitude relationship between the gain coefficient k a corresponding to the first image sensor and the preset threshold 1. If the gain coefficient k a corresponding to the first image sensor is greater than the preset threshold 1, then The first image sensor is determined as the image sensor to be adjusted.
- the magnitude relationship between the gain coefficient k a corresponding to the first image sensor and the preset threshold 1 can be simultaneously determined, and the gain coefficient k b corresponding to the second image sensor is greater than the preset threshold 1 If the gain coefficient k a corresponding to the first image sensor is greater than the preset threshold value 1, and the gain coefficient k b corresponding to the second image sensor is less than the preset threshold value 1, the first image sensor is directly determined as The image sensor to be adjusted; on the contrary, if the gain coefficient k b corresponding to the second image sensor is greater than the preset threshold value 1, and the gain coefficient k a corresponding to the first image sensor is less than the preset threshold value 1, the second image sensor is directly determined Is the image sensor to be adjusted, so that the image sensor to be adjusted is determined among the first image sensor and the second image sensor.
- the gains of the first image sensor and the second image sensor are not adjusted. .
- S402 Adjust the current gain of the image sensor to be adjusted according to the gain coefficient corresponding to the image sensor to be adjusted and the previous gain of the image sensor to be adjusted.
- the current adjustment can be calculated first according to the gain coefficient of the image sensor to be adjusted. Proportion: The product of the current adjustment ratio and the last gain of the image sensor to be adjusted is used as the target gain, and then the current gain of the image sensor to be adjusted is adjusted to the target gain.
- the adjustment ratio is the ratio of the current gain of the image sensor to be adjusted to the previous gain of the image sensor to be adjusted.
- the current adjustment ratio needs to be obtained first, and then the current adjustment ratio and the last time the image sensor to be adjusted The product of the gain is adjusted as the target gain.
- the corresponding current adjustment ratio acquisition method corresponds to when the image sensor to be adjusted is the second image sensor. The current adjustment ratio is obtained in different ways.
- the gain coefficient corresponding to the first image sensor may be calculated first
- the product of the previous adjustment ratio of the first image sensor, and the product is the current adjustment ratio of the first image sensor.
- the product of the current adjustment ratio of the first image sensor and the last gain of the first image sensor is calculated, and the product is the target gain, so that the first image sensor can be adjusted.
- the current gain of an image sensor is adjusted as the target gain, and the brightness of the image output by the first image sensor is adjusted by adjusting the current gain of the first image sensor.
- the adjustment ratio of the first image sensor is the ratio of the current gain of the first image sensor to the previous gain of the first image sensor.
- the last adjustment of the second image sensor when acquiring the current adjustment ratio of the second image sensor, the last adjustment of the second image sensor may be calculated first The quotient of the ratio divided by the gain coefficient corresponding to the second image sensor, and the quotient is the current adjustment ratio of the second image sensor. Further, after the current adjustment ratio of the second image sensor is calculated, the product of the current adjustment ratio of the second image sensor and the last gain of the second image sensor is calculated, and the product is the target gain, so that the first The current gain of the second image sensor is adjusted as the target gain, and the brightness of the image output by the second image sensor is adjusted by adjusting the current gain of the second image sensor.
- the adjustment ratio of the second image sensor is the ratio of the current gain of the second image sensor to the previous gain of the second image sensor.
- the respective gain coefficients of the first image sensor and the second image sensor are calculated, and according to the respective gain coefficients of the first image sensor and the second image sensor, the two After the image sensor to be adjusted for which gain adjustment is required among the image sensors, the current gain of the image sensor to be adjusted can be adjusted according to the corresponding gain coefficient of the image sensor to be adjusted, so that the output of the first image sensor
- the image brightness is as close as possible to the brightness of the image output by the second image sensor.
- FIG. 5 is a schematic diagram of brightness comparison of an image provided by an embodiment of the present invention. The two images in the first row in FIG.
- FIG. 6 is a schematic structural diagram of a gain coefficient obtaining device 60 provided by an embodiment of the present invention, which is applied to two preset image sensors.
- the gain coefficient obtaining device 60 may include : Processor 601 and memory 602.
- the memory 602 is used to store program codes.
- the processor 601 is used to call program code, and when the program code is executed, it is used to perform the following operations:
- the processor 601 is further configured to determine the to-be-adjusted image sensor of the two image sensors that needs gain adjustment according to the respective gain coefficients of the two image sensors; and to treat the image sensor according to the corresponding gain coefficient of the image sensor to be adjusted Adjust the current gain of the image sensor for adjustment.
- the processor 601 is specifically configured to adjust the current gain of the image sensor to be adjusted according to the gain coefficient corresponding to the image sensor to be adjusted and the previous gain of the image sensor to be adjusted.
- the processor 601 is specifically configured to adjust the current gain of the image sensor to be adjusted according to the gain coefficient corresponding to the image sensor to be adjusted and the previous gain of the image sensor to be adjusted, including:
- the processor 601 is specifically configured to calculate the current adjustment ratio according to the gain coefficient corresponding to the image sensor to be adjusted; where the adjustment ratio is the ratio of the current gain of the image sensor to be adjusted to the previous gain of the image sensor to be adjusted; The product of the adjustment ratio of and the previous gain of the image sensor to be adjusted is used as the target gain, and the current gain of the image sensor to be adjusted is adjusted to the target gain.
- the processor 601 is specifically configured to calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value when the gains of the two image sensors are adjusted at the same time.
- the two image sensors include a first image sensor and a second image sensor.
- the processor 601 is specifically configured to calculate the gain coefficient corresponding to the first image sensor when the brightness mean square error of the two image sensors reaches a minimum value when adjusting the first image sensor; and when adjusting the second image sensor, calculate two The gain coefficient corresponding to the second image sensor when the brightness mean square error of the two image sensors reaches a minimum value.
- the processor 601 is specifically configured to determine that the first image sensor is the image sensor to be adjusted when the gain coefficient corresponding to the first image sensor is greater than the preset threshold; when the gain coefficient corresponding to the second image sensor is greater than the preset threshold When the second image sensor is determined to be the image sensor to be adjusted.
- the processor 601 is specifically configured to determine that the first image sensor is the image sensor to be adjusted when the gain coefficient corresponding to the first image sensor is greater than a preset threshold and the gain coefficient corresponding to the second image sensor is less than the preset threshold.
- the second image sensor is determined to be the image sensor to be adjusted.
- the processor 601 is specifically configured to:
- the adjustment ratio is the ratio of the current gain of the first image sensor to the previous gain of the first image sensor.
- the processor 601 is specifically configured to:
- the adjustment ratio is the ratio of the current gain of the second image sensor to the previous gain of the second image sensor.
- the processor 601 is further configured to not adjust the gain of the first image sensor and the second image sensor when the gain coefficient corresponding to the first image sensor and the gain coefficient corresponding to the second image sensor are both smaller than a preset threshold.
- the processor 601 is specifically configured to calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value according to the brightness matrix and the weight matrix of the two image sensors.
- the processor 601 is specifically configured to calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value according to the brightness matrix and the weight matrix of the two image sensors, include:
- the processor 601 is specifically configured to perform partition processing on the images of the two image sensors to generate P partitions respectively; P is an integer greater than or equal to 2; and calculates two partitions according to the brightness matrix and weight matrix of each partition. When the brightness mean square error of the image sensor reaches a minimum value, the corresponding gain coefficient of the two image sensors.
- the gain coefficient obtaining device 60 shown in the embodiment of the present invention can implement the technical solution of the gain coefficient obtaining method shown in any of the above embodiments, its realization principle and beneficial effects and the realization principle and benefits of the gain coefficient obtaining method The effect is similar and will not be repeated here.
- An embodiment of the present invention also provides a computer storage medium, including a readable storage medium and a computer program, the computer program is used to implement the gain coefficient acquisition method described in any of the above embodiments, and its implementation principles and beneficial effects The realization principle and beneficial effects of the method for obtaining the gain coefficient are similar, and will not be repeated here.
- the embodiment of the present invention also provides a program product, the program product includes a computer program (that is, an execution instruction), and the computer program is stored in a readable storage medium.
- the processor can read the computer program from a readable storage medium, and the processor executes the computer program to implement the gain coefficient obtaining method described in any of the above embodiments, the realization principle and the beneficial effects and the gain coefficient obtaining method The implementation principles and beneficial effects are similar, and will not be repeated here.
- the processor in the foregoing embodiment may be a general-purpose processor, a digital signal processor (digital signal processor, DSP), an application specific integrated circuit (ASIC), a field programmable gate array (field programmable gate array, FPGA), or Other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
- DSP digital signal processor
- ASIC application specific integrated circuit
- FPGA field programmable gate array
- Other programmable logic devices discrete gates or transistor logic devices, discrete hardware components.
- the methods, steps, and logical block diagrams disclosed in the embodiments of the present invention can be implemented or executed.
- the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
- the steps of the method disclosed in the embodiments of the present invention may be directly embodied as being executed and completed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
- the software module can be located in random access memory (RAM), flash memory, read-only memory (read-only memory, ROM), programmable read-only memory, or electrically erasable programmable memory, registers, etc. mature in the field Storage medium.
- RAM random access memory
- flash memory read-only memory
- read-only memory read-only memory
- ROM programmable read-only memory
- electrically erasable programmable memory registers, etc. mature in the field Storage medium.
- the storage medium is located in the memory, and the processor reads the instructions in the memory and completes the steps of the above method in combination with its hardware.
- a person of ordinary skill in the art can understand that all or part of the steps in the foregoing method embodiments can be implemented by a program instructing relevant hardware.
- the aforementioned program can be stored in a computer readable storage medium.
- the steps including the foregoing method embodiments are executed; and the foregoing storage medium includes: ROM, RAM, magnetic disk, or optical disk and other media that can store program codes.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Studio Devices (AREA)
- Image Input (AREA)
Abstract
Description
本发明涉及图像处理技术领域,尤其涉及一种增益系数的获取方法和装置。The present invention relates to the technical field of image processing, and in particular to a method and device for obtaining a gain coefficient.
为了满足不同环境下的拍摄需求,通常采用双目摄像头对环境中的画面进行拍摄,得到双目图像,与单目摄像头获取的单目图像相比,可以更加形象地还原画面,从而提高了拍摄效果。In order to meet the shooting needs in different environments, binocular cameras are usually used to shoot pictures in the environment to obtain binocular images. Compared with the monocular images obtained by monocular cameras, the pictures can be restored more vividly, thereby improving the shooting effect.
在采用双目摄像头对环境中的画面进行拍摄时,其实质是通过双目摄像头中的两个图像传感器对环境中的画面进行拍摄。但由于不同的图像传感器具有一定的增益差别,需要用户根据自己的拍照经验,计算图像传感器对应的增益系数,并根据计算得到的增益系数调节图像传感器输出的图像的亮度,使得两个图像摄像头最终输出的图像的亮度尽可能接近。When a binocular camera is used to take pictures in the environment, the essence is to take pictures of the pictures in the environment through two image sensors in the binocular camera. However, because different image sensors have a certain gain difference, users need to calculate the corresponding gain coefficient of the image sensor according to their own photographing experience, and adjust the brightness of the image output by the image sensor according to the calculated gain coefficient, so that the two image cameras finally The brightness of the output image is as close as possible.
但是,在根据自己的拍照经验计算图像传感器对应的增益系数时,会使得计算得到的增益系数的准确度不高。However, when calculating the gain coefficient corresponding to the image sensor according to one's own photographing experience, the accuracy of the calculated gain coefficient will not be high.
发明内容Summary of the invention
本发明实施例提供一种增益系数的获取方法和装置,在计算图像传感器对应的增益系数时,提高了增益系数的准确度。The embodiment of the present invention provides a method and device for obtaining a gain coefficient, which improves the accuracy of the gain coefficient when calculating the gain coefficient corresponding to the image sensor.
第一方面,本发明实施例提供一种增益系数的获取方法,应用于预设的两个图像传感器,该增益系数的获取方法可以包括:In the first aspect, an embodiment of the present invention provides a method for obtaining a gain coefficient, which is applied to two preset image sensors, and the method for obtaining a gain coefficient may include:
分别获取两个所述图像传感器的亮度矩阵;Acquiring the brightness matrices of the two image sensors respectively;
根据两个所述图像传感器的亮度矩阵,分别计算两个所述图像传感器的亮度均方误差达到极小值时,两个所述图像传感器各自对应的增益系数;其中,两个所述传感器各自对应的增益系数用于确定是否需要对两个所述图像传感器进行增益调节。According to the brightness matrices of the two image sensors, calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value; wherein, each of the two sensors The corresponding gain coefficient is used to determine whether it is necessary to adjust the gain of the two image sensors.
第二方面,本发明实施例提供一种增益系数的获取装置,应用于预设的两个图像传感器,该增益系数的获取装置包括:存储器和处理器;In a second aspect, an embodiment of the present invention provides a gain coefficient obtaining device, which is applied to two preset image sensors, and the gain coefficient obtaining device includes: a memory and a processor;
所述存储器,用于存储程序代码;The memory is used to store program code;
所述处理器,用于调用所述程序代码,当所述程序代码被执行时,用于执行以下操作:The processor is configured to call the program code, and when the program code is executed, to perform the following operations:
分别获取两个所述图像传感器的亮度矩阵;并根据两个所述图像传感器的亮度矩阵,分别计算两个所述图像传感器的亮度均方误差达到极小值时,两个所述图像传感器各自对应的增益系数;其中,两个所述传感器各自对应的增益系数用于确定是否需要对两个所述图像传感器进行增益调节。Acquire the brightness matrices of the two image sensors respectively; and calculate the brightness mean square error of the two image sensors to a minimum value according to the brightness matrices of the two image sensors, respectively Corresponding gain coefficient; wherein the respective gain coefficients of the two sensors are used to determine whether it is necessary to adjust the gain of the two image sensors.
第三方面,本发明实施例提供一种计算机存储介质,其特征在于,包括可读存储介质和计算机程序,所述计算机程序,用于实现上述第一方面中任一项所述的增益系数的获取方法。In a third aspect, an embodiment of the present invention provides a computer storage medium, which is characterized by comprising a readable storage medium and a computer program, and the computer program is used to implement the gain coefficient of any one of the above-mentioned first aspects. Obtaining method.
第四方面,本发明提供一种程序产品,该程序产品包括计算机程序(即执行指令),该计算机程序存储在可读存储介质中。处理器可以从可读存储介质读取该计算机程序,处理器执行该计算机程序用于实现上述第一方面中任一项所述的增益系数的获取方法。In a fourth aspect, the present invention provides a program product. The program product includes a computer program (ie, an execution instruction), and the computer program is stored in a readable storage medium. The processor may read the computer program from a readable storage medium, and the processor executes the computer program to implement the method for obtaining the gain coefficient according to any one of the above-mentioned first aspects.
本发明实施例提供的增益系数的获取方法和装置,在分别计算两个图像传感器各自对应的增益系数时,是采用亮度均方误差的方法,根据两个图像传感器的亮度矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数,与现有技术中根据自己的拍照经验计算图像传感器对应的增益系数相比,提高了增益系数的准确度。In the method and device for obtaining gain coefficients provided by the embodiments of the present invention, when calculating the respective gain coefficients of two image sensors, the method of brightness mean square error is adopted. According to the brightness matrices of the two image sensors, two When the brightness mean square error of the image sensor reaches a minimum value, the respective gain coefficients of the two image sensors increase the accuracy of the gain coefficients compared with the gain coefficients corresponding to the image sensors calculated according to their own photographing experience in the prior art .
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following will briefly introduce the drawings used in the description of the embodiments or the prior art. Obviously, the drawings in the following description These are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor.
图1为本发明实施例提供的一种应用场景图;Figure 1 is an application scenario diagram provided by an embodiment of the present invention;
图2为本发明实施例提供的一种增益系数的获取方法的流程示意图;2 is a schematic flowchart of a method for obtaining gain coefficients according to an embodiment of the present invention;
图3为本发明实施例提供的另一种增益系数的获取方法的流程示意图;3 is a schematic flowchart of another method for obtaining gain coefficients according to an embodiment of the present invention;
图4为本发明实施例提供的一种调节增益的方法的流程示意图;4 is a schematic flowchart of a method for adjusting gain provided by an embodiment of the present invention;
图5为本发明实施例提供的一种图像的亮度对比示意图;5 is a schematic diagram of brightness comparison of an image provided by an embodiment of the present invention;
图6为本发明实施例提供的一种增益系数的获取装置的结构示意图。FIG. 6 is a schematic structural diagram of a gain coefficient obtaining apparatus provided by an embodiment of the present invention.
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present disclosure. Rather, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
在本发明的实施例中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,其中A,B可以是单数或者复数。在本发明的文字描述中,字符“/”一般表示前后关联对象是一种“或”的关系。In the embodiments of the present invention, "at least one" refers to one or more, and "multiple" refers to two or more. "And/or" describes the association relationship of the associated objects, indicating that there can be three relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone. A and B can be singular or plural. In the text description of the present invention, the character "/" generally indicates that the associated objects before and after are in an "or" relationship.
图1为本发明实施例提供的一种应用场景图,用户在通过包含双目摄像头的相机对环境中的画面进行拍摄时,由于不同摄像头中的图像传感器具有一定的增益差别,需要用户根据自己的拍照经验,计算图像传感器对应的增益系数,并根据计算得到的增益系数调节图像传感器输出的图像的亮度,使得两个图像摄像头最终输出的图像的亮度尽可能接近。但是,在根据自己的拍照经验计算图像传感器对应的增益系数时,会使得计算得到的增益系数的准确度不高。Figure 1 is a diagram of an application scenario provided by an embodiment of the present invention. When a user uses a camera including binocular cameras to take pictures in the environment, since the image sensors in different cameras have a certain gain difference, the user needs to be based on their own Based on the photographing experience, calculate the gain coefficient corresponding to the image sensor, and adjust the brightness of the image output by the image sensor according to the calculated gain coefficient, so that the brightness of the final output image of the two image cameras is as close as possible. However, when calculating the gain coefficient corresponding to the image sensor according to one's own photographing experience, the accuracy of the calculated gain coefficient will not be high.
为了提高增益系数的准确度,本发明实施例提供了一种增益系数的获取方法,可应用于预设的两个图像传感器,在计算两个图像传感器各自对应的增益系数时,先分别获取两个图像传感器的亮度矩阵,再根据两个图像传感器的亮度矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数,这样就可以通过两个传感器各自对应的增益系数确定是否需要对两个图像传感器进行增益调节。由此可见,在计算两个图像传感器各自对应的增益系数时,是采用亮度均方误差的方法,根据两个图像传感器的亮度矩阵,分别计算两个图像传感器的亮度均方误差达到 极小值时,两个图像传感器各自对应的增益系数,与现有技术中根据自己的拍照经验计算图像传感器对应的增益系数相比,提高了增益系数的准确度。In order to improve the accuracy of the gain coefficient, the embodiment of the present invention provides a method for obtaining the gain coefficient, which can be applied to two preset image sensors. When calculating the respective gain coefficients of the two image sensors, first obtain the two gain coefficients respectively. According to the brightness matrix of the two image sensors, calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value, so that the two image sensors can be passed The respective gain coefficients of the sensors determine whether it is necessary to adjust the gain of the two image sensors. It can be seen that when calculating the respective gain coefficients of the two image sensors, the brightness mean square error method is used. According to the brightness matrix of the two image sensors, the brightness mean square error of the two image sensors is calculated to reach a minimum value. At this time, the gain coefficients corresponding to the two image sensors are compared with the gain coefficients corresponding to the image sensors calculated according to their own photographing experience in the prior art, which improves the accuracy of the gain coefficients.
在详细描述本发明实施例提供的技术方案之前,先介绍本发明涉及的几个概念。其中,图像传感器的亮度矩阵可以理解为用于指示图像传感器的亮度的矩阵。根据图像传感器对应的增益系数可以计算得到该图像传感器的增益,从而通过该图像传感器的增益调节该图像传感器的图像亮度,使得该图像传感器的图像亮度满足需求。例如,该图像传感器的图像亮度达到一个阈值,或者,该图像传感器的图像亮度与另一个图像传感器的亮度尽可能一致等。Before describing in detail the technical solutions provided by the embodiments of the present invention, several concepts related to the present invention will be introduced first. Among them, the brightness matrix of the image sensor can be understood as a matrix for indicating the brightness of the image sensor. The gain of the image sensor can be calculated according to the gain coefficient corresponding to the image sensor, so that the image brightness of the image sensor is adjusted by the gain of the image sensor, so that the image brightness of the image sensor meets the requirements. For example, the image brightness of the image sensor reaches a threshold, or the image brightness of the image sensor is as consistent as possible with the brightness of another image sensor.
下面以具体的实施例对本发明的技术方案进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。The technical solution of the present invention will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
示例的,请参见图2所示,图2为本发明实施例提供的一种增益系数的获取方法的流程示意图,应用于预设的两个图像传感器,该增益系数的获取方法可以由增益系数的获取装置执行,该增益系数的获取装置可以独立设置,也可以设置在拍摄装置中。该增益系数的获取方法可以包括:For example, please refer to FIG. 2. FIG. 2 is a schematic flowchart of a method for obtaining gain coefficients according to an embodiment of the present invention, which is applied to two preset image sensors. The method for obtaining gain coefficients may be The acquisition device for the gain coefficient can be set independently or in the camera. The method for obtaining the gain coefficient may include:
S201、分别获取两个图像传感器的亮度矩阵。S201: Obtain brightness matrices of two image sensors respectively.
由于图像传感器的亮度会影响增益系数的计算,即图像传感器的亮度作为增益系数的一个影响因子,因此,在计算图像传感器对应的增益系数时,需要先获取指示两个图像传感器中各图像传感器的亮度矩阵,并在分别获取两个图像传感器的亮度矩阵之后,根据两个图像传感器的亮度矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数,即执行下述S202:Because the brightness of the image sensor affects the calculation of the gain coefficient, that is, the brightness of the image sensor is used as an influencing factor of the gain coefficient. Therefore, when calculating the gain coefficient corresponding to the image sensor, it is necessary to obtain the information indicating the image sensor of the two image sensors. Brightness matrix, and after obtaining the brightness matrix of the two image sensors, respectively, according to the brightness matrix of the two image sensors, calculate the respective gains of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value Coefficient, that is, perform the following S202:
S202、根据两个图像传感器的亮度矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数。S202: According to the brightness matrices of the two image sensors, respectively calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value.
其中,两个传感器各自对应的增益系数用于确定是否需要对两个图像传感器进行增益调节。Among them, the respective gain coefficients of the two sensors are used to determine whether it is necessary to adjust the gain of the two image sensors.
由此可见,在计算两个图像传感器各自对应的增益系数时,是采用均方误差的方法,根据两个图像传感器的亮度矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数,与现有 技术中根据自己的拍照经验计算图像传感器对应的增益系数相比,提高了增益系数的准确度。It can be seen that when calculating the respective gain coefficients of the two image sensors, the mean square error method is used. According to the brightness matrix of the two image sensors, the brightness mean square error of the two image sensors is calculated separately when the minimum value is reached. Compared with the gain coefficients corresponding to the image sensors calculated according to the photographing experience in the prior art, the gain coefficients corresponding to the two image sensors improve the accuracy of the gain coefficients.
在上述图2所示的实施例中,示例的,两个图像传感器可以为第一传感器和第二图像传感器。其中,第一图像传感器可以为左目图像传感器或右目图像传感器,对应的,第二图像传感器可以为右目传感器或左目图像传感器。需要说明的是,在本发明实施例中,以第一图像传感器为左目图像传感器,第二图像传感器为右目传感器为例进行说明,但并不代表本发明实施例仅局限于此。In the embodiment shown in FIG. 2 above, as an example, the two image sensors may be the first sensor and the second image sensor. Wherein, the first image sensor may be a left-eye image sensor or a right-eye image sensor, and correspondingly, the second image sensor may be a right-eye sensor or a left-eye image sensor. It should be noted that, in the embodiment of the present invention, the first image sensor is the left-eye image sensor and the second image sensor is the right-eye sensor as an example for description, but it does not mean that the embodiment of the present invention is limited to this.
基于图2所示的实施例,下面将详细描述如何根据两个图像传感器的亮度矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数。示例的,在本发明实施例中,可以在至少两种不同的场景下,根据两个图像传感器的亮度矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数。Based on the embodiment shown in FIG. 2, the following will describe in detail how to calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value according to the brightness matrices of the two image sensors. For example, in the embodiment of the present invention, in at least two different scenes, according to the brightness matrix of the two image sensors, the two image sensors can be calculated when the brightness mean square error of the two image sensors reaches a minimum value. The respective gain coefficients.
在一种可能的场景下,当同时调节第一图像传感器和第二图像传感器的增益时,分别计算两个图像传感器的亮度均方误差达到极小值时,第一图像传感器和第二图像传感器各自对应的增益系数,从而得到两个图像传感器的亮度均方误差达到极小值时,第一图像传感器和第二图像传感器各自对应的增益系数。In a possible scenario, when the gains of the first image sensor and the second image sensor are adjusted at the same time, when the brightness mean square error of the two image sensors is calculated to reach a minimum value, the first image sensor and the second image sensor Each corresponding gain coefficient, so as to obtain the respective gain coefficients of the first image sensor and the second image sensor when the brightness mean square error of the two image sensors reaches a minimum value.
可以看出,在该种可能的场景下,在分别计算第一图像传感器和第二图像传感器各自对应的增益系数时,是在同时调节第一图像传感器和第二图像传感器的增益的情况下,计算得到的。需要说明的是,该同时调节第一图像传感器和第二图像传感器的增益,不能局限于理解为在同一时刻调节第一图像传感器和第二图像传感器的增益,还可以理解为既调节第一图像传感器的增益,又调节第二图像传感器的增益。It can be seen that in this possible scenario, when the respective gain coefficients of the first image sensor and the second image sensor are calculated separately, the gains of the first image sensor and the second image sensor are adjusted at the same time. Calculated. It should be noted that adjusting the gains of the first image sensor and the second image sensor at the same time cannot be limited to being understood as adjusting the gains of the first image sensor and the second image sensor at the same time, but can also be understood as adjusting the gains of the first image sensor. The gain of the sensor adjusts the gain of the second image sensor.
在另一种可能的场景下,当调节第一图像传感器时,计算两个图像传感器的亮度均方误差达到极小值时第一图像传感器对应的增益系数;当调节第二图像传感器时,计算两个图像传感器的亮度均方误差达到极小值时第二图像传感器对应的增益系数,从而得到两个图像传感器的亮度均方误差达到极小值时,第一图像传感器和第二图像传感器各自对应的增益系数。In another possible scenario, when adjusting the first image sensor, calculate the gain coefficient corresponding to the first image sensor when the brightness mean square error of the two image sensors reaches a minimum value; when adjusting the second image sensor, calculate When the brightness mean square error of the two image sensors reaches a minimum value, the corresponding gain coefficient of the second image sensor is obtained, so that when the brightness mean square error of the two image sensors reaches a minimum value, the first image sensor and the second image sensor respectively The corresponding gain factor.
可以看出,在该种可能的场景下,在分别计算第一图像传感器和第二图 像传感器各自对应的增益系数时,是在分别调节第一图像传感器和第二图像传感器的增益的情况下,计算得到的。以该种可能的场景为例,在分别计算两个图像传感器的亮度均方误差达到极小值时第二图像传感器对应的增益系数时,请参见图3所示,图3为本发明实施例提供的另一种增益系数的获取方法的流程示意图,该增益系数的获取方法还可以包括:It can be seen that in this possible scenario, when the respective gain coefficients of the first image sensor and the second image sensor are respectively calculated, the gains of the first image sensor and the second image sensor are adjusted separately. Calculated. Taking this possible scenario as an example, when calculating the corresponding gain coefficient of the second image sensor when the brightness mean square error of the two image sensors reaches a minimum value, please refer to FIG. 3, which is an embodiment of the present invention. A schematic flow chart of another method for obtaining gain coefficients is provided, and the method for obtaining gain coefficients may further include:
S301、根据两个图像传感器的亮度矩阵和权重矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数。S301: According to the brightness matrix and the weight matrix of the two image sensors, respectively calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value.
可选的,在根据两个图像传感器的亮度矩阵和权重矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数时,可以通过至少两种可能的实现,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数。Optionally, when the brightness mean square error of the two image sensors is calculated to reach a minimum value according to the brightness matrix and the weight matrix of the two image sensors, when the respective gain coefficients of the two image sensors are calculated, at least two A possible implementation is to calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value.
在一种可能的实现方式中,可以将两个图像传感器的图像作为一个整区域,根据该图像的整个区域的亮度矩阵和权重矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数。In a possible implementation, the images of the two image sensors can be regarded as an entire area, and the brightness mean square error of the two image sensors can be calculated to reach a minimum value according to the brightness matrix and weight matrix of the entire area of the image. When, the two image sensors respectively correspond to the gain coefficient.
需要说明的是,在该种可能的实现方式中,将两个图像传感器的图像作为一个整区域,根据该图像的整个区域的亮度矩阵和权重矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数,可以理解为基于全局平均量的亮度均方误差的方式计算两个图像传感器各自对应的增益系数。采用该基于全局平均量的亮度均方误差的方式计算两个图像传感器各自对应的增益系数的方法,与现有技术中根据自己的拍照经验计算图像传感器对应的增益系数相比,提高了增益系数的准确度。It should be noted that, in this possible implementation, the images of the two image sensors are taken as an entire area, and the brightness mean square error of the two image sensors is calculated according to the brightness matrix and weight matrix of the entire area of the image. When the minimum value is reached, the respective gain coefficients of the two image sensors can be understood as calculating the respective gain coefficients of the two image sensors based on the brightness mean square error of the global average. The method of calculating the respective gain coefficients of the two image sensors based on the global average of the brightness mean square error method improves the gain coefficient compared with calculating the gain coefficients corresponding to the image sensors according to one's own photographing experience in the prior art Accuracy.
在另一种可能的实现方式中,可以先对两个图像传感器的图像分别进行分区处理,分别生成P个分区;P为大于或者等于2的整数;再根据每一分区的亮度矩阵和权重矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数。In another possible implementation, the images of the two image sensors can be partitioned separately to generate P partitions respectively; P is an integer greater than or equal to 2; and then according to the brightness matrix and weight matrix of each partition Calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value.
需要说明的是,在该种可能的实现方式中,先对两个图像传感器的图像分别进行分区处理,分别生成P个分区,再根据每一分区的亮度矩阵和权重矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数可以理解为基于分区的亮度均方误差的方式计算两个图像传感器各自对应的增益系数。采用该基于分区的亮度均方误差的方式 计算两个图像传感器各自对应的增益系数的方法,与现有技术中根据自己的拍照经验计算图像传感器对应的增益系数相比,提高了增益系数的准确度。It should be noted that in this possible implementation, the images of the two image sensors are first partitioned to generate P partitions, and then the two images are calculated according to the brightness matrix and weight matrix of each partition. When the brightness mean square error of the sensor reaches a minimum value, the respective gain coefficients of the two image sensors can be understood as calculating the respective gain coefficients of the two image sensors based on the brightness mean square error of the partition. The method of calculating the respective gain coefficients of the two image sensors based on the partition-based brightness mean square error method improves the accuracy of the gain coefficients compared with calculating the gain coefficients corresponding to the image sensors based on one's own photographing experience in the prior art degree.
以两个图像传感器为第一图像传感器和第二图像传感器为例进行说明,假设第一图像传感器的输入通道为通道A,第二图像传感器的输入通道为通道B,先对第一图像传感器的图像和第二传感器的图像分别进行分区处理,分别生成P个分区,其中P可以用N×M表示,即分成N×M个分区,第一图像传感器的图像对应的亮度矩阵为A N×M,第一图像传感器的图像对应的权重矩阵为AW N×M,第二图像传感器的图像对应的亮度矩阵为B N×M,第二图像传感器的图像对应的权重矩阵为BW N×M,定义两个图像传感器的亮度均方误差MSE为公式(1): Take two image sensors as the first image sensor and the second image sensor as an example. Assume that the input channel of the first image sensor is channel A, and the input channel of the second image sensor is channel B. The image and the image of the second sensor are separately processed to generate P partitions, where P can be represented by N×M, that is, divided into N×M partitions, and the brightness matrix corresponding to the image of the first image sensor is A N×M , The weight matrix corresponding to the image of the first image sensor is AW N×M , the brightness matrix corresponding to the image of the second image sensor is B N×M , and the weight matrix corresponding to the image of the second image sensor is BW N×M , which defines The brightness mean square error MSE of the two image sensors is formula (1):
其中,A i×j表示第一图像传感器的图像的N×M个分区中第i×j个分区对应的亮度矩阵,AW i×j表示第一图像传感器的图像的N×M个分区中第i×j个分区对应的权重矩阵,B i×j表示第二图像传感器的图像的N×M个分区中第i×j个分区对应的亮度矩阵,BW i×j表示第二图像传感器的图像的N×M个分区中第i×j个分区对应的权重矩阵。其中,i为大于或等于1,且小于或等于N的整数,j为大于或等于1,且小于或等于M的整数。 Among them, A i×j represents the brightness matrix corresponding to the i×j partition in the N×M partitions of the image of the first image sensor, and AW i×j represents the brightness matrix of the N×M partition of the image of the first image sensor. The weight matrix corresponding to i×j partitions, B i×j represents the brightness matrix corresponding to the i×j partition in the N×M partitions of the image of the second image sensor, and BW i×j represents the image of the second image sensor The weight matrix corresponding to the i×j partition in the N×M partitions. Wherein, i is an integer greater than or equal to 1 and less than or equal to N, and j is an integer greater than or equal to 1 and less than or equal to M.
基于上述公式(1),示例的,当仅调节第一图像传感器的增益时,第一图像传感器的亮度均方误差MSE函数可以表示为公式(2);当仅调节第二图像传感器的增益时,第二图像传感器的亮度均方误差MSE函数可以表示为公式(3)。Based on the above formula (1), for example, when only the gain of the first image sensor is adjusted, the brightness mean square error MSE function of the first image sensor can be expressed as formula (2); when only the gain of the second image sensor is adjusted , The brightness mean square error MSE function of the second image sensor can be expressed as formula (3).
其中,k a表示第一图像传感器对应的增益系数,k b表示第二图像传感器对应的增益系数。根据上述公式可知,所述第一图像传感器对应的增益系数为第一图像传感器的增益和第二图像传感器的增益的比值;所述第二图像传感器对应的增益系数为第二图像传感器的增益和第一图像传感器的增益的比 值。 Among them, k a represents the gain coefficient corresponding to the first image sensor, and k b represents the gain coefficient corresponding to the second image sensor. According to the above formula, the gain coefficient corresponding to the first image sensor is the ratio of the gain of the first image sensor to the gain of the second image sensor; the gain coefficient corresponding to the second image sensor is the sum of the gain of the second image sensor The ratio of the gain of the first image sensor.
对于上述公式(3),进行推导,得到下述公式(4).For the above formula (3), the following formula (4) is obtained.
再对公式(4)求导,可得到下述公式(5)。Taking the derivative of formula (4) again, the following formula (5) can be obtained.
令上述公式(5)中(MSE(k b) 2)’=0,则得到下述公式(6)。 Let (MSE(k b ) 2 )'=0 in the above formula (5), then the following formula (6) is obtained.
根据公式(6)计算得到:Calculated according to formula (6):
在得到第二图像传感器对应的增益系数k b之后,由于k a和k b的互易性可得到第一图像传感器对应的增益系数k a。 After the gain coefficient k b corresponding to the second image sensor is obtained, the gain coefficient k a corresponding to the first image sensor can be obtained due to the reciprocity of k a and k b .
可以理解的是,当上述公式(5)(MSE(k b) 2)’>0时,通过上述得到的k a和k b分别为MSE(k a)和MSE(k b)的极值点,即计算得到两个图像传感器的亮度均方误差达到极小值时,第一图像传感器对应的增益系数k a和第二图像传感器各自对应的增益系数k b。 It is understandable that when the above formula (5) (MSE(k b ) 2 )'>0, k a and k b obtained from the above are the extreme points of MSE(k a ) and MSE(k b ) , That is, when the brightness mean square error of the two image sensors reaches a minimum value, the gain coefficient k a corresponding to the first image sensor and the gain coefficient k b corresponding to the second image sensor are calculated.
需要说明的是,在上述推导过程中,在得到公式(2)和公式(3)之后,是先对公式(3)进行推导,得到第二图像传感器对应的增益系数k b,再根据 k a和k b的互易性可得到第一图像传感器对应的增益系数k a,当然,也可以先对公式(2)进行推导,得到第一图像传感器对应的增益系数k a,再根据k a和k b的互易性可得到第二图像传感器对应的增益系数k b。在此,本发明实施例只是以先对公式(3)进行推导,得到第二图像传感器对应的增益系数k b,再根据k a和k b的互易性可得到第一图像传感器对应的增益系数k a为例进行说明,但并不代表本发明实施例仅局限于此。 It should be noted that in the above derivation process, after formula (2) and formula (3) are obtained, formula (3) is first derived to obtain the gain coefficient k b corresponding to the second image sensor, and then according to k a The gain coefficient k a corresponding to the first image sensor can be obtained by the reciprocity of k b and k b . Of course, formula (2) can also be derived first to obtain the gain coefficient k a corresponding to the first image sensor, and then according to k a and The reciprocity of k b can obtain the gain coefficient k b corresponding to the second image sensor. Here, the embodiment of the present invention only derives formula (3) first to obtain the gain coefficient k b corresponding to the second image sensor, and then obtains the gain corresponding to the first image sensor according to the reciprocity of k a and k b The coefficient k a is described as an example, but it does not mean that the embodiment of the present invention is limited thereto.
由此可见,在计算两个图像传感器各自对应的增益系数时,是采用均方误差的方法,根据两个图像传感器的亮度矩阵和权重矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数,与现有技术中根据自己的拍照经验计算图像传感器对应的增益系数相比,提高了增益系数的准确度。It can be seen that when calculating the respective gain coefficients of the two image sensors, the mean square error method is used. According to the brightness matrix and weight matrix of the two image sensors, the brightness mean square error of the two image sensors is calculated to reach the extreme When the value is small, the respective gain coefficients of the two image sensors improve the accuracy of the gain coefficients compared with the gain coefficients corresponding to the image sensors calculated according to one's own photographing experience in the prior art.
可以看出,在本发明实施例中,在计算两个图像传感器各自对应的增益系数时,是采用亮度均方误差的方法计算两个图像传感器各自对应的增益系数,当然,也可以采用直方图均方误差的方法或者其它增益系数计算方法计算两个图像传感器各自对应的增益系数。在此,本发明实施例只是以采用亮度均方误差的方法计算两个图像传感器各自对应的增益系数为例进行说明,但并不代表本发明实施例仅局限于此。It can be seen that in the embodiment of the present invention, when calculating the respective gain coefficients of the two image sensors, the brightness mean square error method is used to calculate the respective gain coefficients of the two image sensors. Of course, a histogram can also be used. The mean square error method or other gain coefficient calculation methods calculate the respective gain coefficients of the two image sensors. Here, the embodiment of the present invention is only described by using the method of luminance mean square error to calculate the respective gain coefficients of two image sensors as an example, but it does not mean that the embodiment of the present invention is limited to this.
在通过上述图2或图3所示的实施例分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数之后,还可以根据两个图像传感器各自对应的增益系数确定是否调节两个图像传感器的增益,以根据调节后的增益调节图像传感器输出的图像的亮度,即对两个图像传感器输出的图像的亮度进行亮度均衡。示例的,请参见图4所示,图4为本发明实施例提供的一种调节增益的方法的流程示意图,该增益系数的获取方法还可以包括:After calculating the brightness mean square error of the two image sensors to a minimum value through the embodiment shown in FIG. 2 or FIG. 3, after the respective gain coefficients of the two image sensors, the corresponding gain coefficients of the two image sensors can also be The gain coefficient of determines whether to adjust the gain of the two image sensors, so as to adjust the brightness of the image output by the image sensor according to the adjusted gain, that is, perform brightness equalization on the brightness of the image output by the two image sensors. For example, please refer to FIG. 4. FIG. 4 is a schematic flowchart of a method for adjusting gain according to an embodiment of the present invention. The method for obtaining gain coefficients may further include:
S401、根据两个图像传感器各自对应的增益系数,确定两个图像传感器中需要进行增益调节的待调节图像传感器。S401: According to the respective gain coefficients of the two image sensors, determine the image sensor to be adjusted that needs gain adjustment among the two image sensors.
可选的,在根据两个图像传感器各自对应的增益系数,确定两个图像传感器中需要进行增益调节的待调节图像传感器时,当第一图像传感器对应的增益系数大于预设阈值时,确定第一图像传感器为待调节图像传感器;当第二图像传感器对应的增益系数大于预设阈值时,确定第二图像传感器为待调 节图像传感器。Optionally, when determining the to-be-adjusted image sensor of the two image sensors that requires gain adjustment according to the respective gain coefficients of the two image sensors, when the gain coefficient corresponding to the first image sensor is greater than a preset threshold, the An image sensor is the image sensor to be adjusted; when the gain coefficient corresponding to the second image sensor is greater than the preset threshold, the second image sensor is determined to be the image sensor to be adjusted.
进一步地,当第一图像传感器对应的增益系数大于预设阈值,且第二图像传感器对应的增益系数小于预设阈值时,确定第一图像传感器为待调节图像传感器;当第二图像传感器对应的增益系数大于预设阈值,且第一图像传感器对应的增益系数小于预设阈值时,确定第二图像传感器为待调节图像传感器。Further, when the gain coefficient corresponding to the first image sensor is greater than the preset threshold, and the gain coefficient corresponding to the second image sensor is less than the preset threshold, it is determined that the first image sensor is the image sensor to be adjusted; when the second image sensor corresponds to When the gain coefficient is greater than the preset threshold, and the gain coefficient corresponding to the first image sensor is less than the preset threshold, it is determined that the second image sensor is the image sensor to be adjusted.
其中,预设阈值可以为1,也可以为1.01,当然,也可以为0.99,具体可以根据实际需要进行设置,在此对于预设阈值的具体取值,本发明实施例不做进一步地限制。示例的,在本发明实施例中,预设阈值可以设置为1。The preset threshold may be 1, or 1.01, of course, it may also be 0.99, which can be specifically set according to actual needs. Here, the specific value of the preset threshold is not further limited in the embodiment of the present invention. For example, in this embodiment of the present invention, the preset threshold may be set to 1.
在通过上述图3所示的实施例分别计算得到第一图像传感器和第二图像传感器各自对应的增益系数之后,就可以判断第一图像传感器对应的增益系数k a与预设阈值1之间的大小关系,和/或判断第二图像传感器对应的增益系数k b与预设阈值1之间的大小关系,即通过至少三种可能的实现方式,在第一图像传感器和判断第二图像传感器确定待调节图像传感器。 After the respective gain coefficients of the first image sensor and the second image sensor are respectively calculated through the embodiment shown in FIG. 3, it can be determined that the gain coefficient k a corresponding to the first image sensor is between the preset threshold 1 The size relationship, and/or determine the size relationship between the gain coefficient k b corresponding to the second image sensor and the preset threshold 1, that is, through at least three possible implementations, the first image sensor and the second image sensor determine The image sensor to be adjusted.
在一种可能的实现方式中:可以先判断第一图像传感器对应的增益系数k a与预设阈值1之间的大小关系,若第一图像传感器对应的增益系数大于预设阈值1,则直接将第一图像传感器确定为待调节图像传感器,并无需判断第二图像传感器对应的增益系数k b与预设阈值1之间的大小关系;相反的,若第一图像传感器对应的增益系数小于预设阈值1,则需要进一步判断第二图像传感器对应的增益系数k b与预设阈值1之间的大小关系,若第二图像传感器对应的增益系数k b大于预设阈值1,则将第二图像传感器确定为待调节图像传感器。 In a possible implementation manner: the magnitude relationship between the gain coefficient k a corresponding to the first image sensor and the preset threshold 1 can be determined first, and if the gain coefficient corresponding to the first image sensor is greater than the preset threshold 1, then directly The first image sensor is determined as the image sensor to be adjusted, and there is no need to determine the magnitude relationship between the gain coefficient k b corresponding to the second image sensor and the preset threshold 1; on the contrary, if the gain coefficient corresponding to the first image sensor is less than the preset threshold value 1. Set the threshold value 1, it is necessary to further determine the magnitude relationship between the gain coefficient k b corresponding to the second image sensor and the preset threshold value 1. If the gain coefficient k b corresponding to the second image sensor is greater than the preset threshold value 1, the second image sensor The image sensor is determined to be the image sensor to be adjusted.
在另一种可能的实现方式中,可以先判断第二图像传感器对应的增益系数k b与预设阈值1之间的大小关系,若第二图像传感器对应的增益系数大于预设阈值1,则直接将第二图像传感器确定为待调节图像传感器,并无需判断第一图像传感器对应的增益系数k a与预设阈值1之间的大小关系;相反的,若第二图像传感器对应的增益系数k b小于预设阈值1,则需要进一步判断第一图像传感器对应的增益系数k a与预设阈值1之间的大小关系,若第一图像传感器对应的增益系数k a大于预设阈值1,则将第一图像传感器确定为待调节图像传感器。 In another possible implementation manner, the magnitude relationship between the gain coefficient k b corresponding to the second image sensor and the preset threshold 1 may be determined first, and if the gain coefficient corresponding to the second image sensor is greater than the preset threshold 1, then The second image sensor is directly determined as the image sensor to be adjusted, and there is no need to determine the magnitude relationship between the gain coefficient k a corresponding to the first image sensor and the preset threshold 1; on the contrary, if the gain coefficient k corresponding to the second image sensor is b is less than the preset threshold 1, it is necessary to further determine the magnitude relationship between the gain coefficient k a corresponding to the first image sensor and the preset threshold 1. If the gain coefficient k a corresponding to the first image sensor is greater than the preset threshold 1, then The first image sensor is determined as the image sensor to be adjusted.
在又一种可能的实现方式中,可以同时判断第一图像传感器对应的增益系数k a与预设阈值1之间的大小关系,及第二图像传感器对应的增益系数k b大于预设阈值1之间的大小关系,若第一图像传感器对应的增益系数k a大于预设阈值1,且第二图像传感器对应的增益系数k b小于预设阈值1时,则直接将第一图像传感器确定为待调节图像传感器;相反的,若第二图像传感器对应的增益系数k b大于预设阈值1,且第一图像传感器对应的增益系数k a小于预设阈值1,则直接将第二图像传感器确定为待调节图像传感器,从而在第一图像传感器和第二图像传感器中确定待调节图像传感器。 In another possible implementation manner, the magnitude relationship between the gain coefficient k a corresponding to the first image sensor and the preset threshold 1 can be simultaneously determined, and the gain coefficient k b corresponding to the second image sensor is greater than the preset threshold 1 If the gain coefficient k a corresponding to the first image sensor is greater than the preset threshold value 1, and the gain coefficient k b corresponding to the second image sensor is less than the preset threshold value 1, the first image sensor is directly determined as The image sensor to be adjusted; on the contrary, if the gain coefficient k b corresponding to the second image sensor is greater than the preset threshold value 1, and the gain coefficient k a corresponding to the first image sensor is less than the preset threshold value 1, the second image sensor is directly determined Is the image sensor to be adjusted, so that the image sensor to be adjusted is determined among the first image sensor and the second image sensor.
需要说明的是,在本发明实施例中,当第一图像传感器对应的增益系数和第二图像传感器对应的增益系数均小于预设阈值时,不调节第一图像传感器和第二图像传感器的增益。It should be noted that in the embodiment of the present invention, when the gain coefficient corresponding to the first image sensor and the gain coefficient corresponding to the second image sensor are both smaller than the preset threshold, the gains of the first image sensor and the second image sensor are not adjusted. .
在通过上述三种可能的实现方式在第一图像传感器和第二图像传感器中确定待调节图像传感器之后,就可以执行下述S402:After the image sensor to be adjusted is determined in the first image sensor and the second image sensor through the above three possible implementation manners, the following S402 can be executed:
S402、根据待调节图像传感器对应的增益系数和待调节图像传感器的上一次增益,对待调节图像传感器当前的增益进行调节。S402: Adjust the current gain of the image sensor to be adjusted according to the gain coefficient corresponding to the image sensor to be adjusted and the previous gain of the image sensor to be adjusted.
可选的,在根据待调节图像传感器对应的增益系数和待调节图像传感器的上一次增益,对待调节图像传感器当前的增益进行调节时,可以先根据待调节图像传感器对应的增益系数计算当前的调节比例;并将当前的调节比例和待调节图像传感器上一次的增益的乘积作为目标增益,再将待调节图像传感器当前的增益调节为目标增益。其中,调节比例为待调节图像传感器的当前的增益与待调节图像传感器上一次的增益的比例。Optionally, when the current gain of the image sensor to be adjusted is adjusted according to the gain coefficient corresponding to the image sensor to be adjusted and the previous gain of the image sensor to be adjusted, the current adjustment can be calculated first according to the gain coefficient of the image sensor to be adjusted. Proportion: The product of the current adjustment ratio and the last gain of the image sensor to be adjusted is used as the target gain, and then the current gain of the image sensor to be adjusted is adjusted to the target gain. The adjustment ratio is the ratio of the current gain of the image sensor to be adjusted to the previous gain of the image sensor to be adjusted.
可以看出,在将当前的调节比例和待调节图像传感器上一次的增益的乘积作为目标增益之前,需要先获取该当前的调节比例,之后,再将当前的调节比例和待调节图像传感器上一次的增益的乘积作为目标增益进行调节。需要说明的是,在本发明实施例中,当待调节图像传感器为第一图像传感器时,其对应的当前的调节比例的获取方式,与当待调节图像传感器为第二图像传感器时,其对应的当前的调节比例的获取方式不同。It can be seen that before the product of the current adjustment ratio and the last gain of the image sensor to be adjusted is used as the target gain, the current adjustment ratio needs to be obtained first, and then the current adjustment ratio and the last time the image sensor to be adjusted The product of the gain is adjusted as the target gain. It should be noted that, in the embodiment of the present invention, when the image sensor to be adjusted is the first image sensor, the corresponding current adjustment ratio acquisition method corresponds to when the image sensor to be adjusted is the second image sensor. The current adjustment ratio is obtained in different ways.
可选的,当第一图像传感器为待调节图像传感器,且该第一图像传感器为左目图像传感器时,在获取第一图像传感器当前的调节比例时,可以先计算第一图像传感器对应的增益系数和第一图像传感器上一次的调节比例的乘 积,该乘积即为第一图像传感器当前的调节比例。进一步地,在计算得到第一图像传感器当前的调节比例之后,再计算第一图像传感器当前的调节比例和第一图像传感器上一次的增益的乘积,该乘积即为目标增益,这样就可以将第一图像传感器当前的增益调节为目标增益,通过调节第一图像传感器当前的增益,实现对第一图像传感器输出的图像的亮度的调节。其中,第一图像传感器的调节比例为第一图像传感器当前的增益与第一图像传感器上一次的增益的比例。Optionally, when the first image sensor is an image sensor to be adjusted, and the first image sensor is a left-eye image sensor, when obtaining the current adjustment ratio of the first image sensor, the gain coefficient corresponding to the first image sensor may be calculated first The product of the previous adjustment ratio of the first image sensor, and the product is the current adjustment ratio of the first image sensor. Further, after the current adjustment ratio of the first image sensor is calculated, the product of the current adjustment ratio of the first image sensor and the last gain of the first image sensor is calculated, and the product is the target gain, so that the first image sensor can be adjusted. The current gain of an image sensor is adjusted as the target gain, and the brightness of the image output by the first image sensor is adjusted by adjusting the current gain of the first image sensor. The adjustment ratio of the first image sensor is the ratio of the current gain of the first image sensor to the previous gain of the first image sensor.
可选的,当第二图像传感器为待调节图像传感器,且该第二图像传感器为右目图像传感器时,在获取第二图像传感器当前的调节比例时,可以先计算第二图像传感器上一次的调节比例与第二图像传感器对应的增益系数相除的商,该商即为第二图像传感器当前的调节比例。进一步地,在计算得到第二图像传感器当前的调节比例之后,再计算第二图像传感器当前的调节比例和第二图像传感器上一次的增益的乘积,该乘积即为目标增益,这样就可以将第二图像传感器当前的增益调节为目标增益,通过调节第二图像传感器当前的增益,实现对第二图像传感器输出的图像的亮度的调节。其中,第二图像传感器的调节比例为第二图像传感器当前的增益与第二图像传感器上一次的增益的比例。Optionally, when the second image sensor is an image sensor to be adjusted, and the second image sensor is a right-eye image sensor, when acquiring the current adjustment ratio of the second image sensor, the last adjustment of the second image sensor may be calculated first The quotient of the ratio divided by the gain coefficient corresponding to the second image sensor, and the quotient is the current adjustment ratio of the second image sensor. Further, after the current adjustment ratio of the second image sensor is calculated, the product of the current adjustment ratio of the second image sensor and the last gain of the second image sensor is calculated, and the product is the target gain, so that the first The current gain of the second image sensor is adjusted as the target gain, and the brightness of the image output by the second image sensor is adjusted by adjusting the current gain of the second image sensor. The adjustment ratio of the second image sensor is the ratio of the current gain of the second image sensor to the previous gain of the second image sensor.
在通过本发明实施例提供的增益系数的获取方法计算得到第一图像传感器和第二图像传感器各自对应的增益系数,并根据第一图像传感器和第二图像传感器各自对应的增益系数,在这两个图像传感器中需要进行增益调节的待调节图像传感器之后,就可以根据所述待调节图像传感器对应的增益系数,对所述待调节图像传感器当前的增益进行调节,从而使得第一图像传感器输出的图像亮度和第二图像传感器输出的图像的亮度尽可能接近。示例的,请参见图5所示,图5为本发明实施例提供的一种图像的亮度对比示意图,图5中第一排的两个图像为亮度均衡之前,第一图像传感器输出的图像和第二图像传感器输出的图像,图5中第二排的两个图像为亮度均衡之后,第一图像传感器输出的图像和第二图像传感器输出的图像,结合图5可以看出,在亮度均衡之前,第一图像传感器输出的图像的亮度和第二图像传感器输出的图像的亮度的差别较大,而经过亮度均衡之后,第一图像传感器输出的图像的亮度和第二图像传感器输出的图像的亮度的差别很小,亮度几乎一致,从 而提高了用户体验。In the gain coefficient acquisition method provided by the embodiment of the present invention, the respective gain coefficients of the first image sensor and the second image sensor are calculated, and according to the respective gain coefficients of the first image sensor and the second image sensor, the two After the image sensor to be adjusted for which gain adjustment is required among the image sensors, the current gain of the image sensor to be adjusted can be adjusted according to the corresponding gain coefficient of the image sensor to be adjusted, so that the output of the first image sensor The image brightness is as close as possible to the brightness of the image output by the second image sensor. For example, please refer to FIG. 5. FIG. 5 is a schematic diagram of brightness comparison of an image provided by an embodiment of the present invention. The two images in the first row in FIG. 5 are before the brightness equalization, the image output by the first image sensor and The image output by the second image sensor, the two images in the second row in Figure 5 are after brightness equalization, the image output by the first image sensor and the image output by the second image sensor, combined with Figure 5, it can be seen that before the brightness equalization , The brightness of the image output by the first image sensor and the brightness of the image output by the second image sensor are quite different, and after the brightness equalization, the brightness of the image output by the first image sensor and the brightness of the image output by the second image sensor The difference is very small and the brightness is almost the same, thus improving the user experience.
图6为本发明实施例提供的一种增益系数的获取装置60的结构示意图,应用于预设的两个图像传感器,示例的,请参见图6所示,该增益系数的获取装置60可以包括:处理器601和存储器602。FIG. 6 is a schematic structural diagram of a gain
存储器602,用于存储程序代码。The
处理器601,用于调用程序代码,当程序代码被执行时,用于执行以下操作:The
分别获取两个图像传感器的亮度矩阵;并根据两个图像传感器的亮度矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数;其中,两个传感器各自对应的增益系数用于确定是否需要对两个图像传感器进行增益调节。Obtain the brightness matrices of the two image sensors separately; and calculate the respective gain coefficients of the two image sensors when the brightness mean square error of the two image sensors reaches a minimum value according to the brightness matrices of the two image sensors; The respective gain coefficients of each sensor are used to determine whether to adjust the gain of the two image sensors.
可选的,处理器601,还用于根据两个图像传感器各自对应的增益系数,确定两个图像传感器中需要进行增益调节的待调节图像传感器;并根据待调节图像传感器对应的增益系数,对待调节图像传感器当前的增益进行调节。Optionally, the
可选的,处理器601,具体用于根据待调节图像传感器对应的增益系数和待调节图像传感器的上一次增益,对待调节图像传感器当前的增益进行调节。Optionally, the
可选的,处理器601,具体用于根据待调节图像传感器对应的增益系数和待调节图像传感器的上一次增益,对待调节图像传感器当前的增益进行调节,包括:Optionally, the
处理器601,具体用于根据待调节图像传感器对应的增益系数计算当前的调节比例;其中,调节比例为待调节图像传感器的当前的增益与待调节图像传感器上一次的增益的比例;并将当前的调节比例和待调节图像传感器上一次的增益的乘积作为目标增益,并将待调节图像传感器当前的增益调节为目标增益。The
可选的,处理器601,具体用于当同时调节两个图像传感器的增益时,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数。Optionally, the
可选的,两个图像传感器包括第一图像传感器和第二图像传感器。Optionally, the two image sensors include a first image sensor and a second image sensor.
处理器601,具体用于当调节第一图像传感器时,计算两个图像传感器 的亮度均方误差达到极小值时第一图像传感器对应的增益系数;并当调节第二图像传感器时,计算两个图像传感器的亮度均方误差达到极小值时第二图像传感器对应的增益系数。The
可选的,处理器601,具体用于当第一图像传感器对应的增益系数大于预设阈值时,确定第一图像传感器为待调节图像传感器;当第二图像传感器对应的增益系数大于预设阈值时,确定第二图像传感器为待调节图像传感器。Optionally, the
可选的,处理器601,具体用于当第一图像传感器对应的增益系数大于预设阈值,且第二图像传感器对应的增益系数小于预设阈值时,确定第一图像传感器为待调节图像传感器;当第二图像传感器对应的增益系数大于预设阈值,且第一图像传感器对应的增益系数小于预设阈值时,确定第二图像传感器为待调节图像传感器。Optionally, the
可选的,当第一图像传感器对应的增益系数大于预设阈值时,处理器601,具体用于:Optionally, when the gain coefficient corresponding to the first image sensor is greater than a preset threshold, the
将第一图像传感器对应的增益系数和第一图像传感器上一次的调节比例的乘积作为当前的调节比例;根据当前的调节比例和第一图像传感器上一次的增益调节第一图像传感器的增益;其中,调节比例为第一图像传感器当前的增益与第一图像传感器上一次的增益的比例。Taking the product of the gain coefficient corresponding to the first image sensor and the last adjustment ratio of the first image sensor as the current adjustment ratio; adjust the gain of the first image sensor according to the current adjustment ratio and the last gain of the first image sensor; where , The adjustment ratio is the ratio of the current gain of the first image sensor to the previous gain of the first image sensor.
可选的,当第二图像传感器对应的增益系数大于预设阈值时,处理器601,具体用于:Optionally, when the gain coefficient corresponding to the second image sensor is greater than a preset threshold, the
将第二图像传感器上一次的调节比例和第二图像传感器对应的增益系数相除得到当前的调节比例;并根据当前的调节比例和第二图像传感器上一次的增益调节第二图像传感器的增益;其中,调节比例为第二图像传感器当前的增益与第二图像传感器上一次的增益的比例。Divide the last adjustment ratio of the second image sensor by the gain coefficient corresponding to the second image sensor to obtain the current adjustment ratio; and adjust the gain of the second image sensor according to the current adjustment ratio and the last gain of the second image sensor; The adjustment ratio is the ratio of the current gain of the second image sensor to the previous gain of the second image sensor.
可选的,处理器601,还用于当第一图像传感器对应的增益系数和第二图像传感器对应的增益系数均小于预设阈值时,不调节第一图像传感器和第二图像传感器的增益。Optionally, the
可选的,处理器601,具体用于根据两个图像传感器的亮度矩阵和权重矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数。Optionally, the
可选的,处理器601,具体用于根据两个图像传感器的亮度矩阵和权重 矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器各自对应的增益系数,包括:Optionally, the
处理器601,具体用于对两个图像传感器的图像分别进行分区处理,分别生成P个分区;P为大于或者等于2的整数;并根据每一分区的亮度矩阵和权重矩阵,分别计算两个图像传感器的亮度均方误差达到极小值时,两个图像传感器对应的增益系数。The
本发明实施例所示的增益系数的获取装置60,可以执行上述任一实施例所示的增益系数的获取方法的技术方案,其实现原理以及有益效果与增益系数的获取方法的实现原理及有益效果类似,此处不再进行赘述。The gain
本发明实施例还提供一种计算机存储介质,包括可读存储介质和计算机程序,所述计算机程序,用于实现上述任一实施例所述的增益系数的获取方法,其实现原理以及有益效果与增益系数的获取方法的实现原理及有益效果类似,此处不再进行赘述。An embodiment of the present invention also provides a computer storage medium, including a readable storage medium and a computer program, the computer program is used to implement the gain coefficient acquisition method described in any of the above embodiments, and its implementation principles and beneficial effects The realization principle and beneficial effects of the method for obtaining the gain coefficient are similar, and will not be repeated here.
本发明实施例还提供一种程序产品,该程序产品包括计算机程序(即执行指令),该计算机程序存储在可读存储介质中。处理器可以从可读存储介质读取该计算机程序,处理器执行该计算机程序用于实现上述任一实施例所述的增益系数的获取方法,其实现原理以及有益效果与增益系数的获取方法的实现原理及有益效果类似,此处不再进行赘述。The embodiment of the present invention also provides a program product, the program product includes a computer program (that is, an execution instruction), and the computer program is stored in a readable storage medium. The processor can read the computer program from a readable storage medium, and the processor executes the computer program to implement the gain coefficient obtaining method described in any of the above embodiments, the realization principle and the beneficial effects and the gain coefficient obtaining method The implementation principles and beneficial effects are similar, and will not be repeated here.
上述实施例中处理器可以是通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本发明实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存取存储器(random access memory,RAM)、闪存、只读存储器(read-only memory,ROM)、可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的指令,结合其硬件完成上述方法的步骤。The processor in the foregoing embodiment may be a general-purpose processor, a digital signal processor (digital signal processor, DSP), an application specific integrated circuit (ASIC), a field programmable gate array (field programmable gate array, FPGA), or Other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps, and logical block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like. The steps of the method disclosed in the embodiments of the present invention may be directly embodied as being executed and completed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can be located in random access memory (RAM), flash memory, read-only memory (read-only memory, ROM), programmable read-only memory, or electrically erasable programmable memory, registers, etc. mature in the field Storage medium. The storage medium is located in the memory, and the processor reads the instructions in the memory and completes the steps of the above method in combination with its hardware.
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。A person of ordinary skill in the art can understand that all or part of the steps in the foregoing method embodiments can be implemented by a program instructing relevant hardware. The aforementioned program can be stored in a computer readable storage medium. When the program is executed, the steps including the foregoing method embodiments are executed; and the foregoing storage medium includes: ROM, RAM, magnetic disk, or optical disk and other media that can store program codes.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: It is still possible to modify the technical solutions described in the foregoing embodiments, or equivalently replace some or all of the technical features; these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present invention range.
Claims (27)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2019/092060 WO2020252739A1 (en) | 2019-06-20 | 2019-06-20 | Method and apparatus for acquiring gain coefficient |
| CN201980012151.XA CN111713096A (en) | 2019-06-20 | 2019-06-20 | Gain coefficient acquisition method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2019/092060 WO2020252739A1 (en) | 2019-06-20 | 2019-06-20 | Method and apparatus for acquiring gain coefficient |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2020252739A1 true WO2020252739A1 (en) | 2020-12-24 |
Family
ID=72536685
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2019/092060 Ceased WO2020252739A1 (en) | 2019-06-20 | 2019-06-20 | Method and apparatus for acquiring gain coefficient |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN111713096A (en) |
| WO (1) | WO2020252739A1 (en) |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102143326A (en) * | 2010-01-28 | 2011-08-03 | 比亚迪股份有限公司 | Automatic exposure unit and method thereof |
| CN104270570A (en) * | 2014-10-17 | 2015-01-07 | 北京英泰智软件技术发展有限公司 | Binocular video camera and image processing method thereof |
| CN108401457A (en) * | 2017-08-25 | 2018-08-14 | 深圳市大疆创新科技有限公司 | A kind of control method of exposure, device and unmanned plane |
Family Cites Families (17)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2009017020A (en) * | 2007-07-02 | 2009-01-22 | Nissan Motor Co Ltd | Image processing apparatus and display image generation method |
| CN101359148B (en) * | 2007-08-03 | 2011-04-06 | 深圳艾科创新微电子有限公司 | Method for automatic exposure regulation and control system |
| CN101873437B (en) * | 2009-09-15 | 2012-01-25 | 杭州海康威视系统技术有限公司 | Method and device for regulating exposure |
| CN102223484A (en) * | 2011-08-04 | 2011-10-19 | 浙江工商大学 | Method and device for configuring head-end parameter of camera |
| US9531961B2 (en) * | 2015-05-01 | 2016-12-27 | Duelight Llc | Systems and methods for generating a digital image using separate color and intensity data |
| CN103647900A (en) * | 2013-11-15 | 2014-03-19 | 天津天地伟业数码科技有限公司 | Dual-channel CCD-image-sensor image splicing method based on gain adjustment |
| CN104618691A (en) * | 2015-01-29 | 2015-05-13 | 桂林长海发展有限责任公司 | Panoramic brightness balance regulating system and regulating method |
| US10460641B2 (en) * | 2015-05-28 | 2019-10-29 | Lg Display Co., Ltd. | Image processing circuit and display device using the histogram analyzer to perform a differential shift and extension shift of image data gray level to adjust gray level respect to the brightness image level |
| CN105245785A (en) * | 2015-08-10 | 2016-01-13 | 深圳市达程科技开发有限公司 | Brightness balance adjustment method of vehicle panoramic camera |
| CN106851122B (en) * | 2017-02-27 | 2020-02-18 | 上海兴芯微电子科技有限公司 | Calibration method and device for automatic exposure parameters based on double-camera system |
| US10122943B1 (en) * | 2017-05-05 | 2018-11-06 | Motorola Mobility Llc | High dynamic range sensor resolution using multiple image sensors |
| CN107330872A (en) * | 2017-06-29 | 2017-11-07 | 无锡维森智能传感技术有限公司 | Luminance proportion method and apparatus for vehicle-mounted viewing system |
| CN107371007A (en) * | 2017-07-25 | 2017-11-21 | 广东欧珀移动通信有限公司 | White balance processing method, device and terminal |
| CN107979726B (en) * | 2017-11-28 | 2020-05-22 | 信利光电股份有限公司 | Panoramic lens pairing method and panoramic lens |
| WO2019104622A1 (en) * | 2017-11-30 | 2019-06-06 | 深圳市大疆创新科技有限公司 | 差异校准方法、双目视觉系统和计算机可读存储介质 differential calibration method, binocular vision system, and computer-readable storage medium |
| CN108184105B (en) * | 2017-12-28 | 2021-03-26 | 努比亚技术有限公司 | Method and device for adjusting brightness and computer readable storage medium |
| CN109727216B (en) * | 2018-12-28 | 2023-06-06 | Oppo广东移动通信有限公司 | Image processing method, device, terminal equipment and storage medium |
-
2019
- 2019-06-20 WO PCT/CN2019/092060 patent/WO2020252739A1/en not_active Ceased
- 2019-06-20 CN CN201980012151.XA patent/CN111713096A/en active Pending
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102143326A (en) * | 2010-01-28 | 2011-08-03 | 比亚迪股份有限公司 | Automatic exposure unit and method thereof |
| CN104270570A (en) * | 2014-10-17 | 2015-01-07 | 北京英泰智软件技术发展有限公司 | Binocular video camera and image processing method thereof |
| CN108401457A (en) * | 2017-08-25 | 2018-08-14 | 深圳市大疆创新科技有限公司 | A kind of control method of exposure, device and unmanned plane |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111713096A (en) | 2020-09-25 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP7186672B2 (en) | System and method for multiscopic noise reduction and high dynamic range | |
| US9288392B2 (en) | Image capturing device capable of blending images and image processing method for blending images thereof | |
| CN107950018B (en) | Image generation method and system, and computer readable medium | |
| CN108364267B (en) | Image processing method, device and equipment | |
| CN107948519A (en) | Image processing method, device and equipment | |
| CN113962892B (en) | Method, device and photographic equipment for correcting wide-angle lens image distortion | |
| EP2704423A1 (en) | Image processing apparatus, image processing method, and image processing program | |
| JP5932045B2 (en) | Method and apparatus for conditional display of stereoscopic image pairs | |
| CN108053363A (en) | Background blurring processing method, device and equipment | |
| CN111327824A (en) | Shooting parameter selection method and device, storage medium and electronic equipment | |
| US10116917B2 (en) | Image processing apparatus, image processing method, and storage medium | |
| CN110611767B (en) | Image processing method and device and electronic equipment | |
| US9838594B2 (en) | Irregular-region based automatic image correction | |
| CN109191506B (en) | Depth map processing method, system and computer readable storage medium | |
| CN108024057A (en) | Background blurring processing method, device and equipment | |
| CN105338235B (en) | A kind of automatic aperture adjusting method and device | |
| CN105306806A (en) | Mobile terminal and photographing method thereof | |
| WO2017190415A1 (en) | Image optimization method and device, and terminal | |
| CN111935413A (en) | Aperture control method and camera | |
| CN110677557B (en) | Image processing method, image processing device, storage medium and electronic equipment | |
| CN114422665B (en) | Shooting method based on multiple cameras and related device | |
| WO2020107289A1 (en) | Photographing method and apparatus, and unmanned aerial vehicle | |
| CN116415474A (en) | Optical structure optimization method and device of lens group and electronic device | |
| WO2020252739A1 (en) | Method and apparatus for acquiring gain coefficient | |
| WO2025223054A1 (en) | Image exposure method and apparatus, and electronic device and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19934257 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 19934257 Country of ref document: EP Kind code of ref document: A1 |