Disclosure of Invention
To solve the above technical problem, the present invention provides a control method, a proximity detection device, an electronic device, a computer-readable storage medium, and a computer apparatus.
The invention provides a proximity detection method for an electronic device, which is characterized in that the electronic device comprises a proximity sensor, the proximity sensor is used for emitting infrared light and receiving the infrared light reflected by an object, and the control method comprises the following steps:
acquiring a first intensity value of infrared light in current ambient light;
acquiring a second intensity value of the infrared light received by the proximity sensor; and
and detecting the distance from the object to the electronic device according to the first intensity value and the second intensity value to judge whether the object is close to or far away from the electronic device.
In some embodiments, the proximity detection method comprises the steps of:
detecting the brightness value of the current environment light; and
when the brightness value is greater than or equal to a brightness preset threshold value, acquiring the first intensity value of the infrared light in the current environment light.
In some embodiments, the proximity detection method comprises the steps of:
if the brightness value is smaller than the preset brightness threshold value, detecting the distance from the object to the electronic device according to the second intensity value to judge whether the object is close to or far away from the electronic device.
In some embodiments, the step of detecting the brightness value of the current ambient light includes:
acquiring a multi-frame image of a current environment; and
and calculating the brightness value of the current environment according to the multi-frame image.
In some embodiments, the step of obtaining the first intensity value of infrared light in the current ambient light when the brightness value is greater than or equal to a brightness predetermined threshold comprises:
detecting the inclination angle of the electronic device; and
and when the inclination angle is smaller than a preset angle threshold, acquiring the first intensity value of the infrared light in the current ambient light.
In some embodiments, the proximity detection method comprises the steps of:
if the inclination angle is larger than or equal to a preset angle threshold, detecting the distance from the object to the electronic device according to the second intensity value to judge whether the object is close to or far away from the electronic device.
The present invention provides a proximity detection apparatus for an electronic apparatus, characterized in that the electronic apparatus includes a proximity sensor for emitting infrared light and receiving infrared light reflected by an object, the proximity detection apparatus including:
the system comprises an acquisition module, a processing module and a control module, wherein the acquisition module is used for acquiring a first intensity value of infrared light in current ambient light;
the acquisition module is further used for acquiring a second intensity value of the infrared light received by the proximity sensor; and
a judging module, configured to detect a distance from the object to the electronic device according to the first intensity value and the second intensity value to judge whether the object is close to or far from the electronic device.
The invention provides an electronic device, which is characterized by comprising:
the environment light sensor is used for acquiring infrared light in environment light;
a proximity sensor for emitting infrared light and receiving infrared light reflected by an object; and
a processor to:
acquiring a first intensity value of infrared light in current ambient light;
acquiring a second intensity value of the infrared light received by the proximity sensor; and
and detecting the distance from the object to the electronic device according to the first intensity value and the second intensity value to judge whether the object is close to or far away from the electronic device.
In some embodiments, the ambient light sensor is configured to detect a brightness value of the current ambient light, and the processor is configured to obtain the first intensity value of the infrared light in the current ambient light when the brightness value is greater than or equal to a brightness predetermined threshold.
In some embodiments, the processor is further configured to detect a distance from the object to the electronic device according to the second intensity value to determine whether the object is close to or far from the electronic device when the brightness value is smaller than the brightness predetermined threshold.
In some embodiments, the electronic device includes a camera configured to obtain a plurality of frames of images of a current environment, and the processor is configured to calculate the brightness value of the current environment according to the plurality of frames of images.
In some embodiments, the electronic device includes an acceleration sensor configured to detect a tilt angle of the electronic device, and the processor is configured to obtain the first intensity value of the infrared light in the current ambient light when the tilt angle is smaller than an angle predetermined threshold.
In some embodiments, the processor is configured to detect a distance from the object to the electronic device according to the second intensity value to determine whether the object is close to or far from the electronic device when the tilt angle is greater than or equal to a predetermined angle threshold.
One or more non-transitory computer-readable storage media containing computer-executable instructions that, when executed by one or more processors, cause the processors to perform the proximity detection method are provided.
The invention provides a computer device comprising a memory and a processor, wherein the memory stores computer readable instructions, and the instructions, when executed by the processor, cause the processor to execute the proximity detection method.
According to the proximity detection method, the proximity detection device, the electronic device, the computer-readable storage medium and the computer equipment, the distance between the object and the electronic device is judged by detecting the intensity of infrared light received by the proximity sensor and the intensity of infrared light in ambient light, and interference caused by the ambient light on detection of the proximity sensor can be reduced.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
A proximity detection method, aproximity detection apparatus 200, anelectronic apparatus 100, a computer-readable storage medium, and acomputer device 300 according to embodiments of the present invention are described in detail below with reference to fig. 1 to 15.
Referring to fig. 1 to 4, an embodiment of the invention provides a proximity detection method for anelectronic device 100. Theelectronic device 100 includes an ambientlight sensor 161 and aproximity sensor 162, the ambientlight sensor 161 for acquiring infrared light in ambient light, and theproximity sensor 162 for emitting infrared light and receiving infrared light reflected by an object. The approach detection method includes the steps of:
s10, a first intensity value of the infrared light in the current ambient light is obtained.
S20, a second intensity value of the infrared light received by the proximity sensor is obtained. And
and S30, detecting the distance from the object to the electronic device according to the first intensity value and the second intensity value to judge whether the object is close to or far away from the electronic device.
The embodiment of the invention also provides aproximity detection device 200 for theelectronic device 100. The proximity detection method according to the embodiment of the present invention can be realized by theproximity detection device 200 according to the embodiment of the present invention. Theproximity detection device 200 includes anacquisition module 21 and adetermination module 22, and steps S10 and S20 may be implemented by theacquisition module 21, and step S30 may be implemented by thedetermination module 22. That is, the obtainingmodule 21 may be configured to obtain a first intensity value of the infrared light in the current ambient light and obtain a second intensity value of the infrared light received by theproximity sensor 162. The determiningmodule 22 can be used for detecting a distance from the object to theelectronic device 100 according to the first intensity value and the second intensity value to determine whether the object is close to or far away from theelectronic device 100.
The embodiment of the invention also provides anelectronic device 100. Theelectronic device 100 includes an ambientlight sensor 161, aproximity sensor 162, and aprocessor 24. Step S10, step S20, and step S30 may be implemented by theprocessor 24. That is, theprocessor 24 is configured to obtain a first intensity value of the infrared light in the current ambient light received by the ambientlight sensor 161 and obtain a second intensity value of the infrared light received by theproximity sensor 162, and detect a distance from the object to theelectronic device 100 according to the first intensity value and the second intensity value to determine whether the object is close to or far from theelectronic device 100.
The embodiment of the invention also providescomputer equipment 300. In an embodiment of the present invention, theproximity detection apparatus 200 may be employed in acomputer device 300. Thecomputer device 300 may be a mobile phone, a tablet computer, a notebook computer, an intelligent bracelet, an intelligent watch, an intelligent helmet, an intelligent glasses, a game console, and the like, and theelectronic apparatus 100 according to the embodiment of the present invention may also be one of thecomputer devices 300.
The embodiment of the present invention is described by taking theelectronic device 100 as a mobile phone as an example. The ambientlight sensor 161 and theproximity sensor 162 in the mobile phone respectively realize the adjustment of the screen brightness according to the intensity of the ambient light and the detection of the distance between theelectronic device 100 and the user. Referring to fig. 5 and 6, when the ambient light detection is performed, for example, when the user is in an outdoor environment and the ambient light is strong, the ambientlight sensor 161 feeds back the light intensity of the environment to the processor, the processor sends a corresponding instruction to the controller, and the controller increases the brightness of the display screen according to the instruction to adapt to the light intensity of the current environment, so that the content of the screen viewed by the user is clearer. When the user is in a dark environment, the ambient light is weak, the ambientlight sensor 161 feeds back the light intensity of the environment to the processor, the processor sends a corresponding instruction to the controller, and the controller reduces the brightness of the display screen according to the instruction to adapt to the light intensity of the current environment, so that the user does not feel dazzling when watching the screen content, and the optimal visual effect is provided for the user.
Referring to fig. 7 and 8, when distance detection is performed, for example, when a user is receiving or making a call and brings a mobile phone close to the head, theproximity sensor 162 calculates intensity of infrared light emitted by the emitter and intensity of infrared light reflected by the receiver to generate distance detection information, the processor sends a corresponding instruction to the controller according to the distance detection information, and the controller closes the screen according to the instruction. When the mobile phone is far away from the head, the processor calculates and sends an instruction to the controller again according to the detection information fed back by theproximity sensor 162, and the controller reopens the screen according to the instruction.
However, in the practical application process of the proximity sensor, for example, in an outdoor use environment in which sunlight is directly emitted, since the sunlight contains infrared light, certain interference is caused to the infrared light emitted by the proximity sensor itself, and particularly, when the electronic device is at different receiving angles, the proximity sensor fluctuates due to the intensity of the received infrared light, so that the proximity sensor cannot accurately judge whether an object is blocked or approaches the electronic device.
The proximity detection method, theproximity detection apparatus 200, theelectronic apparatus 100, the computer-readable storage medium, and thecomputer device 300 according to the embodiments of the present invention can reduce interference of the ambient light with detection of theproximity sensor 162 by detecting the intensity of the infrared light received by theproximity sensor 162 and the intensity of the infrared light in the ambient light to determine the distance between the object and theelectronic apparatus 100.
It should be noted that, since the ambientlight sensor 161 can also sense the infrared light emitted by theproximity sensor 162, after the ambientlight sensor 161 obtains the first intensity value of the infrared light in the current ambient light, theproximity sensor 162 may be turned on to emit the infrared light for distance detection, so as to avoid interference of the infrared light emitted by theproximity sensor 162 on detection of the first intensity value. In addition, the installation position of the ambientlight sensor 161 may be set to be distant from the installation position of theproximity sensor 162. It is to be understood that after the second intensity value of the infrared light received by theproximity sensor 162 is obtained, the ambientlight sensor 161 may be turned on to obtain the first intensity value of the infrared light in the current ambient light, and the timing sequence is not limited specifically.
In addition, the distance from the object to theelectronic device 100 may be calculated by subtracting the first intensity value from the second intensity value, so as to determine whether the object is close to or far from theelectronic device 100 according to the obtained distance. For example, in a normal state, when the intensity of infrared light received by theproximity sensor 162 is below 50 lumens (Lumen, lm), it indicates that the distance between the object or the human face and theelectronic device 100 is above 90mm, which indicates that the object or the human face is far away from theelectronic device 100. When the intensity of the infrared light received by theproximity sensor 162 is above 200 lumens, it indicates that the distance between the object or the human face and theelectronic device 100 is below 50mm, indicating that the object or the human face approaches theelectronic device 100. When ambientlight sensor 161 detects a first intensity value of 70 lumens for infrared light in the ambient light andproximity sensor 162 detects a second intensity value of 85 lumens for infrared light, subtracting the first intensity value of 70 lumens from the second intensity value of 85 lumens is 15 lumens (15 lumens is less than 50 lumens), indicating that the object or face is far fromelectronic device 100. When ambientlight sensor 161 detects a first intensity value of 70 lumens for infrared light in the ambient light andproximity sensor 162 detects a second intensity value of 350 lumens for infrared light, the subtraction of the first intensity value of 70 lumens from the second intensity value of 350 lumens is 280 lumens (280 lumens is greater than 200 lumens), indicating that an object or a human face is in proximity toelectronic device 100. It will be appreciated that these intensity values and distance values are exemplary only and are not limiting to the invention. The intensity value and the distance value can be set according to specific situations.
Referring to fig. 9, in some embodiments, a proximity detection method includes the steps of:
s101: detecting the brightness value of the current environment light; and
s102: when the brightness value is larger than or equal to a preset brightness threshold value, a first intensity value of infrared light in current environment light is acquired.
Referring to fig. 3, in some embodiments, step S101 and step S102 may be implemented by the obtainingmodule 21. That is, the obtainingmodule 21 may detect a brightness value of the current ambient light, and obtain the first intensity value of the infrared light in the current ambient light when the brightness value is greater than or equal to a predetermined brightness threshold.
Referring to fig. 1, in some embodiments, steps S101 and S102 may be implemented by theprocessor 24. That is, theprocessor 24 may acquire the brightness value of the current ambient light detected by the ambientlight sensor 161 and acquire the first intensity value of the infrared light in the current ambient light when the brightness value is greater than or equal to the brightness predetermined threshold.
Specifically, referring to fig. 10, when the user is in an outdoor environment, such as exposed to the sun, theproximity sensor 162 is greatly affected by infrared rays in the ambient light during the distance detection process, and thus a detection error of theproximity sensor 162 is more likely to be caused. Therefore, when it is detected that the brightness value of the current ambient light is greater than or equal to the brightness predetermined threshold, acquiring the first intensity value of the infrared light in the ambient light is beneficial to reducing the interference caused by the ambient light on the detection of theproximity sensor 162. The predetermined brightness threshold may be set according to specific situations. Further, the luminance value of the ambient light may be calculated by the level of sensitivity of the image sensor in theelectronic device 100.
Referring to fig. 11, in some embodiments, a proximity detection method includes the steps of:
s103: if the brightness value is smaller than the preset brightness threshold value, the distance from the object to the electronic device is detected according to the second intensity value to judge whether the object is close to or far away from the electronic device.
Referring to fig. 3, in some embodiments, step S103 may be implemented by the determiningmodule 22. That is, the determiningmodule 22 may detect the distance from the object to theelectronic device 100 according to the second intensity value when the brightness value is smaller than the predetermined brightness threshold to determine whether the object is close to or far away from theelectronic device 100.
Referring to fig. 1, in some embodiments, step S103 may be implemented by theprocessor 24. That is, theprocessor 24 may detect the distance from the object to theelectronic device 100 according to the second intensity value when the brightness value is smaller than the predetermined brightness threshold to determine whether the object is close to or far from theelectronic device 100.
Specifically, when the brightness value is less than the predetermined threshold value of brightness, the infrared light in the current light environment has less influence on theproximity sensor 162. For example, when the user is in a low-light environment such as indoors, since infrared light in ambient light is small and the influence on theproximity sensor 162 is negligible, the distance detection operation can be performed using the second intensity value detected by theproximity sensor 162 as it is.
Referring to fig. 11, in some embodiments, the step S101 of detecting the brightness value of the current ambient light includes:
s1011, acquiring a multi-frame image of the current environment; and
s1012, a luminance value of the current environment is calculated from the plurality of frames of images.
Referring to fig. 3, in some embodiments, theproximity detection apparatus 200 includes acalculation module 23. Step S1011 may be implemented by the obtainingmodule 21, and step S1012 may be implemented by the calculatingmodule 23. That is, the obtainingmodule 21 may obtain a multi-frame image of the current environment, and the calculatingmodule 23 may calculate the brightness value of the current environment according to the multi-frame image.
Referring to fig. 1, in some embodiments, theelectronic device 100 includes thecamera 163, and steps S1011 and S1012 can be implemented by theprocessor 24. That is, theprocessor 24 may acquire a plurality of frame images of the current environment by using thecamera 163, and calculate the brightness value of the current environment from the plurality of frame images.
Specifically, the brightness value of the current environment may also be obtained by detecting the image captured by thecamera 163. For example, the luminance value of the current environment may be calculated from the brightness of the captured image. It is understood that these ways of detecting the ambient light are only exemplary, and do not limit the present invention, and that the ways of detecting the ambient light may be other forms.
Referring to fig. 12, in some embodiments, the step S10 of acquiring the first intensity value of the infrared light in the current ambient light when the brightness value is greater than or equal to the predetermined brightness threshold includes:
s104, detecting the inclination angle of the electronic device; and
and S105, when the inclination angle is smaller than the preset angle threshold, acquiring a first intensity value of the infrared light in the current ambient light.
Referring to fig. 3, in some embodiments, step S104 and step S105 may be implemented by the obtainingmodule 21. That is, the obtainingmodule 21 may detect the tilt angle of theelectronic device 100, and obtain the first intensity value of the infrared light in the current ambient light when the tilt angle is smaller than the predetermined angle threshold.
Referring to fig. 1, in some embodiments, theelectronic device 100 includes anacceleration sensor 164, and step S104 and step S105 can be implemented by theprocessor 24. That is, theprocessor 24 may detect the tilt angle of theelectronic device 100 by using theacceleration sensor 164, and obtain the first intensity value of the infrared light in the current ambient light when the tilt angle is smaller than the predetermined angle threshold.
Specifically, please refer to fig. 13, in which the tilt angle of theelectronic device 100 is 0 degree (theelectronic device 100 is parallel to the horizontal direction). Referring to fig. 14, the tilt angle of theelectronic device 100 is 30 degrees (the included angle between theelectronic device 100 and the horizontal direction is 30 degrees). Theproximity sensor 162 can more easily receive the infrared light in the ambient light, and the influence on theproximity sensor 162 is large, so when the tilt angle of theelectronic device 100 is smaller than the predetermined angle threshold, the distance between the object and theelectronic device 100 can be determined by detecting the intensity of the infrared light received by theproximity sensor 162 and the intensity of the infrared light in the ambient light, and the interference caused by the detection of theproximity sensor 162 by the ambient light can be reduced. In addition, the tilt angle of theelectronic device 100 may also include a tilt angle of theelectronic device 100 from a vertical direction. The tilt angle of theelectronic device 100 may be detected by a gravity sensor or a gyro sensor. It is understood that the specific data of the predetermined angle threshold can be set according to actual conditions.
Referring to fig. 12, in some embodiments, a proximity detection method includes the steps of:
and S106, if the inclination angle is larger than or equal to the preset angle threshold, detecting the distance from the object to the electronic device according to the second intensity value to judge whether the object is close to or far away from the electronic device.
Referring to fig. 3, in some embodiments, step S106 may be implemented by the determiningmodule 22. That is, the determiningmodule 22 may detect the distance from the object to theelectronic device 100 according to the second intensity value when the tilt angle is greater than or equal to the predetermined angle threshold to determine whether the object is close to or far from theelectronic device 100.
Referring to fig. 1, in some embodiments, step S106 may be implemented by theprocessor 24. That is, theprocessor 24 may detect the distance from the object to theelectronic device 100 according to the second intensity value when the tilt angle is greater than or equal to the predetermined angle threshold to determine whether the object is close to or far from theelectronic device 100.
Specifically, please refer to fig. 15, the tilt angle of theelectronic device 100 is 120 degrees. Theproximity sensor 162 receives less infrared light in the ambient light, and the influence on theproximity sensor 162 is negligible, so that the distance detection operation can be performed directly using the second intensity value detected by theproximity sensor 162.
The embodiment of the invention also provides a computer readable storage medium. One or more non-transitory computer-readable storage media containing computer-executable instructions that, when executed by the one ormore processors 24, cause theprocessors 24 to perform the proximity detection method of any of the embodiments described above. For example, step S10 is executed to obtain a first intensity value of the infrared light in the current ambient light. In step S20, a second intensity value of the infrared light received by the proximity sensor is acquired. And step S30, detecting the distance from the object to the electronic device according to the first intensity value and the second intensity value to judge whether the object is close to or far away from the electronic device.
Referring to fig. 4, the embodiment of the invention further provides acomputer device 300. The computer device includes amemory 32 and aprocessor 24, wherein thememory 32 stores computer readable instructions, and when the instructions are executed by theprocessor 24, theprocessor 24 executes the proximity detection method according to any of the embodiments. For example, step S10 is executed to obtain a first intensity value of the infrared light in the current ambient light. In step S20, a second intensity value of the infrared light received by the proximity sensor is acquired. And step S30, detecting the distance from the object to the electronic device according to the first intensity value and the second intensity value to judge whether the object is close to or far away from the electronic device.
FIG. 4 is a schematic diagram of internal modules ofcomputer device 300, under an embodiment. Thecomputer apparatus 300 includes aprocessor 24, a memory 32 (e.g., a nonvolatile storage medium), aninternal memory 33, aninput device 34, an ambientlight sensor 161, aproximity sensor 162, acamera 163, and anacceleration sensor 164, which are connected by asystem bus 31. Thememory 32 of thecomputer device 300 has stored therein an operating system and computer readable instructions. The computer readable instructions are executable by theprocessor 24 to implement the proximity detection method of any of the above embodiments.Processor 24 may be used to provide computing and control capabilities that support the operation of theoverall computer device 300. Theinternal memory 33 of thecomputer device 300 provides an environment for the execution of computer readable instructions in thememory 32. Theinput device 34 of thecomputer device 300 may be a touch panel on a display screen, a button, a track ball or a touch pad arranged on a housing of thecomputer device 300, or an external keyboard, a touch pad or a mouse. Thecomputer device 300 may be a mobile phone, a tablet computer, a notebook computer, a personal digital assistant, or a wearable device (e.g., a smart bracelet, a smart watch, a smart helmet, smart glasses), etc. It will be appreciated by those skilled in the art that the configurations shown in the figures are merely schematic representations of portions of configurations relevant to the present inventive arrangements and are not intended to limit thecomputing device 300 to which the present inventive arrangements may be applied, and that aparticular computing device 300 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program, which can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above embodiments of the methods. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), or the like.
The above disclosure provides many different embodiments, or examples, for implementing different features of the invention. The components and arrangements of the specific examples are described above to simplify the present disclosure. Of course, they are merely examples and are not intended to limit the present invention. Furthermore, the present invention may repeat reference numerals and/or letters in the various examples, such repetition is for the purpose of simplicity and clarity and does not in itself dictate a relationship between the various embodiments and/or configurations discussed. In addition, the present invention provides examples of various specific processes and materials, but one of ordinary skill in the art may recognize applications of other processes and/or uses of other materials.
In the description of the present specification, reference to the description of the terms "one embodiment", "some embodiments", "an illustrative embodiment", "an example", "a specific example", or "some examples", etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.