CN111829483B - Distance change detection method, device, equipment and storage medium - Google Patents
Distance change detection method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN111829483B CN111829483B CN201910313951.7A CN201910313951A CN111829483B CN 111829483 B CN111829483 B CN 111829483B CN 201910313951 A CN201910313951 A CN 201910313951A CN 111829483 B CN111829483 B CN 111829483B
- Authority
- CN
- China
- Prior art keywords
- light
- light intensity
- terminal
- intensity data
- scene
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01C—MEASURING DISTANCES, LEVELS OR BEARINGS; SURVEYING; NAVIGATION; GYROSCOPIC INSTRUMENTS; PHOTOGRAMMETRY OR VIDEOGRAMMETRY
- G01C3/00—Measuring distances in line of sight; Optical rangefinders
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Physics & Mathematics (AREA)
- Electromagnetism (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Radar, Positioning & Navigation (AREA)
- Remote Sensing (AREA)
- Measurement Of Optical Distance (AREA)
Abstract
The disclosure provides a distance change detection method, a distance change detection device, distance change detection equipment and a storage medium, and belongs to the field of electronic equipment. The method comprises the following steps: determining an ambient light scene where a terminal is located; when the ambient light scene is a dim light scene, detecting the distance of an object in front of the light sensor through first light intensity data collected by the first light detection channel; when the ambient light scene is a bright light scene, distance detection is carried out on an object in front of the light sensor through second light intensity data collected by a second light detection channel; the first light detection channel is used for detecting infrared light, and the second light detection channel is used for detecting visible light and infrared light. According to the distance change detection method, the terminal can detect the distance change of the object in front of the optical sensor through the optical sensor, the terminal can be not provided with a proximity sensor any more, and the manufacturing cost of the terminal is reduced.
Description
Technical Field
The present disclosure relates to the field of electronic devices, and in particular, to a method, an apparatus, a device, and a storage medium for detecting a distance change.
Background
A light sensor is arranged in the terminal for detecting ambient light.
The light intensity of the ambient light detected by the terminal through the light sensor is used for realizing some functions, for example, the light intensity of the ambient light detected by the light sensor can be used as a parameter for adjusting the backlight value of the terminal screen.
However, the optical sensor is not used to detect the distance between the terminal and the human body, and if the terminal detects that it is close to or far from the human body, a proximity sensor provided in the terminal is generally used. Therefore, when the terminal needs to have the function of detecting ambient light and the function of detecting that the terminal is close to or far away from a human body, at least one light sensor and one proximity sensor need to be arranged on the terminal.
Disclosure of Invention
The embodiment of the disclosure provides a distance change detection method, a distance change detection device, distance change detection equipment and a storage medium. The technical scheme is as follows:
according to an aspect of the embodiments of the present disclosure, there is provided a distance change detection method applied to a terminal provided with a light sensor provided with a first light detection channel and a second light detection channel, the method including:
determining an ambient light scene where a terminal is located;
when the ambient light scene is a dim light scene, detecting the distance of an object in front of the light sensor through first light intensity data collected by the first light detection channel; the first light detection channel is a channel for detecting infrared light;
when the ambient light scene is a bright light scene, distance detection is carried out on an object in front of the light sensor through second light intensity data collected by a second light detection channel; the second light detection channel is a channel that detects visible light and infrared light.
In some embodiments, when the ambient light scene is a dim light scene, the distance detection of the object in front of the light sensor is performed by the first light intensity data collected by the first light detection channel, including:
when the ambient light scene is a dark light scene, acquiring first light intensity data acquired by a first light detection channel;
when the first light intensity data changes from large to small in the target duration, determining that the distance between the terminal and the object is relatively far away and large;
and when the first light intensity data changes from small to large in the target time length, determining that the distance between the terminal and the object is relatively close to be smaller.
In some embodiments, when the ambient light scene is a bright light scene, the distance detection of the object in front of the light sensor is performed by the second light intensity data collected by the second light detection channel, including:
when the ambient light scene is a bright light scene, second light intensity data collected by a second light detection channel is acquired;
when the second light intensity data changes from large to small in the target duration, the distance between the terminal and the object is determined to be relatively close to the object and smaller;
and when the second light intensity data is changed from small to large in the target duration, determining that the distance between the terminal and the object is relatively far away and large.
In some embodiments, the target duration is the last n acquisition cycles of the light sensor, n being a positive integer.
In some embodiments, determining the ambient light scene in which the terminal is located comprises:
acquiring an ambient light intensity value through a second light detection channel;
when the ambient light intensity value is smaller than the light intensity threshold value, determining that the ambient light scene is a dark light scene;
when the ambient light intensity value is equal to or greater than the light intensity threshold value, determining that the ambient light scene is a bright light scene;
wherein the light intensity threshold is used to determine the ambient light scene.
According to another aspect of the embodiments of the present disclosure, there is provided a distance change detection apparatus in which a light sensor is provided, the light sensor being provided with a first light detection channel and a second light detection channel, the apparatus including:
a determining module configured to determine an ambient light scene in which the terminal is located;
the detection module is configured to perform distance detection on an object in front of the light sensor through first light intensity data collected by the first light detection channel when the ambient light scene is a dim light scene; the first light detection channel is a channel for detecting infrared light;
the detection module is configured to perform distance detection on an object in front of the light sensor through second light intensity data collected by a second light detection channel when the ambient light scene is a bright light scene; the second light detection channel is a channel that detects visible light and infrared light.
In some embodiments, the detection module comprises:
a first acquisition sub-module configured to acquire first light intensity data acquired by a first light detection channel when the ambient light scene is a dim light scene;
the first determining sub-module is configured to determine that the distance between the terminal and the object is relatively far away and large when the first light intensity data changes from large to small in the target duration;
and the first determining submodule is configured to determine that the distance between the terminal and the object is relatively close to be smaller when the first light intensity data changes from small to large in the target time length.
In some embodiments, a detection module comprises:
a first acquisition sub-module configured to acquire second light intensity data acquired by a second light detection channel when the ambient light scene is a bright light scene;
the first determining sub-module is configured to determine that the distance between the terminal and the object is relatively close to and smaller when the second light intensity data changes from large to small in the target duration;
and the first determining submodule is configured to determine that the distance between the terminal and the object is relatively far away and large when the second light intensity data changes from small to large in the target time length.
In some embodiments, the target duration is the last n acquisition cycles of the light sensor, n being a positive integer.
In some embodiments, the determining module comprises:
a second acquisition submodule configured to acquire an ambient light intensity value through a second light detection channel;
a second determination submodule configured to determine that the ambient light scene is a dim light scene when the ambient light intensity value is less than the light intensity threshold;
a second determination submodule configured to determine that the ambient light scene is a bright light scene when the ambient light intensity value is equal to or greater than the light intensity threshold; wherein the light intensity threshold is used to determine the ambient light scene.
According to another aspect of the embodiments of the present disclosure, there is provided a terminal, including:
a processor;
a memory coupled to the processor;
wherein the processor is configured to load and execute executable instructions to implement the distance change detection method as described in the first aspect and its optional embodiments above.
According to another aspect of the embodiments of the present disclosure, there is provided a computer storage medium having at least one instruction, at least one program, code set, or instruction set stored therein, which is loaded and executed by a processor to implement the distance change detection method according to the first aspect and its optional embodiments.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
determining an ambient light scene where a terminal is located; when the ambient light scene is a dim light scene, detecting the distance of an object in front of the light sensor through first light intensity data collected by the first light detection channel; when the ambient light scene is a bright light scene, distance detection is carried out on an object in front of the light sensor through second light intensity data collected by a second light detection channel; wherein the first light detection channel is a channel for detecting infrared light, and the second light detection channel is a channel for detecting visible light and infrared light. According to the distance change detection method, the terminal can detect the distance change of the object in front of the optical sensor through the optical sensor, the terminal can be not provided with a proximity sensor any more, and the manufacturing cost of the terminal is reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a schematic diagram of a terminal structure shown in accordance with an exemplary embodiment;
FIG. 2 is a schematic diagram of a light sensor configuration shown in accordance with an exemplary embodiment;
FIG. 3 is a flow diagram illustrating a method of distance change detection in accordance with an exemplary embodiment;
FIG. 4 is a flow chart illustrating a method of distance change detection according to another exemplary embodiment;
FIG. 5 is a flow chart illustrating a method of distance change detection according to another exemplary embodiment;
FIG. 6 is a flow chart illustrating a method of distance change detection according to another exemplary embodiment;
FIG. 7 is a block diagram illustrating a distance change detection device according to an exemplary embodiment;
fig. 8 is a schematic diagram illustrating a structure of a terminal according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Referring to fig. 1, a schematic structural diagram of a terminal 100 provided in an exemplary embodiment is shown, where the terminal 100 includes a light sensor 101, a memory 102, and a processor 103;
wherein, the optical sensor 101 and the memory 102 are electrically connected with the processor 103; optionally, the light sensor 101, the memory 102 and the processor 103 are connected by a bus.
The light sensor 101 may be an ambient light sensor that collects light intensity data and reports the light intensity data to the processor 103.
The Memory 102 may include a Random Access Memory (RAM) or a Read-Only Memory (ROM). The memory 102 stores therein a program for implementing the distance change detection method provided by the present disclosure.
The processor 103 may comprise one or more processing cores, the processor 103 being configured to load and execute a program stored in the memory 102 to implement the distance change detection method described above.
It should be noted that the optical sensor 101 includes two optical detection channels for implementing the distance change detection method, as shown in fig. 2, a schematic structural diagram of the optical sensor 101 is shown, in which the optical sensor 101 includes a first optical detection channel 18 and a second optical detection channel 19, the first optical detection channel 18 is a channel for detecting infrared light, and the second optical detection channel 19 is a channel for detecting visible light and infrared light.
The optical sensor 101 further includes an optical filter 17, an integrating to Digital Converter (ADC) 16, an address selection unit 11, an instruction memory 12, an ADC register 13, an interrupt control unit 14, a Two-wire Serial Interface (TWI) 15, a clock line (SCL)20, a data line (SDA)21, and an address selection signal input terminal 23.
The instruction memory 12 and the ADC register 13 are respectively connected to the integral analog-to-digital converter 16 through a two-wire serial interface 15; the instruction memory 12 and the ADC register 13 are respectively connected with the address selection unit 11 through a two-wire serial interface 15; the interrupt control unit 14 is connected to a Two-wire Serial Interface (TWI) 15.
The filter 17 filters incident light, the integrating analog-to-digital converter 16 is connected with a first light detection channel 18 and a second light detection channel 19, and the analog signal of the passing infrared light is transmitted to the integrating analog-to-digital converter 16 through the first light detection channel 18, or the analog signal of the passing visible light and the infrared light is transmitted to the integrating analog-to-digital converter 16 through the second light detection channel 19; the integrating analog-to-digital converter 16 loads and executes an analog-to-digital conversion instruction from the instruction memory 12 to realize a function of converting an analog signal received from the first light detection channel 18 or the second light detection channel 19 into a digital signal, and finally obtains light intensity data; the integrating analog-to-digital converter 16 stores the processed light intensity data into the ADC register 13; the light sensor 101 reports the light intensity data stored in the ADC register 13 to the processor 103 via the data line 21.
The address selection unit 11 is configured to, when accessing the instruction memory 12 and the ADC register 13, address according to a selection signal input by an address selection signal input end to obtain a corresponding instruction or light intensity data; the interrupt control unit 14 controls the interruption of data transmission from the light sensor 101 to the processor 103 through the shaping port 22; the data line 21 is used for data transmission between the light sensor 101 and the processor 103; the clock line 20 is used to provide a clock signal for the light sensor 101.
Referring to fig. 3, a flowchart of a method for detecting a distance change according to an exemplary embodiment is shown, where for example, the method is applied to the terminal shown in fig. 1, the method includes:
The ambient light scene comprises a dim light scene and a bright light scene; the dim light scene is a scene when the ambient light intensity value is smaller than the light intensity threshold value, and the bright light scene is a scene when the ambient light intensity value is equal to or larger than the light intensity threshold value.
The light intensity threshold value refers to a reference value of the light intensity of the visible light, and when the ambient light intensity value is equal to or greater than the reference value, the ambient light intensity value is in a bright scene and indicates that the visible light is strong; when the ambient light intensity value is less than the reference value, the scene is in a dim light scene, which indicates that the visible light is weak. Wherein visible light refers to light visible to the human eye.
The terminal determines the ambient light scene where the terminal is located, and when the ambient light scene is a dark light scene, step 202 is executed; when the ambient light scene is a bright light scene, step 203 is performed.
The first light detection channel is a channel for detecting infrared light. When the ambient light scene is a dim light scene, visible light is weak, and first light intensity data corresponding to infrared light is collected through a first light detection channel of the light sensor; and detecting the distance of the object in front of the optical sensor according to the first light intensity data, and determining the relative change of the distance between the object in front of the optical sensor and the terminal.
And 203, detecting the distance of the object in front of the optical sensor through second light intensity data acquired by the second light detection channel.
The second light detection channel is a channel that detects visible light and infrared light. When the ambient light scene is a bright light scene, the terminal collects second light intensity data corresponding to visible light and infrared light through a second light detection channel of the light sensor according to the visible light intensity; and detecting the distance of the object in front of the optical sensor according to the second light intensity data, and determining the relative change of the distance between the object in front of the optical sensor and the terminal.
In summary, the distance change detection method provided in this embodiment determines the ambient light scene where the terminal is located; when the ambient light scene is a dim light scene, detecting the distance of an object in front of the light sensor through first light intensity data collected by the first light detection channel; when the ambient light scene is a bright light scene, distance detection is carried out on an object in front of the light sensor through second light intensity data collected by a second light detection channel; wherein the first light detection channel is a channel for detecting infrared light, and the second light detection channel is a channel for detecting visible light and infrared light. According to the distance change detection method, the terminal can detect the distance change of the object in front of the optical sensor through the optical sensor, the terminal can be not provided with a proximity sensor any more, and the manufacturing cost of the terminal is reduced.
In addition, the terminal is provided with the optical sensor comprising the first/second optical detection channels, so that the terminal can detect the distance change of an object in front of the optical sensor in the daytime and at night.
Based on fig. 3, step 201 may be replaced by steps 2011 to 2014, as shown in fig. 4, that is, the terminal may determine the ambient light scene in which it is located by the following steps:
in step 2011, the ambient light intensity value is obtained through the second light detection channel.
The terminal determines the ambient light scene where the terminal is located, and obtains the ambient light intensity value through a second light detection channel capable of collecting visible light.
The terminal stores a light intensity threshold value, the light intensity threshold value is used for determining an ambient light scene, and the terminal divides the ambient light scene into a dark light scene and a bright light scene by taking the light intensity threshold value as a boundary value. When the terminal determines that the ambient light intensity value is smaller than the light intensity threshold value, executing step 2013; when the terminal determines that the ambient light intensity value is equal to or greater than the light intensity threshold, step 2014 is performed.
And when the ambient light intensity value is smaller than the light intensity threshold value, the terminal determines the ambient light intensity value as a dim light scene.
At step 2014, it is determined that the ambient light intensity value is a bright scene.
And when the ambient light intensity value is equal to or greater than the light intensity threshold value, the terminal determines the ambient light intensity value as a bright scene.
The terminal determines that an object in front of the optical sensor moves relatively in a direction far away from the terminal according to first light intensity data acquired by the first light detection channel; alternatively, it is determined from the first light intensity data that the object in front of the light sensor is moving relatively in a direction approaching the terminal.
And 203, detecting the distance of the object in front of the optical sensor through second light intensity data acquired by the second light detection channel.
The terminal determines that an object in front of the optical sensor moves relatively in the direction far away from the terminal according to second light intensity data acquired by the second light detection channel; or, determining that the object in front of the light sensor moves relatively in the direction close to the terminal according to the second light intensity data.
In summary, the distance change detection method provided in this embodiment determines the ambient light scene where the terminal is located; when the ambient light scene is a dim light scene, detecting the distance of an object in front of the light sensor through first light intensity data collected by the first light detection channel; when the ambient light scene is a bright light scene, distance detection is carried out on an object in front of the light sensor through second light intensity data collected by a second light detection channel; wherein the first light detection channel is a channel for detecting infrared light, and the second light detection channel is a channel for detecting visible light and infrared light. The distance change detection method enables the terminal to detect the distance change of the object in front of the optical sensor through the optical sensor, and the terminal can be provided with no proximity sensor, so that the manufacturing cost of the terminal is reduced.
In addition, the terminal is provided with the optical sensor comprising the first/second optical detection channels, so that the terminal can detect the distance change of an object in front of the optical sensor in both daytime and nighttime.
It should be noted that the movement of the object in front of the light sensor of the terminal can be determined by the trend of the light intensity value over a period of time. The above determination of the movement situation can be divided into the following two cases:
firstly, a terminal determines the moving situation of an object in a dark scene;
and secondly, the terminal determines the moving situation of the object in the bright scene.
In the first situation, referring to fig. 5, when the terminal is in a dark light scene, step 202 may be replaced by steps 2021 to 2025, which are as follows:
The terminal acquires first light intensity data acquired by the first light detection channel in a dark light scene. Optionally, the first light intensity data has m light intensity values, m being an integer greater than 1; the acquisition time corresponding to at least two light intensity values in the first light intensity data belongs to the target duration.
The target duration is the last n acquisition cycles of the light sensor, n being a positive integer. Optionally, i acquisition time instants are included in one acquisition cycle, and i is a positive integer.
Step 2022, determining whether the first light intensity data changes from large to small within the target duration.
The terminal judges the variation trend of at least two light intensity values included in the first light intensity data, and the acquisition moments corresponding to the at least two light intensity values belong to the target duration; illustratively, the at least two light intensity values are arranged according to the sequence of acquisition, and the terminal judges whether the at least two light intensity values arranged in sequence change from large to small within the target duration.
Executing step 2023 when the at least two light intensity values in the sequence change from large to small within the target time length; otherwise, step 2024 is performed.
When the first light intensity data changes from large to small in the target duration, the terminal determines that the terminal moves relatively in the direction away from the object, and in the process of relative movement, the distance between the terminal and the object is continuously increased.
The terminal judges whether at least two light intensity values included in the first light intensity data arranged according to the collected sequence change from small to large in the target time length. Executing step 2025 when the at least two light intensity values arranged in sequence change from small to large in the target duration; otherwise, step 2026 is performed.
At step 2025, it is determined that the distance between the terminal and the object becomes relatively small.
When the first light intensity data changes from small to large in the target duration, the terminal determines that the terminal moves relatively in the approaching direction of the object, and in the relative movement process, the distance between the terminal and the object is continuously reduced.
The terminal determines that the terminal does not move or irregularly moves, for example, in a dim light scene, when the terminal makes a circular motion around an object, the terminal determines that the terminal does not move; or when the terminal shakes back and forth relative to the object, the terminal determines that the terminal moves irregularly.
In summary, the distance change detection method provided in this embodiment detects the distance change of the terminal through the first light intensity data corresponding to the infrared light, so that the terminal can also detect the distance change between the terminal and the object through the optical sensor in a dark scene.
It should be noted that, in the method for determining the moving situation of the object in the dim light scene, after step 2021, step 2024 may be performed first. When the determination result of step 2024 is an affirmative result, step 2025 is executed; when the determination result of step 2024 is a negative result, step 2022 is performed. When the determination result is an affirmative result in executing step 2022, executing step 2023; when the determination result is negative, step 2026 is performed.
In the second case, referring to fig. 6, when the terminal is in a bright scene, step 203 may be replaced by steps 2031 to 2035, which are as follows:
And the terminal acquires second light intensity data acquired by the second light detection channel in a bright scene. Optionally, the second light intensity data r light intensity values, r being an integer greater than 1; and the acquisition time corresponding to at least two light intensity values in the second light intensity data belongs to the target duration.
The target duration is the last n acquisition cycles of the light sensor, n being a positive integer. Optionally, one acquisition period includes i acquisition time instants, where i is a positive integer.
Step 2032, determining whether the second light intensity data changes from large to small within the target duration.
The terminal judges the variation trend of at least two light intensity values included in the second light intensity data, and the acquisition moments corresponding to the at least two light intensity values belong to the target duration; illustratively, the at least two light intensity values are arranged according to the sequence of acquisition, and the terminal judges whether the at least two light intensity values arranged in sequence change from large to small within the target duration.
Executing step 2033 when the at least two light intensity values in sequence change from large to small within the target duration; otherwise, step 2034 is performed.
When the second light intensity data changes from large to small in the target duration, the terminal determines that the terminal moves relatively in the approaching direction of the object, and in the relative movement process, the distance between the terminal and the object is continuously reduced.
And the terminal judges whether at least two light intensity values included in the second light intensity data arranged according to the collected sequence change from small to large in the target time length. Executing step 2035 when the at least two light intensity values arranged in sequence change from small to large within the target time length; otherwise, step 2036 is performed.
When the second light intensity data changes from small to large in the target duration, the terminal determines that the terminal moves relatively in the direction away from the object, and in the process of relative movement, the distance between the terminal and the object is continuously increased.
The terminal determines that the terminal moves irregularly, for example, in a bright scene, when the terminal makes a circular motion around an object, the terminal determines that the terminal moves irregularly; or when the terminal shakes back and forth relative to the object, the terminal determines that the terminal moves irregularly.
In summary, the distance change detection method provided in this embodiment detects the distance change of the terminal through the second light intensity data corresponding to the visible light and the infrared light, so that the terminal can also detect the distance change between the terminal and the object through the optical sensor in a bright scene.
It should be noted that, in the method for determining the moving situation of the object in the dim light scene, after step 2031, step 2034 may be performed first. When the determination result of step 2034 is an affirmative result, step 2035 is executed; when the determination result of step 2034 is a negative result, step 2032 is executed. When the determination result is an affirmative result in executing step 2032, executing step 2033; when the determination result is negative, step 2036 is performed.
Referring to fig. 7, a distance change detection apparatus provided in an exemplary embodiment is shown, and part or all of the apparatus may be implemented by software, hardware, or a combination of the two, and the apparatus is mounted with a light sensor provided with a first light detection channel and a second light detection channel, and the apparatus includes:
a determining module 301 configured to determine an ambient light scene in which the terminal is located;
a detection module 302 configured to perform distance detection on an object in front of the light sensor through first light intensity data collected by the first light detection channel when the ambient light scene is a dim light scene; the first light detection channel is a channel for detecting infrared light;
a detection module 302 configured to perform distance detection on an object in front of the light sensor through second light intensity data collected by the second light detection channel when the ambient light scene is a bright light scene; the second light detection channel is a channel that detects visible light and infrared light.
In some embodiments, the detection module 302 includes:
a first acquiring submodule 3021 configured to acquire first light intensity data acquired by the first light detection channel when the ambient light scene is a dim light scene;
a first determining submodule 3022 configured to determine that the distance between the terminal and the object becomes relatively far away when the first light intensity data changes from large to small within the target time length;
a first determining sub-module 3022 configured to determine that the distance between the terminal and the object becomes relatively close as the first light intensity data changes from small to large within the target period of time.
In some embodiments, the detection module 302 includes:
a first acquiring submodule 3021 configured to acquire second light intensity data acquired by the second light detection channel when the ambient light scene is a bright light scene;
a first determination submodule 3022 configured to determine that the distance between the terminal and the object is relatively close to becoming smaller when the second light intensity data changes from large to small within the target time length;
the first determining submodule 3022 is configured to determine that the distance between the terminal and the object is relatively far away from the object when the second light intensity data changes from small to large within the target time length.
In some embodiments, the target duration is the last n acquisition cycles of the light sensor, n being a positive integer.
In some embodiments, the determining module 301 includes:
a second obtaining sub-module 3011 configured to obtain an ambient light intensity value through a second light detection channel;
a second determination sub-module 3012 configured to determine that the ambient light scene is a dim light scene when the ambient light intensity value is less than the light intensity threshold;
a second determination sub-module 3012 configured to determine that the ambient light scene is a bright light scene when the ambient light intensity value is equal to or greater than the light intensity threshold; wherein the light intensity threshold is used to determine the ambient light scene.
In summary, the distance change detection apparatus provided in this embodiment determines the ambient light scene where the terminal is located; when the ambient light scene is a dark light scene, detecting the distance of an object in front of the light sensor through first light intensity data collected by the first light detection channel; when the ambient light scene is a bright light scene, distance detection is carried out on an object in front of the light sensor through second light intensity data collected by a second light detection channel; wherein the first light detection channel is a channel for detecting infrared light, and the second light detection channel is a channel for detecting visible light and infrared light. The distance change detection method enables the terminal to detect the distance change of the object in front of the optical sensor through the optical sensor, and the terminal can be provided with no proximity sensor, so that the manufacturing cost of the terminal is reduced.
In addition, the device enables the terminal to detect the distance change of the object in front of the optical sensor both in the daytime and at night by providing the optical sensor including the first/second optical detection channels.
Referring to fig. 8, a block diagram of a distance change detection apparatus 400 according to an exemplary embodiment is shown. For example, the apparatus 400 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 8, the apparatus 400 may include one or more of the following components: processing component 402, memory 404, power component 406, multimedia component 408, audio component 410, input/output (I/O) interface 412, sensor component 414, and communication component 416.
The processing component 402 generally controls overall operation of the apparatus 400, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 402 can include one or more modules that facilitate interaction between the processing component 402 and other components. For example, the processing component 402 can include a multimedia module to facilitate interaction between the multimedia component 408 and the processing component 402.
The memory 404 is configured to store various types of data to support operations at the apparatus 400. Examples of such data include instructions for any application or method operating on the device 400, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 404 may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The multimedia component 408 includes a screen that provides an output interface between the device 400 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the apparatus 400 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 410 is configured to output and/or input audio signals. For example, audio component 410 includes a Microphone (MIC) configured to receive external audio signals when apparatus 400 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 404 or transmitted via the communication component 416. In some embodiments, audio component 410 also includes a speaker for outputting audio signals.
The I/O interface 412 provides an interface between the processing component 402 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 414 includes one or more sensors for providing various aspects of status assessment for the apparatus 400. For example, the sensor component 414 may detect the open/closed state of the apparatus 400, the relative positioning of components, such as a display and keypad of the apparatus 400, the sensor component 414 may also detect a change in the position of the apparatus 400 or a component of the apparatus 400, the presence or absence of user contact with the apparatus 400, orientation or acceleration/deceleration of the apparatus 400, and a change in the temperature of the apparatus 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 414 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 416 is configured to facilitate communication between the apparatus 400 and other devices in a wired or wireless manner. The apparatus 400 may access a wireless network based on a communication standard, such as Wi-Fi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 416 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 further includes a Near Field Communication (NFC) module to facilitate short range communication.
In an exemplary embodiment, the apparatus 400 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described distance change detection methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 404 comprising instructions, executable by the processor 420 of the apparatus 400 to perform the distance change detection method described above is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer readable storage medium having instructions therein, which when executed by a processor of the apparatus 400, enable the apparatus 400 to perform the above-described distance change detection method.
It should be understood that reference to "a plurality" herein means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (6)
1. A distance change detection method applied to a terminal provided with an optical sensor provided with a first optical detection channel that is a channel for detecting infrared light and a second optical detection channel that is a channel for detecting visible light and the infrared light, the method comprising:
acquiring an ambient light intensity value through the second light detection channel;
when the ambient light intensity value is smaller than the light intensity threshold value, determining that the ambient light scene is a dim light scene;
determining that the ambient light scene is a bright light scene when the ambient light intensity value is equal to or greater than the light intensity threshold, the light intensity threshold being used to determine the ambient light scene;
when the ambient light scene is the dim light scene, performing the steps of:
acquiring first light intensity data acquired by the first light detection channel;
judging whether the first light intensity data changes from large to small within the target time length;
responding to the change of the first light intensity data from large to small in the target time length, and determining that the distance between the terminal and the object is relatively far away;
in response to the first light intensity data not changing from large to small within the target duration, determining whether the first light intensity data changes from small to large within the target duration;
responding to the change of the first light intensity data from small to large in the target time length, and determining that the distance between the terminal and the object is relatively close;
determining that the terminal does not move or moves irregularly in response to the fact that the first light intensity data does not change from small to large in the target time length;
when the ambient light scene is the bright light scene, performing the following steps;
acquiring second light intensity data acquired by the second light detection channel;
judging whether the second light intensity data changes from large to small in the target time length;
determining that the distance between the terminal and the object is relatively close in response to the change of the second light intensity data from large to small in the target time length;
in response to the second light intensity data not changing from large to small within the target duration, determining whether the second light intensity data changes from small to large within the target duration;
determining that the distance between the terminal and the object is relatively far away in response to the change of the second light intensity data from small to large in the target duration;
and determining that the terminal moves irregularly in response to the fact that the second light intensity data does not change from small to large in the target duration.
2. The method of claim 1, wherein the target duration is the last n acquisition cycles of the light sensor, n being a positive integer.
3. A distance change detection device, characterized in that a photosensor is provided in the device, the photosensor is provided with a first photodetection channel and a second photodetection channel, the first photodetection channel is a channel for detecting infrared light, the second photodetection channel is a channel for detecting visible light and the infrared light, the device comprises:
a second acquisition sub-module configured to acquire an ambient light intensity value through the second light detection channel;
a second determination submodule configured to determine that the ambient light scene is a dim light scene when the ambient light intensity value is less than a light intensity threshold;
the second determination submodule configured to determine that the ambient light scene is a bright light scene when the ambient light intensity value is equal to or greater than the light intensity threshold, the light intensity threshold being used to determine the ambient light scene;
a detection module configured to acquire first light intensity data collected by the first light detection channel when the ambient light scene is the dim light scene; judging whether the first light intensity data changes from large to small within the target time length; determining that the distance between the terminal and the object is relatively far away in response to the change of the first light intensity data from large to small in the target duration; in response to the first light intensity data not changing from large to small within the target duration, determining whether the first light intensity data changes from small to large within the target duration; responding to the change of the first light intensity data from small to large in the target time length, and determining that the distance between the terminal and the object is relatively close; determining that the terminal does not move or irregularly moves in response to the fact that the first light intensity data does not change from small to large in the target duration;
the detection module is further configured to acquire second light intensity data acquired by the second light detection channel when the ambient light scene is the bright light scene; judging whether the second light intensity data changes from large to small in the target duration; determining that the distance between the terminal and the object is relatively close in response to the change of the second light intensity data from large to small in the target time length; in response to the second light intensity data not changing from large to small within the target duration, determining whether the second light intensity data changes from small to large within the target duration; determining that the distance between the terminal and the object is relatively far away in response to the change of the second light intensity data from small to large in the target duration; and determining that the terminal moves irregularly in response to the fact that the second light intensity data does not change from small to large in the target time length.
4. The apparatus of claim 3, wherein the target duration is the last n acquisition cycles of the light sensor, n being a positive integer.
5. A terminal, characterized in that the terminal comprises:
a processor;
a memory coupled to the processor;
wherein the processor is configured to load and execute executable instructions to implement the distance change detection method of claim 1 or 2.
6. A computer-readable storage medium, in which at least one program is stored, the at least one program being loaded and executed by a processor to implement the distance change detection method according to claim 1 or 2.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910313951.7A CN111829483B (en) | 2019-04-18 | 2019-04-18 | Distance change detection method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910313951.7A CN111829483B (en) | 2019-04-18 | 2019-04-18 | Distance change detection method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111829483A CN111829483A (en) | 2020-10-27 |
CN111829483B true CN111829483B (en) | 2022-09-23 |
Family
ID=72914931
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910313951.7A Active CN111829483B (en) | 2019-04-18 | 2019-04-18 | Distance change detection method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111829483B (en) |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6243537B1 (en) * | 1998-10-15 | 2001-06-05 | Asahi Kogaku Kogyo Kabushiki Kaisha | Distance measuring apparatus |
CN109213187A (en) * | 2017-06-30 | 2019-01-15 | 北京臻迪科技股份有限公司 | A kind of displacement of unmanned plane determines method, apparatus and unmanned plane |
CN108810196B (en) * | 2018-03-28 | 2020-11-27 | Oppo广东移动通信有限公司 | Electronic device and method of manufacturing the same |
-
2019
- 2019-04-18 CN CN201910313951.7A patent/CN111829483B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN111829483A (en) | 2020-10-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3179711B1 (en) | Method and apparatus for preventing photograph from being shielded | |
CN105245775B (en) | camera imaging method, mobile terminal and device | |
CN111984347B (en) | Interactive processing method, device, equipment and storage medium | |
EP3575862A1 (en) | Method and device for adjusting lens position | |
CN106572299A (en) | Camera switching-on method and device | |
CN111988493B (en) | Interaction processing method, device, equipment and storage medium | |
EP2991067A1 (en) | Backlight brightness control method and device | |
CN104216525B (en) | Method and device for mode control of camera application | |
EP3232301A1 (en) | Mobile terminal and virtual key processing method | |
CN106775246B (en) | Screen brightness adjusting method and device | |
CN109922203B (en) | Terminal, screen off method and device | |
CN107566750A (en) | Control method, device and the storage medium of flash lamp | |
CN116954540A (en) | Application program display method and device and terminal | |
CN112331158B (en) | Terminal display adjusting method, device, equipment and storage medium | |
EP3629560A1 (en) | Full screen terminal, and operation control method and device based on full screen terminal | |
CN108650412B (en) | Display method, display device and computer readable storage medium | |
CN111829483B (en) | Distance change detection method, device, equipment and storage medium | |
CN111131596B (en) | Screen brightness adjusting method and device | |
CN106603882A (en) | Incoming call sound volume adjusting method, incoming call sound volume adjusting device and terminal | |
CN112017598A (en) | Backlight brightness adjusting method and device | |
CN111698414B (en) | Image signal processing method and device, electronic device and readable storage medium | |
CN115550539A (en) | Function control method, function control device, and storage medium | |
US11402994B2 (en) | Method and apparatus for calling shortcut function, and storage medium | |
CN111343336B (en) | Mode switching method and device, electronic equipment and computer readable storage medium | |
CN109275179B (en) | Terminal device control method and device, terminal device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |