+

CN115014421A - Calibration method and device of sensor data, anti-shake method and camera module - Google Patents

Calibration method and device of sensor data, anti-shake method and camera module Download PDF

Info

Publication number
CN115014421A
CN115014421A CN202210607428.7A CN202210607428A CN115014421A CN 115014421 A CN115014421 A CN 115014421A CN 202210607428 A CN202210607428 A CN 202210607428A CN 115014421 A CN115014421 A CN 115014421A
Authority
CN
China
Prior art keywords
sensor data
motion
state
data
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210607428.7A
Other languages
Chinese (zh)
Other versions
CN115014421B (en
Inventor
李章宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202210607428.7A priority Critical patent/CN115014421B/en
Publication of CN115014421A publication Critical patent/CN115014421A/en
Application granted granted Critical
Publication of CN115014421B publication Critical patent/CN115014421B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01DMEASURING NOT SPECIALLY ADAPTED FOR A SPECIFIC VARIABLE; ARRANGEMENTS FOR MEASURING TWO OR MORE VARIABLES NOT COVERED IN A SINGLE OTHER SUBCLASS; TARIFF METERING APPARATUS; MEASURING OR TESTING NOT OTHERWISE PROVIDED FOR
    • G01D18/00Testing or calibrating apparatus or arrangements provided for in groups G01D1/00 - G01D15/00
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Studio Devices (AREA)

Abstract

本申请涉及一种传感器数据的校准方法、装置、电子设备、存储介质和计算机程序产品。所述方法包括:基于实时采集的第一传感器数据,确定电子设备的目标运动状态;根据所述目标运动状态,确定目标校准方式;其中,所述目标校准方式包括第一校准方式或第二校准方式,所述第一校准方式的目标校准参数是基于所述第一传感器数据确定的,所述第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的;基于所述目标校准方式的目标校准参数,对所述电子设备实时采集的第二传感器数据进行校准。采用本方法能够丰富传感器数据的校准方式。

Figure 202210607428

The present application relates to a method, apparatus, electronic device, storage medium and computer program product for calibrating sensor data. The method includes: determining a target motion state of an electronic device based on first sensor data collected in real time; determining a target calibration mode according to the target motion state; wherein the target calibration mode includes a first calibration mode or a second calibration mode method, the target calibration parameters of the first calibration method are determined based on the first sensor data, and the target calibration parameters of the second calibration method are determined based on the sensor data in a historical static state; based on the target calibration The target calibration parameters of the method are used to calibrate the second sensor data collected in real time by the electronic device. The method can enrich the calibration methods of sensor data.

Figure 202210607428

Description

传感器数据的校准方法和装置、防抖方法和摄像模组Sensor data calibration method and device, anti-shake method and camera module

技术领域technical field

本申请涉及计算机技术领域,特别是涉及一种传感器数据的校准方法和装置、防抖方法和装置、摄像模组、电子设备、计算机可读存储介质和计算机程序产品。The present application relates to the field of computer technology, and in particular, to a method and device for calibrating sensor data, an anti-shake method and device, a camera module, an electronic device, a computer-readable storage medium, and a computer program product.

背景技术Background technique

在电子设备中安装有各种传感器,通过各种传感器采集数据。而传感器通中有各种类型的误差,导致该传感器无法准确地采集数据。因此,需要对传感器数据进行校准。Various sensors are installed in electronic equipment, and data is collected by various sensors. There are various types of errors in the sensor communication, which cause the sensor to not accurately collect data. Therefore, the sensor data needs to be calibrated.

传统的传感器数据的校准方法,通常是获取预先在厂线上校准好的参数对传感器数据进行校准,存在传感器数据的校准方式单一的问题。The traditional method for calibrating sensor data is usually to obtain pre-calibrated parameters on the factory line to calibrate the sensor data, and there is a problem of a single calibration method for the sensor data.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供了一种传感器数据的校准方法和装置、防抖方法和装置、摄像模组、电子设备、计算机可读存储介质和计算机程序产品,可以丰富传感器数据的校准方式。Embodiments of the present application provide a sensor data calibration method and device, an anti-shake method and device, a camera module, an electronic device, a computer-readable storage medium, and a computer program product, which can enrich sensor data calibration methods.

第一方面,本申请提供了一种传感器数据的校准方法。所述方法包括:In a first aspect, the present application provides a method for calibrating sensor data. The method includes:

基于实时采集的第一传感器数据,确定电子设备的目标运动状态;Determine the target motion state of the electronic device based on the first sensor data collected in real time;

根据所述目标运动状态,确定目标校准方式;其中,所述目标校准方式包括第一校准方式或第二校准方式,所述第一校准方式的目标校准参数是基于所述第一传感器数据确定的,所述第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的;According to the target motion state, a target calibration method is determined; wherein, the target calibration method includes a first calibration method or a second calibration method, and the target calibration parameter of the first calibration method is determined based on the first sensor data , the target calibration parameters of the second calibration method are determined based on sensor data in a historical static state;

基于所述目标校准方式的目标校准参数,对所述电子设备实时采集的第二传感器数据进行校准。Based on the target calibration parameters of the target calibration method, the second sensor data collected in real time by the electronic device is calibrated.

第二方面,本申请还提供了一种传感器数据的校准装置。所述装置包括:In a second aspect, the present application also provides an apparatus for calibrating sensor data. The device includes:

计算模块,用于基于实时采集的第一传感器数据,确定电子设备的目标运动状态;a calculation module for determining the target motion state of the electronic device based on the first sensor data collected in real time;

所述计算模块还用于根据所述目标运动状态,确定目标校准方式;其中,所述目标校准方式包括第一校准方式或第二校准方式,所述第一校准方式的目标校准参数是基于所述第一传感器数据确定的,所述第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的;The calculation module is further configured to determine a target calibration method according to the target motion state; wherein, the target calibration method includes a first calibration method or a second calibration method, and the target calibration parameter of the first calibration method is based on the target calibration method. The target calibration parameters of the second calibration method are determined based on the sensor data in a historical static state;

校准模块,用于基于所述目标校准方式的目标校准参数,对所述电子设备实时采集的第二传感器数据进行校准。The calibration module is configured to calibrate the second sensor data collected in real time by the electronic device based on the target calibration parameters of the target calibration method.

第三方面,本申请还提供了一种电子设备。所述电子设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:In a third aspect, the present application also provides an electronic device. The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

基于实时采集的第一传感器数据,确定电子设备的目标运动状态;Determine the target motion state of the electronic device based on the first sensor data collected in real time;

根据所述目标运动状态,确定目标校准方式;其中,所述目标校准方式包括第一校准方式或第二校准方式,所述第一校准方式的目标校准参数是基于所述第一传感器数据确定的,所述第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的;According to the target motion state, a target calibration method is determined; wherein, the target calibration method includes a first calibration method or a second calibration method, and the target calibration parameter of the first calibration method is determined based on the first sensor data , the target calibration parameters of the second calibration method are determined based on sensor data in a historical static state;

基于所述目标校准方式的目标校准参数,对所述电子设备实时采集的第二传感器数据进行校准。Based on the target calibration parameters of the target calibration method, the second sensor data collected in real time by the electronic device is calibrated.

第四方面,本申请还提供了一种计算机可读存储介质。所述计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:In a fourth aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by the processor, the following steps are implemented:

基于实时采集的第一传感器数据,确定电子设备的目标运动状态;Determine the target motion state of the electronic device based on the first sensor data collected in real time;

根据所述目标运动状态,确定目标校准方式;其中,所述目标校准方式包括第一校准方式或第二校准方式,所述第一校准方式的目标校准参数是基于所述第一传感器数据确定的,所述第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的;According to the target motion state, a target calibration method is determined; wherein, the target calibration method includes a first calibration method or a second calibration method, and the target calibration parameter of the first calibration method is determined based on the first sensor data , the target calibration parameters of the second calibration method are determined based on sensor data in a historical static state;

基于所述目标校准方式的目标校准参数,对所述电子设备实时采集的第二传感器数据进行校准。Based on the target calibration parameters of the target calibration method, the second sensor data collected in real time by the electronic device is calibrated.

第五方面,本申请还提供了一种计算机程序产品。所述计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现以下步骤:In a fifth aspect, the present application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the following steps:

基于实时采集的第一传感器数据,确定电子设备的目标运动状态;Determine the target motion state of the electronic device based on the first sensor data collected in real time;

根据所述目标运动状态,确定目标校准方式;其中,所述目标校准方式包括第一校准方式或第二校准方式,所述第一校准方式的目标校准参数是基于所述第一传感器数据确定的,所述第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的;According to the target motion state, a target calibration method is determined; wherein, the target calibration method includes a first calibration method or a second calibration method, and the target calibration parameter of the first calibration method is determined based on the first sensor data , the target calibration parameters of the second calibration method are determined based on sensor data in a historical static state;

基于所述目标校准方式的目标校准参数,对所述电子设备实时采集的第二传感器数据进行校准。Based on the target calibration parameters of the target calibration method, the second sensor data collected in real time by the electronic device is calibrated.

上述传感器数据的校准方法、装置、电子设备、计算机可读存储介质和计算机程序产品,基于实时采集的第一传感器数据,确定该电子设备的目标运动状态,进而根据该目标运动状态确定目标校准方式;其中,该目标校准方式包括第一校准方式或第二校准方式,第一校准方式的目标校准参数是基于第一传感器数据确定的,第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的。那么,电子设备可以采用多种校准方式中的一种校准方式,对实时采集的第二传感器数据进行校准,丰富了传感器数据的校准方式。The calibration method, device, electronic device, computer-readable storage medium and computer program product of the above sensor data, based on the first sensor data collected in real time, determine the target motion state of the electronic device, and then determine the target calibration method according to the target motion state ; wherein, the target calibration mode includes a first calibration mode or a second calibration mode, the target calibration parameters of the first calibration mode are determined based on the first sensor data, and the target calibration parameters of the second calibration mode are based on historical static conditions. determined by sensor data. Then, the electronic device can use one of multiple calibration methods to calibrate the second sensor data collected in real time, which enriches the calibration methods of the sensor data.

进一步地,电子设备在采用第一校准方式对实时采集的第二传感器数据进行校准的情况下,第一校准方式的目标校准参数是基于实时采集的第一传感器数据确定的,可以实时地对第二传感器数据进行在线校准,减少了离线校准所需的产线工序和额外的校准设备硬件成本,降低了传感器数据校准的成本。同时,第一校准方式的目标校准参数是基于实时采集的第一传感器数据确定的,该第一校准方式的目标校准参数是跟随环境变化而得到,可以满足温湿漂等多种复杂环境下的高精度校准,提高传感器数据校准的准确性。Further, when the electronic device uses the first calibration method to calibrate the second sensor data collected in real time, the target calibration parameters of the first calibration method are determined based on the first sensor data collected in real time. The two sensor data are calibrated online, which reduces the production line process required for offline calibration and the hardware cost of additional calibration equipment, and reduces the cost of sensor data calibration. At the same time, the target calibration parameters of the first calibration method are determined based on the first sensor data collected in real time. The target calibration parameters of the first calibration method are obtained by following changes in the environment, which can meet the requirements of various complex environments such as temperature and humidity drift. High-precision calibration to improve the accuracy of sensor data calibration.

进一步地,电子设备在采用第二校准方式对实时采集的第二传感器数据进行校准的情况下,丰富了传感器数据的校准方式,可以提高传感器数据校准的有效性、兼容性、可靠性和容灾性。Further, when the electronic device uses the second calibration method to calibrate the second sensor data collected in real time, the calibration method of the sensor data is enriched, and the validity, compatibility, reliability and disaster tolerance of the sensor data calibration can be improved. sex.

第六方面,本申请还提供了一种防抖方法。所述方法包括:In a sixth aspect, the present application also provides an anti-shake method. The method includes:

在电子设备的拍摄场景中,获取校准后的传感器数据;所述校准后的传感器数据是根据任一项所述的传感器数据的校准方法得到;In the shooting scene of the electronic device, the calibrated sensor data is obtained; the calibrated sensor data is obtained according to any one of the sensor data calibration methods;

基于所述校准后的传感器数据,确定防抖补偿量;determining an anti-shake compensation amount based on the calibrated sensor data;

基于所述防抖补偿量对摄像模组进行抖动补偿。Shake compensation is performed on the camera module based on the anti-shake compensation amount.

第七方面,本申请还提供了一种防抖装置。所述装置包括:In a seventh aspect, the present application further provides an anti-shake device. The device includes:

获取模块,用于在电子设备的拍摄场景中,获取校准后的传感器数据;所述校准后的传感器数据是根据任一项所述的传感器数据的校准方法得到;an acquisition module, configured to acquire calibrated sensor data in the shooting scene of the electronic device; the calibrated sensor data is obtained according to any one of the sensor data calibration methods;

确定模块,用于基于所述校准后的传感器数据,确定防抖补偿量;a determining module for determining an anti-shake compensation amount based on the calibrated sensor data;

防抖模块,用于基于所述防抖补偿量对摄像模组进行抖动补偿。An anti-shake module, configured to perform jitter compensation on the camera module based on the anti-shake compensation amount.

第八方面,本申请还提供了一种摄像模组。所述摄像模组包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行如所述的传感器数据的校准方法的步骤,或所述的防抖方法的步骤。In an eighth aspect, the present application further provides a camera module. The camera module includes a memory and a processor, and a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the method for calibrating sensor data as described above, or the steps of the anti-shake method.

第九方面,本申请还提供了一种电子设备。所述电子设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:In a ninth aspect, the present application further provides an electronic device. The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

在电子设备的拍摄场景中,获取校准后的传感器数据;所述校准后的传感器数据是根据任一项所述的传感器数据的校准方法得到;In the shooting scene of the electronic device, the calibrated sensor data is obtained; the calibrated sensor data is obtained according to any one of the sensor data calibration methods;

基于所述校准后的传感器数据,确定防抖补偿量;determining an anti-shake compensation amount based on the calibrated sensor data;

基于所述防抖补偿量对摄像模组进行抖动补偿。Shake compensation is performed on the camera module based on the anti-shake compensation amount.

第十方面,本申请还提供了一种计算机可读存储介质。所述计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:In a tenth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by the processor, the following steps are implemented:

在电子设备的拍摄场景中,获取校准后的传感器数据;所述校准后的传感器数据是根据任一项所述的传感器数据的校准方法得到;In the shooting scene of the electronic device, the calibrated sensor data is obtained; the calibrated sensor data is obtained according to any one of the sensor data calibration methods;

基于所述校准后的传感器数据,确定防抖补偿量;determining an anti-shake compensation amount based on the calibrated sensor data;

基于所述防抖补偿量对摄像模组进行抖动补偿。Shake compensation is performed on the camera module based on the anti-shake compensation amount.

第十一方面,本申请还提供了一种计算机程序产品。所述计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现以下步骤:In an eleventh aspect, the present application further provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the following steps:

在电子设备的拍摄场景中,获取校准后的传感器数据;所述校准后的传感器数据是根据任一项所述的传感器数据的校准方法得到;In the shooting scene of the electronic device, the calibrated sensor data is obtained; the calibrated sensor data is obtained according to any one of the sensor data calibration methods;

基于所述校准后的传感器数据,确定防抖补偿量;determining an anti-shake compensation amount based on the calibrated sensor data;

基于所述防抖补偿量对摄像模组进行抖动补偿。Shake compensation is performed on the camera module based on the anti-shake compensation amount.

上述防抖方法、装置、摄像模组、电子设备、计算机可读存储介质和计算机程序产品,并且,该传感器数据的校准过程和光学防抖过程处于同个闭环系统中,避免随着时间推移带来数据上的偏差,以及校准过程和光学防抖过程处于不同空间带来的偏差,可以提高校准的准确性。在提高传感器数据的校准精度的同时,该校准后的传感器数据也用于进行防抖,提高了防抖算法的性能,提升了生成的画面的画质表现力,可以赋能更高的产品表现力。The above-mentioned anti-shake method, device, camera module, electronic equipment, computer-readable storage medium and computer program product, and the calibration process of the sensor data and the optical anti-shake process are in the same closed-loop system, to avoid banding over time. The deviation in the data, and the deviation caused by the calibration process and the optical image stabilization process in different spaces, can improve the accuracy of the calibration. While improving the calibration accuracy of the sensor data, the calibrated sensor data is also used for anti-shake, which improves the performance of the anti-shake algorithm, improves the image quality and expressiveness of the generated image, and can enable higher product performance. force.

进一步地,电子设备可以在拍摄场景中,实时获取校准后的传感器数据,基于该传感器数据实时对摄像模组进行抖动补偿,可以增加抖动补偿的时效性;并且若该校准后的传感器是基于第一校准方式的目标校准参数确定的,该目标校准参数是在拍摄场景中实时采集的第一传感器数据确定的,那么该目标校准参数也考虑了当前的拍摄场景的影响因素,可以对传感器数据进行校准,得到更准确的传感器数据,从而对摄像模组更准确进行抖动补偿。Further, the electronic device can acquire calibrated sensor data in real time in the shooting scene, and perform shake compensation on the camera module in real time based on the sensor data, which can increase the timeliness of the shake compensation; and if the calibrated sensor is based on the first The target calibration parameter of a calibration method is determined, and the target calibration parameter is determined by the first sensor data collected in real time in the shooting scene, then the target calibration parameter also takes the influencing factors of the current shooting scene into consideration, and the sensor data can be measured. Calibration to obtain more accurate sensor data, so as to perform more accurate shake compensation for the camera module.

附图说明Description of drawings

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.

图1为一个实施例中传感器数据的校准方法和防抖方法的应用环境图;1 is an application environment diagram of a calibration method for sensor data and an anti-shake method in one embodiment;

图2为一个实施例中传感器数据的校准方法的流程图;2 is a flowchart of a method for calibrating sensor data in one embodiment;

图3为一个实施例中校准模块的校准流程图;Fig. 3 is the calibration flow chart of the calibration module in one embodiment;

图4为另一个实施例中传感器数据的校准方法的流程图;4 is a flowchart of a method for calibrating sensor data in another embodiment;

图5为一个实施例中存储模块的存储流程图;Fig. 5 is the storage flow chart of the storage module in one embodiment;

图6为一个实施例中队空的示意图;6 is a schematic diagram of a team empty in one embodiment;

图7为一个实施例中队满的示意图;Fig. 7 is a schematic diagram of a squadron full in one embodiment;

图8为另一个实施例中传感器数据的校准方法的流程图;8 is a flowchart of a method for calibrating sensor data in another embodiment;

图9为另一个实施例中传感器数据的校准方法的流程图;9 is a flowchart of a method for calibrating sensor data in another embodiment;

图10为另一个实施例中传感器数据的校准方法的流程图;10 is a flowchart of a method for calibrating sensor data in another embodiment;

图11为一个实施例中传感器数据的校准方法的框架图;11 is a framework diagram of a method for calibrating sensor data in one embodiment;

图12为一个实施例中计算模块的计算流程图;Fig. 12 is the calculation flow chart of the calculation module in one embodiment;

图13为一个实施例中防抖方法的流程图;13 is a flowchart of an anti-shake method in one embodiment;

图14为一个实施例中光学防抖系统在电子设备工作的框架图;14 is a frame diagram of the operation of the optical image stabilization system in an electronic device in one embodiment;

图15为一个实施例中传感器数据的校准装置的结构框图;FIG. 15 is a structural block diagram of an apparatus for calibrating sensor data in one embodiment;

图16为一个实施例中防抖装置的结构框图;16 is a structural block diagram of an anti-shake device in one embodiment;

图17为一个实施例中电子设备的内部结构图。FIG. 17 is an internal structure diagram of an electronic device in one embodiment.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.

本申请实施例提供的传感器数据的校准方法和防抖方法,可以应用于如图1所示的应用环境中。其中,电子设备100中包括摄像模组102和目标传感器104;摄像模组102可以包括镜头、图像传感器、第一马达和第二马达等器件,目标传感器104可以是惯性测量单元,惯性测量单元可以包括陀螺仪(gyro,gyroscope)、加速度计(acc,accelerometer)和磁力计(mag,magnetometer)等其中至少一种。The sensor data calibration method and the anti-shake method provided by the embodiments of the present application can be applied to the application environment shown in FIG. 1 . The electronic device 100 includes a camera module 102 and a target sensor 104; the camera module 102 may include a lens, an image sensor, a first motor, a second motor and other devices, the target sensor 104 may be an inertial measurement unit, and the inertial measurement unit may It includes at least one of a gyroscope (gyro, gyroscope), an accelerometer (acc, accelerometer), and a magnetometer (mag, magnetometer).

在电子设备100的拍摄场景中,电子设备100基于目标传感器104实时采集的第一传感器数据,确定电子设备100的目标运动状态;根据目标运动状态,确定目标校准方式;其中,目标校准方式包括第一校准方式或第二校准方式,第一校准方式的目标校准参数是基于第一传感器数据确定的,第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的;基于目标校准方式的目标校准参数,对电子设备100实时采集的第二传感器数据进行校准,得到校准后的第二传感器数据。In the shooting scene of the electronic device 100, the electronic device 100 determines the target motion state of the electronic device 100 based on the first sensor data collected in real time by the target sensor 104; A calibration method or a second calibration method, the target calibration parameters of the first calibration method are determined based on the first sensor data, and the target calibration parameters of the second calibration method are determined based on the sensor data in a historical static state; based on the target calibration method The target calibration parameters are calibrated, and the second sensor data collected in real time by the electronic device 100 is calibrated to obtain calibrated second sensor data.

进一步地,电子设备100获取校准后的第二传感器数据;基于校准后的传感器数据,确定防抖补偿量;基于防抖补偿量对摄像模组102进行抖动补偿,生成图像。Further, the electronic device 100 obtains the calibrated second sensor data; determines the anti-shake compensation amount based on the calibrated sensor data; performs shake compensation on the camera module 102 based on the anti-shake compensation amount to generate an image.

其中,电子设备100可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑、物联网设备和便携式可穿戴设备,物联网设备可为智能音箱、智能电视、智能空调、智能车载设备等。便携式可穿戴设备可为智能手表、智能手环、头戴设备等。Wherein, the electronic device 100 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices can be smart speakers, smart TVs, smart air conditioners, and smart vehicle-mounted devices. Wait. The portable wearable device may be a smart watch, a smart bracelet, a head-mounted device, or the like.

在一些示例性的实施例中,如图2所示,提供了一种传感器数据的校准方法,以该方法应用于图1中的电子设备为例进行说明,包括以下步骤:In some exemplary embodiments, as shown in FIG. 2 , a method for calibrating sensor data is provided, and the method is applied to the electronic device in FIG. 1 as an example to illustrate, including the following steps:

步骤202,基于实时采集的第一传感器数据,确定电子设备的目标运动状态。Step 202: Determine the target motion state of the electronic device based on the first sensor data collected in real time.

第一传感器数据指的是目标传感器实时采集的数据,用于表征电子设备的姿态。The first sensor data refers to data collected in real time by the target sensor, and is used to characterize the attitude of the electronic device.

可选地,目标传感器可以是独立于电子设备的传感器,也可以是安装在电子设备内部的传感器,在此不做限定。若目标传感器是独立于电子设备、且贴附于电子设备上的传感器,则目标传感器通过预设的通信通道与电子设备进行通信。预设的通信通道可以是有线通信通道或无线通信通道。无线通信通道可以是蓝牙通道、无线网络通道或近场通信通道等,不限于此。Optionally, the target sensor may be a sensor independent of the electronic device, or may be a sensor installed inside the electronic device, which is not limited herein. If the target sensor is a sensor independent of the electronic device and attached to the electronic device, the target sensor communicates with the electronic device through a preset communication channel. The preset communication channel may be a wired communication channel or a wireless communication channel. The wireless communication channel may be a Bluetooth channel, a wireless network channel or a near field communication channel, etc., but is not limited thereto.

实时采集数据的目标传感器的种类可以是一种或者多种,每种传感器的数量可以是一个或者多个。The types of target sensors that collect data in real time may be one or more, and the number of each sensor may be one or more.

例如,电子设备中安装有惯性测量单元(IMU,Inertial Measurement Unit),通过惯性测量单元采集IMU数据。其中,惯性测量单元也称惯性传感器,是用于测量物体三轴姿态角(或角速率)以及加速度等姿态数据的装置。惯性测量单元可以包括陀螺仪、加速度计和磁力计。For example, an inertial measurement unit (IMU, Inertial Measurement Unit) is installed in the electronic device, and the IMU data is collected by the inertial measurement unit. Among them, the inertial measurement unit, also called inertial sensor, is a device for measuring attitude data such as the three-axis attitude angle (or angular rate) and acceleration of an object. Inertial measurement units may include gyroscopes, accelerometers, and magnetometers.

又如,电子设备中还可以安装有电场传感器、压力传感器、光传感器、指纹传感器,触摸传感器和转轴传感器等,不限于此。For another example, an electric field sensor, a pressure sensor, a light sensor, a fingerprint sensor, a touch sensor, a rotating shaft sensor, etc. may also be installed in the electronic device, but not limited to this.

目标运动状态指的是实时采集第一传感器数据时电子设备的运动状态。目标运动状态包括静止状态或非静止状态。其中,静止状态指的是电子设备的运动幅度小于预设的运动幅度阈值所处的状态,非静止状态指的是电子设备的运动幅度大于或等于预设的运动幅度阈值所处的状态。预设的运动幅度阈值具体可以是角速度阈值、加速度阈值和速度阈值等其中的至少一种。The target motion state refers to the motion state of the electronic device when the first sensor data is collected in real time. The target motion state includes a stationary state or a non-stationary state. The stationary state refers to the state in which the motion amplitude of the electronic device is smaller than the preset motion amplitude threshold, and the non-stationary state refers to the state in which the motion amplitude of the electronic device is greater than or equal to the preset motion amplitude threshold. The preset motion amplitude threshold may specifically be at least one of an angular velocity threshold, an acceleration threshold, and a velocity threshold.

进一步地,非静止状态具体是包括移动状态或抖动状态。移动状态即电子设备平移所处的状态,抖动状态即电子设备抖动所处的状态。Further, the non-stationary state specifically includes a moving state or a shaking state. The moving state is the state in which the electronic device is translated, and the shaking state is the state in which the electronic device is shaken.

可选地,在电子设备预设的使用场景中,电子设备通过目标传感器实时采集第一传感器数据,基于该第一传感器数据,确定电子设备的目标运动状态。其中,预设的使用场景可以是拍摄场景、指南针场景和地图导航场景等,不限于此。Optionally, in a preset usage scenario of the electronic device, the electronic device collects first sensor data in real time through the target sensor, and determines the target motion state of the electronic device based on the first sensor data. Wherein, the preset usage scene may be a shooting scene, a compass scene, a map navigation scene, etc., but is not limited thereto.

步骤204,根据目标运动状态,确定目标校准方式;其中,目标校准方式包括第一校准方式或第二校准方式,第一校准方式的目标校准参数是基于第一传感器数据确定的,第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的。Step 204: Determine a target calibration method according to the target motion state; wherein, the target calibration method includes a first calibration method or a second calibration method, the target calibration parameters of the first calibration method are determined based on the first sensor data, and the second calibration method The target calibration parameters are determined based on historical stationary sensor data.

目标校准方式指的是与目标运动状态相匹配的校准方式。第一校准方式的目标校准参数是基于第一传感器数据确定的,该第一传感器数据是实时采集的,也即第一校准方式为在线校准方式。第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的,该历史静止状态下的传感器数据是历史数据,也即第二校准方式为离线校准方式。The target calibration method refers to a calibration method that matches the motion state of the target. The target calibration parameter of the first calibration mode is determined based on the first sensor data, and the first sensor data is collected in real time, that is, the first calibration mode is an online calibration mode. The target calibration parameter of the second calibration method is determined based on the sensor data in the historical static state, and the sensor data in the historical static state is historical data, that is, the second calibration method is an offline calibration method.

目标校准参数是目标校准方式所对应的校准参数,用于对实时采集的第二传感器数据进行校准,以降低第二传感器数据的误差。The target calibration parameter is a calibration parameter corresponding to the target calibration method, and is used to calibrate the second sensor data collected in real time, so as to reduce the error of the second sensor data.

历史静止状态是电子设备在历史时间段中所处的静止状态。历史静止状态可以是前一次进行传感器数据的校准时电子设备所处的静止状态,也可以是电子设备在装配节点时电子设备所处的静止状态,还可以是电子设备在历史时间中的空闲时间段电子设备所处的静止状态,在此不做限定。The historical quiescent state is the quiescent state in which the electronic device is in a historical time period. The historical static state can be the static state of the electronic device when the sensor data was calibrated last time, the static state of the electronic device when the electronic device is assembling the node, or the idle time of the electronic device in the historical time. The static state of the segment electronic device is not limited here.

示例性的,电子设备在昨天夜间进行传感器数据的校准的过程中,所处的静止状态为历史静止状态。示例性的,电子设备在历史时刻的拍摄场景进行传感器数据的校准的过程中,所处的静止状态为历史静止状态。示例性的,电子设备在历史时刻进行系统安装完成后,进行传感器数据的校准的过程中,所处的静止状态为历史静止状态。Exemplarily, during the process of calibrating sensor data last night, the electronic device was in a static state that was a historical static state. Exemplarily, during the process of calibrating sensor data in a shooting scene at a historical moment, the electronic device is in a static state that is a historical static state. Exemplarily, in the process of calibrating sensor data after the system installation of the electronic device is completed at a historical moment, the static state in which the electronic device is located is the historical static state.

可选地,电子设备根据目标运动状态,从多个候选校准方式中确定目标校准方式。多个候选校准方式包括第一校准方式和第二校准方式。多个候选校准方式还可以包括其他的校准方式,根据用户需要进行设置,在此不做限定。Optionally, the electronic device determines the target calibration mode from a plurality of candidate calibration modes according to the target motion state. The plurality of candidate calibration modes include a first calibration mode and a second calibration mode. The multiple candidate calibration methods may also include other calibration methods, which are set according to user needs, which is not limited here.

示例性的,多个候选校准方式包括第一校准方式和第二校准方式,还包括第三校准方式和第四校准方式。其中,第三校准方式的目标校准参数是用户预先设置的,第四校准方式的目标校准参数是从传感器的后台服务器中获取的。Exemplarily, the plurality of candidate calibration modes include a first calibration mode and a second calibration mode, and further include a third calibration mode and a fourth calibration mode. The target calibration parameters of the third calibration mode are preset by the user, and the target calibration parameters of the fourth calibration mode are obtained from the background server of the sensor.

在目标校准方式为第一校准方式的情况下,基于第一传感器数据确定该第一校准方式的目标校准参数;在目标校准方式为第二校准方式的情况下,获取历史校准参数作为第二校准方式的目标校准参数,该历史校准参数是基于历史静止状态下的传感器数据确定的。When the target calibration method is the first calibration method, the target calibration parameters of the first calibration method are determined based on the first sensor data; when the target calibration method is the second calibration method, the historical calibration parameters are acquired as the second calibration method The target calibration parameters of the method, the historical calibration parameters are determined based on the sensor data in the historical static state.

在一种实施方式中,电子设备可以直接获取确定好的历史校准参数,作为第二校准方式的目标校准参数。在另一种实施方式中,电子设备也可以获取历史静止状态下的传感器数据,基于该历史状态下的传感器数据计算出历史校准参数,将该历史校准参数作为第二校准方式的目标校准参数。In one embodiment, the electronic device may directly acquire the determined historical calibration parameters as the target calibration parameters of the second calibration mode. In another embodiment, the electronic device may also acquire sensor data in a historical static state, calculate historical calibration parameters based on the sensor data in the historical state, and use the historical calibration parameters as the target calibration parameters of the second calibration method.

步骤206,基于目标校准方式的目标校准参数,对电子设备实时采集的第二传感器数据进行校准。Step 206 , calibrate the second sensor data collected in real time by the electronic device based on the target calibration parameters of the target calibration method.

第二传感器数据指的是电子设备中的传感器实时采集的待校准的数据。需要说明的是,在一些实施例中,第二传感器数据可以是确定出目标校准参数之后实时采集的传感器数据,也即第二传感器数据的采集时刻晚于第一传感器数据的采集时刻;在另一些实施例中,第二传感器数据也可以包括第一传感器数据,也即第二传感器数据可以指的是整个实时流程中的所有传感器数据。The second sensor data refers to data to be calibrated collected in real time by sensors in the electronic device. It should be noted that, in some embodiments, the second sensor data may be sensor data collected in real time after the target calibration parameters are determined, that is, the collection time of the second sensor data is later than the collection time of the first sensor data; in another In some embodiments, the second sensor data may also include the first sensor data, that is, the second sensor data may refer to all sensor data in the entire real-time process.

可以理解的是,电子设备对第二传感器数据进行校准,而采集该第二传感器数据的传感器是在静止状态下输出标准的传感器数据所对应的传感器。标准的传感器数据即误差小于预设误差阈值的传感器数据。例如,采集该第二传感器数据的传感器可以是陀螺仪、加速度计等。It can be understood that the electronic device calibrates the second sensor data, and the sensor that collects the second sensor data is a sensor corresponding to outputting standard sensor data in a static state. Standard sensor data is sensor data with an error less than a preset error threshold. For example, the sensor that collects the second sensor data may be a gyroscope, an accelerometer, or the like.

可选地,电子设备基于目标校准方式的目标校准参数确定误差值,将电子设备实时采集的第二传感器数据和该误差值进行差值处理,得到校准后的第二传感器数据。其中,误差值可以是目标校准参数本身,也可以是基于目标校准参数重新计数出的数值,在此不做限定。Optionally, the electronic device determines an error value based on target calibration parameters of the target calibration method, and performs difference processing between the second sensor data collected in real time by the electronic device and the error value to obtain calibrated second sensor data. The error value may be the target calibration parameter itself, or may be a value re-counted based on the target calibration parameter, which is not limited herein.

示例性的,目标校准参数为误差值,则将电子设备实时采集的第二传感器数据减去该误差值,得到校准后的第二传感器数据。Exemplarily, if the target calibration parameter is an error value, the second sensor data collected in real time by the electronic device is subtracted from the error value to obtain calibrated second sensor data.

示例性的,电子设备可以将目标校准参数乘以增益值得到误差值,再将电子设备实时采集的第二传感器数据减去该误差值,得到校准后的第二传感器数据。Exemplarily, the electronic device may multiply the target calibration parameter by the gain value to obtain the error value, and then subtract the error value from the second sensor data collected in real time by the electronic device to obtain calibrated second sensor data.

在一些示例性的实施例中,如图3所示,电子设备获取目标校准参数302,以及实时采集第二传感器数据302,执行步骤306,基于目标校准参数302对第二传感器数据304进行误差校准,得到校准后的第二传感器数据308。In some exemplary embodiments, as shown in FIG. 3 , the electronic device acquires the target calibration parameters 302 and collects the second sensor data 302 in real time, and executes step 306 to perform error calibration on the second sensor data 304 based on the target calibration parameters 302 , to obtain calibrated second sensor data 308 .

上述传感器数据的校准方法,基于实时采集的第一传感器数据,确定该电子设备的目标运动状态,进而根据该目标运动状态确定目标校准方式;其中,该目标校准方式包括第一校准方式或第二校准方式,第一校准方式的目标校准参数是基于第一传感器数据确定的,第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的。那么,电子设备可以采用多种校准方式中的一种校准方式,对实时采集的第二传感器数据进行校准,丰富了传感器数据的校准方式。The method for calibrating the above sensor data, based on the first sensor data collected in real time, determines the target motion state of the electronic device, and then determines the target calibration method according to the target motion state; wherein, the target calibration method includes the first calibration method or the second calibration method. In the calibration mode, the target calibration parameters of the first calibration mode are determined based on the first sensor data, and the target calibration parameters of the second calibration mode are determined based on the sensor data in a historical static state. Then, the electronic device can use one of multiple calibration methods to calibrate the second sensor data collected in real time, which enriches the calibration methods of the sensor data.

在一些可能的实施方式中,电子设备在采用第一校准方式对实时采集的第二传感器数据进行校准的情况下,第一校准方式的目标校准参数是基于实时采集的第一传感器数据确定的,可以实时地对第二传感器数据进行在线校准,减少了离线校准所需的产线工序和额外的校准设备硬件成本,降低了传感器数据校准的成本。同时,第一校准方式的目标校准参数是基于实时采集的第一传感器数据确定的,该第一校准方式的目标校准参数是跟随环境变化而得到,可以满足温湿漂等多种复杂环境下的高精度校准,提高传感器数据校准的准确性。其中,温湿漂指的是传感器的零点随温度、湿度等环境漂移。In some possible implementations, when the electronic device uses the first calibration method to calibrate the second sensor data collected in real time, the target calibration parameters of the first calibration method are determined based on the first sensor data collected in real time, The online calibration of the second sensor data can be performed in real time, which reduces the production line process required for the offline calibration and the hardware cost of additional calibration equipment, and reduces the cost of sensor data calibration. At the same time, the target calibration parameters of the first calibration method are determined based on the first sensor data collected in real time. The target calibration parameters of the first calibration method are obtained by following changes in the environment, which can meet the requirements of various complex environments such as temperature and humidity drift. High-precision calibration to improve the accuracy of sensor data calibration. Among them, the temperature and humidity drift refers to the zero point of the sensor drifting with the environment such as temperature and humidity.

在一些可能的实施方式中,电子设备在采用第二校准方式对实时采集的第二传感器数据进行校准的情况下,丰富了传感器数据的校准方式,可以提高传感器数据校准的有效性、兼容性、可靠性和容灾性。In some possible implementations, when the electronic device uses the second calibration method to calibrate the second sensor data collected in real time, the calibration method of the sensor data is enriched, which can improve the validity, compatibility, and reliability of the sensor data calibration. Reliability and disaster tolerance.

在一些可能的实施例中,根据目标运动状态,确定目标校准方式,包括:判断目标运动状态是否为静止状态,并基于判断结果确定目标校准方式。In some possible embodiments, determining the target calibration mode according to the target motion state includes: judging whether the target motion state is a static state, and determining the target calibration mode based on the judgment result.

判断结果包括第一结果和第二结果。第一结果是目标运动状态为静止状态,第二结果为目标运动状态为非静止状态。The judgment result includes the first result and the second result. The first result is that the target motion state is a stationary state, and the second result is that the target motion state is a non-stationary state.

在本实施例中,电子设备判断目标运动状态是否为静止状态,从而可以基于是否处于静止状态的判断结果,准确地确定出目标校准方式。In this embodiment, the electronic device determines whether the target motion state is a stationary state, so that the target calibration method can be accurately determined based on the determination result of whether the target is in a stationary state.

在一些可能的实施例中,根据目标运动状态,确定目标校准方式,包括:若目标运动状态为静止状态,则确定目标校准方式为第一校准方式;若目标运动状态为非静止状态,则确定目标校准方式为第二校准方式。In some possible embodiments, determining the target calibration method according to the target movement state includes: if the target movement state is a stationary state, determining the target calibration method to be the first calibration method; if the target movement state is a non-stationary state, determining The target calibration mode is the second calibration mode.

若目标运动状态为静止状态,则确定目标校准方式为第一校准方式;在第一校准方式的情况下,基于实时采集的第一传感器数据确定出目标校准参数。If the motion state of the target is a static state, the target calibration method is determined as the first calibration method; in the case of the first calibration method, the target calibration parameter is determined based on the first sensor data collected in real time.

若目标运动状态为非静止状态,则确定目标校准方式为第二校准方式;在第二校准方式的情况下,基于历史静止状态下的传感器数据确定目标校准参数。If the target motion state is a non-stationary state, the target calibration method is determined to be the second calibration method; in the case of the second calibration method, the target calibration parameter is determined based on the sensor data in the historical stationary state.

在本实施例中,电子设备可以基于电子设备的目标运动状态,从多种校准方式中确定出该目标校准方式,丰富了传感器数据的校准方式。In this embodiment, the electronic device may determine the target calibration method from a variety of calibration methods based on the target motion state of the electronic device, thereby enriching the calibration methods for sensor data.

在一些示例性的实施例中,基于实时采集的第一传感器数据,确定电子设备的目标运动状态,包括:根据预设的静止时间段阈值,从缓存的实时传感器数据中获取满足静止时间段阈值的第一传感器数据;基于第一传感器数据,确定电子设备的目标运动状态。In some exemplary embodiments, determining the target motion state of the electronic device based on the first sensor data collected in real time includes: obtaining, according to a preset still time period threshold, from cached real-time sensor data that satisfies the still time period threshold The first sensor data of the electronic device is determined; based on the first sensor data, the target motion state of the electronic device is determined.

静止时间段阈值指的是用于判断采集第一传感器数据的时长是否满足条件的阈值,也即用于判断电子设备处于静止状态的持续时间的阈值。静止时间段阈值可以根据需要进行设置,也可以在实际测试过程中进行调整。例如,静止时间段阈值可以是2s(秒)。The stationary time period threshold refers to a threshold for determining whether the duration of collecting the first sensor data satisfies the condition, that is, a threshold for determining the duration for which the electronic device is in a stationary state. The static time period threshold can be set as required, and can also be adjusted during the actual test. For example, the quiet time period threshold may be 2s (seconds).

可选地,电子设备通过目标传感器实时采集实时传感器数据,并将实时传感器数据存储到缓存中;实时检测缓存中的实时传感器数据所对应的采集时长,当该采集时长满足静止时间段阈值,则从缓存中最新存入的实时传感器数据进行遍历,获取该静止时间段阈值的第一传感器数据。Optionally, the electronic device collects real-time sensor data in real time through the target sensor, and stores the real-time sensor data in the cache; real-time detection of the acquisition duration corresponding to the real-time sensor data in the cache, when the acquisition duration meets the static time period threshold, then Traverse the newly stored real-time sensor data in the cache to obtain the first sensor data of the static time period threshold.

可以理解的是,采集时长越长,则采集到的实时传感器数据越多,也即采集时长和实时传感器数据的数量成正相关。那么,电子设备基于缓存中的实时传感器数据的数量,可以确定出缓存中的实时传感器数据所对应的采集时长。It can be understood that the longer the collection time is, the more real-time sensor data is collected, that is, the collection time is positively correlated with the amount of real-time sensor data. Then, based on the quantity of real-time sensor data in the cache, the electronic device can determine the collection time period corresponding to the real-time sensor data in the cache.

在一些可能的实施方式中,电子设备获取目标传感器采集数据的频率,将缓存中的实时传感器数据的数量除以该频率,可以得到缓存中的实时传感器数据所对应的采集时长。In some possible implementations, the electronic device obtains the frequency of data collected by the target sensor, and divides the number of real-time sensor data in the cache by the frequency to obtain the collection duration corresponding to the real-time sensor data in the cache.

在另一些可能的实施方式中,电子设备还可以获取缓存中第一个实时传感器数据的第一采集时刻和最后一个实时传感器数据的第二采集时刻,则第二采集时刻减去第一采集时刻,可以得到缓存中的实时传感器数据所对应的采集时长。In some other possible implementation manners, the electronic device may also acquire the first collection moment of the first real-time sensor data and the second collection moment of the last real-time sensor data in the cache, then the second collection moment is subtracted from the first collection moment , the acquisition duration corresponding to the real-time sensor data in the cache can be obtained.

在其他可能的实施方式中,电子设备还可以采用其他方式确定出缓存中的实时传感器数据所对应的采集时长,在此不做限定。In other possible implementation manners, the electronic device may also determine the collection duration corresponding to the real-time sensor data in the cache in other manners, which is not limited herein.

可以理解的是,在电子设备的使用场景中,如拍摄场景中,会使得电子设备相对处于静止状态而拍摄出清晰的画面,因此可以设置静止时间段阈值,用于判断电子设备处于静止状态的持续时长是否满足阈值,从而可以获取该满足静止时间段阈值的第一传感器数据,确定电子设备的目标运动状态。It can be understood that in the use scene of electronic equipment, such as in the shooting scene, the electronic equipment will be relatively stationary to capture a clear picture. Therefore, a threshold for the stationary time period can be set to determine whether the electronic equipment is in a stationary state. Whether the duration satisfies the threshold, the first sensor data that satisfies the threshold of the stationary time period can be acquired to determine the target motion state of the electronic device.

在本实施例中,缓存的实时传感器数据中获取满足静止时间段阈值,表示缓存的实时传感器数据的数据量满足用于确定电子设备的运动状态的条件,则从缓存的实时传感器数据中获取满足静止时间段阈值的第一传感器数据,可以更准确地确定电子设备的目标运动状态。In this embodiment, if the buffered real-time sensor data is obtained to satisfy the static time period threshold, it means that the data volume of the buffered real-time sensor data satisfies the condition for determining the motion state of the electronic device, then the buffered real-time sensor data is obtained from the buffered real-time sensor data that satisfies the The first sensor data of the static time period threshold value can more accurately determine the target motion state of the electronic device.

在一些示例性的实施例中,如图4所示,提供了另一种传感器数据的校准方法,以该方法应用于图1中的电子设备为例进行说明,包括以下步骤:In some exemplary embodiments, as shown in FIG. 4 , another method for calibrating sensor data is provided. Taking the method applied to the electronic device in FIG. 1 as an example, the following steps are included:

步骤402,获取当前时刻对应的先入先出队列中的数据长度;先入先出队列中实时缓存有实时传感器数据。In step 402, the data length in the FIFO queue corresponding to the current moment is obtained; the real-time sensor data is buffered in the FIFO queue in real time.

先入先出队列(FIFO,First Input First Output)是先进入的指令先完成并引退,跟着才执行第二条指令的队列。具体地,先入先出队列可以为循环队列。循环队列是把顺序队列首尾相连,把存储队列元素的表从逻辑上看成一个环,成为循环队列。先入先出队列还可以是非循环队列。First-in, first-out queue (FIFO, First Input First Output) is a queue in which the first entered instruction is completed and retired first, followed by the execution of the second instruction. Specifically, the FIFO queue may be a circular queue. The circular queue is to connect the sequential queues end to end, and logically regard the table storing the elements of the queue as a ring, which is called a circular queue. The FIFO queue can also be an acyclic queue.

可以理解的是,先入先出队列中的数据长度表征先入先出队列中的实时传感器数据的数量,数据长度与先入先出队列中的实时传感器数据的数量成正相关,而实时传感器数据的数量与采集时长成正相关,故数据长度与采集时长也成正相关。It can be understood that the data length in the FIFO queue represents the quantity of real-time sensor data in the FIFO queue, and the data length is positively correlated with the quantity of real-time sensor data in the FIFO queue, while the quantity of real-time sensor data is directly related to the quantity of real-time sensor data in the FIFO queue. The collection time is positively correlated, so the data length is also positively correlated with the collection time.

步骤404,根据数据长度和采集时长之间的关系,确定数据长度对应的采集时长,并在采集时长满足静止时间段阈值的情况下,获取满足静止时间段阈值的第一传感器数据。Step 404 , according to the relationship between the data length and the collection time length, determine the collection time length corresponding to the data length, and obtain the first sensor data satisfying the still time period threshold when the collection time length satisfies the static time period threshold.

可选地,电子设备可以预先设置数据长度和采集时长之间的关系,根据该关系确定数据长度对应的采集时长;若采集时长小于或等于静止时间段阈值,即不满足静止时间段阈值,则继续执行获取当前时刻对应的先入先出队列中的数据长度的步骤;若采集时长大于静止时间段阈值,即满足静止时间段阈值,则获取满足静止时间段阈值的第一传感器数据。Optionally, the electronic device can preset the relationship between the data length and the collection time length, and determine the collection time length corresponding to the data length according to the relationship; if the collection time length is less than or equal to the static time period threshold, that is, the static time period threshold Continue to perform the step of obtaining the data length in the FIFO queue corresponding to the current moment; if the collection duration is greater than the static time period threshold, that is, the static time period threshold is satisfied, then the first sensor data that meets the static time period threshold is obtained.

示例性的,静止时间段阈值为2s(秒),电子设备确定出先入先出队列中的数据长度对应的采集时长为1.5s,则继续获取当前时刻对应的先入先出队列中的数据长度;当电子设备确定出先入先出队列中的数据长度对应的采集时长为2.2s,满足静止时间段阈值,则获取满足静止时间段阈值的第一传感器数据,也即获取2s内的第一传感器数据。Exemplarily, the static time period threshold is 2s (seconds), and the electronic device determines that the collection duration corresponding to the data length in the FIFO queue is 1.5s, then continues to obtain the data length in the FIFO queue corresponding to the current moment; When the electronic device determines that the collection duration corresponding to the length of the data in the FIFO queue is 2.2s, which meets the static time period threshold, the first sensor data that meets the static time period threshold is obtained, that is, the first sensor data within 2s is obtained. .

步骤406,基于第一传感器数据,确定电子设备的目标运动状态。Step 406 , based on the first sensor data, determine the target motion state of the electronic device.

步骤408,根据目标运动状态,确定目标校准方式;其中,目标校准方式包括第一校准方式或第二校准方式,第一校准方式的目标校准参数是基于第一传感器数据确定的,第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的。Step 408: Determine a target calibration method according to the target motion state; wherein, the target calibration method includes a first calibration method or a second calibration method, the target calibration parameters of the first calibration method are determined based on the first sensor data, and the second calibration method The target calibration parameters are determined based on historical stationary sensor data.

步骤410,基于目标校准方式的目标校准参数,对电子设备实时采集的第二传感器数据进行校准。Step 410 , calibrate the second sensor data collected in real time by the electronic device based on the target calibration parameters of the target calibration method.

在本实施例中,电子设备获取当前时刻对应的先入先出队列中的数据长度,则根据数据长度和采集时长之间的关系,可以准确地确定数据长度对应的采集时长,从而在采集时长满足静止时间段阈值的情况下,获取满足静止时间段阈值的第一传感器数据,可以准确地获取到足够数据量的第一传感器数据,更准确地确定出电子设备的目标运动状态。In this embodiment, the electronic device acquires the data length in the FIFO queue corresponding to the current moment, then according to the relationship between the data length and the collection time length, the collection time length corresponding to the data length can be accurately determined, so that the collection time length satisfies the In the case of the static time period threshold, acquiring the first sensor data satisfying the static time period threshold can accurately acquire the first sensor data with sufficient data volume and more accurately determine the target motion state of the electronic device.

在一些可选的实施例中,先入先出队列具体可以是RingBuffer队列。如图5所示,电子设备执行步骤502,对RingBuffer队列进行初始化,得到初始化后的RingBuffer队列。惯性测量单元504为目标传感器,将实时采集的第一传感器数据存储至初始化后的RingBuffer队列,电子设备执行步骤506,实时检测初始化后的RingBuffer队列是否队满;若队满,则执行步骤508;若没有队满,则执行步骤512。In some optional embodiments, the FIFO queue may specifically be a RingBuffer queue. As shown in FIG. 5 , the electronic device performs step 502 to initialize the RingBuffer queue to obtain the initialized RingBuffer queue. The inertial measurement unit 504 is a target sensor, and stores the first sensor data collected in real time in the initialized RingBuffer queue, and the electronic device performs step 506 to detect in real time whether the initialized RingBuffer queue is full; if the queue is full, then perform step 508; If the queue is not full, step 512 is executed.

步骤508,电子设备调用出队函数判断该初始化后的RingBuffer队列是否队空,若没有队空,则执行步骤510,初始化后的RingBuffer队列中的第一传感器数据出队。在判断出初始化后的RingBuffer队列队满后,再调用出队函数再次判断初始化后的RingBuffer队列是否队空,以保证出队操作时的正确性。In step 508, the electronic device calls the dequeue function to determine whether the initialized RingBuffer queue is empty. If the queue is not empty, step 510 is executed to dequeue the first sensor data in the initialized RingBuffer queue. After judging that the initialized RingBuffer queue is full, call the dequeue function again to determine whether the initialized RingBuffer queue is empty, so as to ensure the correctness of the dequeuing operation.

步骤512,实时采集的第一传感器数据入队。Step 512, the first sensor data collected in real time is queued.

步骤514,取队首。Step 514, take the team leader.

步骤516,求长度。Step 516, find the length.

其中,步骤502具体包括:设置待初始化的RingBuffer队列的预设数据长度,基于该预设数据长度分配内存空间,再设置待初始化的RingBuffer队列的头指针和尾指针。Wherein, step 502 specifically includes: setting a preset data length of the RingBuffer queue to be initialized, allocating memory space based on the preset data length, and then setting the head pointer and tail pointer of the RingBuffer queue to be initialized.

其中,该预设数据长度大于静止时间段阈值内所采集的数据长度。示例性的,假设惯性测量单元504以1000Hz(1000个数据/1秒)的频率实时采集第一传感器数据,并将该实时采集的第一传感器数据存入RingBuffer队列,而静止时间段阈值为2s,那么,用于确定目标运动状态所需的第一传感器数据的长度为连续2s内采集的数据,也即时间*频率2*1000=2000个第一传感器数据,因此,待初始化的RingBuffer队列的预设数据长度大于2000。进一步地,预设数据长度可以是待初始化的RingBuffer队列的最大数据存储长度,可以存储更多的数据。Wherein, the preset data length is greater than the data length collected within the static time period threshold. Exemplarily, it is assumed that the inertial measurement unit 504 collects the first sensor data in real time at a frequency of 1000 Hz (1000 data/1 second), and stores the first sensor data collected in real time in the RingBuffer queue, and the static time period threshold is 2s. , then, the length of the first sensor data required to determine the motion state of the target is the data collected in consecutive 2s, that is, time * frequency 2 * 1000 = 2000 pieces of first sensor data. Therefore, the length of the RingBuffer queue to be initialized The preset data length is greater than 2000. Further, the preset data length may be the maximum data storage length of the RingBuffer queue to be initialized, and more data may be stored.

基于该预设数据长度分配内存空间,可以分配预设数据长度的一维数组。该一维数组是连续内存,可以扩展链式存储。进一步地,电子设备调用内存分配系统函数,分配预设数据长度的存储空间内存池,后续都在该存储空间内存池中进行处理,避免算法内存泄露。The memory space is allocated based on the preset data length, and a one-dimensional array of the preset data length can be allocated. This one-dimensional array is contiguous memory and can be extended chained storage. Further, the electronic device calls the memory allocation system function to allocate a storage space memory pool with a preset data length, and subsequent processing is performed in the storage space memory pool to avoid algorithm memory leakage.

设置待初始化的RingBuffer队列的头指针和尾指针,包括:电子设备将头指针和尾指针置0,即头指针front=0,尾指针rear=0,此时表示队列为空,即队空,如图6所示,头指针front=0,尾指针rear=0,表示队列为空。Set the head pointer and tail pointer of the RingBuffer queue to be initialized, including: the electronic device sets the head pointer and tail pointer to 0, that is, the head pointer front=0, and the tail pointer rear=0, which means that the queue is empty, that is, the queue is empty, As shown in FIG. 6 , the head pointer front=0 and the tail pointer rear=0, indicating that the queue is empty.

其中,步骤506可以包括:若尾指针后移一位等于头指针,则表示队满:(rear+1)%Maxsize==front;若尾指针后移一位不等于头指针,则没有队满,如图7所示,显示了队满。Wherein, step 506 may include: if the tail pointer is moved backward by one position and equal to the head pointer, it means the team is full: (rear+1)% Maxsize==front; if the tail pointer is moved backward by one position and is not equal to the head pointer, the team is not full, such as Figure 7 shows that the team is full.

若队满,则需要进行出队操作;若没有队满,则可以将实时采集的第一传感器数据进行入队操作。If the queue is full, a dequeue operation is required; if the queue is not full, the first sensor data collected in real time can be entered into the queue.

其中,步骤508可以包括:若尾指针等于头指针,即尾指针和头指针均指向同一个位置则表示队空:rear=front,则不可进行出队操作;若尾指针不等于头指针,则表示没有队空,进行出队操作。Wherein, step 508 may include: if the tail pointer is equal to the head pointer, that is, the tail pointer and the head pointer both point to the same position, it means that the queue is empty: rear=front, then the dequeue operation cannot be performed; if the tail pointer is not equal to the head pointer, it means that there is no queue The queue is empty, and the dequeue operation is performed.

步骤510的出队操作可以包括:将初始化后的RingBuffer队列的头指针front指向的队首存储的第一传感器数据出队:先记录队首值用于返回:last=RingBuffer[front],然后将头指针front后移一位:front=(front+1)%Maxsize。出队操作是即将出队的第一传感器数据丢弃。在出队操作后,再将新的第一传感器进行入队操作。The dequeue operation in step 510 may include: dequeue the first sensor data stored at the head of the team pointed to by the head pointer front of the initialized RingBuffer queue: first record the value of the head of the team for returning: last=RingBuffer[front], and then The head pointer front is moved back one bit: front=(front+1)%Maxsize. The dequeue operation is to discard the first sensor data to be dequeued. After the dequeuing operation, the new first sensor is then subjected to the enqueuing operation.

步骤512的入队操作可以包括:将实时采集得到的新的第一传感器数据放入尾指针rear指向的队尾:RingBuffer[rear]=data,并将尾指针rear后移一位:rear=(rear+1)%Maxsize。The queue entry operation in step 512 may include: putting the new first sensor data collected in real time into the queue tail pointed to by the tail pointer rear: RingBuffer[rear]=data, and moving the rear pointer rear by one bit: rear=( rear+1)%Maxsize.

其中,步骤514可以包括:获取初始化后的RingBuffer队列的头指针front指向的队首存储的第一传感器数据,以进行赋值:data=RingBuffer[front]。Wherein, step 514 may include: acquiring the first sensor data stored at the head of the queue pointed to by the head pointer front of the initialized RingBuffer queue, to perform assignment: data=RingBuffer[front].

其中,步骤516可以包括:计算初始化后的RingBuffer队列中存储的第一传感器数据的数据长度,用于循环队列操作:(rear-front+Maxsize)%Maxsize。Wherein, step 516 may include: calculating the data length of the first sensor data stored in the initialized RingBuffer queue for circular queue operation: (rear-front+Maxsize)%Maxsize.

在一个实施例中,根据第一传感器数据确定电子设备的目标运动状态,包括:根据第一传感器数据,确定第一传感器数据对应的运动数据;基于运动数据和第一状态判别条件,确定电子设备的目标运动状态。In one embodiment, determining the target motion state of the electronic device according to the first sensor data includes: determining motion data corresponding to the first sensor data according to the first sensor data; determining the electronic device based on the motion data and the first state discrimination condition target motion state.

运动数据是采用数学方法计算出的反映电子设备运动的数据。可以理解的是,运动数据越大,表示电子设备运动越剧烈。电子设备的运动包括移动和抖动中的至少一种。例如,运动数据可以包括均值、方差、标准差、中位数和均值差异值等其中至少一种。Motion data is data that reflects the motion of electronic equipment calculated by mathematical methods. It can be understood that the larger the motion data, the more vigorous the motion of the electronic device. The motion of the electronic device includes at least one of movement and shaking. For example, the motion data may include at least one of mean, variance, standard deviation, median, and mean difference.

示例性的,电子设备将各个第一传感器数据进行计算,得到第一传感器数据对应的均值

Figure BDA0003671952870000081
其中,μ是均值,N是满足静止时间段阈值的第一传感器的总数,Xi是第i个第一传感数据。Exemplarily, the electronic device calculates each first sensor data to obtain an average value corresponding to the first sensor data.
Figure BDA0003671952870000081
Among them, μ is the mean value, N is the total number of first sensors that satisfy the static time period threshold, and X i is the i-th first sensing data.

示例性的,电子设备将各个第一传感器数据进行计算,得到第一传感器数据对应的方差

Figure BDA0003671952870000082
Figure BDA0003671952870000083
其中,σ2是方差,μ是均值,N是满足静止时间段阈值的第一传感器的总数,Xi是第i个第一传感数据。Exemplarily, the electronic device calculates each first sensor data to obtain the variance corresponding to the first sensor data.
Figure BDA0003671952870000082
Figure BDA0003671952870000083
Among them, σ 2 is the variance, μ is the mean value, N is the total number of first sensors that satisfy the static time period threshold, and X i is the i-th first sensing data.

可选地,运动数据为均值,均值的确定方式,包括:获取上一轮次满足静止时间段阈值的各个第一传感器数据,以及本轮次待计算均值的各个第一传感器数据;基于上一轮次满足静止时间段阈值的各个第一传感器数据,以及本轮次待计算均值的各个第一传感器数据,确定出本轮次相对于上一轮次新进的第一传感器数据和退出的第一传感器数据;基于上一轮次的均值、新进的第一传感器数据和退出的第一传感器数据,确定本轮次满足静止时间段阈值的各个第一传感器数据的均值。Optionally, the motion data is an average value, and the method for determining the average value includes: acquiring each first sensor data that satisfies the static time period threshold in the previous round, and each first sensor data for which the average value is to be calculated in this round; The first sensor data of each round meeting the threshold of the stationary time period, and the first sensor data of the average value to be calculated in this round, determine the new first sensor data and the exited first sensor data of this round relative to the previous round. One sensor data; based on the mean value of the previous round, the newly entered first sensor data, and the exited first sensor data, determine the mean value of each first sensor data that satisfies the static time period threshold in the current round.

可以理解的是,电子设备通过实时采集第一传感器数据,以及实时根据第一传感器数据确定出运动数据,那么在相邻轮次所获取的第一传感器数据存在重叠的数据,则可以基于相邻轮次获得的各个第一传感器数据,确定出本轮次中新进的第一传感器数据,以及退出的第一传感器数据;将上一轮次的均值乘以上一轮次第一传感器数据的总数,加上新进的第一传感器数据并减去退出的第一传感器,再将得到的数值除以本轮次第一传感器数据的总数,可以得到本轮次满足静止时间段阈值的各个第一传感器数据的均值。It can be understood that the electronic device collects the first sensor data in real time and determines the motion data according to the first sensor data in real time, so that there is overlapping data in the first sensor data acquired in adjacent rounds. For each first sensor data obtained in a round, determine the new first sensor data in this round and the first sensor data that exits; multiply the average value of the previous round by the total number of first sensor data in the previous round , add the newly entered first sensor data and subtract the exited first sensor, and then divide the obtained value by the total number of first sensor data in this round to obtain each first sensor that meets the static time period threshold in this round. The mean value of the sensor data.

示例性的,上一轮次满足静止时间段阈值的各个第一传感器数据为【1,2,3】,上一轮次的均值x0=(1+2+3)/3,本轮次待计算均值的各个第一传感器数据为【4,2,3】,则本轮次新进的第一传感器数据为【4】,退出的第一传感器数据为【1】,本轮次满足静止时间段阈值的各个第一传感器的均值x1=(x0*3-1+4)/3。Exemplarily, each first sensor data that satisfies the static time period threshold in the previous round is [1, 2, 3], the mean value of the previous round x0=(1+2+3)/3, and the current round is to be The first sensor data for calculating the mean value is [4, 2, 3], then the new first sensor data for this round is [4], and the first sensor data for exit is [1], this round satisfies the static time The mean value of each first sensor of the segment threshold value x1=(x0*3-1+4)/3.

采用上述的均值计算方式,可以在大规模数据集中得到高效优化,快速确定大规模数据集的均值。Using the above-mentioned mean value calculation method, efficient optimization can be obtained in large-scale data sets, and the mean value of large-scale data sets can be quickly determined.

第一状态判别条件是用于第一次判断出电子设备的运动状态的条件。第一状态判别条件可以包括运动条件和静止时间段条件中的至少一种。运动条件可以包括运动阈值,还可以包括运动范围等,不限于此。静止时间段条件可以包括静止时间段阈值,还可以包括静止时间段的时刻、静止时间段的时间范围等,不限于此。运动阈值可以根据需要进行设置,也可以在实际测试过程中进行调整。静止时间段阈值可以根据需要进行设置,也可以在实际测试过程中进行调整。The first state determination condition is a condition for determining the motion state of the electronic device for the first time. The first state discrimination condition may include at least one of a motion condition and a stationary period condition. The motion condition may include a motion threshold, and may also include a motion range, etc., but is not limited thereto. The still time period condition may include the still time period threshold, and may also include the time of the still time period, the time range of the still time period, etc., but is not limited thereto. The motion threshold can be set as needed or adjusted during the actual test. The static time period threshold can be set as required, and can also be adjusted during the actual test.

可选地,电子设备根据第一传感器数据,确定第一传感器数据对应的运动数据,将该运动数据与第一状态判别条件进行比较,得到比较结果,并基于比较结果确定电子设备的目标运动状态。Optionally, the electronic device determines motion data corresponding to the first sensor data according to the first sensor data, compares the motion data with the first state discrimination condition, obtains a comparison result, and determines the target motion state of the electronic device based on the comparison result. .

示例性的,第一状态判别条件用于判断电子设备的运动状态是否为静止状态;电子设备根据第一传感器数据,确定第一传感器数据对应的运动数据为均值A,将该均值A与第一状态判别条件进行比较,得到比较结果;若比较结果为均值A满足第一状态判别条件,则可以确定电子设备的目标状态为静止状态;若比较结果为均值A不满足第一状态判别条件,则可以确定电子设备的目标状态为非静止状态。Exemplarily, the first state discrimination condition is used to determine whether the motion state of the electronic device is a static state; the electronic device determines, according to the first sensor data, that the motion data corresponding to the first sensor data is the average value A, and the average value A is the same as the first value A. Compare the state discriminating conditions to obtain a comparison result; if the comparison result is that the mean value A satisfies the first state discriminating condition, it can be determined that the target state of the electronic device is a static state; if the comparison result is that the mean value A does not satisfy the first state discriminating condition, then It can be determined that the target state of the electronic device is a non-stationary state.

在本实施例中,电子设备根据第一传感器数据,确定该第一传感器数据对应的运动数据,则基于该运动数据和第一状态判别条件,可以准确地确定电子设备的目标运动状态。In this embodiment, the electronic device determines motion data corresponding to the first sensor data according to the first sensor data, and based on the motion data and the first state discrimination condition, the target motion state of the electronic device can be accurately determined.

在一些可能的实施例中,第一状态判别条件包括运动阈值;基于运动数据和第一状态判别条件,确定电子设备的目标运动状态,包括:若运动数据小于或等于运动阈值,则确定电子设备的目标运动状态为静止状态;若运动数据大于运动阈值,则调整第一状态判别条件至第二状态判别条件,并基于第二状态判别条件,确定电子设备的目标运动状态。In some possible embodiments, the first state discriminating condition includes a motion threshold; determining the target motion state of the electronic device based on the motion data and the first state discriminating condition, including: if the motion data is less than or equal to the motion threshold, determining the electronic device If the motion data is greater than the motion threshold, adjust the first state judgment condition to the second state judgment condition, and determine the target motion state of the electronic device based on the second state judgment condition.

运动阈值的大小可以根据需要进行设置。在本实施例中,运动数据可以包括均值、方差和标准差中的至少一种。The size of the motion threshold can be set as required. In this embodiment, the motion data may include at least one of mean, variance, and standard deviation.

第二状态判别条件是用于最终判断出电子设备的运动状态的条件。The second state determination condition is a condition for finally determining the motion state of the electronic device.

若运动数据小于或等于运动阈值,表示第一传感器数据均较小,则确定电子设备的目标运动状态为静止状态;若运动数据大于运动阈值,第一传感器数据均较大或者第一传感器数据中存在噪声数据,因此需要调整第一状态判别条件至第二状态判别条件,并基于第二状态判别条件,再次确定电子设备的目标运动状态。If the motion data is less than or equal to the motion threshold, it means that the first sensor data is relatively small, and the target motion state of the electronic device is determined to be a static state; if the motion data is greater than the motion threshold, the first sensor data is relatively large or the first sensor data There is noise data, so it is necessary to adjust the first state determination condition to the second state determination condition, and based on the second state determination condition, determine the target motion state of the electronic device again.

在本实施例中,若运动数据小于或等于运动阈值,则确定电子设备的目标运动状态为静止状态;若运动数据大于运动阈值,第一传感器数据可能均较大也可能存在噪声数据,则调整第一状态判别条件至第二状态判别条件,并基于第二状态判别条件,可以更准确地确定出电子设备的目标运动状态。In this embodiment, if the motion data is less than or equal to the motion threshold, it is determined that the target motion state of the electronic device is a static state; if the motion data is greater than the motion threshold, the first sensor data may be relatively large or there may be noise data, then adjust the The first state judging condition to the second state judging condition, and based on the second state judging condition, the target motion state of the electronic device can be more accurately determined.

在一些可能的实施例中,第一传感器数据为惯性测量单元采集的数据,惯性测量单元包括至少1种传感器,每种传感器包括至少2轴数据;运动数据包括多个第一统计数据,每个轴采集的数据对应至少1个第一统计数据,每个第一统计数据对应1个运动阈值;若运动数据小于或等于运动阈值,则确定电子设备的目标运动状态为静止状态,包括:若各个第一统计数据均小于或等于对应的运动阈值,则确定电子设备的目标运动状态为静止状态。In some possible embodiments, the first sensor data is data collected by an inertial measurement unit, the inertial measurement unit includes at least one type of sensor, each sensor includes at least 2-axis data; the motion data includes a plurality of first statistical data, each The data collected by the axis corresponds to at least one first statistical data, and each first statistical data corresponds to one motion threshold; if the motion data is less than or equal to the motion threshold, it is determined that the target motion state of the electronic device is a static state, including: if each If the first statistical data are all less than or equal to the corresponding motion threshold, it is determined that the target motion state of the electronic device is a stationary state.

惯性测量单元可以包括陀螺仪、加速度计和磁力计等其中至少一种传感器,每种传感器包括X、Y和Z轴中的至少2轴数据。The inertial measurement unit may include at least one of sensors such as a gyroscope, an accelerometer, and a magnetometer, each of which includes data on at least 2 of the X, Y, and Z axes.

若各个第一统计数据均小于或等于对应的运动阈值,表示各个第一传感器数据均较小,则可以确定电子设备的目标运动状态为静止状态。If each of the first statistical data is less than or equal to the corresponding motion threshold, indicating that each of the first sensor data is small, it can be determined that the target motion state of the electronic device is a static state.

示例性的,惯性测量单元包括陀螺仪、加速度计和磁力计,陀螺仪、加速度计和磁力计均包括X、Y和Z轴数据,每个轴采集的数据对应得到均值和方差,每个均值对应一个均值阈值,每个方差对应一个方差阈值;可知,惯性测量单元可以得到18个维度的运动数据,对应18个维度的运动阈值。Exemplarily, the inertial measurement unit includes a gyroscope, an accelerometer, and a magnetometer, and the gyroscope, accelerometer, and magnetometer all include X, Y, and Z axis data, and the data collected in each axis corresponds to a mean value and a variance, and each mean value is obtained. Corresponding to a mean threshold, each variance corresponds to a variance threshold; it can be seen that the inertial measurement unit can obtain motion data of 18 dimensions, corresponding to the motion thresholds of 18 dimensions.

电子设备可以提供9个队列,用于存储9个维度的原始数据;其中,陀螺仪、加速度计和磁力计每种传感器均包括X、Y和Z轴3个维度,则3个传感器共有9个维度的原始数据,可以分别存储在9个队列中;当需要确定电子设备的目标运动状态时,针对每个维度的原始数据,计算出该维度的原始数据的均值和方差,则9个维度的原始数据可以计算出18个维度的运动数据,赌赢有18个维度的运动阈值。The electronic device can provide 9 queues for storing raw data in 9 dimensions; among them, each sensor of the gyroscope, accelerometer and magnetometer includes 3 dimensions of X, Y and Z axes, so the 3 sensors have a total of 9 The raw data of the dimension can be stored in 9 queues respectively; when it is necessary to determine the target motion state of the electronic device, for the raw data of each dimension, calculate the mean and variance of the raw data of the dimension, then the 9 dimensions The raw data can calculate the motion data of 18 dimensions, and there are 18 dimensions of motion thresholds for gambling.

若陀螺仪、加速度计和磁力计中每个轴的均值均小于或等于对应的均值阈值,且陀螺仪、加速度计和磁力计中每个轴的方差均小于或等于对应的均值阈值,则确定电子设备的目标运动状态为静止状态。If the mean of each axis in the gyroscope, accelerometer, and magnetometer is less than or equal to the corresponding mean threshold, and the variance of each axis in the gyroscope, accelerometer, and magnetometer is less than or equal to the corresponding mean threshold, then determine The target motion state of the electronic device is a stationary state.

可以理解的是,单一维度的数据判断电子设备的运动状态可能会存在误差,而本实施例采用多个维度的运动数据进行判断,可以更准确地确定电子设备的目标运动状态。It can be understood that there may be errors in judging the motion state of the electronic device with single-dimensional data, and this embodiment uses motion data of multiple dimensions to determine the target motion state of the electronic device more accurately.

在一些示例性实施例中,如图8所示,提供了另一种传感器数据的校准方法,以该方法应用于图1中的电子设备为例进行说明,该传感器数据的校准方法包括以下步骤:In some exemplary embodiments, as shown in FIG. 8 , another method for calibrating sensor data is provided. Taking the method applied to the electronic device in FIG. 1 as an example, the method for calibrating sensor data includes the following steps. :

步骤802,根据预设的静止时间段阈值,从缓存的实时传感器数据中获取满足静止时间段阈值的第一传感器数据;第一传感器数据为惯性测量单元采集的数据,惯性测量单元包括至少1种传感器,每种传感器包括至少2轴数据。Step 802, according to the preset static time period threshold, obtain the first sensor data satisfying the static time period threshold from the cached real-time sensor data; the first sensor data is the data collected by the inertial measurement unit, and the inertial measurement unit includes at least one type Sensors, each sensor includes at least 2 axes of data.

步骤804,根据第一传感器数据,确定第一传感器数据对应的运动数据;运动数据包括多个第一统计数据,每个轴采集的数据对应至少1个第一统计数据;第一状态判别条件包括运动阈值,每个第一统计数据对应1个运动阈值。Step 804: Determine motion data corresponding to the first sensor data according to the first sensor data; the motion data includes a plurality of first statistical data, and the data collected by each axis corresponds to at least one first statistical data; the first state discrimination conditions include Motion threshold, each first statistic corresponds to one motion threshold.

步骤806,若各个第一统计数据均小于或等于对应的运动阈值,则确定电子设备的目标运动状态为静止状态。Step 806: If each of the first statistical data is less than or equal to the corresponding motion threshold, determine that the target motion state of the electronic device is a stationary state.

步骤808,若各个第一统计数据中,存在大于对应的运动阈值的第二统计数据,则确定第二统计数据的数量。Step 808: If there is second statistical data greater than the corresponding motion threshold in each of the first statistical data, determine the quantity of the second statistical data.

若各个第一统计数据中,存在大于对应的运动阈值的第二统计数据,则记录该大于对应运动阈值的第二统计数据,并确定第二统计数量的数量。If there is second statistical data greater than the corresponding motion threshold in each of the first statistical data, the second statistical data greater than the corresponding motion threshold is recorded, and the quantity of the second statistical quantity is determined.

步骤810,若数量小于预设的数量阈值,则调整第二统计数据对应的运动阈值,并基于调整后的运动阈值以及第一判别条件中除调整后的运动阈值之外的条件,得到第二状态判别条件。Step 810, if the quantity is less than the preset quantity threshold, then adjust the motion threshold corresponding to the second statistical data, and obtain the second motion threshold based on the adjusted motion threshold and conditions other than the adjusted motion threshold in the first discriminating condition. State discriminant condition.

数量阈值的大小可以根据需要进行设置。例如,数量阈值可以是1个、或者2个等。The size of the quantity threshold can be set as required. For example, the number threshold may be one, or two, or the like.

可以理解的是,若各个第一统计数据中,存在大于对应的运动阈值的第二统计数据,并且该第二统计数据的数量小于预设的数量阈值,表示不满足第一状态判别条件的第二统计数据较少,可能存在误判的情况,因此调整第二统计数据对应的运动阈值,并基于调整后的运动阈值以及第一判别条件中除调整后的运动阈值之外的条件,得到第二状态判别条件,重新基于第二状态判别条件判断电子设备的运动状态,可以避免误判的情况,更准确地得出电子设备的运动状态。It can be understood that, if there is second statistical data greater than the corresponding motion threshold in each of the first statistical data, and the number of the second statistical data is less than the preset number threshold, it indicates that the first state discrimination condition is not satisfied. The second statistical data is less, and there may be misjudgments. Therefore, the motion threshold corresponding to the second statistical data is adjusted, and based on the adjusted motion threshold and the conditions other than the adjusted motion threshold in the first judgment condition, the first judgment is obtained. The second state discriminating condition is to judge the motion state of the electronic device based on the second state discriminating condition again, which can avoid misjudgment and obtain the motion state of the electronic device more accurately.

可选地,调整第二统计数据对应的运动阈值,包括:增大第二统计数据对应的运动阈值。Optionally, adjusting the motion threshold corresponding to the second statistical data includes: increasing the motion threshold corresponding to the second statistical data.

电子设备可以按照预设比例增大第二统计数据对应的运动阈值。预设比例如25%、50%或100%等,预设比例不超过100%。例如,第二统计数据对应的运动阈值为均值阈值,该均值阈值为0.1,若按照预设比例25%增大对应的均值阈值,得到增大后的均值为0.125;若按照预设比例50%增大对应的均值阈值,得到增大后的均值为0.15;若按照预设比例100%增大对应的均值阈值,得到增大后的均值为0.2。The electronic device may increase the motion threshold corresponding to the second statistical data according to a preset ratio. The preset ratio is 25%, 50% or 100%, etc. The preset ratio does not exceed 100%. For example, the motion threshold corresponding to the second statistical data is the mean threshold, and the mean threshold is 0.1. If the corresponding mean threshold is increased according to the preset ratio of 25%, the increased mean value is 0.125; if the preset ratio is 50% By increasing the corresponding mean threshold value, the increased mean value is 0.15; if the corresponding mean value threshold is increased according to the preset ratio of 100%, the increased mean value is 0.2.

步骤812,基于第二状态判别条件,确定电子设备的目标运动状态。Step 812: Determine the target motion state of the electronic device based on the second state discrimination condition.

步骤814,根据目标运动状态,确定目标校准方式;其中,目标校准方式包括第一校准方式或第二校准方式,第一校准方式的目标校准参数是基于第一传感器数据确定的,第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的。Step 814: Determine a target calibration method according to the target motion state; wherein, the target calibration method includes a first calibration method or a second calibration method, the target calibration parameters of the first calibration method are determined based on the first sensor data, and the second calibration method The target calibration parameters are determined based on historical stationary sensor data.

步骤816,基于目标校准方式的目标校准参数,对电子设备实时采集的第二传感器数据进行校准。Step 816 , calibrate the second sensor data collected in real time by the electronic device based on the target calibration parameters of the target calibration method.

在本实施例中,可以理解的是,若各个第一统计数据中,存在大于对应的运动阈值的第二统计数据,且第二统计数据的数量小于预设的数量阈值,则该第二统计数据可能存在噪声数据而导致误判,因此调整第二统计数据对应的运动阈值,得到新的运动阈值,进而得到第二状态判别条件,基于该状态判别条件可以更准确地确定电子设备的运动状态。进一步地,增大第二统计数据对应的运动阈值,可以提高算法的有效性。In this embodiment, it can be understood that if each of the first statistical data contains second statistical data that is greater than the corresponding motion threshold, and the quantity of the second statistical data is less than the preset quantity threshold, then the second statistical data is greater than the corresponding motion threshold. There may be noise data in the data, which may lead to misjudgment. Therefore, adjust the motion threshold corresponding to the second statistical data to obtain a new motion threshold, and then obtain the second state judgment condition. Based on this state judgment condition, the motion state of the electronic device can be more accurately determined. . Further, increasing the motion threshold corresponding to the second statistical data can improve the effectiveness of the algorithm.

在一些示例性实施例中,若各个第二统计数据均小于或等于对应的调整后的运动阈值,则确定电子设备的目标运动状态为静止状态;若各个第二统计数据存在大于对应的调整后的运动阈值,则确定电子设备的目标运动状态为非静止状态。In some exemplary embodiments, if each second statistical data is less than or equal to the corresponding adjusted motion threshold, it is determined that the target motion state of the electronic device is a static state; if each second statistical data is greater than the corresponding adjusted motion threshold If the motion threshold is set, the target motion state of the electronic device is determined to be a non-stationary state.

若各个第二统计数据均小于或等于对应的调整后的运动阈值,表示用于确定第二统计数据的各个第一传感器数据中存在噪声数据,使得确定出的第二统计数据偏差较大而导致误判,因此确定电子设备的目标运动状态为静止状态。If each of the second statistical data is less than or equal to the corresponding adjusted motion threshold, it means that there is noise data in each of the first sensor data used to determine the second statistical data, so that the determined second statistical data has a large deviation, resulting in Misjudgment, so it is determined that the target motion state of the electronic device is a static state.

若各个第二统计数据存在大于对应的调整后的运动阈值,表示仍存在第二统计数据不能满足调整后的运动阈值,第二统计数据对应的第一传感器数据不属于噪声数据,则确定电子设备的目标运动状态为非静止状态。If each second statistical data is greater than the corresponding adjusted motion threshold, it means that there is still second statistical data that cannot meet the adjusted motion threshold, and the first sensor data corresponding to the second statistical data does not belong to noise data, then determine the electronic device The target motion state is a non-stationary state.

在本实施例中,在调整第二统计数据对应的运动阈值后,若各个第二统计数据均小于或等于对应的调整后的运动阈值,表示用于确定第二统计数据的第一传感器数据中存在噪声数据,使得确定出的第二统计数据偏差较大而导致误判,则确定电子设备的目标运动状态为静止状态;若各个第二统计数据存在大于对应的调整后的运动阈值,表示仍存在第二统计数据不能满足调整后的运动阈值,则确定电子设备的目标运动状态为非静止状态。电子设备将第二统计数据重新与调整后的运动阈值进行比较,可以排除噪声数据的干扰,更准确地确定出电子设备的运动状态。In this embodiment, after adjusting the motion threshold corresponding to the second statistical data, if each second statistical data is less than or equal to the corresponding adjusted motion threshold, it means that the first sensor data used to determine the second statistical data is in the first sensor data. There is noise data, so that the determined second statistical data has a large deviation and causes misjudgment, then determine that the target motion state of the electronic device is a static state; if each second statistical data is greater than the corresponding adjusted motion threshold, it means that it is still If the second statistical data cannot satisfy the adjusted motion threshold, it is determined that the target motion state of the electronic device is a non-stationary state. The electronic device compares the second statistical data with the adjusted motion threshold again, which can eliminate the interference of the noise data and more accurately determine the motion state of the electronic device.

在一些示例性实施例中,如图9所示,提供了另一种传感器数据的校准方法,以该方法应用于图1中的电子设备为例进行说明,包括以下步骤:In some exemplary embodiments, as shown in FIG. 9 , another method for calibrating sensor data is provided. Taking the method applied to the electronic device in FIG. 1 as an example, the following steps are included:

步骤902,根据预设的静止时间段阈值,从缓存的实时传感器数据中获取满足静止时间段阈值的第一传感器数据;第一传感器数据为惯性测量单元采集的数据,惯性测量单元包括至少1种传感器,每种传感器包括至少2轴数据。Step 902, according to a preset static time period threshold, obtain first sensor data that satisfies the static time period threshold from the cached real-time sensor data; the first sensor data is data collected by an inertial measurement unit, and the inertial measurement unit includes at least one type Sensors, each sensor includes at least 2 axes of data.

步骤904,根据第一传感器数据,确定第一传感器数据对应的运动数据;运动数据包括多个第一统计数据,每个轴采集的数据对应至少1个第一统计数据;第一状态判别条件包括运动阈值和静止时间段阈值,每个第一统计数据对应1个运动阈值。Step 904: Determine motion data corresponding to the first sensor data according to the first sensor data; the motion data includes a plurality of first statistical data, and the data collected by each axis corresponds to at least one first statistical data; the first state discrimination conditions include The motion threshold and the still time period threshold, each first statistic corresponds to one motion threshold.

步骤906,若各个第一统计数据均小于或等于对应的运动阈值,则确定电子设备的目标运动状态为静止状态。Step 906, if each of the first statistical data is less than or equal to the corresponding motion threshold, determine that the target motion state of the electronic device is a stationary state.

步骤908,若各个第一统计数据中,存在大于对应的运动阈值的第二统计数据,则确定第二统计数据的数量。Step 908: If there is second statistical data greater than the corresponding motion threshold in each of the first statistical data, determine the number of the second statistical data.

步骤910,若数量小于预设的数量阈值,则调整第二统计数据对应的运动阈值。Step 910, if the quantity is less than a preset quantity threshold, adjust the motion threshold corresponding to the second statistical data.

步骤912,若基于调整后的运动阈值确定电子设备的运动状态为非静止状态,则调整静止时间段阈值。Step 912 , if it is determined based on the adjusted motion threshold that the motion state of the electronic device is a non-stationary state, adjust the stationary time period threshold.

可选地,电子设备基于第二统计数据和对应的调整后的运动阈值,确定电子设备的中间运动状态。其中,中间运动状态是调整第一状态判别条件后重新确定的运动状态。Optionally, the electronic device determines an intermediate motion state of the electronic device based on the second statistical data and the corresponding adjusted motion threshold. The intermediate motion state is a motion state that is re-determined after adjusting the first state discrimination condition.

若各个第二统计数据均小于或等于对应的调整后的运动阈值,则确定电子设备的中间运动状态为静止状态;若各个第二统计数据中,存在大于对应的调整后的运动阈值,则确定电子设备的中间运动状态为非静止状态。If each second statistical data is less than or equal to the corresponding adjusted motion threshold, it is determined that the intermediate motion state of the electronic device is a static state; if each second statistical data is greater than the corresponding adjusted motion threshold, then it is determined The intermediate motion state of the electronic device is a non-stationary state.

若中间运动状态为非静止状态,该电子设备可能静止状态持续时间较短,而导致满足静止时间段阈值的第一传感器数据中存在噪声数据,则调整静止时间段阈值。If the intermediate motion state is a non-stationary state, the electronic device may be stationary for a short duration, resulting in noise data in the first sensor data that meets the stationary time period threshold, and the stationary time period threshold is adjusted.

可选地,若中间运动状态为非静止状态,则减小静止时间段阈值。Optionally, if the intermediate motion state is a non-stationary state, the stationary time period threshold is decreased.

电子设备可以按照预设比例减小静止时间段阈值。预设比例如10%、20%或50%等,预设比例不超过50%。例如,静止时间段阈值为2s(秒),若按照预设比例10%减小静止时间段阈值,得到减小后的静止时间段阈值为1.8s;若按照预设比例20%减小静止时间段阈值,得到减小后的静止时间段阈值为1.6s;若按照预设比例50%减小静止时间段阈值,得到减小后的静止时间段阈值为1s。The electronic device may decrease the static time period threshold according to a preset ratio. The preset ratio is 10%, 20% or 50%, etc. The preset ratio does not exceed 50%. For example, if the static time period threshold is 2s (seconds), if the static time period threshold is reduced by 10% according to the preset ratio, the reduced static time period threshold is 1.8s; if the static time period is reduced by 20% according to the preset ratio segment threshold, the reduced static time segment threshold is 1.6s; if the static time segment threshold is reduced by a preset ratio of 50%, the reduced static time segment threshold is 1s.

步骤914,根据调整后的运动阈值、调整后的静止时间段阈值、以及第一状态判别条件中除调整后的运动阈值和静止时间段阈值之外的其他条件,得到第二状态判别条件。Step 914: Obtain the second state discrimination condition according to the adjusted motion threshold value, the adjusted stationary time period threshold value, and other conditions in the first state discrimination condition except the adjusted motion threshold value and the stationary time period threshold value.

第二状态判别条件包括调整后的运动阈值、调整后的静止时间段阈值、以及第一状态判别条件中的其他条件。The second state discriminating condition includes an adjusted motion threshold, an adjusted stationary time period threshold, and other conditions in the first state discriminating condition.

在另一些实施例中,若第一状态判别条件包括运动阈值和静止时间段阈值,则第二状态判别条件包括调整后的运动阈值和调整后的静止时间段阈值。In other embodiments, if the first state determination condition includes a motion threshold and a stationary period threshold, the second state determination condition includes an adjusted motion threshold and an adjusted stationary period threshold.

步骤916,基于第二状态判别条件,确定电子设备的目标运动状态。Step 916: Determine the target motion state of the electronic device based on the second state determination condition.

步骤918,根据目标运动状态,确定目标校准方式;其中,目标校准方式包括第一校准方式或第二校准方式,第一校准方式的目标校准参数是基于第一传感器数据确定的,第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的。Step 918: Determine a target calibration method according to the target motion state; wherein, the target calibration method includes a first calibration method or a second calibration method, the target calibration parameters of the first calibration method are determined based on the first sensor data, and the second calibration method The target calibration parameters are determined based on historical stationary sensor data.

步骤920,基于目标校准方式的目标校准参数,对电子设备实时采集的第二传感器数据进行校准。Step 920 , calibrate the second sensor data collected in real time by the electronic device based on the target calibration parameters of the target calibration method.

在本实施例中,电子设备基于调整后的运动阈值确定电子设备的运动状态为非静止状态,该电子设备可能静止状态持续时间较短,而导致满足静止时间段阈值的第一传感器数据中存在噪声数据,则从静止时间段阈值这一维度进行调整,根据调整后的运动阈值、调整后的静止时间段阈值、以及第一状态判别条件中除调整后的运动阈值和静止时间段阈值之外的其他条件,得到第二状态判别条件。那么,基于该第二状态判别条件,可以更准确地区分出第一传感器的噪声数据或者实际运动的数据,更准确地确定出电子设备的运动状态。进一步地,减小静止时间段阈值,重新基于第二状态判别条件确定电子设备的运动状态,可以提高算法的有效性。In this embodiment, the electronic device determines that the motion state of the electronic device is a non-stationary state based on the adjusted motion threshold, and the electronic device may be in a stationary state for a short duration, resulting in the existence of the first sensor data that satisfies the stationary time period threshold. Noise data, then adjust from the dimension of the static time period threshold, according to the adjusted motion threshold, the adjusted static time period threshold, and the first state discrimination condition except the adjusted motion threshold and static time period threshold. other conditions, the second state discriminant condition is obtained. Then, based on the second state judging condition, the noise data of the first sensor or the actual motion data can be more accurately distinguished, and the motion state of the electronic device can be more accurately determined. Further, reducing the static time period threshold and re-determining the motion state of the electronic device based on the second state discriminating condition can improve the effectiveness of the algorithm.

在一些示例性实施例中,基于第二状态判别条件,确定电子设备的目标运动状态,包括:从缓存的实时传感器数据中确定出满足调整后的静止时间段阈值的第一传感器数据,得到新的第一传感器数据,并基于新的第一传感器数据确定新的运动数据;若新的运动数据小于或等于调整后的运动阈值,则确定电子设备的目标运动状态为静止状态;若新的运动数据大于调整后的运动阈值,则确定电子设备的目标运动状态为非静止状态。In some exemplary embodiments, determining the target motion state of the electronic device based on the second state discriminating condition includes: determining, from the buffered real-time sensor data, first sensor data that satisfies the adjusted static time period threshold, and obtaining a new and determine new motion data based on the new first sensor data; if the new motion data is less than or equal to the adjusted motion threshold, then determine that the target motion state of the electronic device is a static state; if the new motion data is less than or equal to the adjusted motion threshold If the data is greater than the adjusted motion threshold, it is determined that the target motion state of the electronic device is a non-stationary state.

可以理解的是,电子设备调整静止时间段阈值,则原先获取的第一传感器数据不满足调整后的静止时间段阈值,需要重新从缓存的实时传感器数据中确定出满足调整后的静止时间段阈值的第一传感器数据,得到新的第一传感器是数据。It is understandable that if the electronic device adjusts the static time period threshold, the originally acquired first sensor data does not meet the adjusted static time period threshold, and needs to be re-determined from the cached real-time sensor data to satisfy the adjusted static time period threshold. of the first sensor data, get the new first sensor is data.

可选地,若调整静止时间段阈值为减小静止时间段阈值,则电子设备从第一传感器数据中确定满足调整后的静止时间段阈值的第一传感器数据。Optionally, if the adjustment of the static time period threshold is to decrease the static time period threshold, the electronic device determines from the first sensor data first sensor data that satisfies the adjusted static time period threshold.

在一些可能的实施方式中,电子设备可以从第一传感器数据中随机确定出满足调整后的静止时间段阈值的第一传感器数据。In some possible implementations, the electronic device may randomly determine, from the first sensor data, first sensor data that satisfies the adjusted static time period threshold.

在另一些可能的实施方式中,电子设备可以从第一传感器数据中确定满足调整后的静止时间段阈值,且最新的第一传感器数据。In other possible implementations, the electronic device may determine, from the first sensor data, the latest first sensor data that satisfies the adjusted static time period threshold.

在另一些可能的实施方式中,电子设备可以从第一传感器数据中确定出满足调整后的静止时间段阈值,且最旧的第一传感器数据。In other possible implementations, the electronic device may determine, from the first sensor data, the oldest first sensor data that satisfies the adjusted static time period threshold.

在其他实施方式中,电子设备还可以采用其他方式从第一传感器数据中确定出满足调整后的静止时间段阈值的第一传感器,在此不做限定。In other implementation manners, the electronic device may also determine, from the first sensor data, the first sensor that satisfies the adjusted static time period threshold in other manners, which is not limited herein.

若新的运动数据小于或等于调整后的运动阈值,则确定电子设备的目标运动状态为静止状态,该静止状态的持续时长较短。If the new motion data is less than or equal to the adjusted motion threshold, it is determined that the target motion state of the electronic device is a stationary state, and the duration of the stationary state is short.

若新的运动数据大于调整后的运动阈值,表示调整运动阈值和静止时间段阈值后,电子设备的运动仍较大,则确定电子设备的目标运动状态为非静止状态。If the new motion data is greater than the adjusted motion threshold, it means that the motion of the electronic device is still large after adjusting the motion threshold and the stationary time period threshold, and the target motion state of the electronic device is determined to be a non-stationary state.

在本实施例中,在调整静止时间段阈值和第二统计数据对应的运动阈值后,若新的运动数据小于或等于调整后的运动阈值,表示电子设备处于静止状态的持续时长较短,但是仍可以确定电子设备的目标运动状态为静止状态;若新的运动数据大于调整后的运动阈值,表示电子设备的运动仍较大,则确定电子设备的目标运动状态为非静止状态。电子设备调整运动阈值和静止时间段阈值,从多个维度上排除第一传感器数据可能存在的噪声而导致误判的可能性,从而更准确地确定出电子设备的运动状态。In this embodiment, after adjusting the stationary time period threshold and the motion threshold corresponding to the second statistical data, if the new motion data is less than or equal to the adjusted motion threshold, it means that the duration of the stationary state of the electronic device is short, but It can still be determined that the target motion state of the electronic device is a stationary state; if the new motion data is greater than the adjusted motion threshold, indicating that the motion of the electronic device is still large, the target motion state of the electronic device is determined to be a non-stationary state. The electronic device adjusts the motion threshold and the static time period threshold to exclude the possibility of misjudgment caused by noise that may exist in the first sensor data from multiple dimensions, so as to more accurately determine the motion state of the electronic device.

在一些示例性实施例中,如图10所示,提供了另一种传感器数据的校准方法,以该方法应用于图1中的电子设备为例进行说明,包括以下步骤:In some exemplary embodiments, as shown in FIG. 10 , another method for calibrating sensor data is provided. Taking the method applied to the electronic device in FIG. 1 as an example, the following steps are included:

步骤1002,根据预设的静止时间段阈值,从缓存的实时传感器数据中获取满足静止时间段阈值的第一传感器数据。Step 1002: Acquire first sensor data that satisfies the static time period threshold from the cached real-time sensor data according to the preset static time period threshold.

步骤1004,根据第一传感器数据,确定第一传感器数据对应的运动数据;第一状态判别条件包括运动阈值和静止时间段阈值。Step 1004: Determine motion data corresponding to the first sensor data according to the first sensor data; the first state discrimination condition includes a motion threshold and a stationary time period threshold.

步骤1006,若运动数据小于或等于运动阈值,则确定电子设备的目标运动状态为静止状态。Step 1006, if the motion data is less than or equal to the motion threshold, determine that the target motion state of the electronic device is a static state.

步骤1008,若运动数据大于运动阈值,则调整静止时间段阈值;根据调整后的静止时间段阈值、以及第一状态判别条件中除静止时间段阈值之外的其他条件,得到第二状态判别条件,并基于第二状态判别条件,确定电子设备的目标运动状态。Step 1008, if the motion data is greater than the motion threshold, adjust the static time period threshold; according to the adjusted static time period threshold and other conditions other than the static time period threshold in the first state discrimination condition, obtain the second state discrimination condition , and based on the second state discrimination condition, determine the target motion state of the electronic device.

若运动数据大于运动阈值,该电子设备可能静止状态持续时间较短,而导致满足静止时间段阈值的第一传感器数据中存在噪声数据,因此调整静止时间段阈值。If the motion data is greater than the motion threshold, the electronic device may be in a stationary state for a short duration, resulting in noise data in the first sensor data that satisfies the stationary time period threshold. Therefore, the stationary time period threshold is adjusted.

可选地,调整静止时间段阈值,包括:减小静止时间段阈值。Optionally, adjusting the static time period threshold includes: reducing the static time period threshold.

步骤1010,根据目标运动状态,确定目标校准方式;其中,目标校准方式包括第一校准方式或第二校准方式,第一校准方式的目标校准参数是基于第一传感器数据确定的,第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的。Step 1010: Determine a target calibration mode according to the target motion state; wherein, the target calibration mode includes a first calibration mode or a second calibration mode, the target calibration parameters of the first calibration mode are determined based on the first sensor data, and the second calibration mode The target calibration parameters are determined based on historical stationary sensor data.

步骤1012,基于目标校准方式的目标校准参数,对电子设备实时采集的第二传感器数据进行校准。Step 1012 , calibrate the second sensor data collected in real time by the electronic device based on the target calibration parameters of the target calibration method.

在本实施例中,若运动数据大于运动阈值,该电子设备可能静止状态持续时间较短,而导致满足静止时间段阈值的第一传感器数据中存在噪声数据,因此从静止时间段阈值这一维度进行调整,根据调整后的运动阈值以及第一状态判别条件中除调整后的静止时间段阈值之外的其他条件,得到第二状态判别条件。那么,基于该第二状态判别条件,可以从静止时间段的这一维度上更准确地更准确地确定出电子设备的运动状态。进一步地,减小静止时间段阈值,重新基于第二状态判别条件确定电子设备的运动状态,可以提高算法的有效性。In this embodiment, if the motion data is greater than the motion threshold, the electronic device may be in a stationary state for a short duration, resulting in noise data in the first sensor data that satisfies the stationary period threshold. Therefore, from the dimension of the stationary period threshold The adjustment is performed, and the second state determination condition is obtained according to the adjusted motion threshold and other conditions in the first state determination condition except the adjusted static time period threshold. Then, based on the second state judging condition, the motion state of the electronic device can be more accurately and accurately determined from this dimension of the stationary time period. Further, reducing the static time period threshold and re-determining the motion state of the electronic device based on the second state discriminating condition can improve the effectiveness of the algorithm.

在另一些实施例中,步骤1008包括:若运动数据大于运动阈值,则调整静止时间段阈值;从缓存的实时传感器数据中确定出满足调整后的静止时间段阈值的第一传感器数据,得到新的第一传感器数据,并基于新的第一传感器数据确定新的运动数据;基于新的运动数据确定电子设备的运动状态为非静止状态,则调整运动阈值;基于调整后的运动阈值、调整后的静止时间段阈值、以及第一状态判别条件中除静止时间段阈值和调整后的运动阈值之外的其他条件,得到第二状态判别条件,并基于第二状态判别条件,确定电子设备的目标运动状态。In other embodiments, step 1008 includes: if the motion data is greater than the motion threshold, adjusting the static time period threshold; determining the first sensor data that satisfies the adjusted static time period threshold from the cached real-time sensor data, and obtaining a new and determine new motion data based on the new first sensor data; determine that the motion state of the electronic device is a non-stationary state based on the new motion data, then adjust the motion threshold; based on the adjusted motion threshold, after the adjustment and other conditions except the static time period threshold and the adjusted motion threshold in the first state discrimination condition, obtain the second state discrimination condition, and based on the second state discrimination condition, determine the target of the electronic device state of motion.

也就是说,电子设备可以先调整静止时间段阈值,若基于调整后的静止时间段阈值确定电子设备的运动状态为非静止状态,再调整运动阈值,可以从多个维度调整第一状态判别条件,提高算法的有效性。That is to say, the electronic device can first adjust the static time period threshold. If the motion state of the electronic device is determined to be a non-static state based on the adjusted static time period threshold, and then adjust the motion threshold, the first state discrimination condition can be adjusted from multiple dimensions. , to improve the effectiveness of the algorithm.

在一个实施例中,基于第二状态判别条件,确定电子设备的目标运动状态,包括:从缓存的实时传感器数据中确定出满足调整后的静止时间段阈值的第一传感器数据,得到新的第一传感器数据,并基于新的第一传感器数据确定新的运动数据;若新的运动数据小于或等于运动阈值,则确定电子设备的目标运动状态为静止状态;若新的运动数据大于运动阈值,则确定电子设备的目标运动状态为非静止状态。In one embodiment, determining the target motion state of the electronic device based on the second state discriminating condition includes: determining, from the buffered real-time sensor data, first sensor data that satisfies the adjusted static time period threshold, and obtaining a new first sensor data. a sensor data, and determine new motion data based on the new first sensor data; if the new motion data is less than or equal to the motion threshold, then determine that the target motion state of the electronic device is a static state; if the new motion data is greater than the motion threshold, Then it is determined that the target motion state of the electronic device is a non-stationary state.

可以理解的是,电子设备调整静止时间段阈值,则原先获取的第一传感器数据不满足调整后的静止时间段阈值,需要重新从缓存的实时传感器数据中确定出满足调整后的静止时间段阈值的第一传感器数据,得到新的第一传感器是数据。It is understandable that if the electronic device adjusts the static time period threshold, the originally acquired first sensor data does not meet the adjusted static time period threshold, and needs to be re-determined from the cached real-time sensor data to satisfy the adjusted static time period threshold. of the first sensor data, get the new first sensor is data.

可选地,若调整静止时间段阈值为减小静止时间段阈值,则电子设备从第一传感器数据中确定出满足调整后的静止时间段阈值的第一传感器数据。Optionally, if the adjustment of the static time period threshold is to decrease the static time period threshold, the electronic device determines from the first sensor data first sensor data that satisfies the adjusted static time period threshold.

在一些可能的实施方式中,电子设备可以从第一传感器数据中随机确定出满足调整后的静止时间段阈值的第一传感器数据。In some possible implementations, the electronic device may randomly determine, from the first sensor data, first sensor data that satisfies the adjusted static time period threshold.

在一些可能的实施方式中,电子设备可以从第一传感器数据中确定出满足调整后的静止时间段阈值,且处于最新时间段范围内的第一传感器数据。In some possible implementations, the electronic device may determine, from the first sensor data, the first sensor data that satisfies the adjusted static time period threshold and is within the range of the latest time period.

在其他实施方式中,电子设备还可以采用其他方式从第一传感器数据中确定出满足调整后的静止时间段阈值的第一传感器,在此不做限定。In other implementation manners, the electronic device may also determine, from the first sensor data, the first sensor that satisfies the adjusted static time period threshold in other manners, which is not limited herein.

若新的运动数据小于或等于运动阈值,则确定电子设备的目标运动状态为静止状态,该静止状态的持续时长较短。If the new motion data is less than or equal to the motion threshold, it is determined that the target motion state of the electronic device is a stationary state, and the duration of the stationary state is short.

若新的运动数据大于运动阈值,表示调整静止时间段阈值后,仍无法找到电子设备处于静止状态的静止时间段,则确定电子设备的目标运动状态为非静止状态。If the new motion data is greater than the motion threshold, it means that after adjusting the static time period threshold, the static time period in which the electronic device is in a static state cannot be found, and the target motion state of the electronic device is determined to be a non-static state.

在本实施例中,在调整静止时间段后,若新的运动数据小于或等于该运动阈值,表示电子设备处于静止状态的持续时长较短,但是仍可以确定电子设备的目标运动状态为静止状态;若新的运动数据仍大于该运动阈值,表示调整静止时间段阈值后,仍无法找到电子设备处于静止状态的静止时间段,则确定电子设备的目标运动状态为非静止状态。电子设备调整静止时间段阈值,可以从电子设备处于静止状态的持续时长这一维度上排除第一传感器数据可能存在的噪声而导致误判的可能性,从而更准确地确定出电子设备的运动状态。In this embodiment, after adjusting the stationary time period, if the new motion data is less than or equal to the motion threshold, it means that the duration of the stationary state of the electronic device is shorter, but it can still be determined that the target motion state of the electronic device is stationary ; If the new motion data is still greater than the motion threshold, it means that after adjusting the static time period threshold, the static time period in which the electronic device is in a static state cannot be found, and the target motion state of the electronic device is determined to be a non-static state. Adjusting the static time period threshold by the electronic device can exclude the possibility of misjudgment caused by the noise that may exist in the first sensor data from the dimension of the duration of the electronic device being in a static state, so as to more accurately determine the motion state of the electronic device .

在一些可能的实施例中,上述方法还包括:检测电子设备的稳定程度;基于电子设备的稳定程度,调整初始状态判别条件,得到第一状态判别条件。In some possible embodiments, the above method further includes: detecting the degree of stability of the electronic device; based on the degree of stability of the electronic device, adjusting the initial state discriminating condition to obtain the first state discriminating condition.

电子设备的稳定程度指的是电子设备的姿态稳定的程度。电子设备的稳定程度越高,电子设备处于静止状态下的可能性越高,处于静止状态的持续时长也越高。The degree of stability of the electronic device refers to the degree to which the posture of the electronic device is stable. The higher the stability of the electronic device, the higher the probability of the electronic device being in a stationary state, and the longer the duration of being in the stationary state.

初始状态判别条件是初始设置的用于判断出电子设备的运动状态的条件。初始状态判别条件可以包括运动条件和静止时间段条件中的至少一种。运动条件可以包括运动阈值,还可以包括运动范围等,不限于此。静止时间段条件可以包括静止时间段阈值,还可以包括静止时间段的时刻、静止时间段的时间范围等,不限于此。The initial state judging condition is an initially set condition for judging the motion state of the electronic device. The initial state discrimination condition may include at least one of a motion condition and a stationary period condition. The motion condition may include a motion threshold, and may also include a motion range, etc., but is not limited thereto. The still time period condition may include the still time period threshold, and may also include the time of the still time period, the time range of the still time period, etc., but is not limited thereto.

在一些可能的实施方式中,电子设备通过惯性测量单元实时采集IMU数据,基于IMU数据确定电子设备的稳定程度;IMU数据的大小和电子设备的稳定程度成正相关。其中,IMU数据包括陀螺仪的角速度数据、加速度计的加速度数据和磁力计的磁力数据等至少一种。磁力数据可以包括磁场强度和方向。In some possible implementations, the electronic device collects IMU data in real time through an inertial measurement unit, and determines the stability of the electronic device based on the IMU data; the size of the IMU data is positively correlated with the stability of the electronic device. The IMU data includes at least one of angular velocity data of a gyroscope, acceleration data of an accelerometer, and magnetic force data of a magnetometer. Magnetic data may include magnetic field strength and direction.

在另一些可能的实施方式中,电子设备实时检测预览画面的运动程度,基于该预览画面的运动程度确定电子设备的稳定程度;预览画面的运动程度和电子设备的稳定程度成负相关。In other possible implementations, the electronic device detects the motion degree of the preview image in real time, and determines the stability of the electronic device based on the motion degree of the preview image; the motion degree of the preview image is negatively correlated with the stability of the electronic device.

可以理解的是,电子设备的稳定程度较低,存在较大的抖动或移动时,预览画面中的运动程度也较大,预览画面存在较大的抖动或移动,因此可以基于实时检测的预览画面的运动程度,准确地确定电子设备的稳定程度。It can be understood that the stability of the electronic device is low. When there is a large shake or movement, the degree of motion in the preview screen is also large, and the preview screen has large shake or movement. Therefore, the preview screen based on real-time detection can be used. the degree of movement, and accurately determine the degree of stability of the electronic device.

在其他实施方式中,电子设备还可以采用其他方式确定电子设备的稳定程度,在此不做限定。In other implementation manners, the electronic device may also determine the degree of stability of the electronic device in other manners, which is not limited herein.

在本实施例中,电子设备基于本身的稳定程度,可以调整初始状态判别条件,得到第一状态判别条件,也即可以跟随当前电子设备的稳定程度而对初始状态判别条件进行调整,得到更适合当前电子设备的稳定程度的第一状态判别条件,从而更准确地判断出电子设备的运动状态。In this embodiment, the electronic device can adjust the initial state judging condition based on its own stability to obtain the first state judging condition. The first state judging condition of the current stability of the electronic device, so as to more accurately determine the motion state of the electronic device.

在另一些可能的实施例中,上述方法还包括:检测电子设备的稳定程度;基于电子设备的稳定程度,动态调整第一状态判别条件,得到新的第一状态判别条件。In some other possible embodiments, the above method further includes: detecting the stability of the electronic device; dynamically adjusting the first state discrimination condition based on the stability of the electronic device to obtain a new first state discrimination condition.

在一个实施例中,基于电子设备的稳定程度,调整初始状态判别条件,得到第一状态判别条件,包括:若初始状态判别条件包括运动阈值,则基于电子设备的稳定程度,调整运动阈值,得到第一状态判别条件;电子设备的稳定程度与运动阈值成负相关;若初始状态判别条件包括静止时间段阈值,则基于电子设备的稳定程度,调整静止时间段阈值,得到第一状态判别条件;电子设备的稳定程度与静止时间段阈值成正相关;若初始状态判别条件包括运动阈值和静止时间段阈值,则基于电子设备的稳定程度,调整运动阈值和静止时间段阈值,得到第一状态判别条件。In one embodiment, adjusting the initial state discrimination condition based on the stability of the electronic device to obtain the first state discriminating condition includes: if the initial state discriminating condition includes a motion threshold, adjusting the motion threshold based on the stability of the electronic device to obtain The first state discriminating condition; the stability of the electronic device is negatively correlated with the motion threshold; if the initial state discriminating condition includes the stationary time period threshold, then based on the stability of the electronic device, the stationary time period threshold is adjusted to obtain the first state discriminating condition; The stability of the electronic device is positively correlated with the static time period threshold; if the initial state discrimination condition includes the motion threshold and the static time period threshold, then based on the stability of the electronic device, adjust the motion threshold and the static time period threshold to obtain the first state discrimination condition .

若初始状态判别条件包括运动阈值,则基于电子设备的稳定程度,调整运动阈值,得到第一状态判别条件;电子设备的稳定程度与运动阈值成负相关。也就是说,电子设备的稳定程度越高,则减小运动阈值,得到更小的运动阈值。If the initial state judging condition includes a motion threshold, the motion threshold is adjusted based on the stability of the electronic device to obtain the first state judging condition; the stability of the electronic device is negatively correlated with the motion threshold. That is to say, the higher the stability of the electronic device is, the lower the motion threshold is to obtain a smaller motion threshold.

若初始状态判别条件包括静止时间段阈值,则基于电子设备的稳定程度,调整静止时间段阈值,得到第一状态判别条件;电子设备的稳定程度与静止时间段阈值成正相关。也就是说,电子设备的稳定程度越高,则增大静止时间段阈值,得到更大的静止时间段阈值。If the initial state judging condition includes the static time period threshold, then based on the stability of the electronic device, the static time period threshold is adjusted to obtain the first state distinguishing condition; the stability of the electronic device is positively correlated with the static time period threshold. That is to say, the higher the stability of the electronic device is, the higher the static time period threshold value is, and the larger the static time period threshold value is obtained.

若初始状态判别条件包括运动阈值和静止时间段阈值,则基于电子设备的稳定程度,调整运动阈值和静止时间段阈值,得到第一状态判别条件。也就是说,电子设备的稳定程度越高,则减小运动阈值,以及增大静止时间段阈值,得到更小的运动阈值和更大的静止时间段阈值。If the initial state judging condition includes a motion threshold and a stationary time period threshold, then based on the stability of the electronic device, the motion threshold and the stationary period threshold are adjusted to obtain the first state judgment condition. That is to say, the higher the stability of the electronic device is, the lower the motion threshold value and the larger the stationary time period threshold value, to obtain a smaller motion threshold value and a larger stationary time period threshold value.

在本实施例中,基于电子设备的稳定程度,调整初始状态判别条件中的运动阈值和静止时间段阈值中的至少一种,可以得到更适合电子设备的稳定程度的第一状态判别条件。在电子设备的稳定程度较高的情况下,减小运动阈值以及增大静止时间段阈值中至少一种,可以提高确定的电子设备的目标运动状态的准确性,从而在第一校准方式的情况下提高目标校准参数的精度。在电子设备的稳定程度较低的情况下,增大运动阈值以及减小静止时间段阈值中至少一种,可以在后续实时采集的第一传感器数据中排除噪声数据,提高算法的有效性。In this embodiment, based on the stability of the electronic device, adjusting at least one of the motion threshold and the static time period threshold in the initial state determination condition can obtain a first state determination condition more suitable for the stability of the electronic device. When the stability of the electronic device is relatively high, at least one of reducing the motion threshold and increasing the stationary time period threshold can improve the accuracy of the determined target motion state of the electronic device, so that in the case of the first calibration method to improve the accuracy of the target calibration parameters. When the stability of the electronic device is low, at least one of increasing the motion threshold and decreasing the static time period threshold can exclude noise data from the first sensor data collected in real time subsequently and improve the effectiveness of the algorithm.

在一些可能的实施例中,上述方法还包括:检测电子设备的温漂;基于电子设备的温漂,调整初始状态判别条件,得到第一状态判别条件。In some possible embodiments, the above method further includes: detecting the temperature drift of the electronic device; and adjusting the initial state determination condition based on the temperature drift of the electronic device to obtain the first state determination condition.

调整初始状态判别条件,包括:若初始状态判别条件包括运动阈值,基于温漂程度调整运动阈值;温漂程度和运动阈值成正相关。Adjusting the initial state judging condition includes: if the initial state judging condition includes a motion threshold, adjusting the motion threshold based on the degree of temperature drift; the degree of temperature drift and the motion threshold are positively correlated.

温漂指的是由温度变化所引起的零点漂移。若电子设备处于温漂环境下,则对传感器数据的校准有新的影响因素,需要增大运动阈值。Temperature drift refers to the zero point drift caused by temperature changes. If the electronic device is in a temperature drift environment, there will be new factors affecting the calibration of sensor data, and the motion threshold needs to be increased.

在一些可能的实施例中,第一校准方式的目标校准参数经过精校准得到,精校准方式,包括:基于实时采集的第一传感器数据,确定出离群值范围,并从各个第一传感器数据中确定出处于离群值范围内的离群数据;对离群数据进行处理,得到处理结果,根据处理结果和第一传感器数据中非离群数据,得到更新后的第一传感器数据;基于更新后的第一传感器数据,确定出第一校准方式的目标校准参数。In some possible embodiments, the target calibration parameters of the first calibration method are obtained through fine calibration, and the fine calibration method includes: determining the outlier range based on the first sensor data collected in real time, and determining the outlier range from each first sensor data Outlier data within the range of outliers is determined in the method; the outlier data is processed to obtain a processing result, and the updated first sensor data is obtained according to the processing result and the non-outlier data in the first sensor data; based on the updated After obtaining the first sensor data, target calibration parameters of the first calibration mode are determined.

离群值(outlier),也称逸出值,是指在多个数据中与其他数值相比差异较大的数值。离群值范围是指与多个数据中的大部分数据差异较大的数值范围,该离群值范围不包括多个数据中的大部分数据。离群值范围中的第一传感器数据为离群数据。不处于离群值范围内的第一传感器数据为非离群数据。Outliers, also known as outliers, are values that differ significantly from other values in multiple data sets. An outlier range is a range of values that is significantly different from the majority of the multiple data, and the outlier range does not include the majority of the multiple data. The first sensor data in the outlier range is outlier data. The first sensor data that is not within the outlier range is non-outlier data.

可选地,若电子设备的目标运动状态为静止状态,则基于实时采集的第一传感器数据,确定出运动数据,根据运动数据确定出离群值范围。Optionally, if the target motion state of the electronic device is a static state, motion data is determined based on the first sensor data collected in real time, and an outlier range is determined according to the motion data.

示例性的,电子设备基于实时采集的第一传感器数据,确定出运动数据分别是均值和方差,则离群值范围可以是与均值相差超过三倍标准差的数值范围。其中,方差的算术平方根为标准差。Exemplarily, the electronic device determines, based on the first sensor data collected in real time, that the motion data are the mean value and the variance, respectively, and the outlier range may be a value range that differs from the mean by more than three standard deviations. where the arithmetic square root of the variance is the standard deviation.

假设基于实时采集的第一传感器数据,确定出第一传感器数据的均值为0.1、方差为0.09,则标准差为方差的算术平方根即0.3,离群值范围是与均值相差超过三倍标准差的数值范围,也即(-∞,-0.8)&(1.0,+∞)。Assuming that based on the first sensor data collected in real time, it is determined that the mean value of the first sensor data is 0.1 and the variance is 0.09, then the standard deviation is the arithmetic square root of the variance, which is 0.3, and the range of outliers is more than three times the standard deviation from the mean value. The range of values, i.e. (-∞, -0.8) & (1.0, +∞).

电子设备从各个第一传感器数据中确定出处于离群值范围内的离群数据,该离群数据与各个第一传感器数据的差异较大,可能是潜在的噪声数据,因此对离群数据进行处理,得到处理结果。The electronic device determines outlier data within the range of outliers from each first sensor data. The outlier data is quite different from each first sensor data, and may be potential noise data. Therefore, the outlier data is analyzed. processing to get the processing result.

在一些可能的实施方式中,电子设备对离群数据进行剔除处理,得到处理结果。In some possible implementations, the electronic device performs elimination processing on outlier data to obtain a processing result.

在另一些可能的实施方式中,电子设备将离群数据替换为其他的非离群数据,得到处理结果。In other possible implementations, the electronic device replaces the outlier data with other non-outlier data to obtain a processing result.

在其他实施方式中,电子设备还可以对离群数据进行其他的处理,在此不做限定。In other implementation manners, the electronic device may also perform other processing on the outlier data, which is not limited herein.

在一种实施方式中,电子设备求取更新后的第一传感器数据的均值,将该均值作为第一校准方式的目标校准参数。In an embodiment, the electronic device obtains an average value of the updated first sensor data, and uses the average value as a target calibration parameter of the first calibration method.

在另一种实施方式中,电子设备求取更新后的第一传感器数据的中位数,将该中位数作为第一校准方式的目标校准参数。In another embodiment, the electronic device obtains the median of the updated first sensor data, and uses the median as the target calibration parameter of the first calibration method.

在其他实施方式中,电子设备还可以采用其他方式基于更新后的第一传感器数据确定给出第一校准方式的目标校准参数,在此不做限定。In other implementation manners, the electronic device may also use other manners to determine target calibration parameters that give the first calibration manner based on the updated first sensor data, which is not limited herein.

在本实施例中,电子设备基于实时采集的第一传感器数据,确定出离群值范围,并从各个第一传感器数据中确定出处于离群值范围内的离群数据,对离群数据进行处理,得到处理结果,从而可以得到更准确的更新后的第一传感器数据,该更新后的第一传感器数据中的噪声数据更少。那么,基于更新后的第一传感器数据,可以更准确地确定出第一校准方式的目标校准参数。In this embodiment, the electronic device determines an outlier range based on the first sensor data collected in real time, determines outlier data within the outlier range from each first sensor data, and performs an analysis on the outlier data. processing to obtain a processing result, thereby obtaining more accurate updated first sensor data with less noise data in the updated first sensor data. Then, based on the updated first sensor data, the target calibration parameters of the first calibration mode can be more accurately determined.

在一个实施例中,对离群数据进行处理,得到处理结果,包括:确定出与离群数据相匹配的非离群值数据;将非离群值数据替换离群数据,得到处理结果。In one embodiment, processing the outlier data to obtain a processing result includes: determining non-outlier data matching the outlier data; and replacing the outlier data with the non-outlier data to obtain the processing result.

具体地,电子设备确定出与离群数据相差最小的非离群数据,将该非离群值数据替换离群数据,得到处理结果。Specifically, the electronic device determines the non-outlier data with the smallest difference from the outlier data, replaces the non-outlier data with the outlier data, and obtains a processing result.

可以理解的是,除离群值范围之外的是非离群值范围,非离群值范围可以表征各个第一传感器数据中的大部分数据,而离群数据为各个第一传感器数据中潜在的噪声数据,因此确定与该离群数据相差最小的非离群数据,可以最大程度地表征该离群数据,使得处理结果与实际采集的数据最接近。It can be understood that the range other than the outlier is the range of non-outliers, the range of non-outliers can represent most of the data in each of the first sensor data, and the outlier data is the potential in each of the first sensor data. Therefore, determining the non-outlier data with the smallest difference from the outlier data can characterize the outlier data to the greatest extent, so that the processing result is the closest to the actually collected data.

在另一些可能的实施方式中,电子设备还可以确定出各个第一传感器数据的均值,该均值为非离群数据,并将该均值作为与离群数据相匹配的非离群值数据。In some other possible implementations, the electronic device may further determine the mean value of each first sensor data, the mean value is the non-outlier data, and use the mean value as the non-outlier data matching the outlier data.

在另一些可能的实施方式中,电子设备还可以确定出各个第一传感器数据的中位数,该中位数为非离群数据,并将该均值作为与离群数据相匹配的非离群值数据。In some other possible implementations, the electronic device may further determine the median of each first sensor data, where the median is the non-outlier data, and use the mean as the non-outlier matching the outlier data value data.

在另一些可能的实施方式中,电子设备还可以将该0作为与离群数据相匹配的非离群值数据。In some other possible implementation manners, the electronic device may further regard the 0 as non-outlier data matching the outlier data.

在其他实施方式中,电子设备还可以采用其他方式确定出与离群数据相匹配的非离群值数据,在此不做限定。In other implementation manners, the electronic device may also determine non-outlier data matching the outlier data in other manners, which is not limited herein.

在一些可能的实施例中,第二校准方式的目标校准参数的确定方式,包括:若电子设备的目标运动状态均为非静止状态,则获取历史校准参数作为第二校准方式的目标校准参数,历史校准参数是基于历史静止状态下的传感器数据确定,历史静止状态是基于历史时刻采集的实时传感器数据确定的。In some possible embodiments, the method for determining the target calibration parameters of the second calibration method includes: if the target motion states of the electronic device are all non-stationary states, acquiring historical calibration parameters as the target calibration parameters of the second calibration method, The historical calibration parameters are determined based on sensor data in a historical static state, and the historical static state is determined based on real-time sensor data collected at historical moments.

可以理解的是,电子设备实时采集第一传感器数据,并实时基于第一传感器数据确定电子设备的目标运动状态;若电子设备实时得到的目标运动状态均为非静止状态,表示电子设备持续处于非静止状态,无法基于实时采集的第一传感器数据确定出目标校准参数,因此确定目标校准方式为第二校准方式,获取历史校准参数作为第二校准方式的目标校准参数。It can be understood that the electronic device collects the first sensor data in real time, and determines the target motion state of the electronic device based on the first sensor data in real time; In the static state, the target calibration parameters cannot be determined based on the real-time collected first sensor data, so the target calibration method is determined as the second calibration method, and the historical calibration parameters are obtained as the target calibration parameters of the second calibration method.

可选地,若电子设备的目标运动状态在预设的时长内均为非静止状态,则确定目标校准方式为第二校准方式,获取历史校准参数作为第二校准方式的目标校准参数。其中,预设的时长可以根据需要进行设置。例如,预设的时长可以为10分钟。Optionally, if the target motion state of the electronic device is in a non-stationary state within a preset time period, the target calibration method is determined to be the second calibration method, and historical calibration parameters are acquired as the target calibration parameters of the second calibration method. The preset duration can be set as required. For example, the preset time period may be 10 minutes.

在一些可能的实施例中,第二校准方式的目标校准参数经过后台校准得到,后台校准的具体方式,包括:响应于电子设备进入装配节点或者空闲时间段,获取电子设备实时采集的第四传感器数据;根据第四传感器数据确定电子设备的历史运动状态;在历史运动状态为静止状态的情况下,基于实时采集的第四传感器数据确定目标校准参数。In some possible embodiments, the target calibration parameters of the second calibration method are obtained through background calibration. The specific method of the background calibration includes: in response to the electronic device entering an assembly node or an idle time period, acquiring a fourth sensor collected in real time by the electronic device data; determining the historical motion state of the electronic device according to the fourth sensor data; and determining the target calibration parameter based on the fourth sensor data collected in real time when the historical motion state is a static state.

第四传感器数据是电子设备进入装配节点或者空闲时间段所采集的传感器数据。The fourth sensor data is sensor data collected when the electronic device enters an assembly node or during an idle time period.

装配节点是电子设备进行装配、系统安装等出厂操作时的节点。可以理解的是,电子设备响应于进入装配节点,可以触发进行传感器数据的校准,该传感器数据的校准也就传感器数据的首次校准。An assembly node is a node when an electronic device is assembled, system installed, and other factory operations. It can be understood that, in response to entering the assembly node, the electronic device can trigger the calibration of the sensor data, and the calibration of the sensor data is also the first calibration of the sensor data.

在该传感器数据的校准过程中,无需任何工序,电子设备自动实现首次的传感器数据的校准,得到目标校准参数,并将目标校准参数存储在本地中。During the calibration process of the sensor data, without any process, the electronic device automatically realizes the first calibration of the sensor data, obtains the target calibration parameters, and stores the target calibration parameters locally.

空闲时间段指的是电子设备处于空闲状态的时间段。例如,空闲时间段可以是夜间的时间段、待机的时间段或关机时间段等,不限于此。The idle time period refers to a time period during which the electronic device is in an idle state. For example, the idle time period may be a night time period, a standby time period or a shutdown time period, etc., but is not limited thereto.

空闲状态可以根据用户需要进行设置。示例性的,电子设备完全没有处理任务时为空闲状态;电子设备没有被用户使用时为空闲状态;电子设备执行的处理任务少于指定数量时为空闲状态;等等。其中,指定数量可以根据需要进行设置,如1或2等。The idle state can be set according to user needs. Exemplarily, the electronic device is in an idle state when it has no processing tasks at all; when the electronic device is not used by a user, it is in an idle state; when the electronic device performs less than a specified number of processing tasks, it is in an idle state; and so on. Among them, the specified number can be set as required, such as 1 or 2.

电子设备响应于进入空闲时间段,获取电子设备实时采集的第四传感器数据,可以根据第四传感器数据确定出电子设备的历史运动状态,在历史运动状态为静止状态的情况下,基于实时采集的第四传感器数据确定目标校准参数,根据该目标校准参数对电子设备存储的历史校准参数进行更新;在历史运动状态为非静止状态的情况下,则不进行校准。In response to entering the idle time period, the electronic device acquires the fourth sensor data collected by the electronic device in real time, and can determine the historical motion state of the electronic device according to the fourth sensor data. The fourth sensor data determines a target calibration parameter, and according to the target calibration parameter, updates the historical calibration parameter stored in the electronic device; when the historical motion state is a non-stationary state, no calibration is performed.

需要说明的是,根据第四传感器数据确定出电子设备的历史运动状态的具体方式,和根据第一传感器数据确定电子设备的目标运动状态的具体方式,是一致的,在此不做赘述。It should be noted that the specific method of determining the historical motion state of the electronic device according to the fourth sensor data is the same as the specific method of determining the target motion state of the electronic device according to the first sensor data, and will not be repeated here.

在本实施例中,电子设备响应于进入装配节点或者空闲时间段,基于实时采集的第四传感器数据,确定出目标校准参数。可以理解的是,电子设备响应于进入装配节点,可以首次得到目标校准参数,则后续对传感器数据进行校准时,若采用第二校准方式也可以基于历史静止状态下的传感器数据确定出该首次校准得到的目标校准参数,丰富了传感器数据的校准方式,可以提高传感器数据校准的有效性、兼容性、可靠性和容灾性。电子设备响应于进入空闲时间段,则可以进行传感器数据的校准,无需用户参与,计算量小,且持续时间短无需更多格外功耗。In this embodiment, in response to entering an assembly node or an idle time period, the electronic device determines the target calibration parameter based on the fourth sensor data collected in real time. It can be understood that, in response to entering the assembly node, the electronic device can obtain the target calibration parameters for the first time, and when the sensor data is subsequently calibrated, if the second calibration method is adopted, the first calibration can also be determined based on the sensor data in a historical static state. The obtained target calibration parameters enrich the calibration methods of sensor data, and can improve the validity, compatibility, reliability and disaster tolerance of sensor data calibration. In response to entering the idle time period, the electronic device can perform calibration of the sensor data without user participation, with a small amount of computation, and a short duration without requiring more extra power consumption.

图11为一个实施例中传感器数据的校准方法的框架图。电子设备包括存储模、计算模块和校准模块。其中,电子设备通过目标传感器实时采集传感器数据输入存储模块的先入先出队列中,实时采集的传感器数据队尾入队,队首出队。其中,该先入先出队列可以是循环队列,循环队列具体可以是RingBuffer队列。Figure 11 is a block diagram of a method for calibrating sensor data in one embodiment. The electronic equipment includes a memory module, a calculation module and a calibration module. Among them, the electronic device collects sensor data in real time through the target sensor and inputs it into the first-in, first-out queue of the storage module, the sensor data collected in real time enters the queue at the tail, and the head of the queue leaves the queue. The FIFO queue may be a circular queue, and the circular queue may specifically be a RingBuffer queue.

若先入先出队列中存储的传感器数据的数据长度所对应的采集时长,满足静止时间段阈值,则获取满足静止时间段阈值的传感器数据输入计算模块中。If the collection duration corresponding to the data length of the sensor data stored in the FIFO queue satisfies the static time period threshold, the acquired sensor data satisfying the static time period threshold is input into the calculation module.

计算模块用于预先设置阈值,设置的阈值包括静止时间段阈值和运动阈值。计算模块基于满足静止时间段阈值的传感器数据,计算运动数据,并将运动数据与预先设置的阈值进行比较,进行状态判别。若确定电子设备处于静止状态,则确定目标校准方式为第一校准方式,基于传感器数据进行精校准得到第一校准方式的目标校准参数;若确定电子设备处于非静止状态,则确定目标校准方式为第二校准方式,获取经过后台校准得到的目标校准参数。其中,后台校准是电子设备响应于进入装配节点或者空闲时间段时进行的校准。The calculation module is used to preset a threshold value, and the set threshold value includes a static time period threshold value and a motion threshold value. The calculation module calculates the motion data based on the sensor data satisfying the threshold value of the stationary time period, and compares the motion data with the preset threshold value to determine the state. If it is determined that the electronic device is in a stationary state, the target calibration method is determined as the first calibration mode, and the target calibration parameters of the first calibration mode are obtained by performing fine calibration based on sensor data; if it is determined that the electronic device is in a non-stationary state, the target calibration mode is determined as In the second calibration method, target calibration parameters obtained through background calibration are acquired. Among them, the background calibration is the calibration performed by the electronic device in response to entering an assembly node or an idle time period.

校准模块用于获取计算模块输出的目标校准参数,基于目标校准参数对实时采集的传感器数据进行误差校准,得到校准后的传感器数据。The calibration module is used to obtain the target calibration parameters output by the calculation module, and perform error calibration on the sensor data collected in real time based on the target calibration parameters to obtain calibrated sensor data.

图12为一个实施例中计算模块的计算流程图。电子设备预先设置阈值,阈值包括运动阈值和静止时间段阈值,运动阈值可以包括均值、方差、标准差、中位数和均值差异值等其中至少一种。电子设备将实时采集的传感器数据存储到队列1204中,若队列1204中存储的传感器数据的数据长度所对应的采集时长,满足静止时间段阈值,则获取满足静止时间段阈值的传感器数据,并计算各个传感器数据的运动数据1206。FIG. 12 is a calculation flow chart of the calculation module in one embodiment. The electronic device presets a threshold, the threshold includes a motion threshold and a static time period threshold, and the motion threshold may include at least one of mean, variance, standard deviation, median, and mean difference. The electronic device stores the sensor data collected in real time in the queue 1204. If the collection duration corresponding to the data length of the sensor data stored in the queue 1204 satisfies the static time period threshold, the sensor data that meets the static time period threshold is obtained, and calculates Motion data 1206 for various sensor data.

电子设备执行步骤1208,基于运动数据1206和设置的阈值,判断电子设备是否处于静止状态;若判断为是,则执行步骤1210;若判断为否,则执行步骤1212。其中,后台校准是电子设备响应于进入装配节点1214或者空闲时间段1216进行的校准。The electronic device executes step 1208 , based on the motion data 1206 and the set threshold, to determine whether the electronic device is in a stationary state; if the determination is yes, then step 1210 is performed; if the determination is no, step 1212 is performed. Among them, background calibration is a calibration performed by the electronic device in response to entering the assembly node 1214 or the idle time period 1216 .

在一些示例性实施例中,如图13所示,提供了一种防抖方法,以该方法应用于图1中的电子设备为例进行说明,包括以下步骤:In some exemplary embodiments, as shown in FIG. 13, an anti-shake method is provided, and the method is applied to the electronic device in FIG. 1 as an example for description, including the following steps:

步骤1302,在电子设备的拍摄场景中,获取校准后的传感器数据;校准后的传感器数据是根据上述的传感器数据的校准方法得到。Step 1302 , in the shooting scene of the electronic device, obtain calibrated sensor data; the calibrated sensor data is obtained according to the above-mentioned sensor data calibration method.

电子设备包括摄像模组,通过摄像模组进行拍摄。摄像模组可以包括镜头、图像传感器(CMOS,Complementary Metal Oxide Semiconductor)、马达等器件。The electronic device includes a camera module, and shooting is performed through the camera module. The camera module may include a lens, an image sensor (CMOS, Complementary Metal Oxide Semiconductor), a motor, and other devices.

拍摄场景可以是拍照场景、拍视频场景或拍摄画面预览场景等。The shooting scene may be a shooting scene, a shooting video scene, or a shooting picture preview scene, and the like.

步骤1304,基于校准后的传感器数据,确定防抖补偿量。Step 1304: Determine the anti-shake compensation amount based on the calibrated sensor data.

防抖补偿量是用于对电子设备的抖动进行补偿的数值。防抖补偿量可以包括镜头的第一防抖补偿量,以及图像传感器的第二防抖补偿量。The anti-shake compensation amount is a value for compensating for the jitter of the electronic device. The anti-shake compensation amount may include a first anti-shake compensation amount of the lens, and a second anti-shake compensation amount of the image sensor.

具体地,电子设备基于校准后的传感器数据,采用预设的防抖算法,分别确定出镜头的第一防抖补偿量,以及图像传感器的第二防抖补偿量。Specifically, the electronic device adopts a preset anti-shake algorithm based on the calibrated sensor data to determine the first anti-shake compensation amount of the lens and the second anti-shake compensation amount of the image sensor, respectively.

步骤1306,基于防抖补偿量对摄像模组进行抖动补偿。Step 1306: Perform shake compensation on the camera module based on the anti-shake compensation amount.

电子设备基于第一防抖补偿量控制第一马达对摄像模组中的镜头进行抖动补偿,基于第二防抖补偿量控制第二马达对摄像模组中的图像传感器进行抖动补偿。电子设备在抖动补偿的同时,可以通过镜头模组获取到更准确进行曝光的光信号,从而生成更清晰的图像。The electronic device controls the first motor to perform shake compensation on the lens in the camera module based on the first anti-shake compensation amount, and controls the second motor based on the second anti-shake compensation amount to perform shake compensation on the image sensor in the camera module. While compensating for jitter, the electronic device can obtain a more accurate light signal for exposure through the lens module, thereby generating a clearer image.

上述防抖方法,在电子设备的拍摄场景中,根据上述的传感器数据的校准方法,可以获取更准确的校准后的传感器数据,从而基于校准后的传感器数据,确定出更准确的防抖补偿量,进一步地更准确地对摄像模组进行抖动补偿,从而生成更加清晰的图像。In the above-mentioned anti-shake method, in a shooting scene of an electronic device, more accurate calibrated sensor data can be obtained according to the above-mentioned sensor data calibration method, so that a more accurate anti-shake compensation amount can be determined based on the calibrated sensor data , further and more accurately perform shake compensation on the camera module, thereby generating a clearer image.

并且,该传感器数据的校准过程和光学防抖过程处于同个闭环系统中,避免随着时间推移带来数据上的偏差,以及校准过程和光学防抖过程处于不同空间带来的偏差,可以提高校准的准确性。在提高传感器数据的校准精度的同时,该校准后的传感器数据也用于进行防抖,提高了防抖算法的性能,提升了生成的画面的画质表现力,可以赋能更高的产品表现力。In addition, the calibration process of the sensor data and the optical anti-shake process are in the same closed-loop system, which avoids the deviation of the data over time, and the deviation caused by the calibration process and the optical anti-shake process in different spaces, which can improve the performance. Calibration accuracy. While improving the calibration accuracy of the sensor data, the calibrated sensor data is also used for anti-shake, which improves the performance of the anti-shake algorithm, improves the image quality and expressiveness of the generated image, and can enable higher product performance. force.

进一步地,电子设备可以在拍摄场景中,实时获取校准后的传感器数据,基于该传感器数据实时对摄像模组进行抖动补偿,可以增加抖动补偿的时效性;并且若该校准后的传感器是基于第一校准方式的目标校准参数确定的,该目标校准参数是在拍摄场景中实时采集的第一传感器数据确定的,那么该目标校准参数也考虑了当前的拍摄场景的影响因素,可以对传感器数据进行校准,得到更准确的传感器数据,从而对摄像模组更准确进行抖动补偿。Further, the electronic device can acquire calibrated sensor data in real time in the shooting scene, and perform shake compensation on the camera module in real time based on the sensor data, which can increase the timeliness of the shake compensation; and if the calibrated sensor is based on the first The target calibration parameter of a calibration method is determined, and the target calibration parameter is determined by the first sensor data collected in real time in the shooting scene, then the target calibration parameter also takes the influencing factors of the current shooting scene into consideration, and the sensor data can be measured. Calibration to obtain more accurate sensor data, so as to perform more accurate shake compensation for the camera module.

图14为一个实施例中光学防抖系统在电子设备工作的框架图。电子设备通过惯性测量单元计算得到目标校准参数,基于目标校准参数对实时获取的传感器数据(IMU数据)进行校准误差,得到校准后的传感器数据。基于校准后的传感器数据计算防抖补偿量,包括镜头的第一防抖补偿量和图像传感器的第二防抖补偿量。电子设备可以控制第一马达对镜头进行抖动补偿,控制第二马达对图像传感器进行抖动补偿。在镜头和图像传感器进行抖动补偿的过程中,光源发射光信号透出抖动补偿的镜头投射至抖动补偿的图像传感器上,图像传感器可以将光信号转换为电信号,该电信号再经过图像信号处理器进行图像信号处理,可以生成清晰的图像。FIG. 14 is a frame diagram of the operation of the optical anti-shake system in an electronic device in one embodiment. The electronic device obtains the target calibration parameters through the inertial measurement unit calculation, and calibrates the sensor data (IMU data) acquired in real time based on the target calibration parameters to obtain calibrated sensor data. The anti-shake compensation amount is calculated based on the calibrated sensor data, including the first anti-shake compensation amount of the lens and the second anti-shake compensation amount of the image sensor. The electronic device can control the first motor to perform shake compensation on the lens, and control the second motor to perform shake compensation on the image sensor. During the shake compensation process between the lens and the image sensor, the light signal emitted by the light source is projected through the shake-compensated lens and projected onto the shake-compensated image sensor. The image sensor can convert the light signal into an electrical signal, which is then processed by the image signal. The processor performs image signal processing and can generate clear images.

应该理解的是,虽然如上所述的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上所述的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that, although the steps in the flowcharts involved in the above embodiments are sequentially displayed according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order, and these steps may be performed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but may be performed at different times The execution order of these steps or phases is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or phases in the other steps.

基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的传感器数据的校准方法的传感器数据的校准装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个传感器数据的校准装置实施例中的具体限定可以参见上文中对于传感器数据的校准方法的限定,在此不再赘述。Based on the same inventive concept, an embodiment of the present application also provides a sensor data calibration device for implementing the above-mentioned sensor data calibration method. The solution to the problem provided by the device is similar to the solution described in the above method, so the specific limitations in the embodiment of the calibration device for one or more sensor data provided below can refer to the calibration of sensor data above. The limitation of the method is not repeated here.

在一个实施例中,如图15所示,提供了一种传感器数据的校准装置,包括:计算模块1502和校准模块1504,其中:In one embodiment, as shown in FIG. 15, a sensor data calibration device is provided, including: a calculation module 1502 and a calibration module 1504, wherein:

计算模块1502,用于基于实时采集的第一传感器数据,确定电子设备的目标运动状态。The computing module 1502 is configured to determine the target motion state of the electronic device based on the first sensor data collected in real time.

计算模块1502还用于根据目标运动状态,确定目标校准方式;其中,目标校准方式包括第一校准方式或第二校准方式,第一校准方式的目标校准参数是基于第一传感器数据确定的,第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的。The calculation module 1502 is further configured to determine the target calibration mode according to the target motion state; wherein, the target calibration mode includes the first calibration mode or the second calibration mode, and the target calibration parameters of the first calibration mode are determined based on the first sensor data, and the first calibration mode is determined based on the first sensor data. The target calibration parameters of the second calibration method are determined based on the sensor data in the historical static state.

校准模块1504,用于基于目标校准方式的目标校准参数,对电子设备实时采集的第二传感器数据进行校准。The calibration module 1504 is configured to calibrate the second sensor data collected in real time by the electronic device based on the target calibration parameters of the target calibration method.

上述传感器数据的校准装置,基于实时采集的第一传感器数据,确定该电子设备的目标运动状态,进而根据该目标运动状态确定目标校准方式;其中,该目标校准方式包括第一校准方式或第二校准方式,第一校准方式的目标校准参数是基于第一传感器数据确定的,第二校准方式的目标校准参数是基于历史静止状态下的传感器数据确定的。那么,电子设备可以采用多种校准方式中的一种校准方式,对实时采集的第二传感器数据进行校准,丰富了传感器数据的校准方式。The above sensor data calibration device determines the target motion state of the electronic device based on the first sensor data collected in real time, and then determines a target calibration method according to the target motion state; wherein, the target calibration method includes the first calibration method or the second calibration method. In the calibration mode, the target calibration parameters of the first calibration mode are determined based on the first sensor data, and the target calibration parameters of the second calibration mode are determined based on the sensor data in a historical static state. Then, the electronic device can use one of multiple calibration methods to calibrate the second sensor data collected in real time, which enriches the calibration methods of the sensor data.

可选地,电子设备在采用第一校准方式对实时采集的第二传感器数据进行校准的情况下,第一校准方式的目标校准参数是基于实时采集的第一传感器数据确定的,可以实时地对第二传感器数据进行在线校准,减少了离线校准所需的产线工序和额外的校准设备硬件成本,降低了传感器数据校准的成本。同时,第一校准方式的目标校准参数是基于实时采集的第一传感器数据确定的,该第一校准方式的目标校准参数是跟随环境变化而得到,可以满足温湿漂等多种复杂环境下的高精度校准,提高传感器数据校准的准确性。Optionally, when the electronic device uses the first calibration method to calibrate the second sensor data collected in real time, the target calibration parameters of the first calibration method are determined based on the first sensor data collected in real time, and can be calibrated in real time. The second sensor data is calibrated online, which reduces the production line process required for the offline calibration and the hardware cost of additional calibration equipment, and reduces the cost of sensor data calibration. At the same time, the target calibration parameters of the first calibration method are determined based on the first sensor data collected in real time. The target calibration parameters of the first calibration method are obtained by following changes in the environment, which can meet the requirements of various complex environments such as temperature and humidity drift. High-precision calibration to improve the accuracy of sensor data calibration.

可选地,电子设备在采用第二校准方式对实时采集的第二传感器数据进行校准的情况下,丰富了传感器数据的校准方式,可以提高传感器数据校准的有效性、兼容性、可靠性和容灾性。Optionally, when the electronic device uses the second calibration method to calibrate the second sensor data collected in real time, the calibration method of the sensor data is enriched, and the validity, compatibility, reliability and tolerance of the sensor data calibration can be improved. catastrophic.

在一些实施例中,上述计算模块1502还用于根据预设的静止时间段阈值,从缓存的实时传感器数据中获取满足静止时间段阈值的第一传感器数据;基于第一传感器数据,确定电子设备的目标运动状态。In some embodiments, the above-mentioned calculation module 1502 is further configured to obtain first sensor data that satisfies the static time period threshold from the cached real-time sensor data according to a preset static time period threshold; based on the first sensor data, determine the electronic device target motion state.

在一些实施例中,上述装置还包括存储模块;实时传感器数据为实时缓存在先入先出队列中的数据;上述存储模块还用于获取当前时刻对应的先入先出队列中的数据长度;计算模块1502还用于根据数据长度和采集时长之间的关系,确定数据长度对应的采集时长,并在采集时长满足静止时间段阈值的情况下,获取满足静止时间段阈值的第一传感器数据。In some embodiments, the above-mentioned device further includes a storage module; the real-time sensor data is the data buffered in the FIFO queue in real time; the above-mentioned storage module is also used to obtain the data length in the FIFO queue corresponding to the current moment; the calculation module 1502 is further configured to determine the collection time length corresponding to the data length according to the relationship between the data length and the collection time length, and obtain first sensor data satisfying the still time period threshold when the collection time length satisfies the still time period threshold.

在一些实施例中,先入先出队列为循环队列。In some embodiments, the FIFO queue is a circular queue.

在一些实施例中,上述计算模块1502还用于根据第一传感器数据,确定第一传感器数据对应的运动数据;基于运动数据和第一状态判别条件,确定电子设备的目标运动状态。In some embodiments, the above calculation module 1502 is further configured to determine motion data corresponding to the first sensor data according to the first sensor data; and determine the target motion state of the electronic device based on the motion data and the first state discrimination condition.

在一些实施例中,第一状态判别条件包括运动阈值;上述计算模块1502还用于若运动数据小于或等于运动阈值,则确定电子设备的目标运动状态为静止状态;若运动数据大于运动阈值,则调整第一状态判别条件至第二状态判别条件,并基于第二状态判别条件,确定电子设备的目标运动状态。In some embodiments, the first state discrimination condition includes a motion threshold; the above calculation module 1502 is further configured to determine that the target motion state of the electronic device is a static state if the motion data is less than or equal to the motion threshold; if the motion data is greater than the motion threshold, Then, the first state judging condition is adjusted to the second state judging condition, and the target motion state of the electronic device is determined based on the second state judging condition.

在一些实施例中,第一传感器数据为惯性测量单元采集的数据,惯性测量单元包括至少1种传感器,每种传感器包括至少2轴数据;运动数据包括多个第一统计数据,每个轴采集的数据对应至少1个第一统计数据,每个第一统计数据对应1个运动阈值;上述计算模块1502还用于若各个第一统计数据均小于或等于对应的运动阈值,则确定电子设备的目标运动状态为静止状态。In some embodiments, the first sensor data is data collected by an inertial measurement unit, the inertial measurement unit includes at least one type of sensor, and each sensor includes data of at least two axes; the motion data includes a plurality of first statistical data, collected in each axis The data corresponding to at least one first statistical data, and each first statistical data corresponds to one motion threshold; the above-mentioned calculation module 1502 is further configured to determine if each first statistical data is less than or equal to the corresponding motion threshold, then determine the The target motion state is the stationary state.

在一些实施例中,上述计算模块1502还用于若各个第一统计数据中,存在大于对应的运动阈值的第二统计数据,则确定第二统计数据的数量;若数量小于预设的数量阈值,则调整第二统计数据对应的运动阈值,并基于调整后的运动阈值以及第一判别条件中除调整后的运动阈值之外的条件,得到第二状态判别条件。In some embodiments, the above-mentioned calculation module 1502 is further configured to determine the quantity of the second statistical data if the second statistical data greater than the corresponding motion threshold exists in each of the first statistical data; if the quantity is less than the preset quantity threshold , the motion threshold corresponding to the second statistical data is adjusted, and the second state judgment condition is obtained based on the adjusted motion threshold and conditions other than the adjusted motion threshold in the first judgment condition.

在一些实施例中,上述计算模块1502还用于增大第二统计数据对应的运动阈值。In some embodiments, the above calculation module 1502 is further configured to increase the motion threshold corresponding to the second statistical data.

在一些实施例中,上述计算模块1502还用于若各个第二统计数据均小于或等于对应的调整后的运动阈值,则确定电子设备的目标运动状态为静止状态;若各个第二统计数据存在大于对应的调整后的运动阈值,则确定电子设备的目标运动状态为非静止状态。In some embodiments, the above calculation module 1502 is further configured to determine that the target motion state of the electronic device is a static state if each second statistical data is less than or equal to the corresponding adjusted motion threshold; if each second statistical data exists If it is greater than the corresponding adjusted motion threshold, it is determined that the target motion state of the electronic device is a non-stationary state.

在一些实施例中,第一状态判别条件还包括静止时间段阈值;上述计算模块1502还用于基于调整后的运动阈值确定电子设备的中间运动状态;若中间运动状态为非静止状态,则调整静止时间段阈值;根据调整后的运动阈值、调整后的静止时间段阈值、以及第一状态判别条件中除调整后的运动阈值和静止时间段阈值之外的其他条件,得到第二状态判别条件。In some embodiments, the first state discrimination condition further includes a stationary time period threshold; the above-mentioned calculation module 1502 is further configured to determine an intermediate motion state of the electronic device based on the adjusted motion threshold; if the intermediate motion state is a non-stationary state, adjust the The static time period threshold; according to the adjusted motion threshold, the adjusted static time period threshold, and other conditions in the first state judgment condition except the adjusted motion threshold and the static time period threshold, the second state judgment condition is obtained .

在一些实施例中,上述计算模块1502还用于减小静止时间段阈值。In some embodiments, the calculation module 1502 described above is also used to reduce the static time period threshold.

在一些实施例中,上述计算模块1502还用于从缓存的实时传感器数据中确定出满足调整后的静止时间段阈值的第一传感器数据,得到新的第一传感器数据,并基于新的第一传感器数据确定新的运动数据;若新的运动数据小于或等于调整后的运动阈值,则确定电子设备的目标运动状态为静止状态;若新的运动数据大于调整后的运动阈值,则确定电子设备的目标运动状态为非静止状态。In some embodiments, the above calculation module 1502 is further configured to determine the first sensor data that meets the adjusted static time period threshold from the cached real-time sensor data, obtain new first sensor data, and based on the new first sensor data The sensor data determines new motion data; if the new motion data is less than or equal to the adjusted motion threshold, the target motion state of the electronic device is determined to be a static state; if the new motion data is greater than the adjusted motion threshold, the electronic device is determined The target motion state is a non-stationary state.

在一些实施例中,第一状态判别条件还包括静止时间段阈值;上述计算模块1502还用于若运动数据大于运动阈值,则调整静止时间段阈值;根据调整后的静止时间段阈值、以及第一状态判别条件中除静止时间段阈值之外的其他条件,得到第二状态判别条件。In some embodiments, the first state judging condition further includes a static time period threshold; the above calculation module 1502 is further configured to adjust the static time period threshold if the motion data is greater than the motion threshold; according to the adjusted static time period threshold and the first A second state judging condition is obtained from other conditions except the static time period threshold in the first state judging condition.

在一些实施例中,上述计算模块1502还用于减小静止时间段阈值。In some embodiments, the calculation module 1502 described above is also used to reduce the static time period threshold.

在一些实施例中,上述计算模块1502还用于从缓存的实时传感器数据中确定出满足调整后的静止时间段阈值的第一传感器数据,得到新的第一传感器数据,并基于新的第一传感器数据确定新的运动数据;若新的运动数据小于或等于运动阈值,则确定电子设备的目标运动状态为静止状态;若新的运动数据大于运动阈值,则确定电子设备的目标运动状态为非静止状态。In some embodiments, the above calculation module 1502 is further configured to determine the first sensor data that meets the adjusted static time period threshold from the cached real-time sensor data, obtain new first sensor data, and based on the new first sensor data The sensor data determines new motion data; if the new motion data is less than or equal to the motion threshold, the target motion state of the electronic device is determined to be a static state; if the new motion data is greater than the motion threshold, the target motion state of the electronic device is determined to be non-active. Stationary state.

在一些实施例中,上述计算模块1502还用于检测电子设备的稳定程度;基于电子设备的稳定程度,调整初始状态判别条件,得到第一状态判别条件。In some embodiments, the above calculation module 1502 is further configured to detect the stability of the electronic device; based on the stability of the electronic device, adjust the initial state determination condition to obtain the first state determination condition.

在一些实施例中,上述计算模块1502还用于若初始状态判别条件包括运动阈值,则基于电子设备的稳定程度,调整运动阈值,得到第一状态判别条件;电子设备的稳定程度与运动阈值成负相关;若初始状态判别条件包括静止时间段阈值,则基于电子设备的稳定程度,调整静止时间段阈值,得到第一状态判别条件;电子设备的稳定程度与静止时间段阈值成正相关;若初始状态判别条件包括运动阈值和静止时间段阈值,则基于电子设备的稳定程度,调整运动阈值和静止时间段阈值,得到第一状态判别条件。In some embodiments, the above-mentioned calculation module 1502 is further configured to adjust the motion threshold based on the stability of the electronic device if the initial state determination condition includes a motion threshold, to obtain the first state determination condition; the stability of the electronic device is proportional to the motion threshold Negative correlation; if the initial state discriminating condition includes the static time period threshold, then based on the stability of the electronic equipment, adjust the static time period threshold to obtain the first state discriminating condition; the stability of the electronic equipment is positively correlated with the static time period threshold; if the initial The state discriminating condition includes a motion threshold and a stationary time period threshold, then based on the stability of the electronic device, the motion threshold and the stationary time period threshold are adjusted to obtain the first state discriminating condition.

在一些实施例中,上述计算模块1502还用于判断目标运动状态是否为静止状态,并基于判断结果确定目标校准方式。In some embodiments, the above calculation module 1502 is further configured to determine whether the motion state of the target is a stationary state, and determine the target calibration method based on the judgment result.

在一些实施例中,上述计算模块1502还用于若目标运动状态为静止状态,则确定目标校准方式为第一校准方式;若目标运动状态为非静止状态,则确定目标校准方式为第二校准方式。In some embodiments, the above calculation module 1502 is further configured to determine the target calibration method as the first calibration method if the target motion state is a stationary state; and determine the target calibration method as the second calibration method if the target motion state is a non-stationary state Way.

在一些实施例中,上述计算模块1502还用于基于实时采集的第一传感器数据,确定出离群值范围,并从各个第一传感器数据中确定出处于离群值范围内的离群数据;对离群数据进行处理,得到处理结果,根据处理结果和第一传感器数据中非离群数据,得到更新后的第一传感器数据;基于更新后的第一传感器数据,确定出第一校准方式的目标校准参数。In some embodiments, the above calculation module 1502 is further configured to determine an outlier range based on the first sensor data collected in real time, and determine outlier data within the outlier range from each first sensor data; The outlier data is processed to obtain a processing result, and the updated first sensor data is obtained according to the processing result and the non-outlier data in the first sensor data; based on the updated first sensor data, the first calibration method is determined. Target calibration parameters.

在一些实施例中,上述计算模块1502还用于确定出与离群数据相匹配的非离群值数据;将非离群值数据替换离群数据,得到处理结果。In some embodiments, the above calculation module 1502 is further configured to determine non-outlier data matching the outlier data; replace the non-outlier data with the outlier data to obtain a processing result.

在一些实施例中,上述计算模块1502还用于若电子设备的目标运动状态均为非静止状态,则获取历史校准参数作为第二校准方式的目标校准参数,历史校准参数是基于历史静止状态下的传感器数据确定,历史静止状态是基于历史时刻采集的实时传感器数据确定的。In some embodiments, the above-mentioned calculation module 1502 is further configured to obtain historical calibration parameters as the target calibration parameters of the second calibration method if the target motion states of the electronic device are all non-stationary states, and the historical calibration parameters are based on the historical static state. The historical static state is determined based on real-time sensor data collected at historical moments.

在一些实施例中,上述校准模块1504还用于响应于电子设备进入装配节点或者空闲时间段,获取电子设备实时采集的第四传感器数据;根据第四传感器数据确定电子设备的历史运动状态;在历史运动状态为静止状态的情况下,基于实时采集的第四传感器数据确定目标校准参数。In some embodiments, the above calibration module 1504 is further configured to acquire fourth sensor data collected in real time by the electronic device in response to the electronic device entering an assembly node or an idle time period; determine the historical motion state of the electronic device according to the fourth sensor data; When the historical motion state is a static state, the target calibration parameter is determined based on the fourth sensor data collected in real time.

基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的防抖方法的防抖装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个防抖装置实施例中的具体限定可以参见上文中对于防抖方法的限定,在此不再赘述。Based on the same inventive concept, an embodiment of the present application further provides an anti-shake device for implementing the above-mentioned anti-shake method. The implementation solution provided by the device for solving the problem is similar to the implementation solution described in the above method, so the specific limitations in one or more embodiments of the anti-shake device provided below can refer to the above limitations on the anti-shake method, It is not repeated here.

在一些实施例中,如图16所示,提供了一种传感器数据的校准装置,包括:获取模块1602、确定模块1604和防抖模块1606,其中:In some embodiments, as shown in FIG. 16, a sensor data calibration apparatus is provided, including: an acquisition module 1602, a determination module 1604 and an anti-shake module 1606, wherein:

获取模块1602,用于在电子设备的拍摄场景中,获取校准后的传感器数据;校准后的传感器数据是根据上述的传感器数据的校准方法得到。The acquiring module 1602 is configured to acquire calibrated sensor data in the shooting scene of the electronic device; the calibrated sensor data is obtained according to the above-mentioned sensor data calibration method.

确定模块1604,用于基于校准后的传感器数据,确定防抖补偿量。The determining module 1604 is configured to determine the anti-shake compensation amount based on the calibrated sensor data.

防抖模块1606,用于基于防抖补偿量对摄像模组进行抖动补偿。The anti-shake module 1606 is configured to perform jitter compensation on the camera module based on the anti-shake compensation amount.

上述防抖装置,并且,该传感器数据的校准过程和光学防抖过程处于同个闭环系统中,避免随着时间推移带来数据上的偏差,以及校准过程和光学防抖过程处于不同空间带来的偏差,可以提高校准的准确性。在提高传感器数据的校准精度的同时,该校准后的传感器数据也用于进行防抖,提高了防抖算法的性能,提升了生成的画面的画质表现力,可以赋能更高的产品表现力。The above-mentioned anti-shake device, and the calibration process of the sensor data and the optical anti-shake process are in the same closed-loop system, to avoid data deviation over time, and the calibration process and the optical anti-shake process are brought in different spaces. The deviation can improve the accuracy of calibration. While improving the calibration accuracy of the sensor data, the calibrated sensor data is also used for anti-shake, which improves the performance of the anti-shake algorithm, improves the image quality and expressiveness of the generated image, and can enable higher product performance. force.

可选地,电子设备可以在拍摄场景中,实时获取校准后的传感器数据,基于该传感器数据实时对摄像模组进行抖动补偿,可以增加抖动补偿的时效性;并且若该校准后的传感器是基于第一校准方式的目标校准参数确定的,该目标校准参数是在拍摄场景中实时采集的第一传感器数据确定的,那么该目标校准参数也考虑了当前的拍摄场景的影响因素,可以对传感器数据进行校准,得到更准确的传感器数据,从而对摄像模组更准确进行抖动补偿。Optionally, the electronic device can acquire calibrated sensor data in real time in the shooting scene, and perform shake compensation on the camera module in real time based on the sensor data, which can increase the timeliness of shake compensation; and if the calibrated sensor is based on The target calibration parameter of the first calibration method is determined, and the target calibration parameter is determined by the first sensor data collected in real time in the shooting scene, then the target calibration parameter also takes the influencing factors of the current shooting scene into consideration, and can affect the sensor data. Perform calibration to obtain more accurate sensor data, so as to more accurately perform shake compensation for the camera module.

上述传感器数据的校准装置或防抖装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于电子设备中的处理器中,也可以以软件形式存储于电子设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。Each module in the above-mentioned sensor data calibration device or the anti-shake device can be implemented in whole or in part by software, hardware and combinations thereof. The above modules can be embedded in or independent of the processor in the electronic device in the form of hardware, or stored in the memory in the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

在一些实施例中,提供了一种摄像模组,包括存储器及处理器,存储器中储存有计算机程序,计算机程序被处理器执行时,使得处理器执行如上述的传感器数据的校准方法的步骤,或上述的防抖方法的步骤。In some embodiments, a camera module is provided, comprising a memory and a processor, a computer program is stored in the memory, and when the computer program is executed by the processor, the processor is made to perform the steps of the above-mentioned method for calibrating sensor data, Or the steps of the above anti-shake method.

可选地,提供了一种摄像模组,该摄像模组根据上述的防抖方法进行防抖。可选地,摄像模组包括镜头、图像传感器、第一马达和第二马达,第一马达根据第一防抖补偿量控制镜头进行抖动补偿,第二马达根据第二防抖补偿量控制图像传感器进行抖动补偿;在抖动补偿的过程中,穿透镜头的光线投射至图像传感器中,可以通过图像传感器将光线的光信号转换为电信号,生成图像。Optionally, a camera module is provided, and the camera module performs anti-shake according to the above-mentioned anti-shake method. Optionally, the camera module includes a lens, an image sensor, a first motor and a second motor, the first motor controls the lens to perform shake compensation according to the first anti-shake compensation amount, and the second motor controls the image sensor according to the second anti-shake compensation amount. Perform shake compensation; in the process of shake compensation, the light passing through the lens is projected into the image sensor, and the light signal of the light can be converted into an electrical signal by the image sensor to generate an image.

在一些实施例中,提供了一种电子设备,该电子设备可以是终端,其内部结构图可以如图17所示。该电子设备包括处理器、存储器、输入/输出接口、通信接口、显示单元和输入装置。其中,处理器、存储器和输入/输出接口通过系统总线连接,通信接口、显示单元和输入装置通过输入/输出接口连接到系统总线。其中,该电子设备的处理器用于提供计算和控制能力。该电子设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该电子设备的输入/输出接口用于处理器与外部设备之间交换信息。该电子设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、移动蜂窝网络、NFC(近场通信)或其他技术实现。该计算机程序被处理器执行时以实现一种传感器数据的校准方法或防抖方法。该电子设备的显示单元用于形成视觉可见的画面,可以是显示屏、投影装置或虚拟现实成像装置。显示屏可以是液晶显示屏或者电子墨水显示屏,该电子设备的输入装置可以是显示屏上覆盖的触摸层,也可以是电子设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。In some embodiments, an electronic device is provided, and the electronic device may be a terminal, and the internal structure diagram thereof may be as shown in FIG. 17 . The electronic device includes a processor, a memory, an input/output interface, a communication interface, a display unit and an input device. Wherein, the processor, the memory and the input/output interface are connected through the system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The nonvolatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the execution of the operating system and computer programs in the non-volatile storage medium. The input/output interface of the electronic device is used for exchanging information between the processor and external devices. The communication interface of the electronic device is used for wired or wireless communication with an external terminal, and the wireless communication can be realized by WIFI, mobile cellular network, NFC (Near Field Communication) or other technologies. The computer program, when executed by the processor, implements a sensor data calibration method or an anti-shake method. The display unit of the electronic device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen may be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device may be a touch layer covered on the display screen, or a button, a trackball or a touchpad set on the shell of the electronic device, or a An external keyboard, trackpad, or mouse, etc.

本领域技术人员可以理解,图17中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的电子设备的限定,具体的电子设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 17 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the electronic device to which the solution of the present application is applied. The specific electronic device may be Include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.

本申请实施例还提供了一种计算机可读存储介质。一个或多个包含计算机可执行指令的非易失性计算机可读存储介质,当所述计算机可执行指令被一个或多个处理器执行时,使得所述处理器执行传感器数据的校准方法或防抖方法的步骤。Embodiments of the present application also provide a computer-readable storage medium. One or more non-transitory computer-readable storage media containing computer-executable instructions that, when executed by one or more processors, cause the processors to perform a method of calibrating or preventing sensor data. The steps of the shaking method.

本申请实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行传感器数据的校准方法或防抖方法。Embodiments of the present application also provide a computer program product containing instructions, which, when run on a computer, cause the computer to execute a sensor data calibration method or an anti-shake method.

需要说明的是,本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据,且相关数据的收集、使用和处理需要遵守相关国家和地区的相关法律法规和标准。It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all It is the information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-OnlyMemory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic RandomAccess Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage In the medium, when the computer program is executed, it may include the processes of the above-mentioned method embodiments. Wherein, any reference to a memory, a database or other media used in the various embodiments provided in this application may include at least one of a non-volatile memory and a volatile memory. Non-volatile memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetic variable memory (Magnetoresistive Random Memory) Access Memory, MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory may include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration and not limitation, the RAM may be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM). The database involved in the various embodiments provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a blockchain-based distributed database, etc., but is not limited thereto. The processors involved in the various embodiments provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, data processing logic devices based on quantum computing, etc., and are not limited to this.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features It is considered to be the range described in this specification.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are relatively specific and detailed, but should not be construed as a limitation on the scope of the patent of the present application. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the present application should be determined by the appended claims.

