Gyroscope data calibration method and electronic equipment
By obtaining the image data of the electronic device in a stationary and jittery state, calculating the number of blurred pixels, generating calibration information, and performing gyroscope data calibration, the problem of high gyroscope calibration is solved, and efficient and accurate gyroscope calibration and data is achieved. Improved accuracy.
Patent Information
- Application Number
- CN202411109154.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-12-10
AI Technical Summary
In the prior art, the gyroscope calibration cost is relatively high, and it relies on high-precision vibration tables, which increases the cost of equipment, labor and time.
By acquiring the image data of the electronic device in a stationary and jitter state, based on the gyroscope data, calculate the number of blurred pixels, generate calibration information, perform gyroscope data calibration, eliminate crosstalk influence, and improve data accuracy.
Accurate calibration of the gyroscope based on existing test equipment reduces costs, eliminates the impact of gyroscope crosstalk data, and improves data accuracy and image quality.
Smart Images

Figure CN119104087A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of camera technology, and more particularly to a gyroscope data calibration method and an electronic device. Background Art
[0002] The gyroscope is an angular motion detection device that is widely used in mobile phones. Due to the inherent characteristics of the gyroscope device itself and the chip assembly on the whole machine, there will be an axis deviation between the gyroscope and the mobile phone. At this time, the data of a certain axis of the gyroscope has data components on other axes. This data component is called gyroscope crosstalk data. Due to the existence of gyroscope crosstalk data, the gyroscope data cannot fully reflect the actual shaking of the mobile phone, and the image stabilization effect of the mobile phone cannot reach the best.
[0003] In related technologies, accurate gyroscope data of rotating and non-rotating axes can be obtained, and gyroscope crosstalk correction models can be calculated to calibrate gyroscope data. However, this solution relies on a high-precision vibration table, which increases equipment, manpower, and time costs. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a gyroscope data calibration method and electronic device, which can solve the technical problem of high cost of gyroscope calibration in related technologies.
[0005] In a first aspect, an embodiment of the present application provides a gyroscope data calibration method, which is applied to an electronic device, wherein the electronic device is provided with a gyroscope, the method comprising: acquiring a first image and a second image, the first image being an image of a target object taken by the electronic device in a stationary state, and the second image being an image of the target object taken by the electronic device when it is in a shaking state and an optical image stabilization (OIS) function is turned off; determining a first theoretical number of blurred pixels in different coordinate axis directions in the second image based on first data corresponding to the gyroscope during the shooting of the second image; determining an actual number of blurred pixels in different coordinate axis directions in the second image based on the first image; determining first calibration information of the gyroscope based on the first theoretical number and the actual number; and calibrating the second data based on the first calibration information during the shooting of the target image, wherein the second data is the data corresponding to the gyroscope during the shooting of the target image.
[0006] In a second aspect, an embodiment of the present application provides a gyroscope data calibration device, which is applied to an electronic device, wherein the electronic device is provided with a gyroscope, and the device comprises: a first acquisition unit, for acquiring a first image and a second image, wherein the first image is an image of a target object taken by the electronic device in a stationary state, and the second image is an image of the target object taken by the electronic device in a shaking state and an optical image stabilization OIS function is turned off; a first determination unit, for determining a first theoretical number of blurred pixels in different coordinate axis directions in the second image based on first data corresponding to the gyroscope during the shooting of the second image; a second determination unit, for determining the actual number of blurred pixels in different coordinate axis directions in the second image based on the first image; a third determination unit, for determining first calibration information of the gyroscope based on the first theoretical number and the actual number; in the process of shooting the target image, calibrating the second data based on the first calibration information, wherein the second data is the data corresponding to the gyroscope during the shooting of the target image.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the first aspect above are implemented.
[0009] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0010] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0011] In an embodiment of the present application, by acquiring a first image of the electronic device in a stationary state and a second image when the electronic device is in a shaking state and the OIS function is turned off, the gyroscope is calibrated based on the data of the two images and the data corresponding to the gyroscope, and the gyroscope can be accurately calibrated based on software logic on the basis of existing test equipment. In this process, there is no need to rely on a high-precision vibration table, and the vibration table used in the OIS test can be reused, so there is no need to add additional equipment, labor costs and time costs, thereby reducing the cost of calibrating the gyroscope data. At the same time, due to the existence of gyroscope crosstalk data, there will be a difference between the first theoretical number and the actual number. Therefore, based on the first theoretical number and the actual number, the first calibration information is generated, and the second data corresponding to the gyroscope is calibrated using the first calibration information, which can eliminate the influence of the gyroscope crosstalk data, thereby improving the accuracy of the data generated by the gyroscope. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is a flow chart of a gyroscope data calibration method provided in an embodiment of the present application;
[0013] Figure 2 is a schematic diagram of an application scenario of the gyroscope data calibration method provided in an embodiment of the present application;
[0014] Figure 3 is a schematic diagram of an application scenario of the gyroscope data calibration method provided in an embodiment of the present application;
[0015] Figure 4 is a flow chart of a gyroscope data calibration method provided in an embodiment of the present application;
[0016] Figure 5 is a structural schematic diagram of a gyroscope data calibration device provided in an embodiment of the present application;
[0017] Figure 6 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0018] Figure 7 It is a schematic diagram of the hardware structure of an electronic device suitable for implementing the embodiments of the present application. DETAILED DESCRIPTION
[0019] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0020] The terms "first", "second", etc. in the specification of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are usually a class, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0021] The gyroscope data calibration method and device provided in the embodiments of the present application are described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0022] Please refer to Figure 1 , which shows one of the flow charts of the gyroscope data calibration method provided in the embodiment of the present application. The gyroscope data calibration method provided in the embodiment of the present application can be applied to various electronic devices with image capture functions. The electronic device can be provided with a gyroscope. In practice, the above electronic device can be an electronic device such as a smart phone, a camera, etc.
[0023] The process of the gyroscope data calibration method provided in the embodiment of the present application includes the following steps:
[0024] Step 101, acquiring a first image and a second image, wherein the first image is an image of a target object taken by the electronic device when it is in a stationary state, and the second image is an image of the target object taken by the electronic device when it is in a shaking state and the OIS function is turned off.
[0025] In this embodiment, the first image and the second image are both images taken of the target object. The target object may include but is not limited to a crosshair card. A camera module may be installed in the electronic device, and the first image and the second image may be taken by the camera module. When taking the first image and the second image, the position of the electronic device is the same and the position of the target object is the same.
[0026] In this embodiment, the first image is an image of the target object taken when the electronic device is in a stationary state, and the second image is an image of the target object taken when the electronic device is in a shaking state and the OIS (Optical Image Stabilization) function is turned off. In practice, when shooting the second image, the above-mentioned electronic device can be placed in a vibration table used in the OIS test to achieve the shaking of the electronic device. Among them, the OIS function is implemented by the OIS module. The working process of the OIS module is to sense external vibrations through a gyroscope, feed back the vibration signal to the OIS controller, and drive the OIS motor to perform corresponding lateral and longitudinal compensation to offset the image deviation caused by the shaking, keep the imaging stable, and effectively overcome the image blur caused by the vibration of the electronic device.
[0027] Step 102 : determining a first theoretical number of blurred pixels in different coordinate axis directions in the second image based on first data corresponding to the gyroscope during the second image shooting process.
[0028] In this embodiment, the gyroscope is an angular velocity detection device, and the first data output by the gyroscope is the angular velocity of the electronic device. The blurred pixels are pixels that are difficult to be clearly classified into a specific category or area due to imaging offset caused by shaking of the electronic device.
[0029] In this embodiment, the first data can be integrated by the exposure time of the second image to obtain the shaking angle θ of the electronic device. When the shaking angle is known, the imaging offset distance can be determined based on the focal length f of the image sensor according to the trigonometric function relationship. As an example, see Figure 2 , taking the electronic device as a reference, when the electronic device is not shaking, the position of the target object is O and the imaging position is O 1 When the electronic device is shaken, the target object is located at position O and the imaging position is O 2 The imaging offset distance is O 1 O 2 Based on the imaging offset distance and the size of a single pixel, the number of pixels offset in different coordinate axis directions in the second image can be determined. The number of pixels offset is the first theoretical number of blurred pixels.
[0030] In some optional implementations of this embodiment, since the gyroscope has zero bias, the zero bias can be eliminated first, and then the first theoretical quantity can be calculated. Among them, zero bias, also known as zero drift or zero offset, is an important indicator for measuring the performance of a gyroscope. It indicates the fluctuation or fluctuation of its output signal around its mean when the angular velocity is zero. This fluctuation is usually expressed in standard deviation or root mean square and converted to an equivalent input angular velocity. Zero bias is one of the key factors in evaluating the performance of a gyroscope, especially occupying an important position in the entire performance indicator set. The specific execution steps are as follows:
[0031] The first step is to obtain the initial data of the gyroscope. The initial data can be recorded as gyro offset The initial data is the gyroscope data when the electronic device is in a stationary state. The initial data can be used to indicate the initial offset of the gyroscope, that is, the above-mentioned zero bias, which will change with temperature. The electronic device supports retaining the initial data of the gyroscope at different temperatures, so it can be read directly here.
[0032] The second step is to obtain the zero-bias-removed data based on the first data and the initial data corresponding to the gyroscope during the second image shooting process. The first data can be recorded as gyro raw_ois_off The data without zero bias can be recorded as gyro. Then: gyro = gyro raw_ois_off -gyro offset .
[0033] The third step is to determine the theoretical shaking angle of the electronic device when shooting the second image based on the exposure time of the second image and the zero bias removal data. The exposure time can be recorded as exp, and the theoretical shaking angle can be recorded as θ. Then:
[0034]
[0035] Among them, the above dt represents a micro variable with t as the variable, and t is time.
[0036] The fourth step is to determine the first theoretical number of blurred pixels in different coordinate axis directions in the second image based on the focal length of the image sensor, the theoretical jitter angle, and the size of a single pixel. The focal length can be recorded as f, the first theoretical number of blurred pixels, and the size of a single pixel can be recorded as u, that is, the number of pixels that are offset due to the jitter of the electronic device, which can be recorded as gyro_blur. Then: gyro_blur = f*tanθ / u.
[0037] In practice, for different coordinate axes in different image coordinate systems, the first data, initial data, zero bias removal data, and theoretical jitter angle all have different components. The x-axis component can be represented by the subscript x, and the y-axis component can be represented by the subscript y. The first theoretical number of blurred pixels in the x-axis direction of the second image can be recorded as gyro_blur x_ois_off The first theoretical number of blurred pixels in the y-axis direction of the second image can be recorded as gyro_blur y_ois_off . Then we have:
[0038]
[0039] Among them, θ x is the x-axis component of the theoretical jitter angle, θ y is the y-axis component of the theoretical jitter angle.
[0040] By removing the zero bias, the accuracy of calculating the first theoretical number of blurred pixels under each coordinate axis in the second image can be improved, thereby helping to improve the accuracy of calibrating the data generated by the gyroscope.
[0041] Step 103: Based on the first image, determine the actual number of blurred pixels in different coordinate axis directions in the second image.
[0042] In this embodiment, based on the first image, blur detection can be performed on the second image to determine the actual number of blurred pixels in different coordinate axis directions in the second image. In practice, the number of target pixels in different coordinate axis directions in the first image and the second image can be determined respectively by edge detection operators such as Roberts operator, Sobel operator, Laplacian operator, etc. Since the first image is an image taken when the electronic device is in a stable state, the first image does not contain blurred pixels. This can be used as a reference. For a certain coordinate axis direction, the number of target pixels in the second image in the coordinate axis direction is subtracted from the number of target pixels in the first image in the coordinate axis direction to obtain the actual number of blurred pixels in the second image in the coordinate axis direction.
[0043] In some optional implementations of this embodiment, the actual number of blurred pixels in different coordinate axis directions in the second image may be determined in the following manner: based on the size of the sub-region corresponding to the target pixel in the first statistical region and the size of the sub-region corresponding to the target pixel in the second statistical region, the actual number of blurred pixels in different coordinate axis directions in the second image is determined. The first statistical region is a statistical region in the first image, the second statistical region is a statistical region in the second image, and the position of the first statistical region in the first image corresponds to the position of the second statistical region in the second image.
[0044] As an example, the target object may be a crosshair card. Figure 3 The first statistical region in the first image includes an upper horizontal statistical region as shown by reference numeral 301, a lower horizontal statistical region as shown by reference numeral 302, a left vertical statistical region as shown by reference numeral 303, and a right vertical statistical region as shown by reference numeral 304. The second statistical region in the second image is similar, and will not be described in detail here.
[0045] It should be noted that the position and size of the first statistical area and the second statistical area can be set based on experience. As for the size, for example, the height of the upper horizontal statistical area and the lower horizontal statistical area of the first image and the second image can be 100, and the width can be n times the width of the vertical line of the black cross line in the first image. The width of the left vertical statistical area and the right vertical statistical area of the first image and the second image can be 100, and the height can be n times the width of the horizontal line of the black cross line in the first image. The value of n can be set as needed, for example, it can be set to 5.
[0046] Here, the cross in the cross chart is black, and the rest is white or gray. The target pixel may be a pixel having a pixel value of (0,0,0), that is, a pixel presenting a black color.
[0047] Continuing with the above example, the size of the sub-region corresponding to the target pixel in the first statistical region may include: the average width of the sub-region corresponding to the target pixel in the upper horizontal statistical region and the lower horizontal statistical region in the first image (which may be recorded as the first width), and the average height of the sub-region corresponding to the target pixel in the left vertical statistical region and the right vertical statistical region in the first image (which may be recorded as the first height). The first width may be expressed as picture pixle_x_static , the width of the sub-region corresponding to the target pixel in the upper horizontal statistical region of the first image is l x1_static , the width of the sub-region corresponding to the target pixel in the lower horizontal statistical region of the first image is l x2_static , then we have: picture pixle_x_static =(l x1_static +l x2_static ) / 2. Similarly, the first height can be expressed as picture pixle_y_static , the height of the sub-region corresponding to the target pixel in the left vertical statistical region of the first image is h y1_static , the height of the sub-region corresponding to the target pixel in the right vertical statistical region of the first image is h y2_static , then we have: picture pixle_y_static =(h y1_static +h y2_static ) / 2.
[0048] Similarly, the size of the sub-region corresponding to the target pixel in the second statistical area may include: the average width of the sub-region corresponding to the target pixel in the upper horizontal statistical area and the lower horizontal statistical area in the second image (which may be recorded as the second width), and the average height of the sub-region corresponding to the target pixel in the left vertical statistical area and the right vertical statistical area in the second image (which may be recorded as the second height). The second width may be recorded as picture pixle_x_ois_off , the width of the sub-region corresponding to the target pixel in the upper horizontal statistical region of the second image is l x1_ois_off , the width of the sub-region corresponding to the target pixel in the lower horizontal statistical region of the second image is l x2_ois_off , then we have: picture pixle_x_ois_off =(l x1_ois_off +l x2_ois_off ) / 2. Similarly, the second height can be recorded as picture pixle_y_ois_off , the height of the sub-region corresponding to the target pixel in the left vertical statistical region of the second image is h y1_ois_off , the height of the sub-region corresponding to the target pixel in the right vertical statistical region of the second image is h y2_ois_off , then we have: picture pixle_y_ois_off =(h y1_ois_off +h y2_ois_off _ / 2.
[0049] Next, the difference between the second width and the first width is taken as the actual number of blurred pixels in the x-axis direction of the second image (which can be recorded as picture blur_x_ois_off ), that is, picture blur_x_ois_off =picture pixle_x_ois_off -picture pixle_x_static Similarly, the difference between the second height and the first height is taken as the actual number of blurred pixels in the y-axis direction of the second image (which can be recorded as picture blur_y_ois_off ), that is, picture blur_y_ois_off =picture pixle_y_ois_off -picture pixle_y_static .
[0050] By setting a first statistical area in the first image and a second statistical area in the second image, and determining the actual number of blurred pixels in different coordinate axis directions in the second image based on the size of the sub-area corresponding to the target pixel in the first statistical area and the size of the sub-area corresponding to the target pixel in the second statistical area, the actual number of blurred pixels in different coordinate axis directions in the second image can be obtained conveniently and quickly. In addition, since the first image is an image taken when the electronic device is in a stable state, the first image does not contain blurred pixels, and therefore the calculation of the number of blurred pixels based on this as a reference can improve the accuracy of the calculation result of the actual number of blurred pixels.
[0051] Step 104: Determine first calibration information of the gyroscope based on the first theoretical quantity and the actual quantity.
[0052] It is understandable that due to the inherent characteristics of the gyroscope device itself, installing it on an electronic device will introduce an axis deviation between the gyroscope and the electronic device. At this time, the data of a certain coordinate axis of the gyroscope has data components on other coordinate axes. This data component is called gyroscope crosstalk data. Due to the existence of gyroscope crosstalk data, the data generated by the gyroscope cannot fully reflect the actual shaking direction of the electronic device, and the image stabilization effect of the electronic device cannot achieve the best.
[0053] Due to the existence of the gyroscope crosstalk data, the first theoretical number of blurred pixels in different coordinate axis directions in the second image calculated by the gyroscope data is usually different from the actual number of blurred pixels in different coordinate axis directions in the second image calculated by the difference between the first image and the second image. The above difference can measure the degree of gyroscope crosstalk, so the first calibration information of the gyroscope can be determined by the difference, so that the data generated by the gyroscope can be calibrated by the first calibration information to suppress or eliminate the above gyroscope crosstalk data.
[0054] In some optional implementations of this embodiment, the first theoretical quantity includes a first theoretical quantity x-axis component and a first theoretical quantity y-axis component. The first theoretical quantity x-axis component is the first theoretical quantity of blurred pixels in the x-axis direction of the second image, that is, the gyro_blur x_ois_off The y-axis component of the first theoretical quantity is the first theoretical quantity of blurred pixels in the y-axis direction in the second image, that is, the gyro_blur y_ois_off The actual number includes an actual number x-axis component and an actual number y-axis component. The actual number x-axis component is the actual number of blurred pixels in the second image in the x-axis direction, that is, the picture above blur_x_ois_off The above actual number y-axis component is the actual number of blurred pixels in the y-axis direction of the second image, that is, the above picture blur_y_ois_off The theoretical shaking angle includes the theoretical shaking angle x-axis component and the theoretical shaking angle y-axis component. The theoretical shaking angle x-axis component is the above θ x , the theoretical jitter angle y-axis component is the above θ y .
[0055] On this basis, the first calibration information of the gyroscope can be determined by the following steps:
[0056] The first step is to use the focal length (f), the size of a single pixel (u), the x-axis component of the first theoretical quantity (gyro_blur x_ois_off) and the actual x-axis component (picture blur_x_ois_off ), the difference between the first theoretical quantity y-axis component (gyro_blur y_ois_off ) and the actual quantity y-axis component (picture blur_y_ois_off ) to determine the x-axis component of the jitter angle increment (which can be recorded as Δ θ_x ) and the y-axis component of the jitter angle increment (which can be recorded as Δ θ_y ). See the following formula:
[0057]
[0058] Δ blur_x =|gyro_blur x_ois_off -picture blur_x_ois_off |
[0059] Δ blur_y =|gyro_blur y_ois_off -picture blur_y_ois_off |
[0060] The second step is to determine the actual jitter angle x-axis component (which can be recorded as θ) based on the theoretical jitter angle x-axis component and the jitter angle increment x-axis component. real_x ), and, based on the theoretical jitter angle y-axis component and the jitter angle increment y-axis component, determine the actual jitter angle y-axis component (which can be recorded as θ real_y ). See the following formula:
[0061] θ real_x =θ x -Δ θ_x
[0062] θ real_y =θ y -Δ θ_y
[0063] The third step is to calculate the y-axis component of the jitter angle increment (Δ θ_y ) and the actual jitter angle x-axis component (θ real_x ), determine the first crosstalk ratio of the gyroscope (which can be recorded as k xy ′), and, based on the x-axis component of the jitter angle increment (Δ θ_x ) and the actual jitter angle y-axis component (θ real_y ), determine the second crosstalk ratio of the gyroscope (which can be recorded as k yx ′). The first crosstalk ratio represents the ratio of the crosstalk of the x-axis to the y-axis. The second crosstalk ratio represents the ratio of the crosstalk of the y-axis to the x-axis. See the following formula:
[0064]
[0065] The fourth step is to use the y-axis component of the first theoretical quantity (gyro_blur y_ois_off ) and the actual quantity y-axis component (picture blur_y_ois_off ) to determine the first coefficient (which can be recorded as S xy ), and, based on the first theoretical quantity x-axis component (gyro_blur x_ois_off ) and the actual x-axis component (picture blur_x_ois_off ) to determine the second coefficient (which can be recorded as S yx ). See the following formula:
[0066]
[0067] Step 5: The first crosstalk ratio (k xy ′) and the first coefficient (S xy ) is used as the first crosstalk compensation coefficient (which can be recorded as k xy ), the second crosstalk ratio (k yx ′) and the second coefficient (S yx ) as the second crosstalk compensation coefficient (which can be recorded as k yx ), based on the first crosstalk compensation coefficient and the second crosstalk compensation coefficient, generate first calibration information of the gyroscope. See the following formula:
[0068]
[0069] The first calibration information determined in the above manner includes a first crosstalk compensation coefficient (k xy ) and the second crosstalk compensation coefficient (k yx ), the first crosstalk compensation coefficient (k xy ) represents the compensation coefficient of the x-axis data for the y-axis crosstalk, and the second crosstalk compensation coefficient (k yx ) represents the compensation coefficient of the y-axis data to the x-axis crosstalk, thereby being able to suppress the crosstalk data in the data generated by the gyroscope, thereby eliminating the influence of the gyroscope crosstalk on the data generated by it, and improving the accuracy of the gyroscope data.
[0070] Step 105 , in the process of capturing the target image, calibrate the second data based on the first calibration information.
[0071] In this embodiment, the second data is data corresponding to the gyroscope during the process of shooting the target image. The target image can be shot by the above electronic device. During the process of shooting the target image, the second data can be calibrated based on the first calibration information.
[0072] As an example, based on the first calibration information, the process of calibrating the second data is as follows:
[0073]
[0074] Among them, the above These are the x-axis component and the y-axis component in the second data, respectively. These are the x-axis component and the y-axis component of the initial data of the gyroscope. These are results of calibrating the x-axis component and the y-axis component in the second data based on the first calibration information.
[0075] Due to the existence of gyroscope crosstalk data, there will be a difference between the first theoretical number and the actual number. Therefore, first calibration information is generated based on the first theoretical number and the actual number. The first calibration information is used to calibrate the second data corresponding to the gyroscope during the process of shooting the target image. This can eliminate the influence of the gyroscope crosstalk data, thereby improving the accuracy of the data generated by the gyroscope and further improving the image quality.
[0076] The method provided by the above embodiment of the present application first obtains a first image and a second image, wherein the first image is an image of a target object taken by an electronic device in a stationary state, and the second image is an image of a target object taken by an electronic device in a shaking state and with the OIS function turned off; then, based on the first data corresponding to the gyroscope during the shooting process of the second image, a first theoretical number of blurred pixels in different coordinate axis directions in the second image is determined; then, based on the first image, the actual number of blurred pixels in different coordinate axis directions in the second image is determined; then, based on the first theoretical number and the actual number, first calibration information of the gyroscope is determined; in the process of shooting the target image, the second data corresponding to the gyroscope in the process of shooting the target image is calibrated based on the first calibration information. Thus, by obtaining a first image of the electronic device in a stationary state and a second image when the electronic device is in a shaking state and with the OIS function turned off, the gyroscope is calibrated based on the data of the two images and the data generated by the gyroscope, and accurate calibration of the gyroscope can be achieved based on software logic on the basis of existing test equipment, and in this process, there is no need to rely on a high-precision vibration table, and the vibration table used in the OIS test can be reused, so there is no need to add additional equipment, labor costs and time costs, thereby reducing the cost of calibrating the gyroscope data. At the same time, due to the existence of gyroscope crosstalk data, there will be a difference between the first theoretical number and the actual number. Therefore, first calibration information is generated based on the first theoretical number and the actual number, and the first calibration information is used to calibrate the second data generated by the gyroscope. This can eliminate the influence of the gyroscope crosstalk data, thereby improving the accuracy of the data generated by the gyroscope.
[0077] Further references Figure 4, which shows the second flow chart of the gyroscope data calibration method provided in the embodiment of the present application. The flow chart of the gyroscope data calibration method provided in the embodiment of the present application includes the following steps:
[0078] Step 401, acquiring a first image, a second image, and a third image, wherein the first image is an image of the target object taken when the electronic device is in a stationary state, the second image is an image of the target object taken when the electronic device is in a shaking state and the optical image stabilization OIS function is turned off, and the third image is an image of the target object taken when the electronic device is in a shaking state and the OIS function is turned on.
[0079] In this embodiment, when the first image, the second image and the third image are captured, the position of the electronic device is the same and the position of the target object is the same.
[0080] Step 402 : determining a first theoretical number of blurred pixels in different coordinate axis directions in the second image based on first data corresponding to the gyroscope during the second image shooting process.
[0081] In some optional implementations of the present embodiment, the above-mentioned determining a first theoretical number of blurred pixels in different coordinate axis directions in the above-mentioned second image based on the first data corresponding to the above-mentioned gyroscope during the shooting process of the above-mentioned second image includes: obtaining initial data of the above-mentioned gyroscope, and the above-mentioned initial data is used to indicate an initial offset of the above-mentioned gyroscope, that is, zero bias; based on the first data corresponding to the above-mentioned gyroscope during the shooting process of the above-mentioned second image and the above-mentioned initial data, obtaining zero bias removal data; based on the exposure time of the above-mentioned second image and the above-mentioned zero bias removal data, determining a theoretical jitter angle of the above-mentioned electronic device when shooting the above-mentioned second image; based on the focal length of the image sensor, the above-mentioned theoretical jitter angle and the size of a single pixel, determining the first theoretical number of blurred pixels in different coordinate axis directions in the above-mentioned second image.
[0082] Step 403: Based on the first image, determine the actual number of blurred pixels in different coordinate axis directions in the second image.
[0083] In some optional implementations of the present embodiment, determining the actual number of blurred pixels in different coordinate axis directions in the second image based on the first image includes: determining the actual number of blurred pixels in different coordinate axis directions in the second image based on the size of a sub-area corresponding to a target pixel in a first statistical area and the size of a sub-area corresponding to a target pixel in a second statistical area, the first statistical area being a statistical area in the first image, the second statistical area being a statistical area in the second image, and a position of the first statistical area in the first image corresponding to a position of the second statistical area in the second image.
[0084] Step 404: Determine first calibration information of the gyroscope based on the first theoretical quantity and the actual quantity.
[0085] In some optional implementations of the present embodiment, the first theoretical quantity includes a first theoretical quantity x-axis component and a first theoretical quantity y-axis component, the actual quantity includes an actual quantity x-axis component and an actual quantity y-axis component, and the theoretical jitter angle includes a theoretical jitter angle x-axis component and a theoretical jitter angle y-axis component; the first calibration information of the gyroscope is determined based on the first theoretical quantity and the actual quantity, including: determining the jitter angle increment x-axis component and the jitter angle increment y-axis component based on the focal length, the size of a single pixel, the difference between the first theoretical quantity x-axis component and the actual quantity x-axis component, and the difference between the first theoretical quantity y-axis component and the actual quantity y-axis component; determining the actual jitter angle x-axis component based on the theoretical jitter angle x-axis component and the jitter angle increment x-axis component, and, based on the theoretical jitter angle The invention relates to a method for generating a calibration curve of the gyroscope according to the present invention. The calibration curve is characterized in that: the calibration curve is characterized in that the calibration curve is linearly proportional to the amplitude of the first crosstalk between the y-axis component of the gyroscope and the actual jitter angle; the calibration curve is characterized in that the calibration curve is linearly proportional to the amplitude of the first crosstalk between the y-axis component of the gyroscope and the actual jitter angle; the calibration curve is characterized in that the calibration curve is linearly proportional to the amplitude of the first crosstalk between the y-axis component of the gyroscope and the actual jitter angle; the calibration curve is characterized in that the calibration curve is linearly proportional to the amplitude of the second crosstalk between the gyroscope and the actual jitter angle; the calibration curve is characterized in that the calibration curve is linearly proportional to the amplitude of the second crosstalk between the gyroscope and the actual jitter angle; the calibration curve is characterized in that the calibration curve is linearly proportional to the amplitude of the first crosstalk between the gyroscope and the actual jitter angle; the calibration curve is characterized in that the calibration curve is linearly proportional to the amplitude of the second crosstalk between the gyroscope and the actual jitter angle; the calibration curve is characterized in that the calibration curve is linearly proportional to the amplitude of the second crosstalk between the gyroscope and the actual jitter angle; the calibration curve is characterized in that the calibration curve is linearly proportional to the amplitude of the second crosstalk between the gyroscope and the actual jitter angle;
[0086] Steps 401 to 404 in this embodiment are substantially the same as steps 101 to 103 in the above embodiment, and are not described again here.
[0087] Step 405 : determining the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image based on the OIS data generated during the capturing process of the third image.
[0088] In this embodiment, the OIS function is to sense external vibrations through a gyroscope, feed back vibration signals to the OIS controller, and drive the OIS motor to perform corresponding lateral and longitudinal compensation to offset the image offset caused by jitter, maintain imaging stability, and effectively overcome image blur caused by vibration of electronic equipment. The OIS data is the data generated by the Hall sensor in the OIS system, which may specifically include the lens compensation displacement during the exposure of the third image. Based on the OIS data, the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image can be determined.
[0089] In some optional implementations of this embodiment, the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image may be determined by the following steps:
[0090] The first step is to determine the OIS compensation angle (referred to as θ) during the third image shooting process based on the OIS data (referred to as hall code) generated during the third image shooting process and the parameter information of the OIS module. ois ). The parameter information of the OIS module may include but is not limited to the OIS module factory calibration parameter (which can be recorded as gyrogain), IC (driver chip) conversion coefficient (which can be recorded as K ic ). The above K ic It is related to the internal operation logic of the IC and is provided by the IC manufacturer. See the following formula:
[0091]
[0092] In the second step, based on the OIS compensation angle and the focal length (f) of the image sensor, the lens compensation displacement (which can be recorded as d x ). See the following formula:
[0093] d x =f*tanθ ois
[0094] The third step is to compensate the displacement based on the lens (d x ) and the size of a single pixel (u), determine the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image (which can be recorded as ois_blur). Then: ois_blur = d x / u.
[0095] In practice, the above OIS data, OIS module factory calibration parameters, OIS compensation angle, and lens compensation displacement all have different components for different coordinate axes. The x-axis component can be represented by the subscript x, and the y-axis component can be represented by the subscript y. The number of compensated pixels compensated by the OIS function in the x-axis direction of the third image can be recorded as ois_blurx The number of compensated pixels in the y-axis direction of the third image compensated by the OIS function can be recorded as ois_blur y . Then we have:
[0096]
[0097] Among them, hall_code x 、hall_code y These are the x-axis component and the y-axis component of the OIS data generated during the third image capture process. x , gyrogain y They are the x-axis component and y-axis component in the OIS module factory calibration parameters.
[0098] By calculating the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image, a data basis can be provided for subsequent sensitivity calibration of the gyroscope.
[0099] Step 406, determining a second theoretical number of blurred pixels in different coordinate axis directions in the third image based on third data corresponding to the gyroscope during the third image shooting process;
[0100] In this embodiment, the method for determining the second theoretical quantity is basically the same as the method for determining the first theoretical quantity in the embodiment, and will not be repeated here.
[0101] Step 407: Determine second calibration information of the gyroscope based on the second theoretical number and the number of compensated pixels.
[0102] In this embodiment, after determining the second theoretical number of blurred pixels in different coordinate axis directions in the third image through the third data corresponding to the gyroscope during the third image shooting process, and after determining the number of compensation pixels in different coordinate axis directions in the third image based on the OIS data generated during the third image shooting process, if the number of compensation pixels is not equal to the second theoretical number, it means that there is a sensitivity error in the OIS anti-shake path, and the gyroscope needs to be compensated for sensitivity, and then the compensation value is sent to the OIS control algorithm to match the lens compensation displacement and the gyroscope theoretical shake displacement. Here, for the same coordinate axis direction, the ratio of the second theoretical number to the number of compensation pixels in the coordinate axis direction can be used as the sensitivity calibration coefficient. The sensitivity calibration coefficients corresponding to different coordinate axis directions are summarized to obtain the second calibration information of the gyroscope.
[0103] In some optional implementations of this embodiment, the second theoretical number includes a second theoretical number x-axis component and a second theoretical number y-axis component, and the number of compensated pixels includes a second theoretical number x-axis component and a second theoretical number y-axis component. The second theoretical number x-axis component is the second theoretical number of blurred pixels in the x-coordinate direction of the third image, which can be recorded as gyro_blur. x_ois_on The y-axis component of the second theoretical quantity is the second theoretical quantity of blurred pixels in the y-axis direction of the third image, which can be recorded as gyro_blur y_ois_on The x-axis component of the above-mentioned number of compensated pixels is the number of compensated pixels compensated by the OIS function in the x-axis direction of the third image (ois_blur x ), the y-axis component of the above-mentioned compensation pixel number is the number of compensation pixels compensated by the OIS function in the y-axis direction of the third image (ois_blur y ).
[0104] On this basis, the second calibration information can be determined by the following steps:
[0105] The first step is based on the second theoretical quantity x-axis component (gyro_blur x_ois_pn ) and the x-axis component of the number of compensated pixels (ois_blur x ), determine the sensitivity calibration coefficient in the x-axis direction (which can be recorded as s x ), and, based on the second theoretical quantity y-axis component (gyro_blur y_ois_on ) and the y-axis component of the number of compensated pixels (ois_blur y ), determine the sensitivity calibration coefficient in the y-axis direction (which can be recorded as s y ). See the following formula:
[0106]
[0107] In the second step, based on the x-axis sensitivity calibration coefficient and the y-axis sensitivity calibration coefficient, second calibration information of the gyroscope is generated.
[0108] The second calibration information determined in the above manner includes the sensitivity calibration coefficient in the x-axis direction (s x ) and the sensitivity calibration coefficient in the y-axis direction (s y). The second calibration information indicates the sensitivity error of the gyroscope to OIS path. The sources of the sensitivity error may include the steady-state error of the motor control system, the sampling error of the Hall sensor, etc. The above sensitivity error causes an offset between the actual and theoretical compensation positions of the lens. After the second theoretical number of blurred pixels determined based on the third data generated by the gyroscope is divided by the number of compensation pixels of the OIS, if the result is less than 1, it means that the lens compensation displacement of the OIS is too much, and the gyroscope input of the OIS control algorithm needs to be reduced to reduce the lens compensation displacement of the OIS; if the result is 1, it means that the lens compensation displacement of the OIS is just right, and the gyroscope input of the OIS control algorithm does not need to be increased or decreased; if the result is greater than 1, it means that the lens compensation displacement of the OIS is not enough, and the gyroscope input of the OIS control algorithm needs to be increased to increase the lens compensation displacement of the OIS. The above method can compensate the sensitivity of the gyroscope so that the actual and theoretical compensation positions of the lens are the same, thereby improving image quality.
[0109] Step 408 : During the process of capturing the target image, calibrate the second data based on the first calibration information and the second calibration information.
[0110] In this embodiment, during the process of shooting the target image, the first calibration information and the second calibration information may be combined to calibrate the second data. The second data may be data corresponding to the gyroscope during the process of the user using the electronic device to shoot the target image.
[0111] As an example, based on the first calibration information and the second calibration information, the process of calibrating the second data is as follows:
[0112]
[0113] Among them, the above These are the x-axis component and the y-axis component in the second data, respectively. These are the x-axis component and the y-axis component of the initial data of the gyroscope. gyro caly These are the results of calibrating the x-axis component and the y-axis component in the second data based on the first calibration information. xy , k yx They are the first crosstalk compensation coefficient and the second crosstalk compensation coefficient.
[0114] from Figure 4 It can be seen that Figure 1Compared with the corresponding embodiment, the process of the gyroscope data calibration method in this embodiment involves the steps of determining the second calibration information of the gyroscope and compensating the gyroscope data based on the first calibration information and the second calibration information. Therefore, the scheme described in this embodiment can not only suppress the crosstalk data in the data generated by the gyroscope, but also compensate the sensitivity of the gyroscope, so that the actual and theoretical compensation positions of the lens are the same, further improving the image quality.
[0115] It should be noted that the gyroscope data calibration method provided in the embodiment of the present application can be executed by a gyroscope data calibration device. In the embodiment of the present application, the gyroscope data calibration method is executed by a gyroscope data calibration device as an example to illustrate the gyroscope data calibration device provided in the embodiment of the present application.
[0116] like Figure 5 As shown, the gyroscope data calibration device 500 of this embodiment includes: a first acquisition unit 501, used to acquire a first image and a second image, wherein the first image is an image of a target object taken by the electronic device in a stationary state, and the second image is an image of the target object taken by the electronic device in a shaking state and an optical image stabilization OIS function is turned off; a first determination unit 502, used to determine a first theoretical number of blurred pixels in different coordinate axis directions in the second image based on first data corresponding to the gyroscope during the shooting of the second image; a second determination unit 503, used to determine the actual number of blurred pixels in different coordinate axis directions in the second image based on the first image; a third determination unit 504, used to calibrate the second data based on the first calibration information during the shooting of the target image, wherein the second data is the data corresponding to the gyroscope during the shooting of the target image; a calibration unit 505, used to calibrate the second data based on the first calibration information when the gyroscope generates the second data.
[0117] In some optional implementations of this embodiment, the device also includes: a second acquisition unit, used to acquire a third image, wherein the third image is an image of the target object taken when the electronic device is in a shaking state and the OIS function is turned on; a fourth determination unit, used to determine the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image based on the OIS data generated during the shooting of the third image; a fifth determination unit, used to determine the second theoretical number of blurred pixels in different coordinate axis directions in the third image based on the third data corresponding to the gyroscope during the shooting of the third image; a sixth determination unit, used to determine the second calibration information of the gyroscope based on the second theoretical number and the number of compensated pixels; the calibration unit 505 is also used to: in the process of shooting the target image, calibrate the second data based on the first calibration information and the second calibration information, wherein the second data is the data corresponding to the gyroscope during the process of shooting the target image.
[0118] In some optional implementations of this embodiment, the first determination unit 502 is further used to: obtain the initial data of the gyroscope, the initial data indicating the initial offset of the gyroscope; obtain the zero-bias removal data based on the first data corresponding to the gyroscope during the shooting of the second image and the initial data; determine the theoretical jitter angle of the electronic device when shooting the second image based on the exposure time of the second image and the zero-bias removal data; determine the first theoretical number of blurred pixels in different coordinate axis directions in the second image based on the focal length of the image sensor, the theoretical jitter angle and the size of a single pixel. By removing the zero bias, the accuracy of the calculation of the first theoretical number of blurred pixels in each coordinate axis in the second image can be improved, thereby helping to improve the accuracy of the calibration of the data generated by the gyroscope.
[0119] In some optional implementations of this embodiment, the second determining unit 503 is further used to determine the actual number of blurred pixels in different coordinate axis directions in the second image based on the size of the sub-region corresponding to the target pixel in the first statistical region and the size of the sub-region corresponding to the target pixel in the second statistical region, wherein the first statistical region is a statistical region in the first image, the second statistical region is a statistical region in the second image, and the position of the first statistical region in the first image corresponds to the position of the second statistical region in the second image. By setting the first statistical region in the first image and the second statistical region in the second image, and determining the actual number of blurred pixels in different coordinate axis directions in the second image based on the size of the sub-region corresponding to the target pixel in the first statistical region and the size of the sub-region corresponding to the target pixel in the second statistical region, the actual number of blurred pixels in different coordinate axis directions in the second image can be obtained conveniently and quickly. In addition, since the first image is an image taken when the electronic device is in a stable state, the first image does not contain blurred pixels, and therefore the calculation of the number of blurred pixels based on this as a reference can improve the accuracy of the calculation result of the actual number of blurred pixels.
[0120] In some optional implementations of the present embodiment, the first theoretical quantity includes a first theoretical quantity x-axis component and a first theoretical quantity y-axis component, the actual quantity includes an actual quantity x-axis component and an actual quantity y-axis component, and the theoretical shake angle includes a theoretical shake angle x-axis component and a theoretical shake angle y-axis component; the third determination unit 504 is further used to: determine the shake angle increment x-axis component and the shake angle increment y-axis component based on the focal length, the size of the single pixel, the difference between the first theoretical quantity x-axis component and the actual quantity x-axis component, and the difference between the first theoretical quantity y-axis component and the actual quantity y-axis component; determine the actual shake angle x-axis component based on the theoretical shake angle x-axis component and the shake angle increment x-axis component, and, determine the actual shake angle x-axis component based on the theoretical shake angle y-axis component and the shake angle The invention relates to a method for generating a calibration curve of the gyroscope according to the present invention. The calibration curve is constructed by using a first calibration curve to determine the first crosstalk ratio of the gyroscope and a second crosstalk ratio of the gyroscope. The calibration curve is constructed by using a first calibration curve to determine the first crosstalk ratio of the gyroscope and a second crosstalk ratio of the gyroscope. The calibration curve is constructed by using a first calibration curve to determine the first crosstalk ratio of the gyroscope and a second crosstalk ratio of the gyroscope. The calibration curve is constructed by using a first calibration curve to determine the first crosstalk ratio of the gyroscope and a second crosstalk ratio of the gyroscope. The calibration curve is constructed by using a first calibration curve to determine the first crosstalk ratio of the gyroscope and a second crosstalk ratio of the gyroscope. The calibration curve is constructed by using a first calibration curve to determine the first crosstalk ratio of the gyroscope and a second crosstalk ratio of the gyroscope. The first calibration information determined in the described manner includes a first crosstalk compensation coefficient and a second crosstalk compensation coefficient. The first crosstalk compensation coefficient represents the compensation coefficient of the x-axis data for the y-axis crosstalk, and the second crosstalk compensation coefficient represents the compensation coefficient of the y-axis data for the x-axis crosstalk. Thus, the crosstalk data in the data generated by the gyroscope can be suppressed, thereby eliminating the influence of the gyroscope crosstalk on the data generated by it, thereby improving the accuracy of the gyroscope data.
[0121] In some optional implementations of this embodiment, the fourth determination unit is further used to: determine the OIS compensation angle during the third image shooting process based on the OIS data and parameter information of the OIS module generated during the third image shooting process; determine the lens compensation displacement during the third image shooting process based on the OIS compensation angle and the focal length of the image sensor; determine the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image based on the lens compensation displacement and the size of a single pixel. By calculating the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image, a data basis can be provided for subsequent sensitivity calibration of the gyroscope.
[0122] In some optional implementations of this embodiment, the second theoretical number includes a second theoretical number x-axis component and a second theoretical number y-axis component, and the number of compensated pixels includes a number of compensated pixels x-axis component and a number of compensated pixels y-axis component; the sixth determination unit is further used to: determine the x-axis sensitivity calibration coefficient based on the second theoretical number x-axis component and the number of compensated pixels x-axis component, and determine the y-axis sensitivity calibration coefficient based on the second theoretical number y-axis component and the number of compensated pixels y-axis component; generate the second calibration information of the gyroscope based on the x-axis sensitivity calibration coefficient and the y-axis sensitivity calibration coefficient. In this way, the sensitivity of the gyroscope can be compensated so that the actual and theoretical compensation positions of the lens are the same, thereby improving the image quality.
[0123] The device provided by the above embodiment of the present application first acquires a first image and a second image, wherein the first image is an image of a target object taken by an electronic device in a stationary state, and the second image is an image of a target object taken by an electronic device in a shaking state and with the OIS function turned off; then, based on the first data corresponding to the gyroscope during the shooting of the second image, a first theoretical number of blurred pixels in different coordinate axis directions in the second image is determined; then, based on the first image, the actual number of blurred pixels in different coordinate axis directions in the second image is determined; then, based on the first theoretical number and the actual number, first calibration information of the gyroscope is determined; in the process of shooting the target image, the second data corresponding to the gyroscope in the process of shooting the target image is calibrated based on the first calibration information. Thus, by acquiring a first image of the electronic device in a stationary state and a second image of the electronic device in a shaking state and with the OIS function turned off, the gyroscope is calibrated based on the data of the two images and the data generated by the gyroscope, and accurate calibration of the gyroscope can be achieved based on software logic on the basis of the existing test equipment, and in this process, there is no need to rely on a high-precision vibration table, and the vibration table used in the OIS test can be reused, so there is no need to add additional equipment, labor costs and time costs, thereby reducing the cost of calibrating the gyroscope data. At the same time, due to the existence of gyroscope crosstalk data, there will be a difference between the first theoretical number and the actual number. Therefore, first calibration information is generated based on the first theoretical number and the actual number, and the first calibration information is used to calibrate the second data generated by the gyroscope. This can eliminate the influence of the gyroscope crosstalk data, thereby improving the accuracy of the data generated by the gyroscope.
[0124] The gyroscope data calibration device in the embodiment of the present application can be an electronic device, or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (Augmented Reality, AR) / virtual reality (Virtual Reality, VR) device, a robot, a wearable device, a super mobile personal computer (Ultra-Mobile Personal Computer, UMPC), a netbook or a personal digital assistant (Personal Digital Assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (Personal Computer, PC), a television (Television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0125] The gyroscope data calibration device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0126] The gyroscope data calibration device provided in the embodiment of the present application can achieve Figure 1 and Figure 4 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0127] Alternatively, if Figure 6 As shown, an embodiment of the present application further provides an electronic device 600, including a processor 601 and a memory 602, wherein the memory 602 stores a program or instruction that can be executed on the processor 601, and when the program or instruction is executed by the processor 601, each step of the above-mentioned gyroscope data calibration method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0128] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0129] Figure 7 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0130] The electronic device 700 includes but is not limited to: a radio frequency unit 701, a network module 702, an audio output unit 703, an input unit 704, a sensor 705, a display unit 706, a user input unit 707, an interface unit 708, a memory 709, and a processor 710.
[0131] Those skilled in the art will appreciate that the electronic device 700 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 710 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 7 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0132] Among them, the processor 710 is used to obtain a first image and a second image, the first image is an image of the target object taken when the electronic device is in a stationary state, and the second image is an image of the target object taken when the electronic device is in a shaking state and the optical image stabilization OIS function is turned off; based on the first data corresponding to the gyroscope during the shooting of the second image, a first theoretical number of blurred pixels in different coordinate axis directions in the second image is determined; based on the first image, the actual number of blurred pixels in different coordinate axis directions in the second image is determined; based on the first theoretical number and the actual number, first calibration information of the gyroscope is determined; in the process of shooting the target image, the second data is calibrated based on the first calibration information, wherein the second data is the data corresponding to the gyroscope during the process of shooting the target image.
[0133] By acquiring a first image of the electronic device in a stationary state and a second image when the electronic device is in a shaking state and the OIS function is turned off, the gyroscope is calibrated based on the data of the two images and the data generated by the gyroscope. It is possible to accurately calibrate the gyroscope based on software logic on the basis of existing test equipment. In this process, there is no need to rely on a high-precision vibration table, and the vibration table used in the OIS test can be reused. Therefore, there is no need to add additional equipment, labor costs and time costs, thereby reducing the cost of calibrating the gyroscope data. At the same time, due to the existence of gyroscope crosstalk data, there will be a difference between the first theoretical number and the actual number. Therefore, the first calibration information is generated based on the first theoretical number and the actual number, and the second data generated by the gyroscope is calibrated using the first calibration information, which can eliminate the influence of the gyroscope crosstalk data, thereby improving the accuracy of the data generated by the gyroscope.
[0134] In some embodiments, the processor 710 is further used to acquire a third image, wherein the third image is an image of the target object taken when the electronic device is in a shaking state and the OIS function is turned on; based on the OIS data generated during the shooting of the third image, determine the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image; based on the third data corresponding to the gyroscope during the shooting of the third image, determine the second theoretical number of blurred pixels in different coordinate axis directions in the third image; based on the second theoretical number and the number of compensated pixels, determine the second calibration information of the gyroscope; in the process of shooting the target image, calibrate the second data based on the first calibration information and the second calibration information, wherein the second data is the data corresponding to the gyroscope during the process of shooting the target image.
[0135] In some embodiments, the processor 710 is further used to obtain the initial data of the gyroscope, the initial data indicating the initial offset of the gyroscope; obtain the zero-bias removal data based on the first data corresponding to the gyroscope during the shooting of the second image and the initial data; determine the theoretical jitter angle of the electronic device when shooting the second image based on the exposure time of the second image and the zero-bias removal data; determine the first theoretical number of blurred pixels in different coordinate axis directions in the second image based on the focal length of the image sensor, the theoretical jitter angle and the size of a single pixel. By removing the zero bias, the accuracy of the calculation of the first theoretical number of blurred pixels in each coordinate axis in the second image can be improved, thereby helping to improve the accuracy of the calibration of the data generated by the gyroscope.
[0136] In some embodiments, the processor 710 is further configured to determine the actual number of blurred pixels in different coordinate axis directions in the second image based on the size of the sub-region corresponding to the target pixel in the first statistical region and the size of the sub-region corresponding to the target pixel in the second statistical region, wherein the first statistical region is a statistical region in the first image, the second statistical region is a statistical region in the second image, and the position of the first statistical region in the first image corresponds to the position of the second statistical region in the second image. By setting the first statistical region in the first image and the second statistical region in the second image, and determining the actual number of blurred pixels in different coordinate axis directions in the second image based on the size of the sub-region corresponding to the target pixel in the first statistical region and the size of the sub-region corresponding to the target pixel in the second statistical region, the actual number of blurred pixels in different coordinate axis directions in the second image can be obtained conveniently and quickly. In addition, since the first image is an image taken when the electronic device is in a stable state, the first image does not contain blurred pixels, and therefore, the calculation of the number of blurred pixels based on this as a reference can improve the accuracy of the calculation result of the actual number of blurred pixels.
[0137] In some embodiments, the first theoretical quantity includes a first theoretical quantity x-axis component and a first theoretical quantity y-axis component, the actual quantity includes an actual quantity x-axis component and an actual quantity y-axis component, and the theoretical shake angle includes a theoretical shake angle x-axis component and a theoretical shake angle y-axis component; the processor 710 is further configured to determine a shake angle increment x-axis component and a shake angle increment y-axis component based on the focal length, the size of a single pixel, a difference between the first theoretical quantity x-axis component and the actual quantity x-axis component, and a difference between the first theoretical quantity y-axis component and the actual quantity y-axis component; determine the actual shake angle x-axis component based on the theoretical shake angle x-axis component and the shake angle increment x-axis component, and, based on the theoretical shake angle y-axis component and the shake angle increment y-axis component, Determine the y-axis component of the actual jitter angle; determine the first crosstalk ratio of the gyroscope based on the jitter angle increment y-axis component and the actual jitter angle x-axis component, and determine the second crosstalk ratio of the gyroscope based on the jitter angle increment x-axis component and the actual jitter angle y-axis component; determine a first coefficient based on the size of the first theoretical number y-axis component and the actual number y-axis component, and determine a second coefficient based on the size of the first theoretical number x-axis component and the actual number x-axis component; use the product of the first crosstalk ratio and the first coefficient as the first crosstalk compensation coefficient, use the product of the second crosstalk ratio and the second coefficient as the second crosstalk compensation coefficient, and generate first calibration information of the gyroscope based on the first crosstalk compensation coefficient and the second crosstalk compensation coefficient. The first calibration information determined in the described manner includes a first crosstalk compensation coefficient and a second crosstalk compensation coefficient. The first crosstalk compensation coefficient represents the compensation coefficient of the x-axis data for the y-axis crosstalk, and the second crosstalk compensation coefficient represents the compensation coefficient of the y-axis data for the x-axis crosstalk. Thus, the crosstalk data in the data generated by the gyroscope can be suppressed, thereby eliminating the influence of the gyroscope crosstalk on the data generated by it, thereby improving the accuracy of the gyroscope data.
[0138] In some embodiments, the processor 710 is further used to determine the OIS compensation angle during the third image shooting process based on the OIS data and parameter information of the OIS module generated during the third image shooting process; determine the lens compensation displacement during the third image shooting process based on the OIS compensation angle and the focal length of the image sensor; and determine the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image based on the lens compensation displacement and the size of a single pixel. By calculating the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image, a data basis can be provided for subsequent sensitivity calibration of the gyroscope.
[0139] In some embodiments, the second theoretical number includes a second theoretical number x-axis component and a second theoretical number y-axis component, and the number of compensated pixels includes a number of compensated pixels x-axis component and a number of compensated pixels y-axis component; the processor 710 determines the x-axis sensitivity calibration coefficient based on the second theoretical number x-axis component and the number of compensated pixels x-axis component, and determines the y-axis sensitivity calibration coefficient based on the second theoretical number y-axis component and the number of compensated pixels y-axis component; and generates the second calibration information of the gyroscope based on the x-axis sensitivity calibration coefficient and the y-axis sensitivity calibration coefficient. In this way, the sensitivity of the gyroscope can be compensated, so that the actual and theoretical compensation positions of the lens are the same, thereby improving the image quality.
[0140] It should be understood that in the embodiment of the present application, the input unit 704 may include a graphics processor (Graphics Processing Unit, GPU) 7041 and a microphone 7042, and the graphics processor 7041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 706 may include a display panel 7061, and the display panel 7061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 707 includes a touch panel 7071 and at least one of other input devices 7072. The touch panel 7071 is also called a touch screen. The touch panel 7071 may include two parts: a touch detection device and a touch controller. Other input devices 7072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0141] The memory 709 can be used to store software programs and various data. The memory 709 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 709 may include a volatile memory or a non-volatile memory, or the memory 709 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 709 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0142] The processor 710 may include one or more processing units; optionally, the processor 710 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 710.
[0143] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned gyroscope data calibration method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0144] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0145] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned gyroscope data calibration method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0146] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0147] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned gyroscope data calibration method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0148] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0149] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0150] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A gyroscope data calibration method, characterized in that: Applied to an electronic device, the electronic device is provided with a gyroscope, and the method comprises: Acquire a first image and a second image, wherein the first image is an image of the target object taken by the electronic device in a stationary state, and the second image is an image of the target object taken by the electronic device in a shaking state and an optical image stabilization (OIS) function is turned off; Determine a first theoretical number of blurred pixels in different coordinate axis directions in the second image based on first data corresponding to the gyroscope during the capturing of the second image; Based on the first image, determining the actual number of blurred pixels in different coordinate axis directions in the second image; Determining first calibration information of the gyroscope based on the first theoretical quantity and the actual quantity; In a process of photographing a target image, second data is calibrated based on the first calibration information, wherein the second data is data corresponding to the gyroscope in the process of photographing the target image.
2. The method according to claim 1, characterized in that The method further comprises: Acquire a third image, where the third image is an image of the target object taken when the electronic device is in a shaking state and the OIS function is turned on; Determining, based on the OIS data generated during the capturing of the third image, the number of compensated pixels in the third image in different coordinate axis directions compensated by the OIS function; determining a second theoretical number of blurred pixels in different coordinate axis directions in the third image based on third data corresponding to the gyroscope during the capturing of the third image; Determining second calibration information of the gyroscope based on the second theoretical number and the number of compensated pixels; The step of calibrating the second data based on the first calibration information during the process of capturing the target image includes: In a process of capturing a target image, the second data is calibrated based on the first calibration information and the second calibration information.
3. The method according to claim 1, characterized in that: The determining, based on the first data corresponding to the gyroscope during the second image shooting process, a first theoretical number of blurred pixels in different coordinate axis directions in the second image includes: Acquiring initial data of the gyroscope, wherein the initial data indicates an initial offset of the gyroscope; Obtaining zero bias-removed data based on the first data corresponding to the gyroscope during the second image capturing process and the initial data; Determining a theoretical shaking angle of the electronic device when shooting the second image based on the exposure time of the second image and the zero bias removal data; Based on the focal length of the image sensor, the theoretical jitter angle, and the size of a single pixel, a first theoretical number of blurred pixels in different coordinate axis directions in the second image is determined.
4. The method according to claim 1, characterized in that: The determining, based on the first image, the actual number of blurred pixels in different coordinate axis directions in the second image includes: Based on the size of the sub-area corresponding to the target pixel in the first statistical area and the size of the sub-area corresponding to the target pixel in the second statistical area, the actual number of blurred pixels in different coordinate axis directions in the second image is determined, the first statistical area is the statistical area in the first image, the second statistical area is the statistical area in the second image, and the position of the first statistical area in the first image corresponds to the position of the second statistical area in the second image.
5. The method according to claim 3, characterized in that: The first theoretical quantity includes a first theoretical quantity x-axis component and a first theoretical quantity y-axis component, the actual quantity includes an actual quantity x-axis component and an actual quantity y-axis component, and the theoretical jitter angle includes a theoretical jitter angle x-axis component and a theoretical jitter angle y-axis component; The determining, based on the first theoretical quantity and the actual quantity, first calibration information of the gyroscope comprises: Determine a jitter angle increment x-axis component and a jitter angle increment y-axis component based on the focal length, the size of the single pixel, a difference between the first theoretical number x-axis component and the actual number x-axis component, and a difference between the first theoretical number y-axis component and the actual number y-axis component; Determine an actual shake angle x-axis component based on the theoretical shake angle x-axis component and the shake angle increment x-axis component, and determine an actual shake angle y-axis component based on the theoretical shake angle y-axis component and the shake angle increment y-axis component; Determine a first crosstalk ratio of the gyroscope based on the jitter angle increment y-axis component and the actual jitter angle x-axis component, and determine a second crosstalk ratio of the gyroscope based on the jitter angle increment x-axis component and the actual jitter angle y-axis component; Determine a first coefficient based on the magnitudes of the first theoretical quantity y-axis component and the actual quantity y-axis component, and determine a second coefficient based on the magnitudes of the first theoretical quantity x-axis component and the actual quantity x-axis component; The product of the first crosstalk ratio and the first coefficient is used as a first crosstalk compensation coefficient, the product of the second crosstalk ratio and the second coefficient is used as a second crosstalk compensation coefficient, and first calibration information of the gyroscope is generated based on the first crosstalk compensation coefficient and the second crosstalk compensation coefficient.
6. The method according to claim 2, characterized in that The determining, based on the OIS data generated during the shooting process of the third image, the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image includes: Determining an OIS compensation angle during the third image capturing process based on the OIS data generated during the third image capturing process and parameter information of the OIS module; determining a lens compensation displacement during the third image capturing process based on the OIS compensation angle and the focal length of the image sensor; Based on the lens compensation displacement and the size of a single pixel, the number of compensated pixels in the third image under different coordinate axis directions compensated by the OIS function is determined.
7. The method according to claim 2, characterized in that The second theoretical number includes a second theoretical number x-axis component and a second theoretical number y-axis component, and the compensated pixel number includes a compensated pixel number x-axis component and a compensated pixel number y-axis component; The determining, based on the second theoretical number and the number of compensated pixels, second calibration information of the gyroscope comprises: Determine a sensitivity calibration coefficient in the x-axis direction based on the x-axis component of the second theoretical number and the x-axis component of the compensated pixel number, and determine a sensitivity calibration coefficient in the y-axis direction based on the y-axis component of the second theoretical number and the y-axis component of the compensated pixel number; Based on the x-axis sensitivity calibration coefficient and the y-axis sensitivity calibration coefficient, second calibration information of the gyroscope is generated.
8. A gyroscope data calibration device, characterized in that: Applied to electronic equipment, the electronic equipment is provided with a gyroscope, and the device comprises: A first acquisition unit is used to acquire a first image and a second image, wherein the first image is an image of the target object taken by the electronic device in a stationary state, and the second image is an image of the target object taken by the electronic device in a shaking state and an optical image stabilization (OIS) function is turned off; A first determining unit, configured to determine a first theoretical number of blurred pixels in different coordinate axis directions in the second image based on first data corresponding to the gyroscope during the capturing of the second image; A second determining unit, configured to determine, based on the first image, actual numbers of blurred pixels in different coordinate axis directions in the second image; a third determining unit, configured to determine first calibration information of the gyroscope based on the first theoretical quantity and the actual quantity; A calibration unit is used to calibrate second data based on the first calibration information during the process of shooting the target image, wherein the second data is data corresponding to the gyroscope during the process of shooting the target image.
9. The device according to claim 8, characterized in that The device also includes: A second acquisition unit, configured to acquire a third image, where the third image is an image of the target object taken when the electronic device is in a shaking state and the OIS function is turned on; a fourth determining unit, configured to determine, based on the OIS data generated during the capturing of the third image, the number of compensated pixels compensated by the OIS function in different coordinate axis directions in the third image; A fifth determining unit, configured to determine a second theoretical number of blurred pixels in different coordinate axis directions in the third image based on third data corresponding to the gyroscope during the capturing of the third image; a sixth determining unit, configured to determine second calibration information of the gyroscope based on the second theoretical number and the number of compensated pixels; The calibration unit is further used for: In a process of capturing a target image, the second data is calibrated based on the first calibration information and the second calibration information.
10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the gyroscope data calibration method according to any one of claims 1 to 7 are implemented.
