Environment detection method, electronic equipment and storage medium
Through the camera shooting environment image analysis, the problem of increasing equipment volume and cost in the existing technology is solved, and efficient and accurate environmental detection and intelligent prompts are achieved.
Patent Information
- Application Number
- CN202410081513.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-19
- Publication Date
- 2025-07-22
AI Technical Summary
In the prior art, in order to detect the current environment in which the user is located, it is usually necessary to set up an optical sensor on the electronic device, which not only increases the size and cost of the device, but also increases the difficulty of waterproofing.
By using the camera of an electronic device to capture an environmental image, analyze the brightness of pixel points, especially the brightness average of grayscale images, to determine the light intensity of the current environment, and judge the environment type based on the light intensity, including indoors and outdoors.
There is no need to set up an additional optical sensor, which avoids the increase in equipment cost and volume, while improving the efficiency and accuracy of environmental detection, enhancing the intelligence of the equipment, and providing corresponding prompts according to the environment type.
Smart Images

Figure CN120358301A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the technical field of terminals, and involve but are not limited to an environment detection method, an electronic device, and a storage medium. Background Art
[0002] In order to encourage users to engage in outdoor activities, the environment where the user is currently located can be detected through an electronic device, and then it is determined whether to remind the user to engage in outdoor activities according to the current environment type. In the prior art, if it is necessary to detect the environment where the user is currently located, an optical sensor usually needs to be set on the electronic device. However, setting an optical sensor on the electronic device not only increases the volume of the electronic device, but also increases the cost of the electronic device and the waterproof difficulty of the electronic device. Summary of the Invention
[0003] In view of this, embodiments of the present application provide an environment detection method, an electronic device, and a storage medium. The environment detection method, the electronic device, and the storage medium provided by the embodiments of the present application are implemented as follows:
[0004] An environment detection method provided by an embodiment of the present application is applied to an electronic device provided with a camera. The method includes:
[0005] Obtain an environmental image of the current environment where the electronic device is located captured by the camera;
[0006] Determine the target illumination intensity of the current environment according to the brightness of the pixel points of the environmental image;
[0007] Determine the target environment type corresponding to the current environment according to the target illumination intensity. The target environment type includes one of an indoor environment and an outdoor environment, and different environment types correspond to different illumination intensities.
[0008] In the embodiments of the present application, the environment type where the user is currently located can be detected through the brightness of the environmental image captured by the camera of the electronic device, without additionally setting an optical sensor for the electronic device, which will not increase the cost and volume of the electronic device, nor will it additionally increase the waterproof difficulty of the electronic device.
[0009] In some embodiments, the determining the target illumination intensity of the current environment according to the brightness of the pixel points of the environmental image includes:
[0010] Perform grayscale conversion on the environmental image to obtain a grayscale image;
[0011] Calculate the average brightness of the grayscale image according to the brightness of each pixel point in the grayscale image. The average brightness of the grayscale image is the brightness of the pixel points of the environmental image;
[0012] Determine the target light intensity of the current environment according to the average brightness of the grayscale image.
[0013] In this embodiment, determining the target light intensity of the current environment by calculating the average brightness of the grayscale image can improve the efficiency of determining the light intensity and save computing resources.
[0014] In some embodiments, the determining the target environment type corresponding to the current environment according to the target light intensity includes:
[0015] Determine whether the target light intensity is greater than a first light intensity threshold;
[0016] When the target light intensity is greater than the first light intensity threshold, determine that the target environment type corresponding to the current environment is an outdoor environment, or, when the target light intensity is less than or equal to the first light intensity threshold, determine that the target environment type corresponding to the current environment is an outdoor environment.
[0017] In this embodiment, by comparing the target light intensity with the light intensity threshold, it is possible to quickly determine whether the current environment where the user is located is outdoor or indoor, saving computing resources.
[0018] In some embodiments, after determining that the target environment type corresponding to the current environment is an indoor environment, the method further includes:
[0019] Output a first prompt message for reminding the user of the electronic device to perform outdoor activities.
[0020] In this embodiment, different prompt messages can be output according to different current environment types. If the current environment is detected to be indoor, the user is reminded to perform outdoor activities, improving the intelligence level of the electronic device.
[0021] In some embodiments, after determining that the target environment type corresponding to the current environment is an outdoor environment, the method further includes:
[0022] Determine whether the target light intensity is less than a second light intensity threshold, where the second light intensity threshold is greater than the first light intensity threshold;
[0023] When the target light intensity is greater than or equal to the second light intensity threshold, output a second prompt message for reminding the user of the electronic device to perform indoor activities.
[0024] In this embodiment, if it is detected that the current environment is outdoor and the current outdoor light intensity is too high, the user is reminded to return indoors, improving the intelligence level of the electronic device.
[0025] In some embodiments, when the target light intensity is less than the second light intensity threshold, the target activity duration of the user using the electronic device in the current environment is recorded.
[0026] In this embodiment, if it is detected that the user is outdoors and the current outdoor light intensity is appropriate, the activity duration of the user outdoors is recorded, improving the intelligence level of the electronic device.
[0027] In some embodiments, after recording the target activity duration of the user using the electronic device in the current environment, the method further includes:
[0028] Determine a preset activity duration corresponding to the target light intensity, where different light intensities correspond to different preset activity durations;
[0029] Judge whether the target activity duration is greater than the preset activity duration;
[0030] When the target activity duration is greater than the preset activity duration, output a third prompt message, where the third prompt message includes a suggestion for outdoor activity duration.
[0031] In this embodiment, if it is detected that the activity duration of the user under the current light intensity exceeds the threshold, a suggestion for outdoor activity duration is output to the user, improving the intelligence level of the electronic device.
[0032] In some embodiments, before determining the target environment type corresponding to the current environment according to the target light intensity, the method further includes:
[0033] Obtain current auxiliary information for determining the target environment type, where the current auxiliary information includes at least one of the weather information of the current environment, the image features of the environment image, the scene information corresponding to the environment image, and the location information of the current environment. The image features include at least one of color features, texture features, and light and shadow features. The scene information includes at least one of building information, sky information, and plant information;
[0034] Determine the first light intensity threshold and / or the second light intensity threshold according to the mapping relationship between the preset auxiliary information and the preset light intensity threshold and the current auxiliary information.
[0035] In this embodiment, since different weather, environments, scenes, and locations correspond to different light intensities, the light intensity threshold used to judge the type of the current environment can be dynamically determined by obtaining such auxiliary information, improving the accuracy of environment detection.
[0036] In some embodiments, determining the target environment type corresponding to the current environment according to the target light intensity includes:
[0037] Obtaining current auxiliary information for determining the target environment type, where the current auxiliary information includes at least one of weather information of the current environment, image features of the environment image, scene information corresponding to the environment image, and location information of the current environment. The image features include at least one of color features, texture features, and light and shadow features. The scene information includes at least one of building information, sky information, and plant information;
[0038] Determining the target environment type corresponding to the current environment according to the target light intensity and the current auxiliary information.
[0039] In this embodiment, by combining auxiliary information such as weather, image features, scene information, and location information to determine the type of the current environment, the accuracy of environment detection is improved.
[0040] In some embodiments, determining the target environment type corresponding to the current environment according to the target light intensity and the current auxiliary information includes:
[0041] Judging whether the target light intensity is greater than the first light intensity threshold;
[0042] When the target light intensity is greater than the first light intensity threshold, determining the initial environment type corresponding to the current environment;
[0043] Judging whether the initial environment type is the same as the environment type determined according to the current auxiliary information;
[0044] When the initial environment type is the same as the environment type determined according to the current auxiliary information, determining the initial environment type as the target environment type corresponding to the current environment.
[0045] In this embodiment, the environment type determined according to the auxiliary information further verifies the initial environment type determined by the light intensity, improving the accuracy of environment detection.
[0046] In some embodiments, obtaining the environment image of the current environment where the electronic device is located captured by the camera includes:
[0047] When it is detected that the user using the electronic device is continuously in a moving state within a preset duration, controlling the camera to turn on and capture the current environment where the electronic device is located at a preset first interval time to obtain the environment image.
[0048] In this embodiment, the detection is only performed after it is detected that the user is in a moving state, which avoids frequent activation and shooting of the camera of the electronic device and can also save the power of the electronic device.
[0049] In some embodiments, obtaining the environmental image of the current environment where the electronic device is located captured by the camera includes:
[0050] Controlling the camera to be turned on and capture the current environment where the electronic device is located at a preset second interval time to obtain the environmental image.
[0051] In this embodiment, the current environment can be automatically captured at a preset interval time, which simplifies the user operation and improves the convenience of environmental detection and the intelligence level of the electronic device.
[0052] An electronic device provided by an embodiment of the present application, the electronic device is provided with a camera, and the electronic device includes an acquisition module and a determination module, wherein:
[0053] The acquisition module is used to acquire the environmental image of the current environment where the electronic device is located captured by the camera;
[0054] The determination module is used to determine the target illumination intensity of the current environment according to the brightness of the pixel points of the environmental image; and, according to the target illumination intensity, determine the target environment type corresponding to the current environment, the target environment type includes one of an indoor environment and an outdoor environment, and different environment types correspond to different illumination intensities.
[0055] An electronic device provided by an embodiment of the present application includes a memory and a processor, the memory stores a computer program that can run on the processor, and the processor implements the method described in the embodiment of the present application when executing the program.
[0056] A computer-readable storage medium provided by an embodiment of the present application, on which a computer program is stored, and when the computer program is executed by a processor, it implements the method provided by the embodiment of the present application. Description of the Drawings
[0057] The drawings here are incorporated into the specification and constitute a part of this specification. These drawings show embodiments that conform to the present application and are used together with the specification to explain the technical solutions of the present application.
[0058] Figure 1 It is a schematic flowchart of an environmental detection method provided by an embodiment of the present application;
[0059] Figure 2 It is a schematic structural diagram of a telephone watch provided by an embodiment of the present application;
[0060] Figure 3 It is a schematic flowchart of another environment detection method provided by an embodiment of the present application;
[0061] Figure 4-1 It is a schematic diagram of the interface for a smartwatch to display a prompt message provided by an embodiment of the present application;
[0062] Figure 4-2 It is a schematic diagram of the interface for a mobile phone to display a prompt message provided by an embodiment of the present application;
[0063] Figure 5 It is a schematic flowchart of yet another environment detection method provided by an embodiment of the present application;
[0064] Figure 6 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application;
[0065] Figure 7 It is a schematic diagram of the structure of another electronic device provided by an embodiment of the present application. Detailed implementation manners
[0066] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will further describe the specific technical solutions of the present application in detail with reference to the accompanying drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not intended to limit the scope of the present application.
[0067] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0068] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments. However, it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0069] It should be noted that the terms "first / second / third" involved in the embodiments of the present application are used to distinguish similar or different objects, and do not represent a specific order for the objects. It can be understood that "first / second / third" can be interchanged with a specific order or sequence when allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0070] Research shows that regular outdoor activities have certain benefits and effects on the eye health of users. On the one hand, regular outdoor activities can reduce the time of using eyes at close range, which is beneficial to the prevention and treatment of myopia. On the other hand, more sunlight can be exposed to in the outdoor environment, increasing the absorption of calcium in the human body. For users' eyes, if they lack outdoor activities for a long time, it is easy to cause calcium deficiency in the eyes, weakening the elasticity and surface tension of the eyeball wall. Coupled with long-term close-range eye use, it is easy to lengthen the eye axis and cause myopia. On the contrary, if users carry out outdoor activities regularly, it can promote the release of more dopamine in the fundus retina. Dopamine can slow down the elongation of the eye axis length, thus playing a role in preventing myopia. Therefore, with the increasing attention of users to eye health, more and more users begin to attach importance to outdoor activities, and it is necessary to encourage and remind users to carry out outdoor activities regularly.
[0071] In order to encourage and remind users to carry out outdoor activities regularly, the electronic device can detect the environment where the user is currently located, and then determine whether to remind the user to carry out outdoor activities according to the type of the current environment. In the prior art, if it is necessary to detect the environment where the user is currently located, an optical sensor (such as an ultraviolet sensor, a multispectral sensor, etc.) usually needs to be set on the electronic device. However, the optical sensor must contact the external environment to further detect the type of the environment where the user is located. Moreover, setting an optical sensor on the electronic device will not only increase the volume of the electronic device, but also increase the cost of the electronic device and the waterproof difficulty of the electronic device.
[0072] In view of this, the embodiments of the present application provide an environment detection method, an electronic device and a storage medium, which are applied to an electronic device equipped with a camera. The method includes: acquiring an environmental image of the current environment where the electronic device is located captured by the camera; determining a target illumination intensity of the current environment according to the brightness of the pixel points of the environmental image; and determining a target environment type corresponding to the current environment according to the target illumination intensity, where the target environment type includes one of an indoor environment and an outdoor environment, and different environment types correspond to different illumination intensities.
[0073] In order to make the purpose and technical solution of the present application more clear and intuitive, the garbage collection and processing method disclosed in the present application will be described in detail below with reference to the accompanying drawings.
[0074] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of an environment detection method disclosed in an embodiment of the present application. As Figure 1 shown, the method is applied to an electronic device equipped with a camera.
[0075] It should be understood that the electronic devices involved in the embodiments of the present application may be mobile phones, tablet computers, laptop computers, handheld computers, vehicle-mounted terminal devices, wearable devices, mobile internet devices (MIDs), virtual reality (VR) devices, augmented reality (AR) devices, earphones, terminals in industrial control, terminals in self-driving, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc. Among them, the wearable devices may be telephone watches, smart bracelets, smart ankle rings, smart earrings, smart necklaces, smart earphones, etc., and the embodiments of the present application are not limited thereto.
[0076] It should be noted that the electronic devices involved in the embodiments of the present application are provided with cameras, and the cameras of the electronic devices may include front cameras and / or rear cameras. Please refer to Figure 2 , Figure 2 which is a schematic structural diagram of a telephone watch disclosed in the embodiments of the present application. Figure 2 It includes a telephone watch dial 20, a display screen 21, and a front camera 22. Among them, the display screen 21 is arranged on the upper surface of the telephone watch dial 20, and the front camera 22 is arranged at the top position on the upper surface of the display screen 21. It should be understood that in addition to being provided with a camera, the electronic devices involved in the embodiments of the present application may also include other components, which are not limited herein.
[0077] Step 101: Obtain an environmental image of the current environment where the electronic device is located captured by the camera.
[0078] In the embodiments of the present application, the camera of the electronic device can capture the current environment where the electronic device is located to obtain an environmental image of the current environment. Further, the camera needs to be turned on before capturing the current environment, and it can be automatically turned on for shooting according to a preset turning-on condition. Those skilled in the art can set any preset turning-on condition according to their needs.
[0079] As an optional implementation manner, the preset turning-on condition may be that when the electronic device detects that the user has been in a moving state for a preset duration, the camera is automatically turned on and captured according to a preset first interval time. Specifically:
[0080] Obtaining an environmental image of the current environment where the electronic device is located captured by the camera includes:
[0081] When it is detected that the user using the electronic device has been in a moving state continuously within a preset duration, the camera is controlled to turn on and capture the current environment where the electronic device is located at a preset first interval time to obtain an environmental image.
[0082] It should be noted that it is possible to further detect whether the user is currently moving in an indoor environment or an outdoor environment after the electronic device detects that the user is in a moving state and has been in a moving state continuously within a preset duration. In this case, since the electronic device has detected that the user is currently in a moving state, a relatively short preset first time interval can be set to activate the camera for shooting, so as to quickly determine in which environment the current user is moving. If it is detected that the user is currently moving indoors, the user can be reminded to move outdoors. Those skilled in the art can set the preset first interval time according to actual needs, which is not limited herein. For example, when it is detected that the user has been moving continuously for 5 minutes, the current environment where the electronic device is located is captured once every 1 minute.
[0083] It should be understood that if the electronic device is a phone watch worn by the user, detecting that the user has been in a moving state continuously within a preset duration is to avoid misjudging that the user is currently in a moving state due to the random shaking of the user's arm. Therefore, only when it is detected that the user has been in a moving state continuously within a preset duration, the camera is controlled to turn on and capture at a preset first interval time, which can avoid the frequent startup and shooting of the camera, thereby avoiding the rapid consumption of the electronic device's power.
[0084] Optionally, it is possible to detect whether the user using the electronic device has been in a moving state continuously within a preset duration according to the sensor data collected by a motion sensor (such as a three-axis sensor, a six-axis sensor, etc.). For example, it is possible to obtain the acceleration data collected by the three-axis sensor to judge the user's motion state, or it is possible to obtain the acceleration data and angular velocity data collected by the six-axis sensor comprehensively to judge the user's motion state. Those skilled in the art can obtain different sensor data to judge according to actual needs, which is not limited in this application.
[0085] By adopting the above optional implementation manner, detection is only performed when it is detected that the user is in a moving state, which avoids the frequent turning on and shooting of the electronic device's camera and can also save the power of the electronic device.
[0086] As another optional implementation manner, the preset opening condition can be to control the camera to automatically turn on and capture at a preset second interval time. Specifically:
[0087] Obtaining the environmental image of the current environment where the electronic device is located captured by the camera includes:
[0088] Control the camera to turn on and capture the current environment where the electronic device is located according to a preset second interval time to obtain an environmental image.
[0089] It should be noted that in the case of not being sure about the current activity status of the user, in order to reduce the power consumption of the electronic device, a relatively long preset second time interval can be set to start the camera for shooting. For example, when the user is currently studying or resting, if the camera is frequently started for shooting and it is detected that the current user is in an indoor environment, reminding the user to go to an outdoor environment for activities may interfere with the user. Therefore, without judging the current status of the user, a relatively long preset second time interval can be set to start the camera for shooting. Those skilled in the art can set the preset second interval time according to actual needs, which is not limited herein. For example, set to capture the current environment where the electronic device is located once every 10 minutes.
[0090] By adopting the above another optional implementation manner, the current environment can be automatically captured according to a preset interval time, which simplifies the user operation and improves the convenience of environmental detection and the intelligence level of the electronic device.
[0091] It should be noted that after the camera is turned on each time, the camera can capture at least one environmental image of the current environment. It should be understood that the more environmental images are captured, the more accurate the environmental detection result is. The number of environmental images captured in this application is not limited.
[0092] Step 102: Determine the target light intensity of the current environment according to the brightness of the pixel points of the environmental image.
[0093] In the embodiments of the present application, the light intensity refers to the density or intensity of the radiation power of light in a specific direction. The stronger the light, the higher the light intensity. For example, the light in the outdoor environment is stronger than that in the indoor environment, so the light intensity in the outdoor environment is higher than that in the indoor environment. Even on cloudy days and under the shade of trees, the light intensity in the outdoor environment is usually several thousand lux. Therefore, the light intensity in the outdoor environment is generally 100 to 1000 times that in the indoor environment.
[0094] In the embodiments of the present application, since the brightness of the environmental images captured by the camera is different under different light intensities. Therefore, the brightness of the outdoor environmental images captured by the camera is higher than that of the indoor environmental images. The target light intensity of the current environment can be determined by detecting the brightness of the environmental image, and then the current environmental type can be determined according to the target light intensity of the current environment.
[0095] As an alternative implementation, the brightness of the pixel points of the environmental image can reflect the brightness of the environmental image. The brightness of the environmental image can be determined by calculating the brightness of the pixel points of the environmental image, and then the target light intensity of the current environment can be determined. Specifically, determining the target light intensity of the current environment according to the brightness of the pixel points of the environmental image includes:
[0096] Perform gray-scale conversion on the environmental image to obtain a grayscale image;
[0097] According to the brightness of each pixel point in the grayscale image, calculate the average brightness of the grayscale image. The average brightness of the grayscale image is the brightness of the pixel points of the environmental image;
[0098] Determine the target light intensity of the current environment according to the average brightness of the grayscale image.
[0099] It should be noted that the environmental image captured by the camera through the photosensitive chip is a two-dimensional array. Each element of the array represents the color information of a pixel point. Each pixel point contains the color information of the red, green, and blue channels, while the grayscale image only retains the brightness information. Therefore, the color environmental image can be converted into a grayscale image. The value of each element in the grayscale image is an integer between 0 and 255, indicating the brightness of the pixel point. Therefore, the average brightness of the grayscale image can be calculated according to the brightness of each pixel point in the grayscale image. This average brightness is the brightness of the pixel points of the corresponding environmental image (i.e., the average brightness of the entire environmental image). This average brightness can also reflect the light intensity of the current environment. Therefore, the target light intensity of the current environment can be determined according to this average brightness.
[0100] As an example, the environmental image captured by the camera can be input into a preset image processing library for processing to obtain the average brightness of the environmental image. The preset image processing library can use the Python Imaging Library (PIL) or the Open Source Computer Vision Library (OpenCV). This application does not make any limitations in this regard.
[0101] Adopting the above alternative implementation, determining the target light intensity of the current environment by calculating the average brightness of the grayscale image can improve the efficiency of determining the light intensity and save computing resources.
[0102] Step 103: Determine the target environment type corresponding to the current environment according to the target light intensity. The target environment type includes one of the indoor environment and the outdoor environment. Different environment types correspond to different light intensities.
[0103] In the embodiments of the present application, since the light intensity is different in different environmental types (for example, the light intensity in an indoor environment is usually lower than 500 lux, and the light intensity in an outdoor environment is usually higher than 500 lux), therefore, after determining the target light intensity of the current environment, the target environmental type of the current environment can be determined according to the target light intensity of the current environment. It should be noted that those skilled in the art can set the judgment threshold of the light intensity of the indoor environment and the outdoor environment according to the detection requirements, and the present application does not limit this here.
[0104] As an optional implementation manner, determining the target environmental type corresponding to the current environment according to the target light intensity includes:
[0105] Judging whether the target light intensity is greater than the first light intensity threshold;
[0106] When the target light intensity is greater than the first light intensity threshold, determining that the target environmental type corresponding to the current environment is an outdoor environment, or when the target light intensity is less than or equal to the first light intensity threshold, determining that the target environmental type corresponding to the current environment is an outdoor environment.
[0107] Exemplarily, the first light intensity threshold can be set to 500 lux. If the detected light intensity of the current environment is 200 lux, it is determined that the environmental type where the current user is located is an indoor environment. If the detected light intensity of the current environment is 1000 lux, it is determined that the environmental type where the current user is located is an outdoor environment. The present application does not limit the value of the first light intensity threshold, and those skilled in the art can set a fixed first light intensity threshold according to requirements.
[0108] By adopting the above optional implementation manner, it is possible to quickly determine whether the current environment where the user is located is outdoor or indoor by comparing the target light intensity with the light intensity threshold, saving computing resources.
[0109] In the embodiments of the present application, whether in an outdoor environment or an indoor environment, different information such as different weather, outdoor buildings, outdoor plants, and different altitude levels determines different light intensities. For example, the light intensity under the shade of a tree outdoors is usually 5556 lux - 7876 lux, the light intensity in an outdoor open environment is usually 11080 lux - 18176 lux, the light intensity in the plateau area is higher than that in the basin area, the light intensity is also different when the user is blocked by buildings at different heights, and the height of the floor where the user lives and the distance between floors will also affect the light intensity.
[0110] Therefore, in addition to directly setting a fixed first light intensity threshold in the embodiments of the present application, a mapping relationship between preset auxiliary information and a preset light intensity threshold can also be preset. Before determining the target environment type corresponding to the current environment according to the target light intensity, the current auxiliary information of the current environment can be obtained, and the most appropriate light intensity threshold can be dynamically determined as the first light intensity threshold for detecting the target environment type corresponding to the current environment according to the current auxiliary information and the mapping relationship. The preset light intensity threshold includes the first light intensity threshold. This way of dynamically determining the first light intensity threshold improves the accuracy of environment detection.
[0111] As an optional implementation manner, before determining the target environment type corresponding to the current environment according to the target light intensity, the method further includes:
[0112] Obtaining current auxiliary information for determining the target environment type, where the current auxiliary information includes at least one of weather information of the current environment, image features of the environmental image, scene information corresponding to the environmental image, and location information of the current environment. The image features include at least one of color features, texture features, and light and shadow features. The scene information includes at least one of building information, sky information, and plant information;
[0113] Determining the first light intensity threshold according to the mapping relationship between the preset auxiliary information and the preset light intensity threshold and the current auxiliary information.
[0114] It should be noted that the present application can preset the mapping relationship between the preset auxiliary information and the preset light intensity threshold. Exemplarily, the light intensity in at least one case of different weather information, image features of different environments, scene information of different environments, and location information of different environments can be collected in advance, and at least one of the weather information, image features, scene information, and location information is used as the preset auxiliary information, and the light intensity corresponding to different preset auxiliary information is used as the preset light intensity threshold. Finally, the mapping relationship between the preset auxiliary information and the preset light intensity threshold is established.
[0115] Further, before determining the target environment type corresponding to the current environment according to the target light intensity, at least one piece of current auxiliary information of the weather information of the current environment, image features of the environmental image, scene information corresponding to the environmental image, and location information of the current environment can be obtained, and the light intensity threshold corresponding to the current auxiliary information is determined as the first light intensity threshold according to the preset mapping relationship.
[0116] As an example, assume that the preset auxiliary information is sunny, and the light intensity of the outdoor environment when it is sunny is previously collected as 10,000 lux. If it is detected that the weather information in the current auxiliary information of the current environment is also sunny, then 10,000 lux can be used as the first light intensity threshold to detect the user in the outdoor environment or the indoor environment. Further, if it is detected that the target light intensity of the current environment is 12,000 lux, it is determined that the target environment type where the user is currently located is the outdoor environment and the current weather is sunny.
[0117] As another example, assume that the preset auxiliary information is high-rise buildings, and it is previously collected that when the user is blocked by high-rise buildings, the light intensity of the outdoor environment is 5,000 lux. If it is detected that the scene information corresponding to the environmental image of the current auxiliary information of the current environment is also high-rise buildings, then 5,000 lux can be used as the first light intensity threshold to detect the user in the outdoor environment or the indoor environment. Further, if it is detected that the target light intensity of the current environment is 6,000 lux, it is determined that the target environment type where the user is currently located is the outdoor environment and there are high-rise buildings blocking nearby.
[0118] It should be understood that since the current auxiliary information of the current environment is obtained when determining the first light intensity threshold, not only can the target environment type where the user is currently located be detected, but also the specific scene in the target environment type where the user is currently located can be determined. For example, not only can it be determined that the user is in the outdoor environment, but it can also be judged that there are high-rise buildings blocking nearby in the environment where the user is located.
[0119] Adopting the above optional implementation manner, since the light intensities corresponding to different weathers, environments, scenes, and positions are different, the light intensity threshold to be used to judge the type of the current environment can be dynamically determined by obtaining such auxiliary information, improving the accuracy of environment detection.
[0120] It can be seen that by implementing the embodiments of the present application, the type of the current environment can be detected through the brightness of the environmental image captured by the camera of the electronic device, without additionally setting an optical sensor for the electronic device, without increasing the cost and volume of the electronic device, and without additionally increasing the waterproof difficulty of the electronic device.
[0121] Please refer to Figure 3 , Figure 3 which is a schematic flowchart of another environment detection method disclosed in the embodiments of the present application.
[0122] Step 301, obtain an environmental image of the current environment where the electronic device is located captured by the camera.
[0123] Step 302, determine the target light intensity of the current environment according to the brightness of the pixel points of the environmental image.
[0124] Step 303: Determine the target environment type corresponding to the current environment according to the target light intensity. The target environment type includes one of an indoor environment and an outdoor environment, and the light intensities corresponding to different environment types are different.
[0125] For the implementation manners of steps 301 to 303, reference may be correspondingly made to the foregoing steps 101 to 103, which will not be elaborated here.
[0126] It should be noted that if the detected target environment type is an indoor environment, step 304 is executed; if the detected target environment type is an outdoor environment, steps 305 to 307 are executed.
[0127] Step 304: If the target environment type is an indoor environment, output a first prompt message, where the first prompt message is used to remind the user using the electronic device to perform outdoor activities.
[0128] In the embodiment of the present application, after determining that the target environment type corresponding to the current environment is an indoor environment, the electronic device may output a first prompt message, where the first prompt message is used to remind the user using the electronic device to perform outdoor activities, thereby improving the intelligence level of the electronic device. For example, the first prompt message may include weather information of the current outdoor environment and the duration of the recommended outdoor activities, etc.
[0129] Exemplarily, please refer to Figure 4-1 , Figure 4-1 which is a schematic diagram of the interface for displaying the prompt message provided by the embodiment of the present application. Among them, Figure 4-1 it includes a phone watch 41, a front camera 411, a display screen 412, and a prompt message display area 413. The prompt message display area 413 is set on the display screen 412, and the prompt message can be displayed in the prompt message display area 413 (for example, display "Currently, you are in an indoor environment. Please move to an outdoor environment").
[0130] It should be noted that the first prompt message involved in the embodiment of the present application may be output through the prompt message display area of the electronic device or output through voice broadcast of the electronic device. Those skilled in the art may also output the first prompt message in other ways according to the actual situation, which is not limited herein. The prompt messages involved in the embodiments of this specification may all be output through the prompt message display area of the electronic device or output through voice broadcast of the electronic device or output in other ways.
[0131] Step 305: If the target environment type is an outdoor environment, determine whether the target light intensity is less than a second light intensity threshold, where the second light intensity threshold is greater than the first light intensity threshold.
[0132] In an embodiment of the present application, after determining that the target environment type corresponding to the current environment is an outdoor environment, the electronic device may further detect whether the target light intensity of the current environment is suitable for the user to perform outdoor activities. It can be determined whether it is currently suitable for the user to perform outdoor activities by comparing the relationship between the target light intensity of the current environment and the second light intensity threshold.
[0133] It should be understood that since it has been determined that the target environment type of the current environment where the user is located is an outdoor environment based on the fact that the target light intensity of the current environment is greater than the first light intensity threshold, then, if it is further necessary to determine whether the target light intensity of the current environment is suitable for the user to perform outdoor activities, the second light intensity threshold must be greater than the first light intensity threshold.
[0134] In an embodiment of the present application, the second light intensity threshold may be a fixed light intensity threshold greater than the first light intensity threshold that those skilled in the art can set according to requirements, or may be to dynamically determine the most suitable light intensity threshold as the second light intensity threshold for detecting whether the target light intensity of the current environment is suitable for the user to perform outdoor activities according to the mapping relationship between the preset auxiliary information and the preset light intensity threshold.
[0135] As an optional implementation manner, before determining the target environment type corresponding to the current environment according to the target light intensity, the method further includes:
[0136] Obtain the current auxiliary information for determining the target environment type, where the current auxiliary information includes at least one of the weather information of the current environment, the image features of the environmental image, the scene information corresponding to the environmental image, and the location information of the current environment. The image features include at least one of color features, texture features, and light and shadow features. The scene information includes at least one of building information, sky information, and plant information;
[0137] Determine the second light intensity threshold according to the mapping relationship between the preset auxiliary information and the preset light intensity threshold and the current auxiliary information.
[0138] It should be noted that when establishing the mapping relationship between the preset auxiliary information and the preset light intensity threshold, on the basis of establishing the first light intensity threshold for judging the indoor environment or the outdoor environment corresponding to each preset auxiliary information, the second light intensity threshold corresponding to each preset auxiliary information can also be established. Since the second light intensity threshold is used to judge whether the target light intensity of the current environment is suitable for the user to perform outdoor activities, the second light intensity threshold is greater than the first light intensity threshold.
[0139] As an example, assume that the preset auxiliary information is sunny, and the light intensity of the outdoor environment when it is sunny is pre-collected as 10,000 lux. Then, 10,000 lux can be set as the first light intensity threshold when it is sunny, and 15,000 lux can be set as the second light intensity threshold when it is sunny. If it is detected that the weather information in the current auxiliary information of the current environment is sunny, and the target light intensity of the current environment is 18,000 lux, it is determined that the target light intensity of the current environment where the user is located is too high and not suitable for the user to carry out outdoor activities.
[0140] Adopting the above optional implementation manner, since the light intensities corresponding to different weathers, environments, scenes, and positions are different, the auxiliary information of this type can be obtained to dynamically determine which light intensity threshold to use to judge the type of the current environment, improving the accuracy of environment detection.
[0141] It should be noted that if the target light intensity is greater than or equal to the second light intensity threshold, step 306 is executed; if the target light intensity is less than the second light intensity threshold, step 307 is executed.
[0142] Step 306, in the case where the target light intensity is greater than or equal to the second light intensity threshold, output a second prompt message, and the second prompt message is used to remind the user using the electronic device to carry out indoor activities.
[0143] In the embodiment of the present application, if it is detected that the target light intensity of the current environment is greater than or equal to the second light intensity threshold, it means that the light intensity of the current outdoor environment is too high, and at this time it is not suitable for the user to carry out outdoor activities.
[0144] Further, after determining that the target light intensity of the current environment is greater than or equal to the second light intensity threshold, the electronic device can output a second prompt message, and the second prompt message is used to remind the user using the electronic device to carry out indoor activities. For example, the second prompt message may include the target light intensity of the current environment and suggest to the user which specific time period can be used for outdoor activities, etc. Among them, which specific time period can be used for outdoor activities can be determined according to the light intensities of the outdoor environment in different time periods pre-collected. For example, if it is pre-collected that the light intensity of the outdoor environment from 17:00 to 18:00 in the afternoon is appropriate, the user can be reminded to carry out outdoor activities during this time period.
[0145] Step 307, in the case where the target light intensity is less than the second light intensity threshold, record the target activity duration of the user using the electronic device in the current environment.
[0146] In the embodiment of the present application, if it is detected that the target light intensity of the current environment is less than the second light intensity threshold, it means that the light intensity of the current outdoor environment is appropriate, and at this time it is suitable for the user to carry out outdoor activities.
[0147] Further, after determining that the target light intensity of the current environment is less than the second light intensity threshold, the user's target activity duration in the current environment when using the electronic device can be recorded. Exemplarily, the moment when the detected target environment type corresponding to the current environment is an outdoor environment can be used as the start time, and recording can be started from this start time until the electronic device detects that the target environment type corresponding to the current environment is an indoor environment and then stops. Among them, the electronic device can record the user's target activity duration in the current environment through a preset application program, a built-in timing clock, an externally connected other device, etc., and the present application does not limit this.
[0148] In the embodiment of the present application, after recording the user's target activity duration in the current environment when using the electronic device, the electronic device can further determine whether the target activity duration of the user under the target light intensity in the current environment is greater than the preset activity duration. If it is greater than the preset activity duration, the user can be reminded that the duration of outdoor activities is too long and it is recommended to return indoors.
[0149] As an alternative implementation manner, after recording the user's target activity duration in the current environment when using the electronic device, the method further includes:
[0150] Determine the preset activity duration corresponding to the target light intensity, where different light intensities correspond to different preset activity durations;
[0151] Judge whether the target activity duration is greater than the preset activity duration;
[0152] When the target activity duration is greater than the preset activity duration, output a third prompt message, and the third prompt message includes a suggestion on the duration of outdoor activities.
[0153] It should be noted that those skilled in the art can set the preset activity duration according to actual needs, and this is not limited here. For example, in the case where it has been determined that the target light intensity of the current environment is a light intensity suitable for the user to carry out activities in the outdoor environment, if the target light intensity is 5000 lux, the preset activity duration corresponding to this target light intensity is set to 2 hours, and if the target light intensity is 3000 lux, the preset activity duration corresponding to this target light intensity is set to 1 hour. Further, if it is detected that the user's activity duration in an environment with a target light intensity of 5000 lux exceeds 2 hours, the third prompt message is output, and if it is detected that the user's activity duration in an environment with a target light intensity of 3000 lux exceeds 1 hour, the third prompt message is output.
[0154] Exemplarily, please refer to Figure 4-2 , Figure 4-2 which is a schematic diagram of the interface for the mobile phone to display the prompt message provided by the embodiment of the present application, where,Figure 4-2 It includes a mobile phone 42, a front camera 421, a display screen 422, and a prompt message display area 423. The prompt message display area 423 is set on the display screen 422, and a prompt message can be displayed in the prompt message display area 423 (for example, the light intensity of the current outdoor environment is 1000 lux, the cumulative duration of your outdoor activities at this light intensity has reached 2 hours, and it is recommended to return indoors after 30 minutes).
[0155] Adopting the above optional implementation manner, if it is detected that the activity duration of the user under the current light intensity exceeds the threshold, a suggestion on the outdoor activity duration is output to the user, improving the intelligence level of the electronic device.
[0156] It can be seen that by implementing the embodiments of the present application, the current environment type can be detected through the brightness of the environmental image captured by the camera of the electronic device. There is no need to additionally set an optical sensor for the electronic device, which will not increase the cost and volume of the electronic device, nor will it additionally increase the waterproof difficulty of the electronic device. Different prompt messages can be output according to different current environment types. If it is detected that the current environment is indoor, the user is reminded to carry out outdoor activities, improving the intelligence level of the electronic device. If it is detected that the current environment is outdoor and the current outdoor light intensity is too high, the user is reminded to return indoors, improving the intelligence level of the electronic device. If it is detected that the user is outdoors and the current outdoor light intensity is appropriate, the activity duration of the user outdoors is recorded, improving the intelligence level of the electronic device.
[0157] Please refer to Figure 5 , Figure 5 which is a schematic flowchart of another environment detection method disclosed in the embodiments of the present application.
[0158] Step 501, obtain an environmental image of the current environment where the electronic device is located captured by the camera.
[0159] Step 502, determine the target light intensity of the current environment according to the brightness of the pixel points of the environmental image.
[0160] For the implementation manners of steps 501 to 502, reference can be made to the corresponding content in the foregoing steps 101 to 102, which will not be elaborated here.
[0161] Step 503, obtain the current auxiliary information for determining the target environment type. The current auxiliary information includes at least one of the weather information of the current environment, the image features of the environmental image, the scene information corresponding to the environmental image, and the location information of the current environment.
[0162] In the embodiments of the present application, in addition to detecting the target environment type corresponding to the current environment based on the target light intensity of the current environment, the current auxiliary information of the current environment can also be combined to assist in detecting the target environment type corresponding to the current environment, so as to improve the accuracy of the detection result.
[0163] In the embodiments of the present application, before determining the target environment type corresponding to the current environment, the current auxiliary information corresponding to the current environment can be obtained. The current auxiliary information includes at least one of the weather information of the current environment, the image features of the environment image, the scene information corresponding to the environment image, and the location information of the current environment.
[0164] Among them, the weather information of the current environment includes weather information such as temperature, humidity, weather conditions, wind speed, relative humidity, and air pressure. The weather information of the current environment can be obtained from channels such as the weather information application program of the electronic device or weather information-related websites, which is not limited here. The accuracy of the target environment type determined according to the target light intensity of the current environment can be verified by combining the environment type determined according to the weather information. For example, it can be determined whether the environment where the user is currently located is an outdoor environment or an indoor environment based on the temperature. Usually, the temperature outdoors is lower than that indoors. It can also be determined whether the environment where the user is currently located is an outdoor environment or an indoor environment based on the wind speed. Usually, the wind speed outdoors is much higher than that indoors.
[0165] Among them, the image features of the environment image include at least one of color features, texture features, and light and shadow features. The electronic device can extract the image features of the environment image of the current environment captured by the camera through image processing technology. The accuracy of the target environment type determined according to the target light intensity of the current environment can be verified by analyzing the image features such as color, texture, and light and shadow in the environment image. For example, the environment image corresponding to the outdoor environment usually has more blue and green, while the environment image corresponding to the indoor environment usually has more red, orange, and yellow; the texture of the environment image corresponding to the outdoor environment is more complex than that of the environment image corresponding to the indoor environment, with more shadows and reflections.
[0166] Among them, the scene information corresponding to the environment image includes at least one of building information, sky information, and plant information. The electronic device can identify the scene information corresponding to the environment image of the current environment captured by the camera through image recognition technology. The accuracy of the target environment type determined according to the target light intensity of the current environment can be verified by analyzing the scene information such as buildings, sky, and plants in the environment image. For example, the environment image corresponding to the outdoor environment usually has obvious buildings and sky, while the environment image corresponding to the indoor environment does not; the plants in the environment image corresponding to the outdoor environment are usually plants with a higher volume, while the plants in the environment image corresponding to the indoor environment are usually plants with a smaller volume.
[0167] Among them, the location information of the current environment includes information such as address, altitude, longitude and latitude, etc. The location information of the current environment can be obtained from the map application of the electronic device or the global navigation satellite system (GNSS) or through channels based on mobile communication technology, etc., which is not limited here. The accuracy of the target environment type determined according to the target light intensity of the current environment can be verified in combination with the environment type determined according to the location information. For example, if the location information is a park, then the target environment type where the current user is located is an outdoor environment. If the location information shows that the current altitude is 3000 km, then the target environment type where the current user is located is an outdoor environment.
[0168] Step 504, determine the target environment type corresponding to the current environment according to the target light intensity and the current auxiliary information.
[0169] In the embodiment of the present application, the electronic device can determine the target environment type corresponding to the current environment by comparing whether the environment type determined according to the current auxiliary information is the same as the initial environment type determined according to the target light intensity, and can also assist in verifying whether the result of the initial environment type determined according to the target light intensity is accurate.
[0170] As an optional implementation manner, determining the target environment type corresponding to the current environment according to the target light intensity and the current auxiliary information includes:
[0171] Judge whether the target light intensity is greater than the first light intensity threshold;
[0172] When the target light intensity is greater than the first light intensity threshold, determine the initial environment type corresponding to the current environment;
[0173] Judge whether the initial environment type is the same as the environment type determined according to the current auxiliary information;
[0174] When the initial environment type is the same as the environment type determined according to the current auxiliary information, determine the initial environment type as the target environment type corresponding to the current environment.
[0175] It should be noted that judging whether the initial environment type is the same as the environment type determined according to the current auxiliary information includes: judging whether the initial environment type is the same as at least one of the environment type determined according to the weather information of the current environment, the environment type determined according to the image features of the environment image, the environment type determined according to the scene information corresponding to the environment image, and the environment type determined according to the location information of the current environment.
[0176] Further, when the initial environment type is the same as the environment type determined according to the current auxiliary information, determining the initial environment type as the target environment type corresponding to the current environment includes: when the initial environment type is the same as at least one of the environment type determined according to the weather information of the current environment, the environment type determined according to the image features of the environment image, the environment type determined according to the scene information corresponding to the environment image, and the environment type determined according to the location information of the current environment, determining the initial environment type as the target environment type corresponding to the current environment.
[0177] It should be understood that in the embodiments of the present application, the environment type determined according to any one or more of the current auxiliary information can be compared with the initial environment type determined according to the target light intensity. If the comparison results are the same, the final target environment type is determined. If the comparison results are different, the electronic device can continue to obtain the environment image of the current environment where the electronic device is located and obtain the current auxiliary information until the comparison results are the same, and then determine the final target environment type. It should be noted that the embodiments of the present application do not elaborate on the various implementation manners of comprehensively determining the target environment type corresponding to the current environment based on the environment type determined according to the current auxiliary information in different combination manners and the initial environment type determined according to the target light intensity.
[0178] It should be noted that the determination method of the first light intensity threshold refers to the implementation manner in the foregoing step 103 and will not be elaborated here.
[0179] Adopting the above optional implementation manner, the environment type determined according to the auxiliary information further verifies the initial environment type determined by the light intensity, improving the accuracy of environment detection.
[0180] It can be seen that by implementing the embodiments of the present application, the environment type of the current location can be detected through the brightness of the environment image captured by the electronic device camera without additionally setting an optical sensor for the electronic device, which will not increase the cost and volume of the electronic device, nor will it additionally increase the waterproof difficulty of the electronic device. Combining auxiliary information such as weather, image features, scene information, and location information to determine the type of the current environment improves the accuracy of environment detection.
[0181] It should be understood that although the steps in the above flowcharts are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above flowcharts may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps. Additionally, the above-mentioned multiple embodiments can be implemented independently or in combination with each other, and no limitation is imposed here.
[0182] Based on the foregoing embodiments, an embodiment of the present application provides an electronic device. The electronic device includes each module included and each unit included in each module, and can be implemented by a processor; of course, it can also be implemented by specific logic circuits. During implementation, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0183] Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As Figure 6 shown, the electronic device is provided with a camera. The electronic device includes an acquisition module 601 and a determination module 602, where:
[0184] The acquisition module 601 is used to acquire an environmental image of the current environment where the electronic device is located captured by the camera;
[0185] The determination module 602 is used to determine the target illumination intensity of the current environment according to the brightness of the pixel points of the environmental image; and, according to the target illumination intensity, determine the target environment type corresponding to the current environment. The target environment type includes one of an indoor environment and an outdoor environment, and different environment types correspond to different illumination intensities.
[0186] In some embodiments, the determination module 602 includes an image processing sub-unit, a calculation sub-unit, and a determination sub-unit. The determination module 602 is used to determine the target illumination intensity of the current environment according to the brightness of the pixel points of the environmental image, specifically including:
[0187] The image processing sub-unit is used to perform grayscale conversion on the environmental image to obtain a grayscale image;
[0188] The calculation subunit is configured to calculate the average brightness of the grayscale image based on the brightness of each pixel point in the grayscale image, and the average brightness of the grayscale image is the brightness of the pixel points of the environmental image.
[0189] The determination subunit is configured to determine the target illumination intensity of the current environment according to the average brightness of the grayscale image.
[0190] In some embodiments, the determination module 602 further includes a judgment subunit, and the determination module 602 is configured to determine the target environment type corresponding to the current environment according to the target illumination intensity, specifically including:
[0191] The judgment subunit is configured to judge whether the target illumination intensity is greater than a first illumination intensity threshold.
[0192] The determination subunit is further configured to, when the target illumination intensity is greater than the first illumination intensity threshold, determine that the target environment type corresponding to the current environment is an outdoor environment, or, when the target illumination intensity is less than or equal to the first illumination intensity threshold, determine that the target environment type corresponding to the current environment is an outdoor environment.
[0193] In some embodiments, the electronic device further includes an output module, wherein:
[0194] The output module is configured to output a first prompt message after determining that the target environment type corresponding to the current environment is an indoor environment, and the first prompt message is used to remind the user of the electronic device to perform outdoor activities.
[0195] In some embodiments, the electronic device further includes a judgment module, wherein:
[0196] The judgment module is configured to judge whether the target illumination intensity is less than a second illumination intensity threshold after determining that the target environment type corresponding to the current environment is an outdoor environment, and the second illumination intensity threshold is greater than the first illumination intensity threshold.
[0197] The output module is further configured to output a second prompt message when the target illumination intensity is greater than or equal to the second illumination intensity threshold, and the second prompt message is used to remind the user of the electronic device to perform indoor activities.
[0198] In some embodiments, the electronic device further includes a recording module, wherein:
[0199] The recording module is configured to record the target activity duration of the user of the electronic device in the current environment when the target illumination intensity is less than the second illumination intensity threshold.
[0200] In some embodiments, the determining module 602 is further configured to determine a preset activity duration corresponding to a target light intensity after recording the target activity duration of the user using the electronic device in the current environment, where different light intensities correspond to different preset activity durations;
[0201] The judging module is further configured to judge whether the target activity duration is greater than the preset activity duration;
[0202] The output module is further configured to output a third prompt message in the case where the target activity duration is greater than the preset activity duration, and the third prompt message includes a suggestion on the outdoor activity duration.
[0203] In some embodiments, the obtaining module 601 is further configured to obtain current auxiliary information for determining the target environment type before determining the target environment type corresponding to the current environment according to the target light intensity, where the current auxiliary information includes at least one of weather information of the current environment, image features of the environmental image, scene information corresponding to the environmental image, and location information of the current environment, the image features include at least one of color features, texture features, and light and shadow features, and the scene information includes at least one of building information, sky information, and plant information;
[0204] The determining module 602 is further configured to determine a first light intensity threshold and / or a second light intensity threshold according to the mapping relationship between the preset auxiliary information and the preset light intensity threshold and the current auxiliary information.
[0205] In some embodiments, the obtaining module 601 is further configured to obtain current auxiliary information for determining the target environment type, where the current auxiliary information includes at least one of weather information of the current environment, image features of the environmental image, scene information corresponding to the environmental image, and location information of the current environment, the image features include at least one of color features, texture features, and light and shadow features, and the scene information includes at least one of building information, sky information, and plant information;
[0206] The determining module 602 is further configured to determine the target environment type corresponding to the current environment according to the target light intensity and the current auxiliary information.
[0207] In some embodiments, the determining module 602 is further configured to determine the target environment type corresponding to the current environment according to the target light intensity and the current auxiliary information, specifically including:
[0208] The judging subunit is further configured to judge whether the target light intensity is greater than the first light intensity threshold;
[0209] The determining subunit is further configured to determine the initial environment type corresponding to the current environment in the case where the target light intensity is greater than the first light intensity threshold;
[0210] The determining sub-unit is further configured to determine whether the initial environment type is the same as the environment type determined according to the current auxiliary information;
[0211] The determining sub-unit is further configured to, when the initial environment type is the same as the environment type determined according to the current auxiliary information, determine the initial environment type as the target environment type corresponding to the current environment.
[0212] In some embodiments, the obtaining module 601 is configured to obtain an environmental image of the current environment where the electronic device is located captured by a camera, specifically including:
[0213] Specifically, the obtaining module 601 is configured to, when it is detected that the user using the electronic device is continuously in a moving state within a preset duration, control the camera to turn on and capture the current environment where the electronic device is located at a preset first interval time to obtain an environmental image.
[0214] In some embodiments, the obtaining module 601 is configured to obtain an environmental image of the current environment where the electronic device is located captured by a camera, specifically including:
[0215] Specifically, the obtaining module 601 is configured to control the camera to turn on and capture the current environment where the electronic device is located at a preset second interval time to obtain an environmental image.
[0216] The description of the above electronic device embodiments is similar to the description of the above method embodiments and has similar beneficial effects to the method embodiments. For the technical details not disclosed in the electronic device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
[0217] Please refer to Figure 7 , Figure 7 which is a schematic structural diagram of another electronic device disclosed in the embodiments of the present application.
[0218] As Figure 7 shown, the electronic device includes:
[0219] A memory 701 storing executable program code;
[0220] A processor 702 coupled to the memory;
[0221] The processor 702 calls the executable program code stored in the memory 701 to execute any one of the environmental detection methods in the above method embodiments.
[0222] The embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the environmental detection method provided in the above embodiments are implemented.
[0223] An embodiment of the present application provides a computer program product including instructions, which, when running on a computer, causes the computer to execute the steps in the environment detection method provided in the above method embodiment.
[0224] Those skilled in the art can understand that Figure 7 the structure shown in [the figure] is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0225] In one embodiment, the electronic device provided by the present application can be implemented in the form of a computer program, and the computer program can run on a computer device as shown in Figure 7 the figure. Each program module constituting the electronic device can be stored in the memory of the computer device. The computer program constituted by each program module causes the processor to execute the steps in the environment detection method of each embodiment of the present application described in this specification.
[0226] It should be noted here that: the descriptions of the above storage medium and electronic device embodiments are similar to the descriptions of the above method embodiments, and have beneficial effects similar to those of the method embodiments. For the technical details not disclosed in the storage medium and electronic device embodiments of the present application, please refer to the descriptions of the method embodiments of the present application for understanding.
[0227] It should be understood that the term "one embodiment" or "an embodiment" or "some embodiments" mentioned throughout the specification means that specific features, structures, or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, the appearances of "in one embodiment" or "in an embodiment" or "in some embodiments" throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the magnitudes of the serial numbers of the above processes do not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The serial numbers of the embodiments of the present application above are only for description and do not represent the advantages or disadvantages of the embodiments. The above descriptions of each embodiment tend to emphasize the differences between the embodiments, and the same or similar parts can be referred to each other. For the sake of brevity, they are not repeated herein.
[0228] The term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, object A and / or object B can represent: object A exists alone, object A and object B exist simultaneously, and object B exists alone.
[0229] It should be noted that in this text, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, system or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or elements inherent to such process, method, article, system or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, system or device including such element.
[0230] In several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there can be other division methods in actual implementation. For example, multiple modules or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed with each other can be through some interfaces, and the indirect coupling or communication connection of devices or modules can be electrical, mechanical or other forms.
[0231] Those of ordinary skill in the art can understand that all or part of the steps to implement the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above method embodiments; and the foregoing storage medium includes: various media such as removable storage devices, read only memory (ROM), magnetic disks or optical discs that can store program codes.
[0232] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0233] The features disclosed in several electronic device embodiments provided in this application can be arbitrarily combined without conflict to obtain new electronic device embodiments.
[0234] As mentioned above, it is only the implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed in this application can easily think of changes or substitutions, which should be covered within the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims
1. An environmental detection method, characterized in that, Applied to an electronic device, the electronic device is provided with a camera, and the method includes: Obtaining an environmental image of the current environment where the electronic device is located captured by the camera; Determining a target light intensity of the current environment according to the brightness of pixel points of the environmental image; Determining a target environment type corresponding to the current environment according to the target light intensity, the target environment type including one of an indoor environment and an outdoor environment, and different environment types corresponding to different light intensities.
2. The method according to claim 1, characterized in that, The determining the target light intensity of the current environment according to the brightness of pixel points of the environmental image includes: Performing gray-scale conversion on the environmental image to obtain a gray-scale image; Calculating an average brightness value of the gray-scale image according to the brightness of each pixel point in the gray-scale image, and the average brightness value of the gray-scale image being the brightness of pixel points of the environmental image; Determining the target light intensity of the current environment according to the average brightness value of the gray-scale image.
3. The method according to claim 1, characterized in that The determining the target environment type corresponding to the current environment according to the target light intensity includes: Judging whether the target light intensity is greater than a first light intensity threshold; When the target light intensity is greater than the first light intensity threshold, determining that the target environment type corresponding to the current environment is an outdoor environment, or, when the target light intensity is less than or equal to the first light intensity threshold, determining that the target environment type corresponding to the current environment is an outdoor environment.
4. The method according to claim 3, wherein After determining that the target environment type corresponding to the current environment is an indoor environment, the method further includes: Outputting a first prompt message, the first prompt message being used to remind the user using the electronic device to perform outdoor activities.
5. The method according to claim 3, characterized in that, After determining that the target environment type corresponding to the current environment is an outdoor environment, the method further includes: Judging whether the target light intensity is less than a second light intensity threshold, the second light intensity threshold being greater than the first light intensity threshold; When the target light intensity is greater than or equal to the second light intensity threshold, outputting a second prompt message, the second prompt message being used to remind the user using the electronic device to perform indoor activities.
6. The method according to claim 5, wherein The method further includes: When the target light intensity is less than the second light intensity threshold, recording a target activity duration of the user using the electronic device in the current environment.
7. The method according to claim 6, characterized in that After recording the target activity duration of the user using the electronic device in the current environment, the method further includes: Determining a preset activity duration corresponding to the target light intensity, wherein different light intensities correspond to different preset activity durations; Judging whether the target activity duration is greater than the preset activity duration; When the target activity duration is greater than the preset activity duration, outputting a third prompt message, the third prompt message including a suggestion on outdoor activity duration.
8. The method according to claim 5, characterized in that, Before determining the target environment type corresponding to the current environment according to the target light intensity, the method further includes: Obtain current auxiliary information for determining the target environment type, where the current auxiliary information includes at least one of the weather information of the current environment, the image features of the environment image, the scene information corresponding to the environment image, and the location information of the current environment. The image features include at least one of color features, texture features, and light and shadow features. The scene information includes at least one of building information, sky information, and plant information; Determine the first light intensity threshold and / or the second light intensity threshold according to the mapping relationship between the preset auxiliary information and the preset light intensity threshold and the current auxiliary information.
9. The method according to claim 3, wherein The determining the target environment type corresponding to the current environment according to the target light intensity includes: Obtain current auxiliary information for determining the target environment type, where the current auxiliary information includes at least one of the weather information of the current environment, the image features of the environment image, the scene information corresponding to the environment image, and the location information of the current environment. The image features include at least one of color features, texture features, and light and shadow features. The scene information includes at least one of building information, sky information, and plant information; Determine the target environment type corresponding to the current environment according to the target light intensity and the current auxiliary information.
10. The method according to claim 9, wherein The determining the target environment type corresponding to the current environment according to the target light intensity and the current auxiliary information includes: Judge whether the target light intensity is greater than the first light intensity threshold; When the target light intensity is greater than the first light intensity threshold, determine the initial environment type corresponding to the current environment; Judge whether the initial environment type is the same as the environment type determined according to the current auxiliary information; When the initial environment type is the same as the environment type determined according to the current auxiliary information, determine the initial environment type as the target environment type corresponding to the current environment.
11. The method according to claim 1, characterized in that, The obtaining the environment image of the current environment where the electronic device is located captured by the camera includes: When it is detected that the user using the electronic device is continuously in a moving state within a preset duration, control the camera to turn on and capture the current environment where the electronic device is located at a preset first interval time to obtain the environment image.
12. The method according to claim 1, wherein The obtaining the environment image of the current environment where the electronic device is located captured by the camera includes: Control the camera to turn on and capture the current environment where the electronic device is located at a preset second interval time to obtain the environment image.
13. An electronic device, characterized in that, The electronic device is provided with a camera, and the electronic device includes an obtaining module and a determining module, where: The obtaining module is used to obtain the environment image of the current environment where the electronic device is located captured by the camera; The determining module is configured to determine the target illumination intensity of the current environment according to the brightness of the pixel points of the environmental image; and determine the target environment type corresponding to the current environment according to the target illumination intensity, where the target environment type includes one of an indoor environment and an outdoor environment, and different environment types correspond to different illumination intensities.
14. An electronic device, characterized in that, It includes a memory and a processor. The memory stores a computer program that can run on the processor, and when the processor executes the program, the steps of the method according to any one of claims 1 to 12 are implemented.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the method according to any one of claims 1 to 12 is implemented.