WO2021047435A1 - 一种电子设备及传感器控制方法 - Google Patents

一种电子设备及传感器控制方法 Download PDF

Info

Publication number
WO2021047435A1
WO2021047435A1 PCT/CN2020/113098 CN2020113098W WO2021047435A1 WO 2021047435 A1 WO2021047435 A1 WO 2021047435A1 CN 2020113098 W CN2020113098 W CN 2020113098W WO 2021047435 A1 WO2021047435 A1 WO 2021047435A1
Authority
WO
WIPO (PCT)
Prior art keywords
sensor
light sensor
ambient light
electronic device
tof
Prior art date
Application number
PCT/CN2020/113098
Other languages
English (en)
French (fr)
Inventor
韩萍
蒋淏苇
康力
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP20863531.8A priority Critical patent/EP4020268A4/en
Priority to US17/642,429 priority patent/US20220342074A1/en
Publication of WO2021047435A1 publication Critical patent/WO2021047435A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01SRADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
    • G01S17/00Systems using the reflection or reradiation of electromagnetic waves other than radio waves, e.g. lidar systems
    • G01S17/86Combinations of lidar systems with systems other than lidar, radar or sonar, e.g. with direction finders
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01SRADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
    • G01S17/00Systems using the reflection or reradiation of electromagnetic waves other than radio waves, e.g. lidar systems
    • G01S17/88Lidar systems specially adapted for specific applications
    • G01S17/89Lidar systems specially adapted for specific applications for mapping or imaging
    • G01S17/8943D imaging with simultaneous measurement of time-of-flight at a 2D array of receiver pixels, e.g. time-of-flight cameras or flash lidar
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01JMEASUREMENT OF INTENSITY, VELOCITY, SPECTRAL CONTENT, POLARISATION, PHASE OR PULSE CHARACTERISTICS OF INFRARED, VISIBLE OR ULTRAVIOLET LIGHT; COLORIMETRY; RADIATION PYROMETRY
    • G01J1/00Photometry, e.g. photographic exposure meter
    • G01J1/42Photometry, e.g. photographic exposure meter using electric radiation detectors
    • G01J1/4204Photometry, e.g. photographic exposure meter using electric radiation detectors with determination of ambient light
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01SRADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
    • G01S17/00Systems using the reflection or reradiation of electromagnetic waves other than radio waves, e.g. lidar systems
    • G01S17/02Systems using the reflection of electromagnetic waves other than radio waves
    • G01S17/06Systems determining position data of a target
    • G01S17/08Systems determining position data of a target for measuring distance only
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01SRADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
    • G01S17/00Systems using the reflection or reradiation of electromagnetic waves other than radio waves, e.g. lidar systems
    • G01S17/02Systems using the reflection of electromagnetic waves other than radio waves
    • G01S17/06Systems determining position data of a target
    • G01S17/08Systems determining position data of a target for measuring distance only
    • G01S17/10Systems determining position data of a target for measuring distance only using transmission of interrupted, pulse-modulated waves
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01SRADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
    • G01S17/00Systems using the reflection or reradiation of electromagnetic waves other than radio waves, e.g. lidar systems
    • G01S17/88Lidar systems specially adapted for specific applications
    • G01S17/89Lidar systems specially adapted for specific applications for mapping or imaging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • G06T7/514Depth or shape recovery from specularities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/64Three-dimensional objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/172Classification, e.g. identification
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/44Receiver circuitry for the reception of television signals according to analogue transmission standards
    • H04N5/57Control of contrast or brightness
    • H04N5/58Control of contrast or brightness in dependence upon ambient light
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • G06F21/32User authentication using biometric data, e.g. fingerprints, iris scans or voiceprints