Claims (29)

1. A method of calibrating sensor data, the method comprising:
determining a target motion state of the electronic equipment based on the first sensor data acquired in real time;
determining a target calibration mode according to the target motion state; the target calibration mode comprises a first calibration mode or a second calibration mode, target calibration parameters of the first calibration mode are determined based on the first sensor data, and target calibration parameters of the second calibration mode are determined based on sensor data in historical static states;
and calibrating the second sensor data acquired by the electronic equipment in real time based on the target calibration parameters of the target calibration mode.
2. The method of claim 1, wherein determining the target calibration mode based on the determination comprises:
if the judgment result shows that the target motion state is a static state, determining that the target calibration mode is a first calibration mode;
and if the judgment result shows that the target motion state is a non-static state, determining that the target calibration mode is a second calibration mode.
3. The method of claim 2, wherein determining the target motion state of the electronic device based on the first sensor data collected in real-time comprises:
according to a preset static time period threshold value, acquiring first sensor data meeting the static time period threshold value from cached real-time sensor data;
based on the first sensor data, a target motion state of the electronic device is determined.
4. The method of claim 3, wherein the real-time sensor data is data buffered in a first-in-first-out queue in real-time; the acquiring, according to a preset stationary time period threshold, first sensor data meeting the stationary time period threshold from the cached real-time sensor data includes:
acquiring the data length in the first-in first-out queue corresponding to the current moment;
according to the relation between the data length and the acquisition time length, the acquisition time length corresponding to the data length is determined, and under the condition that the acquisition time length meets the static time period threshold, first sensor data meeting the static time period threshold are obtained.
5. The method of claim 3, wherein determining a target motion state of an electronic device from the first sensor data comprises:
determining motion data corresponding to the first sensor data according to the first sensor data;
and determining the target motion state of the electronic equipment based on the motion data and the first state discrimination condition.
6. The method of claim 5, wherein the first state discrimination condition comprises a motion threshold; the determining the target motion state of the electronic device based on the motion data and the first state discrimination condition includes:
if the motion data is smaller than or equal to the motion threshold, determining that the target motion state of the electronic equipment is a static state;
and if the motion data is larger than the motion threshold, adjusting the first state judgment condition to a second state judgment condition, and determining the target motion state of the electronic equipment based on the second state judgment condition.
7. The method of claim 6, wherein the first sensor data is data collected by an inertial measurement unit comprising at least 1 sensor, each sensor comprising at least 2 axes of data; the motion data comprises a plurality of first motion data, the data collected by each axis corresponds to at least 1 first motion data, and each first motion data corresponds to 1 motion threshold;
if the motion data is less than or equal to the motion threshold, determining that the target motion state of the electronic device is a static state, including:
and if the first motion data are less than or equal to the corresponding motion threshold values, determining that the target motion state of the electronic equipment is a static state.
8. The method of claim 7, wherein the adjusting the first state discrimination condition to a second state discrimination condition if the motion data is greater than the motion threshold comprises:
if second motion data larger than the corresponding motion threshold exists in each first motion data, determining the quantity of the second motion data;
if the number is smaller than a preset number threshold, adjusting a motion threshold corresponding to the second motion data, and obtaining a second state judgment condition based on the adjusted motion threshold and a condition except the adjusted motion threshold in the first judgment condition.
9. The method of claim 8, wherein the adjusting the motion threshold corresponding to the second motion data comprises: and increasing the motion threshold corresponding to the second motion data.
10. The method of claim 8, wherein determining the target motion state of the electronic device based on the second state discrimination condition comprises:
if each second motion data is smaller than or equal to the corresponding adjusted motion threshold, determining that the target motion state of the electronic equipment is a static state;
and if the second motion data are larger than the corresponding adjusted motion threshold, determining that the target motion state of the electronic equipment is a non-static state.
11. The method of claim 8, wherein the first state discrimination condition further comprises a quiescent period threshold; the obtaining a second state discrimination condition based on the adjusted motion threshold and a condition other than the adjusted motion threshold in the first discrimination condition includes:
if the motion state of the electronic equipment is determined to be a non-static state based on the adjusted motion threshold, adjusting the static time period threshold;
and obtaining a second state discrimination condition according to the adjusted motion threshold, the adjusted stationary time period threshold and other conditions except the adjusted motion threshold and stationary time period threshold in the first state discrimination condition.
12. The method of claim 11, wherein the adjusting the inactivity time period threshold comprises: decreasing the quiescent period threshold.
13. The method of claim 11, wherein the determining a target motion state of the electronic device based on the second state discrimination condition comprises:
determining first sensor data meeting the adjusted stationary time period threshold value from the cached real-time sensor data to obtain new first sensor data, and determining new motion data based on the new first sensor data;
if the new motion data is smaller than or equal to the adjusted motion threshold, determining that the target motion state of the electronic equipment is a static state;
and if the new motion data is larger than the adjusted motion threshold, determining that the target motion state of the electronic equipment is a non-static state.
14. The method of claim 6, wherein the first state discrimination condition further comprises a quiescent period threshold; if the motion data is greater than the motion threshold, adjusting the first state discrimination condition to a second state discrimination condition, including:
if the motion data is larger than the motion threshold, adjusting the stationary time period threshold; and obtaining a second state discrimination condition according to the adjusted stationary time period threshold value and other conditions except the stationary time period threshold value in the first state discrimination condition.
15. The method of claim 14, wherein the adjusting the inactivity time period threshold comprises: decreasing the quiescent period threshold.
16. The method of claim 14, wherein determining the target motion state of the electronic device based on the second state discrimination condition comprises:
determining first sensor data meeting the adjusted stationary time period threshold value from the cached real-time sensor data to obtain new first sensor data, and determining new motion data based on the new first sensor data;
if the new motion data is smaller than or equal to the motion threshold, determining that the target motion state of the electronic equipment is a static state;
and if the new motion data is larger than the motion threshold, determining that the target motion state of the electronic equipment is a non-static state.
17. The method of claim 5, further comprising:
detecting the stability degree of the electronic equipment;
and adjusting an initial state judgment condition based on the stability degree of the electronic equipment to obtain the first state judgment condition.
18. The method of claim 17, wherein adjusting an initial state discrimination condition based on the degree of stability of the electronic device to obtain the first state discrimination condition comprises:
if the initial state discrimination condition comprises a motion threshold, adjusting the motion threshold based on the stability degree of the electronic equipment to obtain the first state discrimination condition; a degree of stability of the electronic device is inversely related to the motion threshold;
if the initial state discrimination condition comprises a stationary time period threshold, adjusting the stationary time period threshold based on the stability degree of the electronic equipment to obtain the first state discrimination condition; the degree of stability of the electronic device is positively correlated with the stationary time period threshold;
if the initial state discrimination condition includes a motion threshold and a stationary time period threshold, the motion threshold and the stationary time period threshold are adjusted based on the stability of the electronic device to obtain the first state discrimination condition.
19. The method according to claim 1, wherein the determining of the target calibration parameter of the first calibration mode comprises:
determining an outlier range based on the first sensor data collected in real time, and determining outlier data in the outlier range from each first sensor data;
processing the outlier data to obtain a processing result, and obtaining updated first sensor data according to the processing result and non-outlier data in the first sensor data;
and determining a target calibration parameter of the first calibration mode based on the updated first sensor data.
20. The method of claim 19, wherein said processing the outlier data to obtain a processed result comprises:
determining non-outlier data matched with the outlier data;
and replacing the outlier data with the non-outlier value data to obtain a processing result.
21. The method of claim 1, wherein the second calibration mode comprises a target calibration parameter determination mode that includes:
if the target motion states of the electronic equipment are all non-static states, acquiring historical calibration parameters as target calibration parameters of the second calibration mode, wherein the historical calibration parameters are determined based on sensor data in historical static states, and the historical static states are determined based on real-time sensor data acquired at historical moments.
22. The method of any of claims 1 to 21, wherein determining the target calibration parameters for the second calibration mode comprises:
responding to the electronic equipment entering an assembly node or an idle time period, and acquiring the fourth sensor data acquired in real time;
determining a historical motion state of the electronic device from the fourth sensor data;
and determining a target calibration parameter based on the fourth sensor data acquired in real time under the condition that the historical motion state is a static state.
23. An anti-shaking method, characterized in that the method comprises:
acquiring calibrated sensor data in a shooting scene of the electronic equipment; the calibrated sensor data is obtained according to the method of any one of claims 1 to 22;
determining an anti-shake compensation amount based on the calibrated sensor data;
and carrying out shake compensation on the camera module based on the shake-proof compensation quantity.
24. An apparatus for calibrating sensor data, comprising:
the computing module is used for determining the target motion state of the electronic equipment based on the first sensor data collected in real time;
the calculation module is also used for determining a target calibration mode according to the target motion state; the target calibration mode comprises a first calibration mode or a second calibration mode, target calibration parameters of the first calibration mode are determined based on the first sensor data, and target calibration parameters of the second calibration mode are determined based on sensor data in historical static states;
and the calibration module is used for calibrating the second sensor data acquired by the electronic equipment in real time based on the target calibration parameters of the target calibration mode.
25. An anti-shake apparatus, comprising:
the acquisition module is used for acquiring calibrated sensor data in a shooting scene of the electronic equipment; the calibrated sensor data is obtained according to the method of any one of claims 1 to 22;
a determining module, configured to determine an anti-shake compensation amount based on the calibrated sensor data;
and the anti-shake module is used for carrying out shake compensation on the camera module based on the anti-shake compensation quantity.
26. A camera module comprising a memory and a processor, the memory having stored thereon a computer program, wherein the computer program, when executed by the processor, causes the processor to perform the steps of the method of calibrating sensor data according to any one of claims 1 to 22, or the steps of the anti-shake method according to claim 23.
27. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program, wherein the computer program, when executed by the processor, causes the processor to carry out the steps of the method of calibrating sensor data according to any one of claims 1 to 22, or the steps of the anti-shake method according to claim 23.
28. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method for calibration of sensor data according to any one of claims 1 to 22, or the steps of the anti-shake method according to claim 23.
29. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, carries out the steps of the calibration method of sensor data of any one of claims 1 to 22, or the steps of the anti-shake method of claim 23.
CN202210607428.7A 2022-05-31 2022-05-31 Calibration method and device of sensor data, anti-shake method and camera module Active CN115014421B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210607428.7A CN115014421B (en) 2022-05-31 2022-05-31 Calibration method and device of sensor data, anti-shake method and camera module

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210607428.7A CN115014421B (en) 2022-05-31 2022-05-31 Calibration method and device of sensor data, anti-shake method and camera module

Publications (2)

Publication Number Publication Date
CN115014421A true CN115014421A (en) 2022-09-06
CN115014421B CN115014421B (en) 2025-09-16

Family

ID=83070389

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210607428.7A Active CN115014421B (en) 2022-05-31 2022-05-31 Calibration method and device of sensor data, anti-shake method and camera module

Country Status (1)

Country Link
CN (1) CN115014421B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024146450A1 (en) * 2023-01-06 2024-07-11 华为技术有限公司 Signal processing method, apparatus and system
CN118695278A (en) * 2024-08-23 2024-09-24 深圳健路网络科技有限责任公司 A real-time calibration device and method for DT road test signaling acquisition time

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009077021A (en) * 2007-09-19 2009-04-09 Casio Comput Co Ltd Imaging apparatus, camera shake detection element calibration execution method, and program
CN108038085A (en) * 2017-12-27 2018-05-15 世纪龙信息网络有限责任公司 The data calibration method and device of real-time task
CN111246108A (en) * 2020-02-05 2020-06-05 Oppo广东移动通信有限公司 Hall sensor calibration method and device and anti-shake method and device
CN112197791A (en) * 2020-09-15 2021-01-08 武汉华中天纬测控有限公司 Method for correcting drift error of isolating switch monitoring equipment
CN114295147A (en) * 2021-12-17 2022-04-08 杭州海康威视数字技术股份有限公司 Dynamic calibration method, device and equipment for holder

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009077021A (en) * 2007-09-19 2009-04-09 Casio Comput Co Ltd Imaging apparatus, camera shake detection element calibration execution method, and program
CN108038085A (en) * 2017-12-27 2018-05-15 世纪龙信息网络有限责任公司 The data calibration method and device of real-time task
CN111246108A (en) * 2020-02-05 2020-06-05 Oppo广东移动通信有限公司 Hall sensor calibration method and device and anti-shake method and device
CN112197791A (en) * 2020-09-15 2021-01-08 武汉华中天纬测控有限公司 Method for correcting drift error of isolating switch monitoring equipment
CN114295147A (en) * 2021-12-17 2022-04-08 杭州海康威视数字技术股份有限公司 Dynamic calibration method, device and equipment for holder

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024146450A1 (en) * 2023-01-06 2024-07-11 华为技术有限公司 Signal processing method, apparatus and system
CN118695278A (en) * 2024-08-23 2024-09-24 深圳健路网络科技有限责任公司 A real-time calibration device and method for DT road test signaling acquisition time
CN118695278B (en) * 2024-08-23 2024-11-15 深圳健路网络科技有限责任公司 A real-time calibration device and method for DT road test signaling acquisition time