Definitions

  • This application relates to the field of electronic equipment, and in particular to an electronic equipment and a sensor control method.
  • Three-dimensional (3dimensions, 3D) imaging technology is a technology that extracts the 3D information of an object through optical means, and restores the 3D features of the object as much as possible during the reconstruction process.
  • accurate acquisition of depth information is the key to 3D imaging technology.
  • Time of flight (TOF) sensors are most used in 3D imaging technology because they can obtain depth information with high efficiency and high quality.
  • the working principle of the TOF sensor is: to continuously send infrared light pulses (such as light pulses with a wavelength of 940nm) to the object, and then receive the infrared light pulses reflected from the object, and calculate the distance between the infrared light pulse and the object by detecting the flight time of the infrared light pulse. Distance, thereby generating depth information.
  • 3D imaging technology has been widely used in electronic devices such as mobile phones.
  • a mobile phone can use a TOF sensor for 3D imaging to realize a 3D face unlock function.
  • the camera of a mobile phone uses a TOF sensor to assist in focusing, and judges the depth of field when taking pictures to achieve background blurring.
  • TOF sensors not only TOF sensors, but also light sensors, such as ambient light sensors (ALS), proximity light sensors (PS), etc.
  • ALS ambient light sensors
  • PS proximity light sensors
  • the electronic device can realize functions such as automatically adjusting the screen brightness and automatically turning off the screen.
  • the TOF sensor is turned on, the infrared light pulse emitted by it is reflected by the object, and it will not only illuminate the TOF sensor, but also the light sensor of the electronic device, which affects the data measured by the light sensor. Accuracy.
  • the embodiment of the application provides an electronic device and a sensor control method, which solves the problem that the infrared light pulse emitted by the TOF sensor when the TOF sensor is turned on is reflected by the object and irradiated on the light sensor of the electronic device, which affects the accuracy of the data measured by the light sensor The problem.
  • an embodiment of the present application provides an electronic device that includes a processor, and a TOF sensor, an ambient light sensor, and a proximity light sensor coupled to the processor, wherein: the TOF sensor, the ambient light sensor, and the proximity light sensor Located on the same side of the electronic device; the processor is used to control the ambient light sensor and proximity light sensor to turn off when the TOF sensor is turned on; the processor is used to control the ambient light sensor and proximity light when the TOF sensor is turned off The sensor is turned on.
  • the light sensor (such as the ambient light sensor and the proximity light sensor) can be controlled to turn off.
  • the light sensor can be controlled to turn on. In order to avoid the infrared light pulse emitted when the TOF sensor is turned on, which will affect the accuracy of the light sensor's measurement data. This avoids false triggering of the corresponding functions of the mobile phone, and can also improve the user experience.
  • the processor is coupled to the TOF sensor through the GPIO pin, the processor is coupled to the ambient light sensor through the first interface, and the proximity light sensor is coupled through the second interface; wherein, the first interface and the second interface are coupled to the proximity light sensor.
  • the interface can be an I2C interface.
  • the processor is also used to output the first level (such as high level) to the TOF sensor through the GPIO pin, and is used to control the TOF sensor to turn on; the processor is used to control the ambient light sensor and the TOF sensor when the TOF sensor is turned on.
  • the closing of the proximity light sensor includes a processor, which is used to control the ambient light sensor to be turned off through the first interface and to control the proximity light sensor to turn off through the second interface when the first level is output to the TOF sensor through the GPIO pin.
  • the processor is also used to control the TOF sensor to turn off when the second level (such as low level) is output to the TOF sensor through the GPIO pin; the processor is used to switch the TOF sensor off.
  • control the ambient light sensor and the proximity light sensor to turn on including: a processor, used to control the ambient light sensor to turn on through the first interface when the second level is output to the TOF sensor through the GPIO pin, and through the second interface The interface controls the proximity light sensor to open.
  • the processor is used to control the ambient light sensor and the proximity light sensor to turn off when the TOF sensor is turned on, including: a processor, which is used to control the ambient light when the TOF sensor is enabled The sensor and the proximity light sensor are turned off; the processor is used to control the ambient light sensor and the proximity light sensor to turn on when the TOF sensor is turned off, including: the processor is used to control the ambient light sensor and the proximity light sensor when the TOF sensor is not enabled The proximity light sensor is turned on.
  • the electronic device can control the light sensor to turn off or on according to the enabled state of the TOF sensor (the enabled state may be enabled or not).
  • the TOF sensor emits infrared light pulses. In order to control the light sensor to turn off when the TOF sensor emits infrared light pulses.
  • the processor is also configured to generate a first command when it is determined that the application needs the TOF sensor to assist in implementing the function, and control the TOF sensor to be enabled by the first drive according to the first command.
  • the first drive is To drive the TOF sensor, the first drive can be called TOF sensor drive; the above-mentioned processor is used to control the ambient light sensor and the proximity light sensor to turn off when the TOF sensor is enabled, and includes: a processor for passing through according to the first command
  • the second drive controls the ambient light sensor to turn off, and the third drive controls the proximity light sensor to turn off according to the first command.
  • the second drive is the drive of the ambient light sensor, and the third drive is the drive of the proximity light sensor.
  • the processor may generate the above-mentioned first command.
  • the processor may generate the above-mentioned first command.
  • the processor is further configured to generate a second command when it is determined that the application (such as the aforementioned 3D face unlocking application or camera application) exits, and to control the TOF sensor through the first drive according to the second command Disabled; processor, used to control the ambient light sensor and proximity light sensor to turn on when the TOF sensor is not enabled, including: processor, used to drive the second command according to the second command after the TOF sensor is disabled The ambient light sensor is controlled to be turned on, and the proximity light sensor is controlled to be turned on by the third drive according to the second command.
  • the enable state (such as enabled or disabled) of the TOF sensor can be obtained by using a software solution, so that the light sensor can be controlled to turn off when the TOF sensor is enabled, that is, when infrared light pulses are emitted outward.
  • the TOF sensor is not enabled, control the light sensor to turn on.
  • an electronic device which may include a processor, and a TOF sensor, an ambient light sensor, and a proximity light sensor coupled to the processor, wherein: the TOF sensor, the ambient light sensor, and the proximity light sensor.
  • the sensor is located on the same side of the electronic device; the processor discards the data measured by the ambient light sensor and the proximity light sensor when the TOF sensor is turned on; when the TOF sensor is turned off, it realizes the electronic device according to the data measured by the ambient light sensor.
  • the first function is to implement the second function of the electronic device according to the data measured by the proximity light sensor when the TOF sensor is turned off.
  • the first function may be to automatically adjust the screen brightness
  • the second function may be to determine whether there is an object near the mobile phone.
  • the TOF sensor when the TOF sensor is turned on, the data measured by the light sensor is discarded, and the data measured by the light sensor when the TOF sensor is turned off is used. In this way, false triggering of the corresponding functions of the mobile phone can be avoided, and the user experience can also be improved.
  • the processor determines the proportion of infrared components in the ambient light based on the data output by the ambient light sensor; the processor discards the ambient light sensor and proximity light sensor measurements when the TOF sensor is turned on
  • the data includes: the processor, when determining that the proportion of the infrared component in the ambient light is greater than the threshold, discards the data measured by the ambient light sensor and the proximity light sensor; the processor, when the TOF sensor is turned off, according to the ambient light sensor measurement The data realizes the first function of the electronic device.
  • the second function of the electronic device is realized according to the data measured by the proximity light sensor, including: a processor that determines that the proportion of infrared components in the ambient light is less than the threshold
  • the first function is realized according to the data measured by the ambient light sensor
  • the second function is realized according to the data measured by the proximity light sensor. In this way, by monitoring the proportion of infrared components in the ambient light, it can be determined whether the TOF sensor is on or off.
  • the processor determines the proportion of the infrared component in the ambient light, including: the processor, according to the ambient light output by the ambient light sensor and the red R channel light Intensity, the light intensity of the green G channel, the light intensity of the blue B channel and the light intensity of the custom C channel, determine the infrared light intensity of the ambient light, and determine the ambient light mid-infrared according to the infrared light intensity and the light intensity of the C channel
  • the percentage of ingredients can be used to determine the intensity of infrared light in the ambient light.
  • IR represents the light intensity of IR in the ambient light.
  • R represents the light intensity of the R channel in the ambient light.
  • G represents the light intensity of the G channel in the ambient light.
  • B represents the light intensity of the B channel in the ambient light.
  • C represents the light intensity of the C channel in the ambient light.
  • the embodiments of the present application provide a sensor control method, which can be applied to an electronic device, and the electronic device can include a TOF sensor, an ambient light sensor, and a proximity light sensor, a TOF sensor, an ambient light sensor, and a proximity light sensor.
  • the sensor is located on the same side of the electronic device; the method may include: when the TOF sensor is turned on, the electronic device controls the ambient light sensor and the proximity light sensor to turn off; when the TOF sensor is turned off, the electronic device controls the ambient light sensor and the proximity light The sensor is turned on.
  • the method may further include: the electronic device outputs the first level to the TOF sensor to control the TOF sensor to turn on; when the TOF sensor is turned on, the above electronic device controls the ambient light sensor and proximity Turning off the light sensor includes: when the electronic device outputs the first level to the TOF sensor, controlling the ambient light sensor and the proximity light sensor to turn off.
  • the method may further include: when the electronic device outputs the second level to the TOF sensor, it is used to control the TOF sensor to turn off; when the TOF sensor is turned off, the above electronic device controls the ambient light sensor and Turning on the proximity light sensor includes: when the electronic device outputs the second level to the TOF sensor, controlling the ambient light sensor and the proximity light sensor to turn on.
  • the above electronic device controls the ambient light sensor and the proximity light sensor to turn off when the TOF sensor is turned on, including: when the TOF sensor is enabled, the electronic device controls the ambient light sensor and the proximity light sensor Turn off; the above electronic device controls the ambient light sensor and the proximity light sensor to turn on when the TOF sensor is turned off, including: the electronic device controls the ambient light sensor and the proximity light sensor to turn on when the TOF sensor is not enabled.
  • the method may further include: when the electronic device determines that the application requires the TOF sensor to assist in realizing the function, generating a first command, and controlling the TOF sensor to be enabled through the first drive according to the first command.
  • the driver is the driver of the TOF sensor; when the TOF sensor is enabled, the above electronic device controls the ambient light sensor and the proximity light sensor to turn off, including: the electronic device controls the ambient light sensor to turn off according to the first command through the second drive, and passes according to the first command
  • the third drive controls the proximity light sensor to turn off, the second drive is the drive of the ambient light sensor, and the third drive is the drive of the proximity light sensor.
  • the method may further include: when the electronic device determines that the application exits, generating a second command, and controlling the TOF sensor to disable the enablement by the first driver according to the second command; the electronic device is in the TOF sensor When it is not enabled, control the ambient light sensor and proximity light sensor to turn on, including: after the TOF sensor is disabled, the electronic device controls the ambient light sensor to turn on through the second drive according to the second command, and controls the ambient light sensor through the third drive according to the second command The proximity light sensor is turned on.
  • the embodiments of the present application provide a sensor control method, which can be applied to an electronic device, and the electronic device can include a TOF sensor, an ambient light sensor, and a proximity light sensor, a TOF sensor, an ambient light sensor, and a proximity light sensor.
  • the sensor is located on the same side of the electronic device; the method may include: when the TOF sensor is turned on, the electronic device discards the data measured by the ambient light sensor and the proximity light sensor; when the TOF sensor is turned off, the electronic device measures according to the ambient light sensor The first function of the electronic device is realized by the data of, and the second function of the electronic device is realized according to the data measured by the proximity light sensor when the TOF sensor is turned off.
  • the method may further include: the electronic device determines the proportion of infrared components in the ambient light according to the data output by the ambient light sensor; the above-mentioned electronic device discards the ambient light sensor when the TOF sensor is turned on And the data measured by the proximity light sensor includes: when the electronic device determines that the proportion of infrared components in the ambient light is greater than the threshold, discarding the data measured by the ambient light sensor and the proximity light sensor; the above-mentioned electronic device discards the data measured by the ambient light sensor and the proximity light sensor; The data measured by the ambient light sensor realizes the first function of the electronic device.
  • the second function of the electronic device is realized according to the data measured by the proximity light sensor, including: the electronic device determines the proportion of infrared components in the ambient light.
  • the first function is realized according to the data measured by the ambient light sensor; when the electronic device determines that the proportion of infrared components in the ambient light is less than the threshold, the second function is realized according to the data measured by the proximity light sensor.
  • the above-mentioned electronic device determines the proportion of infrared components in the ambient light according to the data output by the ambient light sensor, including: the electronic device according to the light intensity of the R channel of the ambient light output by the ambient light sensor, The light intensity of the G channel, the light intensity of the B channel and the light intensity of the C channel determine the infrared light intensity of the ambient light; the electronic device determines the proportion of the infrared component of the ambient light according to the infrared light intensity and the light intensity of the C channel.
  • an embodiment of the present application provides an electronic device, which may include: a processor, a memory, a TOF sensor, an ambient light sensor, and a proximity light sensor; the TOF sensor, the ambient light sensor, and the proximity light sensor are located in the electronic device The same side; processor, TOF sensor, ambient light sensor, proximity light sensor and memory coupling, the memory is used to store computer program code, the computer program code includes computer instructions, when the computer instructions are executed by the electronic device, the electronic device is executed The sensor control method according to the third aspect or the possible implementation manner of the third aspect, or the fourth aspect or the possible implementation manner of the fourth aspect.
  • an embodiment of the present application provides a computer-readable storage medium, including: computer software instructions; when the computer software instructions run in an electronic device, the electronic device executes the third aspect or possible implementations of the third aspect Or the sensor control method according to the fourth aspect or any one of the possible implementation manners of the fourth aspect.
  • the embodiments of the present application provide a computer program product, which when the computer program product runs on a computer, causes the computer to execute possible implementations such as the third aspect or the third aspect, or the fourth aspect or the fourth aspect
  • possible implementations such as the third aspect or the third aspect, or the fourth aspect or the fourth aspect
  • the methods described in the third and fourth aspects provided above, the electronic device described in the fifth aspect, the computer-readable storage medium described in the sixth aspect, and the computer program product described in the seventh aspect It corresponds to the electronic device described in the first aspect and the second aspect. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding electronic devices provided above, which will not be repeated here.
  • FIG. 1 is a schematic front view of a mobile phone provided by an embodiment of this application.
  • FIG. 2 is a schematic diagram of a scene in which a TOF sensor interferes with an ambient light sensor and a proximity light sensor according to an embodiment of the application;
  • FIG. 3 is a schematic diagram of a measurement result of a proximity light sensor when the TOF sensor is closed according to an embodiment of the application;
  • FIG. 4 is a schematic diagram of a measurement result of a proximity light sensor when a TOF sensor is opened according to an embodiment of the application;
  • FIG. 5 is a schematic diagram of a measurement result of an ambient light sensor when the TOF sensor is turned off according to an embodiment of the application;
  • FIG. 6 is a schematic diagram of a measurement result of an ambient light sensor when the TOF sensor is turned on according to an embodiment of the application;
  • FIG. 7 is a schematic structural diagram of an electronic device provided by an embodiment of the application.
  • FIG. 8 is a schematic diagram of a connection between a processor and a sensor according to an embodiment of the application.
  • FIG. 9 is a schematic diagram of the software architecture of a mobile phone based on the Android operating system provided by an embodiment of the application.
  • FIG. 10 is a schematic diagram of a transmission mode of a TOF sensor according to an embodiment of the application.
  • FIG. 11 is a schematic diagram of an electronic device provided by an embodiment of this application.
  • Electronic devices such as mobile phones can be equipped with various sensors to enrich the functions of electronic devices and give users a better experience.
  • a TOF sensor can be configured in a mobile phone to realize the 3D face unlock function, and to judge the depth of field when the shooting function is realized to realize the background blur.
  • a light sensor can be configured in a mobile phone, such as a proximity light sensor, an ambient light sensor, and so on.
  • the proximity light sensor can be used for the mobile phone to determine whether there is an object near the mobile phone to realize the function of automatically turning off the screen.
  • the ambient light sensor can be used for mobile phones to automatically adjust the screen brightness.
  • the electronic device may be equipped with a TOF sensor and a light sensor at the same time. And the TOF sensor and the light sensor may be arranged on the same side of the electronic device.
  • the mobile phone is equipped with a TOF sensor, a proximity light sensor, and an ambient light sensor as an example.
  • FIG. 1 it is a schematic front view of a mobile phone provided by an embodiment of this application.
  • the front of the mobile phone is provided with a TOF sensor 101, a proximity light sensor 102, and an ambient light sensor 103 at the same time.
  • FIG. 1 only exemplarily shows the position of each component in the mobile phone, but it is not intended to be limited thereto.
  • the TOF sensor 101 emits infrared light pulses when it is turned on, and the infrared light pulses will be reflected (such as diffuse reflection) when they encounter an object.
  • the reflected light will be received by the TOF sensor 101.
  • the TOF sensor 101 can obtain the round-trip time of the infrared light pulse through detection.
  • the mobile phone can calculate the distance to the object according to the flight round-trip time obtained by the TOF sensor 101, thereby generating depth information and assisting the mobile phone to implement corresponding functions.
  • the proximity light sensor 102 and the ambient light sensor 103 and the TOF sensor 101 are arranged on the same side of the mobile phone, when the proximity light sensor 102 and the ambient light sensor 103 are turned on, the reflected light may also be the proximity light.
  • the sensor 102 and the ambient light sensor 103 receive, which will affect the accuracy of the measured data, and cause the false triggering of the corresponding functions of the mobile phone.
  • FIG. 3 is a schematic diagram of the light intensity measured by the proximity light sensor 102 when the TOF sensor 101 is turned off and the mobile phone is at different distances from the object.
  • Figure 3 (a), Figure 3 (b), Figure 3 (c) and Figure 3 (d) are respectively when TOF sensor 101 is turned off, the mobile phone is 3 centimeters (cm), In the case of 7 cm, 10 cm, and 15 cm, it is a schematic diagram of the light intensity measured by the proximity light sensor 102.
  • FIG. 4 is a schematic diagram of the light intensity measured by the proximity light sensor 102 when the TOF sensor 101 is turned on and the mobile phone is at different distances from the object.
  • Figure 4 (a), Figure 4 (b), Figure 4 (c) and Figure 4 (d) are respectively when TOF sensor 101 is opened, the phone is 3cm, 7cm, 10cm and A schematic diagram of the light intensity measured by the proximity light sensor 102 in the case of 15 cm.
  • the abscissa is the number of data points, and the ordinate is the light intensity measured by the proximity light sensor 102.
  • the light intensity measured by the proximity light sensor 102 is basically between 40-70.
  • the TOF sensor 101 is turned on, and the mobile phone is 3cm, 7cm, 10cm, and 15cm away from the object, due to the reflection of the infrared light pulse emitted by the TOF sensor 101, the light intensity measured by the proximity light sensor 102 is compared with that of the TOF sensor 101.
  • the light intensity measured by the proximity light sensor 102 will increase. And the closer the mobile phone is to the object, the more the increase will be.
  • the mobile phone when the mobile phone is 3cm away from the object, it will increase by more than 4 times, and when the mobile phone is 7cm away from the object, it will increase by more than 2 times. That is to say, when the TOF sensor 101 is turned on, the data measured by the proximity light sensor 102 is not accurate, which may cause the corresponding function of the mobile phone to be falsely triggered.
  • a camera 104 is provided on the front of the mobile phone.
  • the TOF sensor 101 is turned on for determining the depth of field to achieve background blurring.
  • the mobile phone is in the bright screen state, and the proximity light sensor 102 is also turned on in the bright screen state, which is used by the mobile phone to determine whether there is an object near the mobile phone to realize the function of automatically turning off the screen.
  • the proximity light sensor 102 can receive the reflected light from the infrared light pulse emitted by the TOF sensor 101, resulting in the measured light intensity being too large.
  • the mobile phone may misjudge that there is an object near the mobile phone and automatically turn off the screen. In other words, it may happen that the user is taking a picture, but the phone automatically turns off the screen.
  • FIG. 5 is a schematic diagram of the light intensity measured by the ambient light sensor 103 when the TOF sensor 101 is turned off and the mobile phone is at different distances from the object.
  • Figure 5 (a), Figure 5 (b), Figure 5 (c) and Figure 5 (d) are respectively when TOF sensor 101 is turned off, the phone is 3cm, 7cm, 10cm and A schematic diagram of the light intensity measured by the ambient light sensor 103 in the case of 15 cm.
  • FIG. 6 is a schematic diagram of the light intensity measured by the ambient light sensor 103 when the TOF sensor 101 is turned on and the mobile phone is at different distances from the object.
  • Figure 6 (a), Figure 6 (b), Figure 6 (c) and Figure 6 (d) are respectively when TOF sensor 101 is opened, the phone is 3cm, 7cm, 10cm and A schematic diagram of the light intensity measured by the ambient light sensor 103 in the case of 15 cm.
  • the abscissa is the number of data points, and the ordinate is the light intensity of the four channels of ambient light measured by the ambient light sensor 103.
  • the four channels can be R channel, G channel, B channel and C channel respectively.
  • the R channel is the red channel.
  • the G channel is the green channel.
  • the B channel is the blue channel.
  • the C channel is a custom color channel.
  • the light intensity of the four channels of ambient light measured by the ambient light sensor 103 is basically 0. -25 between.
  • the ambient light sensor 103 measures the ambient light of the four channels of light. The intensity is increased compared to the light intensity of the four channels of ambient light measured by the ambient light sensor 103 when the TOF sensor 101 is turned off.
  • the TOF sensor 101 when the TOF sensor 101 is turned on, the data measured by the ambient light sensor 103 is not accurate, which may cause the corresponding function of the mobile phone to be falsely triggered.
  • the TOF sensor 101 when a user unlocks a 3D face, the TOF sensor 101 is turned on to obtain a 3D face image of the user.
  • the mobile phone when the 3D face is unlocked, the mobile phone is in the bright screen state under the lock screen. In the bright screen state under the lock screen, the ambient light sensor 103 will also be turned on for the mobile phone to automatically adjust the screen brightness. In this scenario, the ambient light sensor 103 receives the reflected light from the infrared light pulse emitted by the TOF sensor 101, resulting in the measured light intensity being too large. In this way, the mobile phone may cause glare by increasing the brightness of the mobile phone's screen in a low-light environment.
  • the light sensor such as ambient light sensor, proximity light sensor
  • the infrared light pulse emitted by the TOF sensor will affect the data measured by the light sensor. Accuracy, leading to false triggering of the corresponding function of the electronic device.
  • the method provided by the embodiment of the present application can correct the impact of the TOF sensor on the light sensor when the TOF sensor is turned on, avoid the false triggering of the corresponding function of the electronic device, and improve the user experience.
  • the electronic devices described in the embodiments of the present application may be mobile phones, tablet computers, desktop computers, laptops, handheld computers, notebook computers, ultra-mobile personal computers (UMPC), and netbooks.
  • PDAs personal digital assistants
  • wearable electronic devices such as smart watches, etc.
  • AR augmented reality
  • VR virtual reality
  • the light sensor may include a proximity light sensor and/or an ambient light sensor.
  • FIG. 7 is a schematic structural diagram of an electronic device provided by an embodiment of this application.
  • the electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142, Antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, A display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the sensor module 180 may include TOF sensor 101, proximity light sensor 102, ambient light sensor 103, pressure sensor 180A, gyroscope sensor 180B, air pressure sensor 180C, magnetic sensor 180D, acceleration sensor 180E, distance sensor 180F, fingerprint sensor 180G, Temperature sensor 180H, touch sensor 180I, bone conduction sensor 180J, etc.
  • the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device.
  • the electronic device may include more or fewer components than shown, or combine certain components, or split certain components, or arrange different components.
  • the illustrated components can be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait.
  • AP application processor
  • modem processor modem processor
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the different processing units may be independent devices or integrated in one or more processors.
  • the controller can be the nerve center and command center of the electronic device.
  • the controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 to store instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory can store instructions or data that the processor 110 has just used or used cyclically. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, and a universal asynchronous transmitter receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, SIM interface, and/or USB interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART universal asynchronous transmitter receiver/transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM interface SIM interface
  • USB interface etc.
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL).
  • the processor 110 may include multiple sets of I2C interfaces.
  • the processor 110 may couple the TOF sensor 101, the proximity light sensor 102, the ambient light sensor 103, the touch sensor 180I, the charger, the flash, the camera 193, etc., respectively through different I2C interfaces.
  • the processor 110 can couple the TOF sensor 101 through the I2C interface, so that the processor 110 and the TOF sensor 101 communicate through the I2C interface to realize the 3D face unlock function of the electronic device, or perform the depth of field judgment when the shooting function is realized to realize the background blur. ⁇ functionality, etc.
  • the processor 110 may also couple the proximity light sensor 102 through an I2C interface, so that the processor 110 and the proximity light sensor 102 communicate through the I2C interface, so as to realize the function of automatically turning off the screen of the electronic device.
  • the processor 110 may also couple the ambient light sensor 103 through the I2C interface, so that the processor 110 and the ambient light sensor 103 communicate through the I2C interface, so as to realize the function of automatically adjusting the screen brightness of the electronic device.
  • the processor 110 may also couple the touch sensor 180I through an I2C interface, so that the processor 110 and the touch sensor 180I communicate through the I2C interface to realize the touch function of the electronic device.
  • the MIPI interface can be used to connect the processor 110 with the display screen 194, the camera 193 and other peripheral devices.
  • the MIPI interface includes a camera serial interface (camera serial interface, CSI), a display serial interface (display serial interface, DSI), and so on.
  • the processor 110 and the camera 193 communicate through a CSI interface to implement the shooting function of the electronic device.
  • the processor 110 and the display screen 194 communicate through the DSI interface to realize the display function of the electronic device.
  • the GPIO interface can be configured through software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and so on.
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the interface connection relationship between the modules illustrated in this embodiment is merely a schematic description, and does not constitute a structural limitation of the electronic device.
  • the electronic device may also adopt different interface connection modes in the above-mentioned embodiments, or a combination of multiple interface connection modes.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 140 may receive the charging input of the wired charger through the USB interface 130.
  • the charging management module 140 may receive the wireless charging input through the wireless charging coil of the electronic device. While the charging management module 140 charges the battery 142, it can also supply power to the electronic device through the power management module 141.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charge management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.
  • the power management module 141 may also be provided in the processor 110.
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device can be realized by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
  • the antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in an electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna can be used in combination with a tuning switch.
  • the mobile communication module 150 may provide a solution for wireless communication including 2G/3G/4G/5G and the like applied to electronic devices.
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor, and convert it into electromagnetic wave radiation via the antenna 1.
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110.
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
  • the wireless communication module 160 can provide applications on electronic devices including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), and global navigation satellite systems. (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • WLAN wireless local area networks
  • BT Bluetooth
  • GNSS global navigation satellite system
  • frequency modulation frequency modulation, FM
  • NFC near field communication technology
  • infrared technology infrared, IR
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110.
  • the wireless communication module 160 may also receive the signal to be sent from the processor 110, perform frequency modulation, amplify it, and convert it into electromagnetic waves to radiate through the antenna 2.
  • the antenna 1 of the electronic device is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite-based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite-based augmentation systems
  • the electronic device realizes the display function through the GPU, the display screen 194, and the application processor.
  • the GPU is an image processing microprocessor, which is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • the processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos, and the like.
  • the display screen 194 includes a display panel.
  • the display panel can use liquid crystal display (LCD), organic light-emitting diode (OLED), active matrix organic light-emitting diode or active-matrix organic light-emitting diode (active-matrix organic light-emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • active-matrix organic light-emitting diode active-matrix organic light-emitting diode
  • emitting diode AMOLED, flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (QLED), etc.
  • the electronic device may include one or N display screens 194, and N is a positive integer greater than one.
  • the electronic device can realize the shooting function through TOF sensor 101, ISP, camera 193, video codec, GPU, display 194 and application processor.
  • the ISP is used to process the data fed back by the camera 193. For example, when taking a picture, the shutter is opened, the light is transmitted to the photosensitive element of the camera through the lens, the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing and is converted into an image visible to the naked eye.
  • ISP can also optimize the image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193.
  • the camera 193 is used to capture still images or videos.
  • the object generates an optical image through the lens and is projected to the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transfers the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the electronic device may include 1 or N cameras 193, and N is a positive integer greater than 1.
  • the electronic device may include the camera 101 shown in FIG. 1 (may be called a front camera), and may also include one or more cameras (may be called a rear camera) arranged on the back of the electronic device (such as a mobile phone).
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device selects the frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device can support one or more video codecs.
  • the electronic device can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, and so on.
  • MPEG moving picture experts group
  • NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • NPU can realize the intelligent cognition of electronic equipment and other applications, such as: image recognition, face recognition, speech recognition, text understanding, etc.
  • the external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example, save music, video and other files in an external memory card.
  • the internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device by running instructions stored in the internal memory 121.
  • the processor 110 may control the light sensor (the proximity light sensor 102 and/or the ambient light sensor 103) by executing the instructions stored in the internal memory 121 when it is determined that the TOF sensor 101 is turned on. Turn off, or discard the data measured by the light sensor (the proximity light sensor 102 and/or the ambient light sensor 103) when the TOF sensor 101 is turned on.
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area can store an operating system, at least one application program (such as a sound playback function, an image playback function, etc.) required by at least one function.
  • the data storage area can store data (such as audio data, phone book, etc.) created during the use of the electronic device.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.
  • the electronic device can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. For example, music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal.
  • the audio module 170 can also be used to encode and decode audio signals.
  • the audio module 170 may be provided in the processor 110, or part of the functional modules of the audio module 170 may be provided in the processor 110.
  • the speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
  • the electronic device can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the electronic device answers a call or voice message, it can receive the voice by bringing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone”, “microphone”, is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through the human mouth, and input the sound signal into the microphone 170C.
  • the electronic device may be provided with at least one microphone 170C.
  • the electronic device may be provided with two microphones 170C, which can implement noise reduction functions in addition to collecting sound signals.
  • the electronic device may also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions.
  • the earphone interface 170D is used to connect wired earphones.
  • the earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, and a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA, CTIA
  • the TOF sensor 101 can continuously send infrared light pulses (for example, light pulses with a wavelength of 940 nm) to the object, and then receive the infrared light pulses reflected from the object, and obtain the flight round-trip time of the infrared light pulses through detection.
  • the TOF sensor 101 outputs the round-trip time of the detected infrared light pulse to the processor 110.
  • the processor 110 calculates the distance between the electronic device and the object according to the flight round-trip time of the infrared light pulse output by the TOF sensor 101.
  • the TOF sensor 101 after the TOF sensor 101 detects the flight round-trip time of the infrared light pulse, it can calculate the distance between the electronic device and the object according to the flight round-trip time of the detected infrared light pulse, and then the calculated electronic device The distance to the object is output to the processor 110.
  • the electronic device can use the data output by the TOF sensor 101 to realize the 3D face unlock function.
  • the data output by the TOF sensor 101 can also be used to implement other functions.
  • an electronic device can use the data output by the TOF sensor 101 to perform a depth of field judgment when implementing a shooting function to achieve background blurring.
  • the processor 110 may control the TOF sensor 101 to turn on.
  • the proximity light sensor 102 may include, for example, a light emitting diode (LED) and a light detector such as a photodiode.
  • the light emitting diode may be an infrared light emitting diode.
  • the proximity light sensor 102 emits infrared light pulses outward, and then detects the infrared reflected light from the object.
  • the proximity light sensor 102 outputs the detected light intensity of the infrared reflected light to the processor 110.
  • the processor 110 can implement corresponding functions according to the light intensity output by the proximity light sensor 102.
  • the proximity light sensor 102 can be used to measure whether an object is close to an electronic device.
  • the processor 110 determines that the light intensity exceeds the threshold, that is, the proximity light sensor 102 detects sufficient reflected light, it can be determined that there is an object near the electronic device.
  • the processor 110 determines that the light intensity does not exceed the threshold, that is, the proximity light sensor 102 detects insufficient reflected light, the electronic device can determine that there is no object near the electronic device.
  • the electronic device can use the proximity light sensor 102 to detect that the user holds the electronic device close to the ear to talk, so as to automatically turn off the screen to prevent the human body from accidentally touching the screen and save power.
  • the electronic device can also use the proximity light sensor 102 to automatically turn off the screen or light up the screen in the holster mode (detecting whether the holster installed on the electronic device is opened) or pocket mode (detecting whether the electronic device is put in the pocket).
  • the processor 110 may control the proximity light sensor 102 to turn on in scenarios such as using an electronic device to make a call, or when the pocket mode is turned on, or the holster mode is turned on. When exiting the above scenario, the processor 110 may control the proximity light sensor 102 to turn off.
  • the ambient light sensor 103 is used to sense the brightness of the ambient light.
  • the ambient light sensor 103 can measure the light intensity of the four channels of ambient light.
  • the ambient light sensor 103 outputs the measured light intensity of the four channels of ambient light to the processor 110.
  • the processor 110 may process the light intensity of the four channels of ambient light output by the ambient light sensor 103 (for example, integrate the light intensity of the four channels of ambient light) to obtain the light intensity of the ambient light (such as illuminance value, or, Illuminance value and color temperature value).
  • the electronic device can adaptively adjust the brightness of the display screen 194 according to the obtained light intensity of the ambient light.
  • the ambient light sensor 103 can also be used to automatically adjust the white balance when implementing the shooting function.
  • the processor 110 controls the ambient light sensor 103 to turn on when the electronic device is in a bright screen state or when a shooting function is implemented.
  • the processor controls the ambient light sensor 103 to turn off.
  • the TOF sensor 101 in order to prevent the reflected light from the infrared light pulse emitted by the TOF sensor 101 from affecting the data measured by the light sensor (the proximity light sensor 102 and/or the ambient light sensor 103), the TOF sensor 101 is determined When it is turned on, the light sensor can be controlled to turn off, or the data measured by the light sensor when the TOF sensor 101 is turned on can be discarded.
  • the pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal.
  • the pressure sensor 180A may be provided on the display screen 194.
  • the capacitive pressure sensor may include at least two parallel plates with conductive materials. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device determines the strength of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device may also calculate the touched position based on the detection signal of the pressure sensor 180A.
  • touch operations that act on the same touch position but have different touch operation strengths may correspond to different operation instructions. For example, when a touch operation whose intensity of the touch operation is less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
  • the gyro sensor 180B can be used to determine the movement posture of the electronic device.
  • the angular velocity of the electronic device around three axes ie, x, y, and z axes
  • the gyro sensor 180B can be used for image stabilization.
  • the gyroscope sensor 180B detects the angle of the shake of the electronic device, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to counteract the shake of the electronic device through a reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device calculates the altitude based on the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device can use the magnetic sensor 180D to detect the opening and closing of the flip holster.
  • the electronic device when the electronic device is a flip machine, the electronic device can detect the opening and closing of the flip according to the magnetic sensor 180D.
  • features such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device in various directions (generally three axes). When the electronic device is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices, and apply to applications such as horizontal and vertical screen switching, pedometers and so on.
  • Distance sensor 180F used to measure distance.
  • Electronic equipment can measure distance through infrared or laser.
  • the electronic device may use the distance sensor 180F to measure the distance to achieve fast focusing.
  • the fingerprint sensor 180G is used to collect fingerprints. Electronic devices can use the collected fingerprint characteristics to unlock fingerprints, access application locks, take photos with fingerprints, and answer calls with fingerprints.
  • the temperature sensor 180H is used to detect temperature.
  • the electronic device uses the temperature detected by the temperature sensor 180H to execute the temperature processing strategy. For example, when the temperature reported by the temperature sensor 180H exceeds a threshold value, the electronic device executes to reduce the performance of the processor located near the temperature sensor 180H, so as to reduce power consumption and implement thermal protection.
  • the electronic device when the temperature is lower than another threshold, the electronic device heats the battery 142 to avoid abnormal shutdown of the electronic device due to low temperature.
  • the electronic device boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • the touch sensor 180I is also called “touch panel”.
  • the touch sensor 180I may be disposed on the display screen 194, and the touch sensor 180I and the display screen 194 form a touch screen, which is also called a “touch screen”.
  • the touch sensor 180I is used to detect touch operations acting on or near it.
  • the touch sensor 180I may transfer the detected touch operation to the application processor to determine the type of the touch event.
  • the visual output related to the touch operation can be provided through the display screen 194.
  • the touch sensor 180I may also be disposed on the surface of the electronic device, which is different from the position of the display screen 194.
  • the bone conduction sensor 180J can acquire vibration signals.
  • the bone conduction sensor 180J can acquire the vibration signal of the vibrating bone mass of the human voice.
  • the bone conduction sensor 180J can also contact the human pulse and receive the blood pressure pulse signal.
  • the bone conduction sensor 180J may also be arranged in the earphone, combined with the bone conduction earphone.
  • the audio module 170 can parse out the voice signal based on the vibration signal of the vibrating bone block of the voice obtained by the bone conduction sensor 180J to realize the voice function.
  • the application processor may analyze the heart rate information based on the blood pressure beating signal obtained by the bone conduction sensor 180J, and realize the heart rate detection function.
  • the button 190 includes a power-on button, a volume button, and so on.
  • the button 190 may be a mechanical button. It can also be a touch button.
  • the electronic device can receive key input, and generate key signal input related to user settings and function control of the electronic device.
  • the motor 191 can generate vibration prompts.
  • the motor 191 can be used for incoming call vibration notification, and can also be used for touch vibration feedback.
  • touch operations that act on different applications can correspond to different vibration feedback effects.
  • Acting on touch operations in different areas of the display screen 194, the motor 191 can also correspond to different vibration feedback effects.
  • Different application scenarios for example: time reminding, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, or to indicate messages, missed calls, notifications, and so on.
  • the SIM card interface 195 is used to connect to the SIM card.
  • the SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device.
  • the electronic device can support 1 or N SIM card interfaces, and N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
  • the same SIM card interface 195 can insert multiple cards at the same time. The types of the multiple cards can be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 may also be compatible with external memory cards.
  • the electronic device interacts with the network through the SIM card to realize functions such as call and data communication.
  • the electronic device adopts an eSIM, that is, an embedded SIM card.
  • the eSIM card can be embedded in the electronic device and cannot be separated from the electronic device.
  • the mobile phone includes a TOF sensor, a proximity light sensor, and an ambient light sensor as examples to introduce the method of the embodiment of the present application.
  • the TOF sensor 101, the proximity light sensor 102 and the ambient light sensor 103 are located on the same side of the mobile phone, for example, they are all located on the front side of the mobile phone. If the light sensor (such as the proximity light sensor 102 and/or the ambient light sensor 103) is also turned on when the TOF sensor 101 is turned on, the infrared light pulse emitted by the TOF sensor 101 will affect the accuracy of the data measured by the light sensor. Sex.
  • case 1 the TOF sensor 101 of the mobile phone is turned on: case 1-1, the shooting function is realized through the front camera (such as the camera 104 shown in Figure 1); case 1-2, using 3D face unlock Function unlocking, etc.
  • the proximity light sensor 102 of the mobile phone is turned on: Case 2-1, the mobile phone is used to make a call; Case 2-2, the pocket mode is turned on; Case 2-3, the holster mode is turned on; Case 2-4, the mobile phone is in The screen on state (including the bright screen under the lock screen and the bright screen after unlocking); case 2-5, the phone is locked and the screen is off, and the time is displayed; case 2-6, the phone calls, etc.
  • the ambient light sensor 103 of the mobile phone is turned on: Case 3-1, the mobile phone is in the bright screen state (including the bright screen under the lock screen and the bright screen after unlocking); in the case 3-2, the camera (front camera) Or rear camera) to achieve the shooting function.
  • both the TOF sensor 101 and the proximity light sensor 102 can be turned on at the same time.
  • both the TOF sensor 101 and the ambient light sensor 103 can be turned on at the same time.
  • the TOF sensor 101, the proximity light sensor 102, and the ambient light sensor 103 can be turned on at the same time.
  • the mobile phone can control the light sensor to turn off.
  • the mobile phone can control the light sensor to turn on again. That is to say, when the TOF sensor 101 is turned on, the light sensor is controlled to be turned off; when the TOF sensor 101 is turned off, the light sensor is controlled to be turned on to prevent the infrared light pulse emitted by the TOF sensor 101 from affecting the light sensor. The situation of the accuracy of data measured by similar sensors appears.
  • the mobile phone may adopt a hardware solution to obtain the working state of the TOF sensor 101 (the working state may be on or off), so that the TOF sensor 101 can be Working state, control the light sensor to close or open. That is, when the TOF sensor 101 is turned on, the processor 110 of the mobile phone controls the light sensor to turn off. When the TOF sensor 101 is turned off, the processor 110 of the mobile phone controls the light sensor to turn on.
  • the processor 110 of the mobile phone is respectively connected to the TOF sensor 101, the proximity light sensor 102 and the ambient light sensor 103 of the mobile phone.
  • the processor 110 may be respectively coupled with the TOF sensor 101, the proximity light sensor 102, and the ambient light sensor 103 through different I2C interfaces.
  • the processor 110 is coupled with the TOF sensor 101 through the I2C interface_AB.
  • the processor 110 is coupled with the ambient light sensor 103 through the I2C interface_DE (the I2C interface_DE may be the first interface in this application).
  • the processor 110 is coupled with the proximity light sensor 102 through the I2C interface_FG (the I2C interface_FG may be the second interface in this application).
  • the processor 110 can communicate with corresponding sensors.
  • the TOF sensor 101 when the TOF sensor 101 is turned on, the TOF sensor 101 can output the round-trip time of the detected infrared light pulse to the processor 110 through the I2C interface_AB.
  • the ambient light sensor 103 when the ambient light sensor 103 is turned on, the ambient light sensor 103 can output the measured light intensity of the four channels of ambient light to the processor 110 through the I2C interface_DE.
  • the proximity light sensor 102 when the proximity light sensor 102 is turned on, the proximity light sensor 102 may output the detected light intensity of the infrared reflected light to the processor 110 through the I2C interface_FG.
  • the processor 110 may also be coupled with the TOF sensor 101 through a general-purpose input/output (GPIO) pin (eg, the "C” pin in FIG. 8) to control the TOF sensor 101 to be turned on or off.
  • GPIO general-purpose input/output
  • the “C” pin of the processor 110 is coupled with the ODS_APC_GATE pin of the TOF sensor 101.
  • the processor 110 can output a high level to the ODS_APC_GATE pin of the TOF sensor 101 through the "C" pin. In this way, the ODS_APC_GATE pin of the TOF sensor 101 changes from a low level to a high level, and the TOF sensor 101 is turned on.
  • the processor 110 can output a low level to the ODS_APC_GATE pin of the TOF sensor 101 through the "C" pin. In this way, the ODS_APC_GATE pin of the TOF sensor 101 changes from a high level to a low level, and the TOF sensor 101 is turned off. When the TOF sensor 101 is turned on, the TOF sensor 101 emits infrared light pulses outward.
  • the processor 110 controls the TOF sensor 101 to turn on, for example, the TOF sensor 101 is turned on through the "C" pin.
  • the processor 110 can control the light sensor to turn off.
  • the processor 110 may control the light sensor to turn off through an I2C interface with the light sensor.
  • the processor 110 when the processor 110 outputs a high level to the ODS_APC_GATE pin of the TOF sensor 101 through the "C" pin, if the proximity light sensor 102 is turned on at this time, the processor can communicate with the proximity light sensor 102 through the I2C interface _FG , Control the proximity light sensor 102 to turn off.
  • the processor 110 when the processor 110 outputs a high level to the ODS_APC_GATE pin of the TOF sensor 101 through the "C" pin, if the ambient light sensor 103 is turned on at this time, the processor can communicate with the ambient light sensor 103 via the I2C interface_ DE, control the ambient light sensor 103 to turn off.
  • the processor 110 controls the TOF sensor 101 to turn off, such as outputting a low level to the ODS_APC_GATE pin of the TOF sensor 101 through the "C" pin, the processor 110 can re-control the light sensor to turn on.
  • the processor 110 may control the light sensor to turn on through an I2C interface with the light sensor. For example, when the processor 110 outputs a low level to the ODS_APC_GATE pin of the TOF sensor 101 through the "C" pin, the processor can re-control the proximity light sensor 102 to turn on through the I2C interface_FG with the proximity light sensor 102.
  • the processor 110 when the processor 110 outputs a low level to the ODS_APC_GATE pin of the TOF sensor 101 through the "C" pin, the processor can re-control the ambient light sensor 103 to turn on through the I2C interface _DE with the ambient light sensor 103.
  • the processor 110 when the user uses the front camera of the mobile phone, that is, the camera 104 to take a photo, the processor 110 outputs a high level to the ODS_APC_GATE pin of the TOF sensor 101 through the "C" pin to control the TOF sensor 101 turn on. It is understandable that when the user takes a photo, the mobile phone is in a bright screen state, and in the bright screen state, the proximity light sensor 102 of the mobile phone is turned on. Therefore, the processor 110 can also control the proximity light sensor 102 to turn off through the I2C interface_FG with the proximity light sensor 102. In the bright screen state, the ambient light sensor 103 of the mobile phone is also turned on.
  • the processor 110 can also control the ambient light sensor 103 to turn off through the I2C interface _DE with the ambient light sensor 103. In this way, false triggering of the corresponding functions of the mobile phone can be avoided. For example, it will not happen that the mobile phone erroneously determines that there is an object near the mobile phone according to the large light intensity measured by the proximity light sensor 102 and automatically turns off the screen. For another example, the mobile phone will not cause glare by increasing the brightness of the mobile phone's screen in a low-light environment according to the large light intensity measured by the ambient light sensor 103.
  • the processor 110 outputs a low level to the ODS_APC_GATE pin of the TOF sensor 101 through the "C" pin to control the TOF sensor 101 to turn off. If the mobile phone is still in the bright screen state, the processor 110 can control the proximity light sensor 102 to turn on again through the I2C interface _FG with the proximity light sensor 102, and control the ambient light through the I2C interface _DE with the ambient light sensor 103 The sensor 103 is turned on again.
  • the working state of the TOF sensor 101 is acquired by adopting a hardware solution, so that when the TOF sensor 101 is turned on, the light sensor can be controlled to turn off.
  • the TOF sensor 101 is turned off, the light sensor is controlled to be turned on again.
  • the false trigger of the corresponding function of the mobile phone is avoided, and the user experience is improved.
  • the mobile phone can use a software solution to obtain the enabled state of the TOF sensor 101 (the enabled state may be enabled or disabled). Therefore, the mobile phone controls the light sensor to be turned off or on according to the enable state of the TOF sensor 101. That is, when the TOF sensor 101 is enabled, the mobile phone controls the light sensor to turn off. When the TOF sensor 101 is not enabled, the mobile phone controls the light sensor to turn on. When the TOF sensor 101 is enabled, the TOF sensor 101 can emit infrared light pulses according to the mode shown in FIG. 10 (such as mode 1 or mode 2). When the TOF sensor 101 is not enabled or after it is disabled, the TOF sensor 101 will not emit infrared light pulses.
  • the mode shown in FIG. 10 such as mode 1 or mode 2
  • FIG. 9 is a schematic diagram of the software architecture of a mobile phone based on the Android operating system provided by an embodiment of the application.
  • the software architecture may include: application layer, framework layer, hardware abstract layer (HAL), kernel layer and hardware layer ). among them:
  • the application layer is the layer that interacts with the user.
  • the application layer may include various applications of the mobile phone (for example, third-party applications and/or system applications).
  • the application layer may include a 3D face unlock application, a camera application, and so on.
  • the mobile phone can control the TOF sensor 101 on the hardware layer of the mobile phone to enable, so as to assist the application to implement corresponding functions.
  • the mobile phone can control the TOF sensor 101 of the mobile phone to enable, so that the data measured by the TOF sensor 101 can be used to generate a 3D face image to realize the 3D face unlocking function.
  • the mobile phone can control the TOF sensor 101 of the mobile phone to enable, so that the data measured by the TOF sensor 101 can be used to judge the depth of field, so as to realize the background blur when the shooting function is realized.
  • the framework layer includes library functions.
  • the library functions provide various application programming interfaces (application programming interface, API) that may be used when building applications.
  • API application programming interface
  • the framework layer provides a sensor manager (manager) for managing the hardware circuit of the sensor (for example, the TOF sensor 101, the proximity light sensor 102, and the ambient light sensor 103).
  • the hardware abstraction layer abstracts the hardware circuit, provides abstract hardware circuits to the framework layer, and provides standard writing or control interfaces to the driver of the kernel layer. Manufacturers can provide drivers for hardware circuits based on this standard.
  • the TOF sensor at the hardware layer, the proximity light sensor, and the ambient light sensor can be virtualized as sensor service modules.
  • the kernel layer provides a driver program that includes the control hardware circuit in the hardware layer.
  • the driver program is generally implemented by the manufacturer of the hardware circuit according to the standard interface provided by the hardware abstraction layer.
  • the inner core layer includes TOF sensor driver, proximity light sensor driver and ambient light sensor driver.
  • the TOF sensor driver is used to control the TOF sensor.
  • the proximity light sensor driver is used to control the proximity light sensor.
  • the ambient light sensor driver is used to control the ambient light sensor.
  • TOF sensor driving may be the first driving in this application.
  • the ambient light sensor driving may be the second driving in this application.
  • the proximity light sensor driving may be the third driving in this application.
  • the hardware layer includes components such as TOF sensor 101, proximity light sensor 102, and ambient light sensor 103.
  • command 1 may be the first command in this application.
  • the sensor manager of the framework layer can issue the command 1 to the TOF sensor driver of the kernel layer through the sensor service module of the hardware abstraction layer, the proximity light sensor driver and the ambient light sensor driver.
  • the TOF sensor driver of the kernel layer After the TOF sensor driver of the kernel layer receives the command 1, it can control the enabling of the TOF sensor 101 of the hardware layer.
  • the proximity light sensor driver of the kernel layer After the proximity light sensor driver of the kernel layer receives the command 1, if the proximity light sensor 102 of the hardware layer is turned on at this time, the proximity light sensor 102 can be controlled to turn off.
  • the ambient light sensor driver of the kernel layer receives the command 1, if the ambient light sensor 103 of the hardware layer is turned on at this time, the ambient light sensor 103 can be controlled to turn off.
  • command 2 can be the second command in this application.
  • the sensor manager of the framework layer can issue the command 2 to the TOF sensor driver of the kernel layer through the sensor service module of the hardware abstraction layer, the proximity light sensor driver and the ambient light sensor driver.
  • the TOF sensor driver of the kernel layer After the TOF sensor driver of the kernel layer receives the command 2, it can control the TOF sensor 101 of the hardware layer to disable it.
  • the proximity light sensor driver of the inner core layer can control the proximity light sensor 102 to turn on again.
  • the ambient light sensor driver of the inner core layer can control the ambient light sensor 103 to turn on again.
  • the above-mentioned command 1 may be a command, and the command is used to enable the TOF sensor 101.
  • the proximity light sensor driver can control the proximity light sensor 102 to turn off according to the command, and the ambient light sensor driver can control the ambient light sensor 103 to turn off according to the command.
  • the above command 1 may be a command, which is used to enable the TOF sensor 101, and is also used to control the proximity light sensor 102 and the ambient light sensor 103 to turn off, that is, this command can enable
  • the TOF sensor 101 controls the proximity light sensor 102 and the ambient light sensor 103 to turn off.
  • the above command 1 may also be a set of multiple commands. One of the multiple commands can be used to enable the TOF sensor 101, and one or more of the multiple commands can be used to control the proximity light.
  • the sensor 102 and the ambient light sensor 103 are turned off.
  • the above-mentioned command 2 may be a command, which is used to disable the TOF sensor 101.
  • the proximity light sensor driver can control the proximity light sensor 102 to turn on according to the command, and the ambient light sensor driver can control the ambient light sensor 103 to turn on according to the command.
  • the above command 2 may be a command, which is used to disable the TOF sensor 101, and is also used to control the proximity light sensor 102 and the ambient light sensor 103 to turn on again, that is, this command can be The TOF sensor 101 is disabled, and the proximity light sensor 102 and the ambient light sensor 103 are controlled to be turned on again.
  • the above command 2 may also be a set of multiple commands. One of the multiple commands can be used to disable the TOF sensor 101, and one or more of the multiple commands can control the proximity light sensor. 102 and the ambient light sensor 103 are turned on again.
  • the mobile phone when the user uses the 3D face unlocking function of the mobile phone to unlock, the mobile phone automatically opens the 3D face unlocking application of the mobile phone.
  • the 3D face unlocking application requires the TOF sensor 101 to assist in generating a 3D face image to complete the unlocking function.
  • the mobile phone is in a bright screen state, and in the bright screen state, the proximity light sensor 102 of the mobile phone is turned on, and the ambient light sensor 103 is also turned on. Therefore, after the mobile phone opens the 3D face unlocking application of the mobile phone, the application layer of the mobile phone sends the above-mentioned command 1 to the sensor manager of the framework layer.
  • the sensor manager of the framework layer After receiving the command 1, the sensor manager of the framework layer issues the command 1 to the TOF sensor driver of the kernel layer through the sensor service module of the hardware abstraction layer, the proximity light sensor driver and the ambient light sensor driver.
  • the TOF sensor driver of the kernel layer controls the enabling of the TOF sensor 101 of the hardware layer according to the command 1.
  • the proximity light sensor driver of the inner core layer controls the proximity light sensor 102 to turn off.
  • the ambient light sensor driver of the inner core layer controls the ambient light sensor 103 to turn off. In this way, false triggering of the corresponding functions of the mobile phone can be avoided.
  • the application layer of the mobile phone can send the above command 2 to the sensor manager of the framework layer.
  • the sensor manager of the framework layer issues the command 2 to the TOF sensor driver of the kernel layer through the sensor service module of the hardware abstraction layer, the proximity light sensor driver and the ambient light sensor driver.
  • the TOF sensor driver at the kernel layer can control the TOF sensor 101 at the hardware layer to disable according to the command 2.
  • the proximity light sensor driver of the inner core layer controls the proximity light sensor 102 to turn on again according to the command 2.
  • the ambient light sensor driver of the inner core layer controls the ambient light sensor 103 to turn on again according to the command 2.
  • the enabling state of the TOF sensor 101 is obtained by adopting a software solution, so that when the TOF sensor 101 is enabled, the light sensor can be controlled to be turned off. When the TOF sensor 101 is not enabled, the light sensor is controlled to be turned on again. In this way, it is possible to prevent the infrared light pulse emitted by the TOF sensor 101 from being reflected by the object and irradiating the light sensor, which will affect the accuracy of the data measured by the light sensor. Thereby, the false trigger of the corresponding function of the mobile phone is avoided, and the user experience is improved.
  • the mobile phone (such as the processor of the mobile phone) can discard the light sensor.
  • the data measured by the class sensor during the opening phase of TOF sensor 101 That is to say, the processor of the mobile phone uses the TOF sensor 101 to turn off the data measured by the light sensor to avoid the infrared light pulse emitted by the TOF sensor 101 from affecting the accuracy of the data measured by the light sensor.
  • the processor of the mobile phone can use the light intensity of the four channels of ambient light output by the ambient light sensor 103 to monitor the proportion of infrared (IR) components in the ambient light. . If the processor 110 of the mobile phone determines that the proportion of the IR component in the ambient light output by the ambient light sensor 103 is greater than the threshold, it can be considered that the TOF sensor 101 is turned on and there is interference from infrared light pulses. The processor 110 of the mobile phone can discard the data output by the ambient light sensor 103.
  • IR infrared
  • the processor 110 of the mobile phone determines that the proportion of the IR component in the ambient light output by the ambient light sensor 103 is less than the threshold, it can be considered that the TOF sensor 101 is turned off at this time, and there is no interference of infrared light pulses.
  • the processor 110 of the mobile phone can use the data output by the ambient light sensor 103 as data for realizing the corresponding function of the mobile phone (this function may be the first function in this application, for example, the first function may be automatically adjusting the brightness of the screen). use.
  • the processor 110 of the mobile phone determines that the IR component of the ambient light output by the ambient light sensor 103 is greater than the threshold, and determines that the TOF sensor 101 is turned on, the data reported by the proximity light sensor 102 (such as the measured infrared reflected light light Intensity), the processor 110 of the mobile phone also performs discarding processing, that is, the data output by the proximity light sensor 102 is discarded. If the processor 110 of the mobile phone determines that the IR component of the ambient light output by the ambient light sensor 103 is less than the threshold, and determines that the TOF sensor 101 is turned off, the processor 110 of the mobile phone can be used to implement the data reported by the proximity light sensor 102.
  • the corresponding function (this function can be the second function in this application, for example, the second function can be to determine whether there is an object near the mobile phone) data to use.
  • the processor 110 of the mobile phone may determine the light intensity of IR in the ambient light according to the following formula (1) or formula (2).
  • IR represents the light intensity of IR in the ambient light.
  • R represents the light intensity of the R channel in the ambient light.
  • G represents the light intensity of the G channel in the ambient light.
  • B represents the light intensity of the B channel in the ambient light.
  • C represents the light intensity of the C channel in the ambient light.
  • the IR component ratio can be equal to the ratio of the light intensity of the IR to the light intensity of the C channel.
  • the ratio of the light intensity of the IR to the light intensity of the C channel that is, the proportion of the IR component will increase.
  • the proportion of the IR component is greater than the threshold, it is determined that the TOF sensor 101 is turned on, and the data measured by the light sensor is discarded.
  • the proportion of the IR component is less than the threshold, it is determined that the TOF sensor 101 is turned off, and the data measured by the light sensor is used as data for realizing the corresponding function of the mobile phone.
  • the threshold may be different according to the performance of the ambient light sensor 103.
  • the threshold can be 60%.
  • the threshold may be 90%.
  • the processor 110 of the mobile phone may control the TOF sensor 101 to turn on.
  • the mobile phone is in a bright screen state. In the bright screen state, the proximity light sensor 102 and the ambient light sensor 103 of the mobile phone are both turned on.
  • the processor 110 of the mobile phone can monitor the proportion of the IR component in the ambient light by outputting data from the ambient light sensor 103. When it is determined that the proportion of the IR component is greater than the threshold, the data output by the ambient light sensor 103 and the proximity light sensor 102 are discarded. When the IR component ratio is less than the threshold, the data output by the ambient light sensor 103 and the proximity light sensor 102 are used to implement the corresponding functions of the mobile phone. In this way, false triggering of the corresponding functions of the mobile phone can be avoided.
  • the ratio of the IR component in the ambient light is monitored to determine whether the TOF sensor 101 is on or off. Therefore, the data measured by the light sensor when the TOF sensor 101 is turned on can be discarded, and the data measured by the light sensor when the TOF sensor 101 is turned off can be used. In this way, false triggering of the corresponding functions of the mobile phone can be avoided, and the user experience can be improved.
  • the TOF sensor 101 there are two modes for the TOF sensor 101 to emit infrared light pulses, such as mode 1 and mode 2.
  • the transmission frequency of the TOF sensor 101 is 30 Hertz (Hz), that is, the transmission period is 33.33 milliseconds (ms).
  • Each emission cycle contains eight high-frequency infrared light pulses.
  • the emission frequencies of the last four high-frequency infrared light pulses are different. For example, in mode 1, the emission frequency of the last four high-frequency infrared light pulses is 60 megahertz (MHz). In mode 2, the emission frequency of the last four high-frequency infrared light pulses is 100MHz.
  • the transmission frequency of the first four high-frequency infrared light pulses is 20MHz.
  • a high level indicates that the TOF sensor 101 is turned on, that is, a high-frequency infrared light pulse is emitted, and a low level indicates that the TOF sensor 101 is turned off. That is, the TOF sensor 101 needs to be turned on and off 8 times in each transmission period.
  • the light sensor in each emission cycle, can be turned off during the time when the TOF sensor 101 is turned on, that is, the high level is indicated. .
  • the TOF sensor 101 is turned off, that is, within the time indicated by the low level, the light sensor is turned on.
  • the TOF sensor 101 is turned on and the light sensor is turned off for every 800 microseconds (us) shown in FIG. 10 .
  • the TOF sensor 101 is turned off and the light sensor is turned on.
  • the mobile phone in each transmission cycle, is discarded during the time when the TOF sensor 101 is turned on, that is, the high level indicates , The data measured by the light sensor.
  • the mobile phone discards the data measured by the light sensor in each 550us time shown in Figure 10, and uses the light in other time periods. Data measured by inductive sensors.
  • the accuracy of the data measured by the light sensor is taken as an example, and how to correct the influence on the light sensor is described.
  • the IR fill light installed on the same side of the electronic device as the light sensor. The IR fill light can be used to fill up the face when unlocking the face in a dark environment.
  • the method provided in the embodiments of the present application can also be used to correct the effect of the device on the light-sensitive sensor.
  • the above-mentioned embodiment of using a software synchronization solution to correct the influence on the light-sensitive sensor or the above-mentioned embodiment of monitoring the proportion of IR components in the ambient light to correct the influence on the light-sensitive sensor can be used.
  • the specific implementation is similar to that of the embodiment, and this embodiment will not be repeated here.
  • the electronic device may include: one or more processors 1101, a memory 1102, a TOF sensor 1103, an ambient light sensor 1104, and a proximity light sensor 1105 ; TOF sensor 1103, ambient light sensor 1104 and proximity light sensor 1105 are located on the same side of the electronic device.
  • the above-mentioned devices may be connected through one or more communication buses 1106.
  • the memory 1102 may be used to store one or more computer program codes 1107.
  • the one or more computer program codes 1107 include computer instructions. When the computer instructions are executed by an electronic device, the electronic device executes the electronic device (such as a mobile phone) in the above-mentioned embodiment. The various functions or steps performed.
  • Embodiments of the present application also provide a computer storage medium, which includes computer instructions, which when run on an electronic device, cause the electronic device to perform various functions or steps performed by the electronic device in the foregoing embodiments.
  • the embodiments of the present application also provide a computer program product, which when the computer program product runs on a computer, causes the computer to execute each function or step performed by the electronic device in the above method embodiment.
  • the technical solutions of the embodiments of the present application are essentially or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of a software product, and the software product is stored in a storage medium.
  • Including several instructions to make a device may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the method described in each embodiment of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code .

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Electromagnetism (AREA)
  • Remote Sensing (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Security & Cryptography (AREA)
  • Signal Processing (AREA)
  • Spectroscopy & Molecular Physics (AREA)
  • Sustainable Development (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Human Computer Interaction (AREA)
  • Telephone Function (AREA)
  • Switches Operated By Changes In Physical Conditions (AREA)
  • Electronic Switches (AREA)
  • Photometry And Measurement Of Optical Pulse Characteristics (AREA)

Abstract

本申请实施例提供一种电子设备及传感器控制方法,涉及电子设备领域。解决了TOF传感器打开时发出的红外光脉冲经物体反射后照射到电子设备的光感类传感器上,影响光感类传感器测量到数据准确性的问题。电子设备包括TOF传感器,接近光传感器和环境光传感器,TOF传感器,接近光传感器及环境光传感器位于电子设备的同一侧。在TOF传感器打开的情况下,可控制光感类传感器(如接近光传感器和/或环境光传感器)关闭。在TOF传感器关闭的情况下,可控制光感类传感器打开。或者,在TOF传感器打开的情况下,丢弃光感类传感器测量的数据。在TOF传感器关闭的情况下,根据光感类传感器测量的数据实现对应功能。

Description

一种电子设备及传感器控制方法
本申请要求于2019年09月12日提交国家知识产权局、申请号为201910866729.X、申请名称为“一种电子设备及传感器控制方法”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及电子设备领域,尤其涉及一种电子设备及传感器控制方法。
背景技术
三维(3dimensions,3D)成像技术是通过光学手段提取物体的3D信息,并在重建过程中尽可能恢复物体3D特征的技术。其中,深度信息的精确获取是3D成像技术中的关键。飞行时间(time of flight,TOF)传感器因其可高效、高质量地获得深度信息,在3D成像技术中应用最多。TOF传感器的工作原理是:向物体连续发送红外光脉冲(例如波长为940nm的光脉冲),然后再接收从物体反射的红外光脉冲,通过探测红外光脉冲的飞行往返时间以计算出与物体的距离,从而产生深度信息。
近年来,3D成像技术,尤其是TOF传感器在手机等电子设备中广泛应用。例如,手机可利用TOF传感器进行3D成像,以实现3D人脸解锁功能。又如,手机的摄像头(camera)利用TOF传感器辅助对焦,在拍照时进行景深判断,以实现背景虚化等。
但是,当前的电子设备中不仅会设置TOF传感器,还可能设置光感类传感器,如环境光传感器(ambient light sensor,ALS),接近光传感器(proximity sensor,PS)等。利用光感类传感器测量到的光强度,电子设备可实现如自动调节屏幕亮度,自动熄灭屏幕等功能。而在TOF传感器打开时,其发出的红外光脉冲经物体反射后,不仅会照射到TOF传感器上,同样也会照射到电子设备的光感类传感器上,从而影响了光感类传感器测量到数据的准确性。
发明内容
本申请实施例提供一种电子设备及传感器控制方法,解决了TOF传感器打开时发出的红外光脉冲经物体反射后照射到电子设备的光感类传感器上,影响光感类传感器测量到数据准确性的问题。
本申请采用如下技术方案:
第一方面,本申请实施例提供一种电子设备,该电子设备包括处理器,以及与处理器耦合的TOF传感器、环境光传感器和接近光传感器,其中:TOF传感器、环境光传感器和接近光传感器位于电子设备的同一侧;处理器,用于在TOF传感器打开的情况下,控制环境光传感器和接近光传感器关闭;处理器,用于在TOF传感器关闭的情况下,控制环境光传感器和接近光传感器打开。
采用该技术方案,在TOF传感器打开的情况下,可以控制光感类传感器(如环境光传感器和接近光传感器)关闭。在TOF传感器关闭的情况下,可控制光感类传感器打开。以避免TOF传感器打开的情况下发出的红外光脉冲,影响光感类传感器测量数 据准确性的情况出现。从而避免了手机对应功能的误触发,还可以提高用户的使用体验。
在一种可能的实现方式中,处理器通过GPIO管脚与TOF传感器耦合,处理器通过第一接口与环境光传感器耦合,通过第二接口与接近光传感器耦合;其中,第一接口和第二接口可以是I2C接口。处理器,还用于通过GPIO管脚向TOF传感器输出第一电平(如高电平),用于控制TOF传感器打开;处理器,用于在TOF传感器打开的情况下,控制环境光传感器和接近光传感器关闭,包括:处理器,用于在通过GPIO管脚向TOF传感器输出第一电平时,通过第一接口控制环境光传感器关闭,通过第二接口控制接近光传感器关闭。
在另一种可能的实现方式中,处理器,还用于通过GPIO管脚向TOF传感器输出第二电平(如低电平)时,用于控制TOF传感器关闭;处理器,用于在TOF传感器关闭的情况下,控制环境光传感器和接近光传感器打开,包括:处理器,用于在通过GPIO管脚向TOF传感器输出第二电平时,通过第一接口控制环境光传感器打开,通过第二接口控制接近光传感器打开。这样,通过采用硬件方案获取TOF传感器的工作状态(如打开或关闭),从而可在TOF传感器打开时,控制光感类传感器关闭。在TOF传感器关闭时,控制光感类传感器打开。
在另一种可能的实现方式中,处理器,用于在TOF传感器打开的情况下,控制环境光传感器和接近光传感器关闭,包括:处理器,用于在TOF传感器使能时,控制环境光传感器和接近光传感器关闭;处理器,用于在TOF传感器关闭的情况下,控制环境光传感器和接近光传感器打开,包括:处理器,用于在TOF传感器未使能时,控制环境光传感器和接近光传感器打开。这样,电子设备可以根据TOF传感器的使能状态(使能状态可以为使能或未使能),控制光感类传感器关闭或打开。在TOF传感器使能时,TOF传感器发射红外光脉冲。以便在TOF传感器向外发射红外光脉冲时,可控制光感类传感器关闭。
在另一种可能的实现方式中,处理器,还用于在确定应用需要TOF传感器辅助实现功能时,生成第一命令,根据第一命令通过第一驱动控制TOF传感器使能,第一驱动是TOF传感器的驱动,第一驱动可以称为TOF传感器驱动;上述处理器,用于在TOF传感器使能时,控制环境光传感器和接近光传感器关闭,包括:处理器,用于根据第一命令通过第二驱动控制环境光传感器关闭,根据第一命令通过第三驱动控制接近光传感器关闭,第二驱动是环境光传感器的驱动,第三驱动是接近光传感器的驱动。例如,在3D人脸解锁应用需TOF传感器辅助生成3D人脸图像时,处理器可生成上述第一命令。又例如,在相机应用需要TOF传感器进行景深判断实现背景虚化时,处理器可生成上述第一命令。
在另一种可能的实现方式中,处理器,还用于在确定应用(如上述3D人脸解锁应用或相机应用)退出时,生成第二命令,根据第二命令通过第一驱动控制TOF传感器去使能;处理器,用于在TOF传感器未使能时,控制环境光传感器和接近光传感器打开,包括:处理器,用于在TOF传感器去使能后,根据第二命令通过第二驱动控制环境光传感器打开,根据第二命令通过第三驱动控制接近光传感器打开。这样,可以通过采用软件方案获取TOF传感器的使能状态(如使能或未使能),从而可在TOF传感 器使能,即向外发射红外光脉冲时,控制光感类传感器关闭。在TOF传感器未使能时,控制光感类传感器打开。
第二方面,本申请实施例提供一种电子设备,该电子设备可以包括处理器,以及与处理器耦合的TOF传感器、环境光传感器和接近光传感器,其中:TOF传感器、环境光传感器和接近光传感器位于电子设备的同一侧;处理器,在TOF传感器打开的情况下,丢弃环境光传感器和接近光传感器测量的数据;在TOF传感器关闭的情况下,根据环境光传感器测量的数据实现电子设备的第一功能,在TOF传感器关闭的情况下,根据接近光传感器测量的数据实现电子设备的第二功能。例如,第一功能可以是自动调节屏幕亮度,第二功能可以是确定手机附近是否有物体。
采用上述技术方案,在TOF传感器打开的情况下,通过丢弃光感类传感器测量的数据,使用TOF传感器关闭的情况下光感类传感器测量的数据。这样,可以避免手机对应功能的误触发,还可以提高用户的使用体验。
在一种可能的实现方式中,处理器,根据环境光传感器输出的数据,确定环境光中红外成分的占比;处理器,在TOF传感器打开的情况下,丢弃环境光传感器和接近光传感器测量的数据,包括:处理器,在确定环境光中红外成分的占比大于阈值时,丢弃环境光传感器和接近光传感器测量的数据;处理器,在TOF传感器关闭的情况下,根据环境光传感器测量的数据实现电子设备的第一功能,在TOF传感器关闭的情况下,根据接近光传感器测量的数据实现电子设备的第二功能,包括:处理器,在确定环境光中红外成分的占比小于阈值时,根据环境光传感器测量的数据实现第一功能,在确定环境光中红外成分的占比小于阈值时,根据接近光传感器测量的数据实现第二功能。这样,通过监测环境光中红外成分占比的大小,以确定TOF传感器打开还是关闭。
在另一种可能的实现方式中,处理器,根据环境光传感器输出的数据,确定环境光中红外成分的占比,包括:处理器,根据环境光传感器输出的环境光的红色R通道的光强度,绿色G通道的光强度,蓝色B通道的光强度及自定义C通道的光强度,确定环境光中红外的光强度,根据红外的光强度和C通道的光强度确定环境光中红外成分的占比。例如,可利用下面公式(1)或公式(2)确定环境光中红外的光强度。IR=(R+G+B-C)/2;公式(2):IR=C-(R+G+B)。其中,IR表示环境光中IR的光强度。R表示环境光中R通道的光强度。G表示环境光中G通道的光强度。B表示环境光中B通道的光强度。C表示环境光中C通道的光强度。
第三方面,本申请实施例提供一种传感器控制方法,该传感器控制方法可以应用于电子设备,该电子设备可以包括TOF传感器、环境光传感器和接近光传感器,TOF传感器、环境光传感器和接近光传感器位于电子设备的同一侧;该方法可以包括:电子设备在TOF传感器打开的情况下,控制环境光传感器和接近光传感器关闭;电子设备在TOF传感器关闭的情况下,控制环境光传感器和接近光传感器打开。
在一种可能的实现方式中,该方法还可以包括:电子设备向TOF传感器输出第一电平,用于控制TOF传感器打开;上述电子设备在TOF传感器打开的情况下,控制环境光传感器和接近光传感器关闭,包括:电子设备在向TOF传感器输出第一电平时,控制环境光传感器和接近光传感器关闭。
在另一种可能的实现方式中,该方法还可以包括:电子设备向TOF传感器输出第 二电平时,用于控制TOF传感器关闭;上述电子设备在TOF传感器关闭的情况下,控制环境光传感器和接近光传感器打开,包括:电子设备在向TOF传感器输出第二电平时,控制环境光传感器和接近光传感器打开。
在另一种可能的实现方式中,上述电子设备在TOF传感器打开的情况下,控制环境光传感器和接近光传感器关闭,包括:电子设备在TOF传感器使能时,控制环境光传感器和接近光传感器关闭;上述电子设备在TOF传感器关闭的情况下,控制环境光传感器和接近光传感器打开,包括:电子设备在TOF传感器未使能时,控制环境光传感器和接近光传感器打开。
在另一种可能的实现方式中,该方法还可以包括:电子设备在确定应用需要TOF传感器辅助实现功能时,生成第一命令,根据第一命令通过第一驱动控制TOF传感器使能,第一驱动是TOF传感器的驱动;上述电子设备在TOF传感器使能时,控制环境光传感器和接近光传感器关闭,包括:电子设备根据第一命令通过第二驱动控制环境光传感器关闭,根据第一命令通过第三驱动控制接近光传感器关闭,第二驱动是环境光传感器的驱动,第三驱动是接近光传感器的驱动。
在另一种可能的实现方式中,该方法还可以包括:电子设备在确定应用退出时,生成第二命令,根据第二命令通过第一驱动控制TOF传感器去使能;上述电子设备在TOF传感器未使能时,控制环境光传感器和接近光传感器打开,包括:电子设备在TOF传感器去使能后,根据第二命令通过第二驱动控制环境光传感器打开,根据第二命令通过第三驱动控制接近光传感器打开。
第四方面,本申请实施例提供一种传感器控制方法,该传感器控制方法可以应用于电子设备,该电子设备可以包括TOF传感器、环境光传感器和接近光传感器,TOF传感器、环境光传感器和接近光传感器位于电子设备的同一侧;该方法可以包括:电子设备在TOF传感器打开的情况下,丢弃环境光传感器和接近光传感器测量的数据;电子设备在TOF传感器关闭的情况下,根据环境光传感器测量的数据实现电子设备的第一功能,在TOF传感器关闭的情况下,根据接近光传感器测量的数据实现电子设备的第二功能。
在一种可能的实现方式中,该方法还可以包括:电子设备根据环境光传感器输出的数据,确定环境光中红外成分的占比;上述电子设备在TOF传感器打开的情况下,丢弃环境光传感器和接近光传感器测量的数据,包括:电子设备在确定环境光中红外成分的占比大于阈值时,丢弃环境光传感器和接近光传感器测量的数据;上述电子设备在TOF传感器关闭的情况下,根据环境光传感器测量的数据实现电子设备的第一功能,在TOF传感器关闭的情况下,根据接近光传感器测量的数据实现电子设备的第二功能,包括:电子设备在确定环境光中红外成分的占比小于阈值时,根据环境光传感器测量的数据实现第一功能;电子设备在确定环境光中红外成分的占比小于阈值时,根据接近光传感器测量的数据实现第二功能。
在另一种可能的实现方式中,上述电子设备根据环境光传感器输出的数据,确定环境光中红外成分的占比,包括:电子设备根据环境光传感器输出的环境光的R通道的光强度,G通道的光强度,B通道的光强度及C通道的光强度,确定环境光中红外的光强度;电子设备根据红外的光强度和C通道的光强度确定环境光中红外成分的占比。
第五方面,本申请实施例提供一种电子设备,该电子设备可以包括:处理器、存储器、TOF传感器、环境光传感器和接近光传感器;TOF传感器、环境光传感器和接近光传感器位于电子设备的同一侧;处理器,TOF传感器,环境光传感器,接近光传感器和存储器耦合,存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令,当该计算机指令被电子设备执行时,使得电子设备执行如第三方面或第三方面的可能的实现方式,或第四方面或第四方面的可能的实现方式中任一项所述的传感器控制方法。
第六方面,本申请实施例提供一种计算机可读存储介质,包括:计算机软件指令;当计算机软件指令在电子设备中运行时,使得电子设备执行如第三方面或第三方面的可能的实现方式,或第四方面或第四方面的可能的实现方式中任一项所述的传感器控制方法。
第七方面,本申请实施例提供一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行如第三方面或第三方面的可能的实现方式,或第四方面或第四方面的可能的实现方式中任一项所述的传感器控制方法。
可以理解地,上述提供的第三方面和第四方面所述的方法、第五方面所述的电子设备、第六方面所述的计算机可读存储介质,以及第七方面所述的计算机程序产品与上述第一方面及第二方面所述的电子设备对应,因此,其所能达到的有益效果可参考上文所提供的对应电子设备中的有益效果,此处不再赘述。
附图说明
图1为本申请实施例提供的一种手机的正面示意图;
图2为本申请实施例提供的一种TOF传感器干扰环境光传感器和接近光传感器的场景示意图;
图3为本申请实施例提供的一种TOF传感器关闭时接近光传感器的测量结果示意图;
图4为本申请实施例提供的一种TOF传感器打开时接近光传感器的测量结果示意图;
图5为本申请实施例提供的一种TOF传感器关闭时环境光传感器的测量结果示意图;
图6为本申请实施例提供的一种TOF传感器打开时环境光传感器的测量结果示意图;
图7为本申请实施例提供的一种电子设备的结构示意图;
图8为本申请实施例提供的一种处理器与传感器的连接示意图;
图9为本申请实施例提供的一种基于安卓操作系统的手机的软件架构的示意图;
图10为本申请实施例提供的一种TOF传感器的发射模式示意图;
图11为本申请实施例提供的一种电子设备的示意图。
具体实施方式
手机等电子设备可通过配置各种传感器,丰富电子设备的功能,给用户更好的使用体验。例如,手机中可配置TOF传感器,用于实现3D人脸解锁功能,在实现拍摄功能时进行景深判断以实现背景虚化等。又例如,手机中可配置光感类传感器,如接近 光传感器,环境光传感器等。接近光传感器可用于手机确定手机附近是否有物体,以实现自动熄灭屏幕的功能。环境光传感器可用于手机自动调节屏幕亮度。
电子设备可能同时设置有TOF传感器和光感类传感器。且TOF传感器和光感类传感器可能设置在电子设备的同一侧。例如,以电子设备为手机,手机同时设置有TOF传感器,接近光传感器和环境光传感器为例。如图1所示,为本申请实施例提供的一种手机的正面示意图。手机的正面同时设置有TOF传感器101、接近光传感器102及环境光传感器103。需要说明的是,图1仅示例性的示出手机中各部件的位置,但并不意在限定于此。
可以理解的,结合图1,如图2所示,TOF传感器101打开时会发射红外光脉冲,红外光脉冲遇到物体后会发生反射(例如漫反射)。发生反射的光会被TOF传感器101接收到。TOF传感器101通过探测可获得红外光脉冲的飞行往返时间。手机根据TOF传感器101获得的飞行往返时间可计算出与物体的距离,从而产生深度信息,辅助手机实现对应功能。继续参考图2,由于接近光传感器102和环境光传感器103与TOF传感器101设置在手机的同一侧,因此,在接近光传感器102和环境光传感器103打开时,发生反射的光也可能被接近光传感器102和环境光传感器103接收,这会影响其测量到数据的准确性,从而导致手机对应功能的误触发。
示例性的,请参考图3,为TOF传感器101关闭时,手机距物体不同距离的情况下,接近光传感器102测量到的光强度的示意图。其中,图3中的(a)、图3中的(b)、图3中的(c)及图3中的(d)分别是TOF传感器101关闭时,手机距物体3厘米(cm)、7cm、10cm及15cm的情况下,接近光传感器102测量到的光强度的示意图。
请参考图4,为TOF传感器101打开时,手机距物体不同距离的情况下,接近光传感器102测量到的光强度的示意图。其中,图4中的(a)、图4中的(b)、图4中的(c)及图4中的(d)分别是TOF传感器101打开时,手机距物体3cm、7cm、10cm及15cm的情况下,接近光传感器102测量到的光强度的示意图。
其中,在图3和图4中,横坐标为数据点数,纵坐标为接近光传感器102测量得到的光强度。
由图3和图4可以看出,当TOF传感器101关闭时,手机距物体3cm、7cm、10cm及15cm的情况下,接近光传感器102测量到的光强度基本在40-70之间。而当TOF传感器101打开时,手机距物体3cm、7cm、10cm及15cm的情况下,由于TOF传感器101发出的红外光脉冲的反射影响,接近光传感器102测量到的光强度相较于TOF传感器101关闭时接近光传感器102测量到的光强度均会增大。并且手机距离物体越近,增大的倍数越多。例如,手机距离物体3cm时会增大4倍以上,手机距离物体7cm时会增大2倍以上。也就是说,当TOF传感器101打开时,接近光传感器102测量到的数据并不准确,这会导致手机的对应功能误触发。
例如,如图1所示,手机的正面设置有摄像头104。用户在使用摄像头104拍照时,TOF传感器101打开,用于进行景深判断以实现背景虚化。另外,在用户拍照时,手机是处于亮屏状态的,而亮屏状态下接近光传感器102也会打开,用于手机确定手机附近是否有物体,以实现自动熄灭屏幕的功能。在这种场景下,接近光传感器102会由于能接收到TOF传感器101发出的红外光脉冲发生反射的光,导致测量到的光强 度偏大。这样,会使得在物体距离手机较远时,手机可能误判手机附近有物体,从而自动熄灭屏幕。也就是说,可能出现用户正在拍照,手机却自动熄灭了屏幕的情况。
又示例性的,请参考图5,为TOF传感器101关闭时,手机距物体不同距离的情况下,环境光传感器103测量到的光强度的示意图。其中,图5中的(a)、图5中的(b)、图5中的(c)及图5中的(d)分别是TOF传感器101关闭时,手机距物体3cm、7cm、10cm及15cm的情况下,环境光传感器103测量到的光强度的示意图。
请参考图6,为TOF传感器101打开时,手机距物体不同距离的情况下,环境光传感器103测量到的光强度的示意图。其中,图6中的(a)、图6中的(b)、图6中的(c)及图6中的(d)分别是TOF传感器101打开时,手机距物体3cm、7cm、10cm及15cm的情况下,环境光传感器103测量到的光强度的示意图。
其中,在图5和图6中,横坐标为数据点数,纵坐标为环境光传感器103测量得到环境光的四个通道的光强度。四个通道分别可以是R通道,G通道,B通道和C通道。R通道是红色(red)通道。G通道是绿色(green)通道。B通道是蓝色(blue)通道。C通道是自定义(custom)的颜色通道。
由图5和图6可以看出,当TOF传感器101关闭时,手机距物体3cm、7cm、10cm及15cm的情况下,环境光传感器103测量到的环境光的四个通道的光强度基本在0-25之间。而当TOF传感器101打开时,手机距物体3cm、7cm、10cm及15cm的情况下,由于TOF传感器101发出的红外光脉冲的反射影响,环境光传感器103测量到的环境光的四个通道的光强度相较于TOF传感器101关闭时环境光传感器103测量到的环境光的四个通道的光强度均会增大。并且手机距离物体越近,增大的倍数越多。也就是说,当TOF传感器101打开时,环境光传感器103测量到的数据并不准确,这会导致手机的对应功能误触发。
例如,用户在进行3D人脸解锁时,TOF传感器101打开,用于获得用户的3D人脸图像。另外,在进行3D人脸解锁时,手机是处于锁屏下的亮屏状态的。而锁屏下的亮屏状态,环境光传感器103也会打开,用于手机自动调节屏幕亮度。在这种场景下,环境光传感器103会由于接收到TOF传感器101发出的红外光脉冲发生反射的光,导致测量到的光强度偏大。这样,手机可能会在光线暗的环境下,将手机的屏幕亮度调高引起刺眼。
综上可以得到的是,如果在TOF传感器打开时,光感类传感器(如环境光传感器,接近光传感器)也打开,则TOF传感器发出的红外光脉冲,会影响光感类传感器测量到数据的准确性,导致电子设备对应功能的误触发。本申请实施例提供的方法,能够修正TOF传感器打开时对光感类传感器带来的影响,避免电子设备对应功能的误触发,提高用户的使用体验。
下面将结合附图对本申请实施例的实施方式进行详细描述。
示例性的,本申请实施例中所述的电子设备可以是手机、平板电脑、桌面型、膝上型、手持计算机、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本,以及蜂窝电话、个人数字助理(personal digital assistant,PDA)、可穿戴电子设备(如智能手表等)、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备等包括TOF传感器及光感类传感器的设备,本 申请实施例对该设备的具体形态不作特殊限制。光感类传感器可以包括接近光传感器和/或环境光传感器等。
请参考图7,为本申请实施例提供的一种电子设备的结构示意图。如图7所示,电子设备可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。
其中,传感器模块180可以包括TOF传感器101,接近光传感器102,环境光传感器103,压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,指纹传感器180G,温度传感器180H,触摸传感器180I,骨传导传感器180J等。
可以理解的是,本实施例示意的结构并不构成对电子设备的具体限定。在另一些实施例中,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
控制器可以是电子设备的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,SIM接口,和/或USB接口等。
其中,I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C接口。处理器110可以通过不同的I2C接口分别耦合TOF传感器101,接近光传感器102,环境光传感器103,触摸传感器180I,充电器,闪光灯,摄像头 193等。例如:处理器110可以通过I2C接口耦合TOF传感器101,使处理器110与TOF传感器101通过I2C接口通信,实现电子设备的3D人脸解锁功能,或在实现拍摄功能时进行景深判断以实现背景虚化功能等。处理器110还可以通过I2C接口耦合接近光传感器102,使处理器110与接近光传感器102通过I2C接口通信,实现电子设备的自动熄灭屏幕功能。处理器110还可以通过I2C接口耦合环境光传感器103,使处理器110与环境光传感器103通过I2C接口通信,实现电子设备的自动调节屏幕亮度功能。处理器110还可以通过I2C接口耦合触摸传感器180I,使处理器110与触摸传感器180I通过I2C接口通信,实现电子设备的触摸功能。
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
可以理解的是,本实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备的结构限定。在另一些实施例中,电子设备也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁 波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
无线通信模块160可以提供应用在电子设备上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备可以通过TOF传感器101,ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备可以包括1个或N个摄像头193,N为大于1的正整数。如电子设备可以包括图1中所示的摄像头101(可称为前置摄像头),还可包括一个或多个设置于电子设备(如手机)背面的摄像头(可称为后置摄像头)。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备可以支持一种或多种视频编解码器。这样,电子设备可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备的各种功能应用以及数据处理。例如,在本申请实施例中,处理器110可以通过执行存储在内部存储器121中的指令,在确定TOF传感器101打开时,控制光感类传感器(接近光传感器102和/或环境光传感器103)关闭,或者,丢弃TOF传感器101打开时光感类传感器(接近光传感器102和/或环境光传感器103)测量的数据。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
电子设备可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息或需要通过语音助手触发电子设备执行某些功能时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备可以设置至少一个麦克风170C。在另一些实施例中,电子设备可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
TOF传感器101可通过向物体连续发送红外光脉冲(例如,波长为940nm的光脉冲),然后再接收从物体反射的红外光脉冲,通过探测可获得红外光脉冲的飞行往返时间。TOF传感器101将探测到的红外光脉冲的飞行往返时间输出给处理器110。处理器110根据TOF传感器101输出的红外光脉冲的飞行往返时间计算出电子设备与物体的距离。在其他一些实施例中,TOF传感器101在探测到红外光脉冲的飞行往返时间后,可以根据探测到的红外光脉冲的飞行往返时间计算出电子设备与物体的距离,然后将计算出的电子设备与物体的距离输出给处理器110。
电子设备可利用TOF传感器101输出的数据实现3D人脸解锁功能。还可以利用TOF传感器101输出的数据实现其他功能,如电子设备可使用TOF传感器101输出的数据,在实现拍摄功能时进行景深判断以实现背景虚化。其中,在使用3D人脸解锁功能解锁,或者通过前置摄像头,如图1中所示的摄像头104实现拍摄功能等场景下,处理器110可以控制TOF传感器101打开。
接近光传感器102可以包括例如发光二极管(LED)和光检测器,如光电二极管。发光二极管可以是红外发光二极管。接近光传感器102向外发射红外光脉冲,再检测来自物体的红外反射光。接近光传感器102将检测到的红外反射光的光强度输出给处理器110。处理器110根据接近光传感器102输出的光强度可实现对应功能。例如,接近光传感器102可用于物体是否接近电子设备的测量。如,当处理器110确定光强度超过阈值,即接近光传感器102检测到充分的反射光时,可以确定电子设备附近有物体。当处理器110确定光强度未超过阈值,即接近光传感器102检测到不充分的反射光时,电子设备可以确定电子设备附近没有物体。
电子设备可以利用接近光传感器102检测用户手持电子设备贴近耳朵通话,以便自动熄灭屏幕达到防止人体误触屏幕及省电的目的。电子设备也可以利用接近光传感器102实现皮套模式(检测安装在电子设备上的皮套是否打开),口袋模式(检测电子设备是否放入口袋)下的自动熄灭屏幕或点亮屏幕。其中,在使用电子设备通话,或者口袋模式打开,或皮套模式打开等场景下,处理器110可以控制接近光传感器102打开。在退出上述场景时,处理器110可以控制接近光传感器102关闭。
环境光传感器103用于感知环境光亮度。例如:环境光传感器103可以测量环境光的四个通道的光强度。环境光传感器103将测量到的环境光的四个通道的光强度输出给处理器110。处理器110可以对环境光传感器103输出的环境光的四个通道的光强度进行处理(如,对环境光的四个通道的光强度积分)得到环境光的光强度(如照度值,或者,照度值和色温值)。在亮屏状态(包括解锁后的亮屏和锁屏下的亮屏)下,电子设备可以根据得到的环境光的光强度自适应调节显示屏194亮度。如,在环境光照较暗时,降低屏幕亮度防止刺眼;在环境光照较明亮时,提高屏幕亮度,可以使屏幕显示更清楚。环境光传感器103也可用于实现拍摄功能时自动调节白平衡。其中,在电子设备处于亮屏状态,或实现拍摄功能时,处理器110控制环境光传感器103打开。在熄屏时,处理器控制环境光传感器103关闭。
在本申请实施例中,为了防止TOF传感器101发出的红外光脉冲发生反射的光对光感类传感器(接近光传感器102和/或环境光传感器103)测量的数据产生影响,在确定TOF传感器101打开时,可控制光感类传感器关闭,或者,丢弃TOF传感器101打开时光感类传感器测量的数据。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备根据压力传感器180A检测所述触摸操作强度。电子设备也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。
气压传感器180C用于测量气压。在一些实施例中,电子设备通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。电子设备可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备是翻盖机时,电子设备可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器180E可检测电子设备在各个方向上(一般为三轴)加速度的大小。当电子设备静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备可以利用距离传感器180F测距以实现快速对焦。
指纹传感器180G用于采集指纹。电子设备可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180H用于检测温度。在一些实施例中,电子设备利用温度传感器180H检测的温度,执行温度处理策略。例如,当温度传感器180H上报的温度超过阈值,电子设备执行降低位于温度传感器180H附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备对电池142加热,以避免低温导致电子设备异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180I,也称“触控面板”。触摸传感器180I可以设置于显示屏194,由触摸传感器180I与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180I用于检测作用于其上或附近的触摸操作。触摸传感器180I可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180I也可以设置于电子设备的表面,与显示屏194所处的位置不同。
骨传导传感器180J可以获取振动信号。在一些实施例中,骨传导传感器180J可以获取人体声部振动骨块的振动信号。骨传导传感器180J也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180J也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180J获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180J获取的血压跳动信号解析心率信息,实现心率检测功能。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备可以接收按键输入,产生与电子设备的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备的接触和分离。电子设备可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备中,不能和电子设备分离。
以下实施例中的方法均可以在具有上述硬件结构的电子设备中实现。
以下以电子设备为手机,手机包括TOF传感器,接近光传感器和环境光传感器为例,对本申请实施例的方法进行介绍。结合图1,TOF传感器101,接近光传感器102及环境光传感器103位于手机的同一侧,如均位于手机的正面。如果在TOF传感器101打开时,光感类传感器(如接近光传感器102和/或环境光传感器103)也打开,则TOF传感器101发出的红外光脉冲,会影响光感类传感器测量到数据的准确性。
其中,在以下情况1下,手机的TOF传感器101打开:情况1-1,通过前置摄像头(如,图1中所示的摄像头104)实现拍摄功能;情况1-2,使用3D人脸解锁功能解锁等。
在以下情况2下,手机的接近光传感器102打开:情况2-1,使用手机进行通话;情况2-2,口袋模式打开;情况2-3,皮套模式打开;情况2-4,手机处于亮屏状态(包括锁屏下的亮屏和解锁后的亮屏);情况2-5,手机锁屏,且处于灭屏状态,显示时间;情况2-6,手机来电等。
在以下情况下,手机的环境光传感器103打开:情况3-1,手机处于亮屏状态(包括锁屏下的亮屏和解锁后的亮屏);情况3-2,通过摄像头(前置摄像头或后置摄像头)实现拍摄功能。
可以理解的是,在情况1的任一情况和情况2的任一情况同时出现的场景下,TOF传感器101和接近光传感器102两者可以同时打开。在情况1的任一情况和情况3的任一情况同时出现的场景下,TOF传感器101和环境光传感器103两者可以同时打开。在情况1的任一情况,情况2的任一情况和情况3的任一情况同时出现的场景下,TOF传感器101、接近光传感器102和环境光传感器103三者可以同时打开。
在本申请一些实施例中,如果TOF传感器101打开时,光感类传感器(如接近光传感器102和/或环境光传感器103)也打开,则手机可以控制光感类传感器关闭。在TOF传感器101关闭时,手机可重新控制光感类传感器打开。也就是说,在TOF传感器101打开的情况下,控制光感类传感器关闭;在TOF传感器101关闭的情况下,控制光感类传感器打开,以避免TOF传感器101发出的红外光脉冲,影响光感类传感器测量数据准确性的情况出现。
在一种可能的实施方式中,手机(如,图2中所示的处理器110)可以采用硬件方案获取TOF传感器101的工作状态(工作状态可以为打开或关闭),从而根据TOF传感器101的工作状态,控制光感类传感器关闭或打开。即在TOF传感器101打开时,手机的处理器110控制光感类传感器关闭。在TOF传感器101关闭时,手机的处理器 110控制光感类传感器打开。
其中,手机的处理器110分别与手机的TOF传感器101,接近光传感器102及环境光传感器103通信连接。
示例性的,处理器110可通过不同的I2C接口分别与TOF传感器101,接近光传感器102及环境光传感器103耦合。例如,如图8所示,处理器110通过I2C接口_AB与TOF传感器101耦合。处理器110通过I2C接口_DE(I2C接口_DE可以为本申请中的第一接口)与环境光传感器103耦合。处理器110通过I2C接口_FG(I2C接口_FG可以为本申请中的第二接口)与接近光传感器102耦合。通过不同的I2C接口,处理器110可以与对应的传感器通信。如,在TOF传感器101打开时,TOF传感器101可通过I2C接口_AB将探测到红外光脉冲的飞行往返时间输出给处理器110。又如,在环境光传感器103打开时,环境光传感器103可通过I2C接口_DE将测量到的环境光的四个通道的光强度输出给处理器110。又如,在接近光传感器102打开时,接近光传感器102可通过I2C接口_FG将检测到的红外反射光的光强度输出给处理器110。
处理器110还可通过通用输入输出(general-purpose input/output,GPIO)管脚(如,图8中的“C”管脚)与TOF传感器101耦合,以控制TOF传感器101打开或关闭。例如,如图8所示,处理器110的“C”管脚与TOF传感器101的ODS_APC_GATE管脚耦合。处理器110可通过“C”管脚向TOF传感器101的ODS_APC_GATE管脚输出高电平。这样,TOF传感器101的ODS_APC_GATE管脚由低电平变为高电平,TOF传感器101打开。处理器110可通过“C”管脚向TOF传感器101的ODS_APC_GATE管脚输出低电平。这样,TOF传感器101的ODS_APC_GATE管脚由高电平变为低电平,TOF传感器101关闭。在TOF传感器101打开时,TOF传感器101向外发出红外光脉冲。
在本申请实施例中,为了避免TOF传感器101打开时发出的红外光脉冲,影响光感类传感器测量数据准确性,在处理器110控制TOF传感器101打开,如通过“C”管脚向TOF传感器101的ODS_APC_GATE管脚输出高电平时,如果光感类传感器此时已打开,则处理器110可控制该光感类传感器关闭。在一些实施例中,处理器110可通过与光感类传感器的I2C接口,控制该光感类传感器关闭。例如,在处理器110通过“C”管脚向TOF传感器101的ODS_APC_GATE管脚输出高电平时,如果接近光传感器102此时已打开,则处理器可通过与接近光传感器102的I2C接口_FG,控制该接近光传感器102关闭。又例如,在处理器110通过“C”管脚向TOF传感器101的ODS_APC_GATE管脚输出高电平时,如果环境光传感器103此时已打开,则处理器可通过与环境光传感器103的I2C接口_DE,控制该环境光传感器103关闭。
在处理器110控制TOF传感器101关闭,如通过“C”管脚向TOF传感器101的ODS_APC_GATE管脚输出低电平时,处理器110可重新控制该光感类传感器打开。在一些实施例中,处理器110可通过与光感类传感器的I2C接口,控制该光感类传感器打开。例如,在处理器110通过“C”管脚向TOF传感器101的ODS_APC_GATE管脚输出低电平时,处理器可通过与接近光传感器102的I2C接口_FG,重新控制该接近光传感器102打开。又如,在处理器110通过“C”管脚向TOF传感器101的ODS_APC_GATE管脚输出低电平时,处理器可通过与环境光传感器103的I2C接口_DE,重新控制该环境光传感器103打开。
例如,结合图1和图8,在用户使用手机的前置摄像头,即摄像头104拍照时,处理器110通过“C”管脚向TOF传感器101的ODS_APC_GATE管脚输出高电平,控制TOF传感器101打开。可以理解的,在用户拍照时,手机是处于亮屏状态的,而在亮屏状态下,手机的接近光传感器102是打开的。因此,处理器110还可通过与接近光传感器102的I2C接口_FG,控制该接近光传感器102关闭。在亮屏状态下,手机的环境光传感器103也是打开的。因此,处理器110还可通过与环境光传感器103的I2C接口_DE,控制该环境光传感器103关闭。这样,便可避免手机对应功能的误触发的情况发生。如,不会出现手机根据接近光传感器102测量的偏大的光强度,误判手机附近有物体而自动熄灭屏幕的情况。又如,不会出现手机根据环境光传感器103测量的偏大的光强度,在光线暗的环境下将手机的屏幕亮度调高引起刺眼的情况。
当然,在处理器110通过“C”管脚向TOF传感器101的ODS_APC_GATE管脚输出低电平,以控制TOF传感器101关闭。如果手机仍处于亮屏状态,则处理器110可通过与接近光传感器102的I2C接口_FG,控制该接近光传感器102重新打开,通过与环境光传感器103的I2C接口_DE,控制该环境光传感器103重新打开。
采用上述技术方案,通过采用硬件方案获取TOF传感器101的工作状态,从而可在TOF传感器101打开时,控制光感类传感器关闭。在TOF传感器101关闭时,重新控制光感类传感器打开。这样,可以避免TOF传感器101打开时发出的红外光脉冲经物体反射后照射到光感类传感器上,影响光感类传感器测量到数据准确性的问题出现。从而避免了手机对应功能的误触发,提高了用户的使用体验。
在另一种可能的实施方式中,结合图1,手机可以采用软件方案获取TOF传感器101的使能状态(使能状态可以为使能或未使能)。从而手机根据TOF传感器101的使能状态,控制光感类传感器关闭或打开。即在TOF传感器101使能时,手机控制光感类传感器关闭。在TOF传感器101未使能时,手机控制光感类传感器打开。在TOF传感器101使能时,TOF传感器101可按照图10所示的模式(如模式1或模式2)发射红外光脉冲。在TOF传感器101未使能时或者说去使能后,TOF传感器101则不会发射红外光脉冲。
作为一种示例,图9为本申请实施例提供的一种基于安卓(Android)操作系统的手机的软件架构的示意图。如图9所示,该软件架构可以包括:应用程序层(application layer),框架层(framework layer),硬件抽象层(hardware abstract layer,HAL),内核层(kernel layer)及硬件层(hardware layer)。其中:
应用程序层是与用户交互的层级。应用程序层可以包括手机的各种应用程序(如,第三方应用程序和/或系统应用程序)。例如,在本实施例中,应用程序层可以包括3D人脸解锁应用、相机应用等。在用户打开这些应用程序时,手机可控制手机硬件层的TOF传感器101使能,以辅助该应用实现对应功能。如,在用户打开3D人脸解锁应用时,手机可控制手机的TOF传感器101使能,以便可以使用TOF传感器101测量到的数据生成3D人脸图像,以实现3D人脸解锁功能。又如,在用户打开相机应用时,手机可控制手机的TOF传感器101使能,以便可以使用TOF传感器101测量到的数据进行景深判断,以便在实现拍摄功能时刻实现背景虚化。
框架层包括库函数。库函数提供了构建应用程序时可能用到的各种应用程序编程 接口(application programming interface,API)。针对传感器硬件电路,框架层提供传感器管理器(manager),用于对传感器(如,TOF传感器101,接近光传感器102及环境光传感器103)硬件电路进行管理。
硬件抽象层通过将硬件电路抽象化,向框架层提供抽象的硬件电路,向内核层的驱动程序提供标准的撰写或控制接口。生产厂商根据该标准可提供硬件电路的驱动程序。例如,可将硬件层的TOF传感器,接近光传感器及环境光传感器虚拟为传感器服务(service)模块。
内核层提供包括控制硬件层中硬件电路的驱动程序,驱动程序一般由硬件电路的生产厂商根据硬件抽象层提供的标准接口来实现。例如,内核层包括TOF传感器驱动,接近光传感器驱动及环境光传感器驱动。TOF传感器驱动用于控制TOF传感器。接近光传感器驱动用于控制接近光传感器。环境光传感器驱动用于控制环境光传感器。其中,TOF传感器驱动可以为本申请中的第一驱动。环境光传感器驱动可以为本申请中的第二驱动。接近光传感器驱动可以为本申请中的第三驱动。
硬件层包括如TOF传感器101、接近光传感器102和环境光传感器103等部件。
在本申请实施例中,在手机的应用程序层接收到打开某应用程序的操作时,如果该应用程序需要TOF传感器101辅助实现对应功能,则应用程序层向框架层的传感器管理器发送命令1。其中,命令1可以为本申请中的第一命令。
框架层的传感器管理器接收到该命令1后,可将该命令1通过硬件抽象层的传感器服务模块下发给内核层的TOF传感器驱动,接近光传感器驱动和环境光传感器驱动。
内核层的TOF传感器驱动接收到该命令1后,可控制硬件层的TOF传感器101使能。
内核层的接近光传感器驱动接收到该命令1后,如果硬件层的接近光传感器102此时已打开,则可控制接近光传感器102关闭。
内核层的环境光传感器驱动接收到该命令1后,如果硬件层的环境光传感器103此时已打开,则可控制环境光传感器103关闭。
在上述应用程序退出,即需要控制TOF传感器101去使能时,应用程序层向框架层的传感器管理器发送命令2。其中,命令2可以为本申请中的第二命令。
框架层的传感器管理器接收到该命令2后,可将该命令2通过硬件抽象层的传感器服务模块下发给内核层的TOF传感器驱动,接近光传感器驱动和环境光传感器驱动。
内核层的TOF传感器驱动接收到该命令2后,可控制硬件层的TOF传感器101去使能。
内核层的接近光传感器驱动接收到该命令2后,可重新控制接近光传感器102打开。
内核层的环境光传感器驱动接收到该命令2后,可重新控制环境光传感器103打开。
可以理解的,在一些实施例中,上述命令1可以是一个命令,该命令用于使能TOF传感器101。接近光传感器驱动根据该命令可控制接近光传感器102关闭,环境光传感器驱动根据该命令可控制环境光传感器103关闭。在其他一些实施例中,上述命令1可以为一个命令,该命令用于使能TOF传感器101,还用于控制接近光传感器102 和环境光传感器103关闭,也就是说,这一个命令可以使能TOF传感器101,控制接近光传感器102和环境光传感器103关闭。在另外一些实施例中,上述命令1也可以为多个命令的集合,其中多个命令中的一个命令可以用于使能TOF传感器101,多个命令的一个或多个可以用于控制接近光传感器102和环境光传感器103关闭。
类似的,在一些实施例中,上述命令2可以是一个命令,该命令用于去使能TOF传感器101。接近光传感器驱动根据该命令可控制接近光传感器102打开,环境光传感器驱动根据该命令可控制环境光传感器103打开。在其他一些实施例中,上述命令2可以为一个命令,该命令用于去使能TOF传感器101,还用于控制接近光传感器102和环境光传感器103重新打开,也就是说,这一个命令可以去使能TOF传感器101,控制接近光传感器102和环境光传感器103重新打开。在另外一些实施例中,上述命令2也可以为多个命令的集合,其中多个命令中的一个命令可以用于去使能TOF传感器101,多个命令的一个或多个可以控制接近光传感器102和环境光传感器103重新打开。
例如,结合图1和图9,在用户使用手机的3D人脸解锁功能解锁时,手机自动打开手机的3D人脸解锁应用。3D人脸解锁应用需TOF传感器101辅助生成3D人脸图像,以完成解锁功能。而在用户使用手机的3D人脸解锁功能解锁时,手机是处于亮屏状态的,而在亮屏状态下,手机的接近光传感器102是打开的,环境光传感器103也是打开的。因此,在手机打开手机的3D人脸解锁应用后,手机的应用程序层向框架层的传感器管理器发送上述命令1。框架层的传感器管理器接收到该命令1后,将该命令1通过硬件抽象层的传感器服务模块下发给内核层的TOF传感器驱动,接近光传感器驱动和环境光传感器驱动。内核层的TOF传感器驱动根据该命令1,控制硬件层的TOF传感器101使能。内核层的接近光传感器驱动根据该命令1,控制接近光传感器102关闭。内核层的环境光传感器驱动根据该命令1,控制环境光传感器103关闭。这样,便可避免手机对应功能的误触发的情况发生。
在结束3D人脸解锁后,手机的应用程序层可向框架层的传感器管理器发送上述命令2。框架层的传感器管理器接收到该命令2后,将该命令2通过硬件抽象层的传感器服务模块下发给内核层的TOF传感器驱动,接近光传感器驱动和环境光传感器驱动。内核层的TOF传感器驱动可根据该命令2,控制硬件层的TOF传感器101去使能。内核层的接近光传感器驱动根据该命令2,控制接近光传感器102重新打开。内核层的环境光传感器驱动根据该命令2,控制环境光传感器103重新打开。
采用上述技术方案,通过采用软件方案获取TOF传感器101的使能状态,从而可在TOF传感器101使能时,控制光感类传感器关闭。在TOF传感器101未使能时,重新控制光感类传感器打开。这样,可以避免TOF传感器101打开时发出的红外光脉冲经物体反射后照射到光感类传感器上,影响光感类传感器测量到数据准确性的问题出现。从而避免了手机对应功能的误触发,提高了用户的使用体验。
在本申请另一些实施例中,如果TOF传感器101打开时,光感类传感器(如接近光传感器102和/或环境光传感器103)也打开,则手机(如手机的处理器)可丢弃光感类传感器在TOF传感器101打开阶段测量的数据。也就是说,手机的处理器使用TOF传感器101关闭时光感类传感器测量的数据,以避免TOF传感器101发出的红外光脉 冲,影响光感类传感器测量数据准确性的情况出现。
作为一种示例,手机的处理器(如图2中的处理器110)可利用环境光传感器103输出的环境光的四个通道的光强度,监控环境光中红外(IR)成分占比的大小。如果手机的处理器110确定环境光传感器103输出的环境光中IR成分占比大于阈值,则可认为是TOF传感器101打开,有红外光脉冲的干扰。手机的处理器110可将环境光传感器103输出的该数据丢弃。如果手机的处理器110确定环境光传感器103输出的环境光中IR成分占比小于该阈值,则可认为此时TOF传感器101是关闭的,没有红外光脉冲的干扰。手机的处理器110可将环境光传感器103输出的该数据,作为用于实现手机对应功能(该功能可以是本申请中的第一功能,如第一功能可以是自动调节屏幕亮度)的数据来使用。
另外,如果手机的处理器110确定环境光传感器103输出的环境光中IR成分占比大于阈值,确定TOF传感器101打开,则对于接近光传感器102上报的数据(如测量到的红外反射光的光强度),手机的处理器110也做丢弃处理,即将接近光传感器102输出的该数据丢弃。如果手机的处理器110确定环境光传感器103输出的环境光中IR成分占比小于阈值,确定TOF传感器101关闭,则对于接近光传感器102上报的数据,手机的处理器110可作为用于实现手机的对应功能(该功能可以是本申请中的第二功能,如第二功能可以是确定手机附近是否有物体)的数据来使用。
在一些实施例中,手机的处理器110可根据以下公式(1)或公式(2)确定环境光中IR的光强度。
公式(1):IR=(R+G+B-C)/2;公式(2):IR=C-(R+G+B)。其中,IR表示环境光中IR的光强度。R表示环境光中R通道的光强度。G表示环境光中G通道的光强度。B表示环境光中B通道的光强度。C表示环境光中C通道的光强度。
IR成分占比可等于IR的光强度与C通道的光强度的比值。一般的,在TOF传感器101打开时,IR的光强度与C通道的光强度的比值,即IR成分的占比会升高。在本实施例中,可以在确定IR成分的占比大于阈值时,确定TOF传感器101打开,丢弃光感类传感器测量的数据。在IR成分的占比小于阈值时,确定TOF传感器101关闭,将光感类传感器测量的数据作为用于实现手机的对应功能的数据来使用。其中,该阈值可以根据环境光传感器103性能的不同而不同。如,该阈值可以为60%。又如,该阈值可以为90%。
例如,在用户使用手机的3D人脸解锁功能,或使用手机的前置摄像头拍照时,手机的处理器110可控制TOF传感器101打开。在用户使用手机的3D人脸解锁功能,或拍照时,手机是处于亮屏状态的,在亮屏状态下,手机的接近光传感器102和环境光传感器103均是打开的。在本实施例中,手机的处理器110可通过根据环境光传感器103输出数据,监控环境光中IR成分占比的大小。在确定IR成分占比大于阈值时,丢弃环境光传感器103和接近光传感器102输出的数据。使用IR成分占比小于阈值时,环境光传感器103和接近光传感器102输出的数据来实现手机的对应功能。这样,便可避免手机对应功能的误触发的情况发生。
采用上述技术方案,通过监测环境光中IR成分占比的大小,以确定TOF传感器101打开还是关闭。从而可丢弃光感类传感器在TOF传感器101打开阶段测量的数据, 使用TOF传感器101关闭时光感类传感器测量的数据。这样,可以避免手机对应功能的误触发,提高了用户的使用体验。
另外,如图10所示,为TOF传感器101发射红外光脉冲的两种模式,如模式1和模式2。这两种模式中,TOF传感器101的发射频率均是30赫兹(Hz),即发射周期是33.33毫秒(ms)。每一个发射周期都包含八个高频红外光脉冲。不同模式中,后四个高频红外光脉冲的发射频率不同。如,模式1中,后四个高频红外光脉冲的发射频率是60兆赫兹(MHz)。模式2中,后四个高频红外光脉冲的发射频率是100MHz。前四个高频红外光脉冲的发射频率均是20MHz。在图10中,高电平表示TOF传感器101打开,即发射高频红外光脉冲,低电平表示TOF传感器101关闭。即一个发射周期内,TOF传感器101要打开和关闭各8次。
在上述采用硬件同步方案修正对光感类传感器影响的实施例中,结合图10,在每个发射周期内,可以在TOF传感器101打开,即高电平表示的时间内,关闭光感类传感器。在TOF传感器101关闭,即低电平表示的时间内,打开光感类传感器。例如,以图10所示的模式1为例,在一个发射周期内,在图10中所示的每个800微秒(us)所示的时间内打开TOF传感器101,并关闭光感类传感器。其他时间内关闭TOF传感器101,并打开光感类传感器。
在上述监控环境光中IR成分占比修正对光感类传感器影响的实施例中,结合图10,在每个发射周期内,手机丢弃掉在TOF传感器101打开,即高电平表示的时间内的,光感类传感器测量到的数据。使用在TOF传感器101关闭,即低电平表示的时间内的,光感类传感器测量的数据。例如,以图10所示的模式2为例,在一个发射周期内,手机丢弃掉在图10中所示的每个550us所示的时间内光感类传感器测量的数据,使用其他时间内光感类传感器测量的数据。
另外,本申请以上实施例中是以TOF传感器101打开时会影响光感类传感器测量到的数据准确性为例,对如何修正对光感类传感器的影响进行说明的。在其他一些实施例中,也可能存在其他与光感类传感器设置在电子设备同一侧的器件对光感类传感器测量的数据产生影响。如,与光感类传感器设置在电子设备同一侧的IR补光灯。IR补光灯可用于暗环境下进行人脸解锁时给人脸补光。在这些实施例中,也可使用本申请实施例提供的方法修正该器件对光感类传感器的影响。如可使用上述采用软件同步方案修正对光感类传感器影响的实施例或使用上述监控环境光中IR成分占比修正对光感类传感器影响的实施例。具体实现与实施例的实现类似,本实施例在此不再一一赘述。
本申请另一些实施例还提供了一种电子设备,如图11所示,该电子设备可以包括:一个或多个处理器1101、存储器1102、TOF传感器1103、环境光传感器1104和接近光传感器1105;TOF传感器1103、环境光传感器1104和接近光传感器1105位于电子设备的同一侧。上述各器件可以通过一个或多个通信总线1106连接。存储器1102可用于存储一个或多个计算机程序代码1107,该一个或多个计算机程序代码1107包括计算机指令,当计算机指令被电子设备执行时,使得电子设备执行上述实施例中电子设备(如手机)执行的各个功能或步骤。
本申请实施例还提供一种计算机存储介质,该计算机存储介质包括计算机指令, 当所述计算机指令在电子设备上运行时,使得该电子设备执行上述实施例中电子设备执行的各个功能或者步骤。
本申请实施例还提供一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机执行上述方法实施例中电子设备执行的各个功能或者步骤。
可以理解的,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (18)

  1. 一种电子设备,其特征在于,所述电子设备包括处理器,以及与所述处理器耦合的飞行时间TOF传感器、环境光传感器和接近光传感器,其中:
    所述TOF传感器、所述环境光传感器和所述接近光传感器位于所述电子设备的同一侧;
    所述处理器,用于在所述TOF传感器打开的情况下,控制所述环境光传感器和所述接近光传感器关闭;
    所述处理器,用于在所述TOF传感器关闭的情况下,控制所述环境光传感器和所述接近光传感器打开。
  2. 根据权利要求1所述的电子设备,其特征在于,所述处理器通过通用输入输出GPIO管脚与所述TOF传感器耦合,所述处理器通过第一接口与所述环境光传感器耦合,通过第二接口与所述接近光传感器耦合;
    所述处理器,还用于通过所述GPIO管脚向所述TOF传感器输出第一电平,用于控制所述TOF传感器打开;
    所述处理器,用于在所述TOF传感器打开的情况下,控制所述环境光传感器和所述接近光传感器关闭,包括:
    所述处理器,用于在通过所述GPIO管脚向所述TOF传感器输出所述第一电平时,通过所述第一接口控制所述环境光传感器关闭,通过所述第二接口控制所述接近光传感器关闭。
  3. 根据权利要求2所述的电子设备,其特征在于,
    所述处理器,还用于通过所述GPIO管脚向所述TOF传感器输出第二电平时,用于控制所述TOF传感器关闭;
    所述处理器,用于在所述TOF传感器关闭的情况下,控制所述环境光传感器和所述接近光传感器打开,包括:
    所述处理器,用于在通过所述GPIO管脚向所述TOF传感器输出所述第二电平时,通过所述第一接口控制所述环境光传感器打开,通过所述第二接口控制所述接近光传感器打开。
  4. 根据权利要求1所述的电子设备,其特征在于,
    所述处理器,用于在所述TOF传感器打开的情况下,控制所述环境光传感器和所述接近光传感器关闭,包括:
    所述处理器,用于在所述TOF传感器使能时,控制所述环境光传感器和所述接近光传感器关闭;
    所述处理器,用于在所述TOF传感器关闭的情况下,控制所述环境光传感器和所述接近光传感器打开,包括:
    所述处理器,用于在所述TOF传感器未使能时,控制所述环境光传感器和所述接近光传感器打开。
  5. 根据权利要求1或4所述的电子设备,其特征在于,
    所述处理器,还用于在确定应用需要所述TOF传感器辅助实现功能时,生成第一命令,根据所述第一命令通过第一驱动控制所述TOF传感器使能,所述第一驱动是所 述TOF传感器的驱动;
    所述处理器,用于在所述TOF传感器使能时,控制所述环境光传感器和所述接近光传感器关闭,包括:
    所述处理器,用于根据所述第一命令通过第二驱动控制所述环境光传感器关闭,根据所述第一命令通过第三驱动控制所述接近光传感器关闭,所述第二驱动是所述环境光传感器的驱动,所述第三驱动是所述接近光传感器的驱动。
  6. 根据权利要求5所述的电子设备,其特征在于,
    所述处理器,还用于在确定所述应用退出时,生成第二命令,根据所述第二命令通过所述第一驱动控制所述TOF传感器去使能;
    所述处理器,用于在所述TOF传感器未使能时,控制所述环境光传感器和所述接近光传感器打开,包括:
    所述处理器,用于在所述TOF传感器去使能后,根据所述第二命令通过所述第二驱动控制所述环境光传感器打开,根据所述第二命令通过所述第三驱动控制所述接近光传感器打开。
  7. 一种电子设备,其特征在于,所述电子设备包括处理器,以及与所述处理器耦合的飞行时间TOF传感器、环境光传感器和接近光传感器,其中:
    所述TOF传感器、所述环境光传感器和所述接近光传感器位于所述电子设备的同一侧;
    所述处理器,在所述TOF传感器打开的情况下,丢弃所述环境光传感器和所述接近光传感器测量的数据;在所述TOF传感器关闭的情况下,根据所述环境光传感器测量的数据实现所述电子设备的第一功能,在所述TOF传感器关闭的情况下,根据所述接近光传感器测量的数据实现所述电子设备的第二功能。
  8. 根据权利要求7所述的电子设备,其特征在于,
    所述处理器,根据所述环境光传感器输出的数据,确定环境光中红外成分的占比;
    所述处理器,在所述TOF传感器打开的情况下,丢弃所述环境光传感器和所述接近光传感器测量的数据,包括:
    所述处理器,在确定所述环境光中红外成分的占比大于阈值时,丢弃所述环境光传感器和所述接近光传感器测量的数据;
    所述处理器,在所述TOF传感器关闭的情况下,根据所述环境光传感器测量的数据实现所述电子设备的第一功能,在所述TOF传感器关闭的情况下,根据所述接近光传感器测量的数据实现所述电子设备的第二功能,包括:
    所述处理器,在确定所述环境光中红外成分的占比小于阈值时,根据所述环境光传感器测量的数据实现所述第一功能,在确定所述环境光中红外成分的占比小于阈值时,根据所述接近光传感器测量的数据实现所述第二功能。
  9. 根据权利要求8所述的电子设备,其特征在于,所述处理器,根据所述环境光传感器输出的数据,确定环境光中红外成分的占比,包括:
    所述处理器,根据所述环境光传感器输出的环境光的红色R通道的光强度,绿色G通道的光强度,蓝色B通道的光强度及自定义C通道的光强度,确定环境光中红外的光强度,根据所述红外的光强度和所述C通道的光强度确定所述环境光中红外成分 的占比。
  10. 一种传感器控制方法,其特征在于,所述传感器控制方法应用于电子设备,所述电子设备包括飞行时间TOF传感器、环境光传感器和接近光传感器,所述TOF传感器、所述环境光传感器和所述接近光传感器位于所述电子设备的同一侧;所述方法包括:
    所述电子设备在所述TOF传感器打开的情况下,控制所述环境光传感器和所述接近光传感器关闭;
    所述电子设备在所述TOF传感器关闭的情况下,控制所述环境光传感器和所述接近光传感器打开。
  11. 根据权利要求10所述的方法,其特征在于,所述方法还包括:
    所述电子设备向所述TOF传感器输出第一电平,用于控制所述TOF传感器打开;
    所述电子设备在所述TOF传感器打开的情况下,控制所述环境光传感器和所述接近光传感器关闭,包括:
    所述电子设备在向所述TOF传感器输出所述第一电平时,控制所述环境光传感器和所述接近光传感器关闭。
  12. 根据权利要求10或11所述的方法,其特征在于,所述方法还包括:
    所述电子设备向所述TOF传感器输出第二电平时,用于控制所述TOF传感器关闭;
    所述电子设备在所述TOF传感器关闭的情况下,控制所述环境光传感器和所述接近光传感器打开,包括:
    所述电子设备在向所述TOF传感器输出所述第二电平时,控制所述环境光传感器和所述接近光传感器打开。
  13. 根据权利要求10所述的方法,其特征在于,
    所述电子设备在所述TOF传感器打开的情况下,控制所述环境光传感器和所述接近光传感器关闭,包括:
    所述电子设备在所述TOF传感器使能时,控制所述环境光传感器和所述接近光传感器关闭;
    所述电子设备在所述TOF传感器关闭的情况下,控制所述环境光传感器和所述接近光传感器打开,包括:
    所述电子设备在所述TOF传感器未使能时,控制所述环境光传感器和所述接近光传感器打开。
  14. 根据权利要求10或13所述的方法,其特征在于,所述方法还包括:
    所述电子设备在确定应用需要所述TOF传感器辅助实现功能时,生成第一命令,根据所述第一命令通过第一驱动控制所述TOF传感器使能,所述第一驱动是所述TOF传感器的驱动;
    所述电子设备在所述TOF传感器使能时,控制所述环境光传感器和所述接近光传感器关闭,包括:
    所述电子设备根据所述第一命令通过第二驱动控制所述环境光传感器关闭,根据所述第一命令通过第三驱动控制所述接近光传感器关闭,所述第二驱动是所述环境光传感器的驱动,所述第三驱动是所述接近光传感器的驱动。
  15. 根据权利要求14所述的方法,其特征在于,所述方法还包括:
    所述电子设备在确定所述应用退出时,生成第二命令,根据所述第二命令通过所述第一驱动控制所述TOF传感器去使能;
    所述电子设备在所述TOF传感器未使能时,控制所述环境光传感器和所述接近光传感器打开,包括:
    所述电子设备在所述TOF传感器去使能后,根据所述第二命令通过所述第二驱动控制所述环境光传感器打开,根据所述第二命令通过所述第三驱动控制所述接近光传感器打开。
  16. 一种传感器控制方法,其特征在于,所述传感器控制方法应用于电子设备,所述电子设备包括飞行时间TOF传感器、环境光传感器和接近光传感器,所述TOF传感器、所述环境光传感器和所述接近光传感器位于所述电子设备的同一侧;所述方法包括:
    所述电子设备在所述TOF传感器打开的情况下,丢弃所述环境光传感器和所述接近光传感器测量的数据;
    所述电子设备在所述TOF传感器关闭的情况下,根据所述环境光传感器测量的数据实现所述电子设备的第一功能,在所述TOF传感器关闭的情况下,根据所述接近光传感器测量的数据实现所述电子设备的第二功能。
  17. 根据权利要求16所述的方法,其特征在于,所述方法还包括:
    所述电子设备根据所述环境光传感器输出的数据,确定环境光中红外成分的占比;
    所述电子设备在所述TOF传感器打开的情况下,丢弃所述环境光传感器和所述接近光传感器测量的数据,包括:
    所述电子设备在确定所述环境光中红外成分的占比大于阈值时,丢弃所述环境光传感器和所述接近光传感器测量的数据;
    所述电子设备在所述TOF传感器关闭的情况下,根据所述环境光传感器测量的数据实现所述电子设备的第一功能,在所述TOF传感器关闭的情况下,根据所述接近光传感器测量的数据实现所述电子设备的第二功能,包括:
    所述电子设备在确定所述环境光中红外成分的占比小于阈值时,根据所述环境光传感器测量的数据实现所述第一功能;
    所述电子设备在确定所述环境光中红外成分的占比小于阈值时,根据所述接近光传感器测量的数据实现所述第二功能。
  18. 根据权利要求17所述的方法,其特征在于,所述电子设备根据所述环境光传感器输出的数据,确定环境光中红外成分的占比,包括:
    所述电子设备根据所述环境光传感器输出的环境光的红色R通道的光强度,绿色G通道的光强度,蓝色B通道的光强度及自定义C通道的光强度,确定环境光中红外的光强度;
    所述电子设备根据所述红外的光强度和所述C通道的光强度确定所述环境光中红外成分的占比。
PCT/CN2020/113098 2019-09-12 2020-09-02 一种电子设备及传感器控制方法 WO2021047435A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP20863531.8A EP4020268A4 (en) 2019-09-12 2020-09-02 ELECTRONIC DEVICE AND SENSOR CONTROL METHOD
US17/642,429 US20220342074A1 (en) 2019-09-12 2020-09-02 Electronic Device and Sensor Control Method

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910866729.X 2019-09-12
CN201910866729.XA CN110750772B (zh) 2019-09-12 2019-09-12 一种电子设备及传感器控制方法

Publications (1)

Publication Number Publication Date
WO2021047435A1 true WO2021047435A1 (zh) 2021-03-18

Family

ID=69276396

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/113098 WO2021047435A1 (zh) 2019-09-12 2020-09-02 一种电子设备及传感器控制方法

Country Status (4)

Country Link
US (1) US20220342074A1 (zh)
EP (1) EP4020268A4 (zh)
CN (1) CN110750772B (zh)
WO (1) WO2021047435A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11294054B2 (en) * 2019-10-11 2022-04-05 Dell Products L.P. Information handling system infrared proximity detection with ambient light management
US11334146B2 (en) 2020-01-31 2022-05-17 Dell Products L.P. Information handling system peripheral enhanced user presence detection
US11435475B2 (en) 2019-10-11 2022-09-06 Dell Products L.P. Information handling system infrared proximity detection with frequency domain modulation
US11435447B2 (en) 2019-10-11 2022-09-06 Dell Products L.P. Information handling system proximity sensor with mechanically adjusted field of view
US11513813B2 (en) 2020-01-31 2022-11-29 Dell Products L.P. Information handling system notification presentation based upon user presence detection
US11662695B2 (en) 2019-10-11 2023-05-30 Dell Products L.P. Information handling system infrared proximity detection with distance reduction detection
US11663343B2 (en) 2020-01-31 2023-05-30 Dell Products L.P. Information handling system adaptive user presence detection

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6909929B2 (ja) * 2018-05-30 2021-07-28 株式会社ニコンビジョン 光検出装置及び方法並びに測距装置及び方法
CN110750772B (zh) * 2019-09-12 2023-05-12 华为技术有限公司 一种电子设备及传感器控制方法
CN112834031A (zh) * 2020-12-30 2021-05-25 Oppo(重庆)智能科技有限公司 电子设备和传感器控制方法
CN113779588B (zh) * 2021-08-12 2023-03-24 荣耀终端有限公司 面部识别方法及装置
CN114639364A (zh) * 2022-03-10 2022-06-17 北京小米移动软件有限公司 电子设备的控制方法、装置、电子设备和存储介质
CN116359945B (zh) * 2023-05-16 2023-10-20 荣耀终端有限公司 一种tof传感模组及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100283394A1 (en) * 2009-05-08 2010-11-11 Avago Technologies ECBU ( Singapore) Pte. Ltd. Light Guide for Ambient Light Sensor in a Portable Electronic Device
CN103852754A (zh) * 2012-12-04 2014-06-11 德州仪器公司 飞行时间(tof)测量系统中的干扰抑制的方法
CN104375721A (zh) * 2013-08-12 2015-02-25 联想(北京)有限公司 一种输入设备和触摸屏以及用户设备
CN109471491A (zh) * 2017-09-08 2019-03-15 苹果公司 具有环境光传感器的电子设备
CN110750772A (zh) * 2019-09-12 2020-02-04 华为技术有限公司 一种电子设备及传感器控制方法

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10922395B2 (en) * 2018-01-05 2021-02-16 Stmicroelectronics, Inc. Facial authentication systems and methods utilizing time of flight sensing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100283394A1 (en) * 2009-05-08 2010-11-11 Avago Technologies ECBU ( Singapore) Pte. Ltd. Light Guide for Ambient Light Sensor in a Portable Electronic Device
CN103852754A (zh) * 2012-12-04 2014-06-11 德州仪器公司 飞行时间(tof)测量系统中的干扰抑制的方法
CN104375721A (zh) * 2013-08-12 2015-02-25 联想(北京)有限公司 一种输入设备和触摸屏以及用户设备
CN109471491A (zh) * 2017-09-08 2019-03-15 苹果公司 具有环境光传感器的电子设备
CN110750772A (zh) * 2019-09-12 2020-02-04 华为技术有限公司 一种电子设备及传感器控制方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4020268A4

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11294054B2 (en) * 2019-10-11 2022-04-05 Dell Products L.P. Information handling system infrared proximity detection with ambient light management
US11435475B2 (en) 2019-10-11 2022-09-06 Dell Products L.P. Information handling system infrared proximity detection with frequency domain modulation
US11435447B2 (en) 2019-10-11 2022-09-06 Dell Products L.P. Information handling system proximity sensor with mechanically adjusted field of view
US11662695B2 (en) 2019-10-11 2023-05-30 Dell Products L.P. Information handling system infrared proximity detection with distance reduction detection
US11334146B2 (en) 2020-01-31 2022-05-17 Dell Products L.P. Information handling system peripheral enhanced user presence detection
US11513813B2 (en) 2020-01-31 2022-11-29 Dell Products L.P. Information handling system notification presentation based upon user presence detection
US11663343B2 (en) 2020-01-31 2023-05-30 Dell Products L.P. Information handling system adaptive user presence detection

Also Published As

Publication number Publication date
US20220342074A1 (en) 2022-10-27
EP4020268A1 (en) 2022-06-29
CN110750772B (zh) 2023-05-12
EP4020268A4 (en) 2022-10-12
CN110750772A (zh) 2020-02-04

Similar Documents

Publication Publication Date Title
WO2021047435A1 (zh) 一种电子设备及传感器控制方法
WO2021000876A1 (zh) 一种语音控制方法、电子设备及系统
WO2020168965A1 (zh) 一种具有折叠屏的电子设备的控制方法及电子设备
WO2021139767A1 (zh) 亮屏控制方法及电子设备
WO2020244623A1 (zh) 一种空鼠模式实现方法及相关设备
WO2021063311A1 (zh) 具有折叠屏的电子设备的显示控制方法及电子设备
CN111369988A (zh) 一种语音唤醒方法及电子设备
WO2021190314A1 (zh) 触控屏的滑动响应控制方法及装置、电子设备
WO2021218540A1 (zh) 天线功率调节方法、终端设备及存储介质
WO2021052170A1 (zh) 马达振动控制方法及电子设备
WO2022156555A1 (zh) 屏幕亮度的调整方法、装置和终端设备
EP4132202A1 (en) Data downloading method and apparatus, and terminal device
CN114422340A (zh) 日志上报方法、电子设备及存储介质
WO2022170856A1 (zh) 建立连接的方法与电子设备
CN115665632B (zh) 音频电路、相关装置和控制方法
WO2020078267A1 (zh) 在线翻译过程中的语音数据处理方法及装置
WO2022199613A1 (zh) 同步播放方法及装置
EP4116722A1 (en) Motor damping measurement methods and system
WO2022033344A1 (zh) 视频防抖方法、终端设备和计算机可读存储介质
WO2021204036A1 (zh) 睡眠风险监测方法、电子设备及存储介质
CN117093068A (zh) 基于穿戴设备的振动反馈方法、系统、穿戴设备和电子设备
CN113467904A (zh) 确定协同模式的方法、装置、电子设备和可读存储介质
CN116708317B (zh) 数据包mtu的调整方法、装置和终端设备
WO2023160524A1 (zh) 测距方法、装置、系统及可读存储介质
WO2023237087A1 (zh) 易孕期的预测方法、装置和电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20863531

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2020863531

Country of ref document: EP

Effective date: 20220323