Also Published As

Publication number Publication date
CN115014421B (en) 2025-09-16

Similar Documents

Publication Publication Date Title
US9316513B2 (en) System and method for calibrating sensors for different operating environments
EP3449624B1 (en) Electronic image stabilization frequency estimator
CN115014421A (en) Calibration method and device of sensor data, anti-shake method and camera module
TWI766282B (en) Calibration method, electronic equipment and storage medium
US20150062178A1 (en) Tilting to scroll
CN105830427A (en) Apply video stabilization to multimedia clips
US12046007B2 (en) Method for processing event data flow and computing device
US20150062179A1 (en) Tilting to scroll
CN111933207B (en) Slow disk identification method, device, electronic device and storage device
CN109919116B (en) Scene recognition method, device, electronic device and storage medium
US10558261B1 (en) Sensor data compression
CN111625764B (en) Mobile data calibration method, device, electronic equipment and storage medium
JP2014199964A (en) Imaging apparatus and image processing apparatus
CN108827341A (en) The method of the deviation in Inertial Measurement Unit for determining image collecting device
CN115701125B (en) Image anti-shake method and electronic equipment
WO2024141097A1 (en) Method and apparatus for correcting relative attitude of user equipment and target device
US11500413B2 (en) Headset clock synchronization
CN108020374B (en) Air pressure value determination method and device
CN118984391B (en) Sampling rate adjustment method, device, computer equipment, and storage medium
CN110660087A (en) Light perception correction method, device, electronic device and storage medium
CN117288151B (en) Three-dimensional attitude determination method and device of projection equipment and electronic equipment
CN113489878A (en) Electronic device, information synchronization method, and computer-readable storage medium
CN114979456B (en) Anti-shake processing method and device for video data, computer equipment and storage medium
CN104135622B (en) A kind of method, device and mobile terminal of combination gyroscope optimization snap
CN119182899B (en) Panoramic video display control method, device, computer equipment, and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载