Ultraviolet detection method and device, electronic equipment and medium
The ambient light information is detected by the light sensor and the ultraviolet intensity is determined in combination with the preset relationship, which solves the problems of high power consumption and increased cost of ultraviolet detection of electronic equipment, and achieves low power consumption and low cost ultraviolet intensity detection.
Patent Information
- Application Number
- CN202410223797.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-28
- Publication Date
- 2025-08-29
AI Technical Summary
Existing electronic devices have high power consumption and increased cost when detecting ultraviolet intensity, mainly due to the high power consumption and complex structure of ultraviolet cameras.
By using a light sensor to detect ambient light information and determining the ultraviolet intensity information based on preset relationships, the low power consumption characteristics of the light sensor are used to avoid additional UV cameras and reduce device power consumption and cost.
Low-power consumption ultraviolet intensity detection is achieved, reducing the power consumption and cost of electronic devices, while simplifying the equipment structure.
Smart Images

Figure CN120558385A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of detection technology, and in particular to an ultraviolet detection method, device, electronic equipment, and medium. Background Art
[0002] Currently, with the development of electronic devices, electronic devices can detect the intensity of ultraviolet rays in the environment to remind users to take appropriate protective measures. However, when detecting the intensity of ultraviolet rays, electronic devices have the problem of high power consumption. Summary of the Invention
[0003] To overcome the problems existing in the related art, the present disclosure provides an ultraviolet detection method, device, electronic device and medium.
[0004] According to a first aspect of an embodiment of the present disclosure, there is provided a method for detecting ultraviolet rays, the method comprising:
[0005] Get the ambient light information detected by the light sensor;
[0006] determining ultraviolet intensity information based on the ambient light information and a preset relationship;
[0007] The preset relationship is used to characterize the relationship between ambient light and ultraviolet intensity.
[0008] In some embodiments of the present disclosure, determining ultraviolet intensity information based on the ambient light information and a preset relationship includes:
[0009] Determine infrared coefficient;
[0010] The ultraviolet intensity information is determined according to the ambient light information, the infrared coefficient, and the preset relationship.
[0011] In some embodiments of the present disclosure, the preset relationship includes a first preset relationship and a second preset relationship, the first preset relationship being used to characterize the relationship between ambient light and ultraviolet intensity when the infrared coefficient is less than or equal to the preset coefficient, and the second preset relationship being used to characterize the relationship between ambient light and ultraviolet intensity when the infrared coefficient is greater than the preset coefficient; determining the ultraviolet intensity information based on the ambient light information, the infrared coefficient, and the preset relationship includes:
[0012] When the infrared coefficient is less than or equal to the preset coefficient, determining the ultraviolet intensity information according to the ambient light information and the first preset relationship;
[0013] When the infrared coefficient is greater than the preset coefficient, the ultraviolet intensity information is determined according to the ambient light information and the second preset relationship.
[0014] In some embodiments of the present disclosure, the ambient light information includes a red channel value, a green channel value, a blue channel value, a transparent channel value, and a full-spectrum channel value; and determining the ultraviolet intensity information based on the ambient light information and the first preset relationship includes:
[0015] determining the ultraviolet intensity information according to the red channel value, the green channel value, the blue channel value, the transparent channel value, the full spectrum channel value, and the first preset relationship;
[0016] The determining the ultraviolet intensity information according to the ambient light information and the second preset relationship includes:
[0017] The ultraviolet intensity information is determined according to the red channel value, the green channel value, the blue channel value, the transparent channel value, the full-spectrum channel value, and the second preset relationship.
[0018] In some embodiments of the present disclosure, the ambient light information includes a red channel value, a green channel value, a blue channel value, and a transparent channel value; and determining the infrared coefficient includes:
[0019] The infrared coefficient is determined according to the red channel value, the green channel value, the blue channel value, and the transparent channel value.
[0020] In some embodiments of the present disclosure, after determining the ultraviolet intensity information based on the ambient light information and the preset relationship, the ultraviolet detection method further includes:
[0021] The ultraviolet level is determined according to the ultraviolet intensity information.
[0022] In some embodiments of the present disclosure, the light sensor is an under-screen light sensor; after acquiring the ambient light information detected by the light sensor, the ultraviolet light detection method further includes:
[0023] Determine the luminous information of the screen;
[0024] The ambient light information is adjusted according to the luminescence information.
[0025] In some embodiments of the present disclosure, after acquiring the ambient light information detected by the light sensor, the ultraviolet light detection method further includes:
[0026] Determine calibration factors;
[0027] The ambient light information is calibrated according to the calibration coefficient.
[0028] In some embodiments of the present disclosure, before acquiring the ambient light information detected by the light sensor, the ultraviolet light detection method further includes:
[0029] Acquiring test ambient light information detected by the light sensor under different ambient lights;
[0030] Acquiring test ultraviolet intensity information corresponding to the test environment light information;
[0031] The preset relationship is determined according to the test ambient light information and the test ultraviolet intensity information.
[0032] In some embodiments of the present disclosure, determining the preset relationship based on the test ambient light information and the test ultraviolet intensity information includes:
[0033] Determining the test infrared coefficient corresponding to each of the test environment light information;
[0034] Determining a first preset relationship based on the test ambient light information in which the test infrared coefficient is less than or equal to a preset coefficient and the corresponding test ultraviolet intensity information;
[0035] determining a second preset relationship according to the test ambient light information in which the test infrared coefficient is greater than the preset coefficient and the corresponding test ultraviolet intensity information;
[0036] The first preset relationship and the second preset relationship are used as the preset relationship.
[0037] According to a second aspect of an embodiment of the present disclosure, there is provided an ultraviolet detection device, comprising:
[0038] an acquisition module, wherein the acquisition module is configured to acquire ambient light information detected by the light sensor;
[0039] a determination module configured to determine ultraviolet intensity information based on the ambient light information and a preset relationship;
[0040] The preset relationship is used to characterize the relationship between ambient light and ultraviolet intensity.
[0041] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising:
[0042] processor;
[0043] a memory for storing instructions executable by the processor;
[0044] The processor is configured to execute:
[0045] Get the ambient light information detected by the light sensor;
[0046] determining ultraviolet intensity information based on the ambient light information and a preset relationship;
[0047] The preset relationship is used to characterize the relationship between ambient light and ultraviolet intensity.
[0048] According to a fourth aspect of an embodiment of the present disclosure, a non-transitory computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of a terminal, the terminal is enabled to perform:
[0049] Get the ambient light information detected by the light sensor;
[0050] determining ultraviolet intensity information based on the ambient light information and a preset relationship;
[0051] The preset relationship is used to characterize the relationship between ambient light and ultraviolet intensity.
[0052] The technical solutions provided by the embodiments of the present disclosure may have the following beneficial effects:
[0053] When it is necessary to detect the intensity of ultraviolet light in an environment, a light sensor detects and obtains ambient light information. Based on a preset relationship, the corresponding ultraviolet intensity information is determined to achieve ultraviolet intensity detection. Due to the low power consumption of light sensors, using light sensors to detect ultraviolet intensity reduces the power consumption of electronic devices. Furthermore, since light sensors are included in all electronic devices, ultraviolet intensity detection can be achieved without the need for additional components, thereby reducing the cost and structural complexity of the electronic devices.
[0054] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0056] Figure 1 is a schematic diagram of a spectral response curve according to an exemplary embodiment;
[0057] Figure 2 is a flow chart of an ultraviolet detection method according to an exemplary embodiment;
[0058] Figure 3 is a flow chart of an ultraviolet detection method according to another exemplary embodiment;
[0059] Figure 4is a flow chart of an ultraviolet detection method according to another exemplary embodiment;
[0060] Figure 5 is a flow chart of an ultraviolet detection method according to another exemplary embodiment;
[0061] Figure 6 is a flow chart of an ultraviolet detection method according to another exemplary embodiment;
[0062] Figure 7 is a flow chart of an ultraviolet detection method according to another exemplary embodiment;
[0063] Figure 8 is a flow chart of an ultraviolet detection method according to another exemplary embodiment;
[0064] Figure 9 is a block diagram of an ultraviolet detection device according to an exemplary embodiment;
[0065] Figure 10 is a block diagram of an electronic device according to an exemplary embodiment.
[0066] In the picture:
[0067] 100 - acquisition module; 200 - determination module; 400 - electronic device; 402 - processing component; 404 - memory; 406 - power supply component; 408 - multimedia component; 410 - audio component; 412 - input / output interface; 414 - sensor component; 416 - communication component; 420 - processor. DETAILED DESCRIPTION
[0068] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with certain aspects of the present disclosure as detailed in the appended claims. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0069] Currently, ultraviolet rays from sunlight can penetrate the atmosphere and reach the Earth's surface. Long-term exposure to these rays can cause physical discomfort. With the development of electronic devices, their functionality is gradually increasing. Electronic devices can now detect the intensity of ultraviolet rays in their environment and alert users to take appropriate protective measures.
[0070] A related art method for ultraviolet light detection uses a UV camera to capture image information when a user requests UV intensity information. The UV intensity information is then determined and displayed based on the image information. While the UV intensity information can be determined from the image information captured by the UV camera, the UV camera consumes a lot of power, increasing the power consumption of the electronic device. Furthermore, due to its complex structure and design, the UV camera is expensive, increasing the cost of the electronic device.
[0071] To address the above technical issues, the present disclosure provides a method for detecting ultraviolet light using a light sensor in an electronic device, which detects ambient light information and determines ultraviolet intensity information based on the ambient light information. Because the power consumption of a light sensor is lower than that of a UV camera, detecting ultraviolet intensity using a light sensor reduces the power consumption of the electronic device. Furthermore, since the electronic device is equipped with a light sensor, there is no need to add an additional UV camera to detect ultraviolet intensity, thereby reducing the cost of the electronic device and the complexity of its structure.
[0072] For ease of understanding, the light sensor disclosed herein is first described. The light sensor has six ambient light sensing channels, namely, a red channel (Red channel), a green channel (Green channel), a blue channel (Blue channel), a transparent channel (Clear channel), a full spectrum channel (Wideband channel), and an infrared channel (IR channel). The channel values of each channel reflect the intensity of red light, green light, blue light, transparent light, full spectrum light, and infrared light, respectively. Figure 1 As shown in the figure, different channels have different spectral responses, and the magnitude of the response can reflect the magnitude of the intensity. When the wavelength is between 300nm and 400nm, only the wideband channel responds. When the wavelength is greater than 400nm, all channels have corresponding responses, and the wideband channel always responds. Therefore, based on the channel values of each channel, all light other than ultraviolet light can be eliminated to obtain ultraviolet intensity information. The horizontal axis λ represents the wavelength, and the vertical axis R represents the scaled and normalized response. Curve S1 represents the response curve corresponding to the Red channel, curve S2 represents the response curve corresponding to the Green channel, curve S3 represents the response curve corresponding to the Blue channel, curve S4 represents the response curve corresponding to the Clear channel, curve S5 represents the response curve corresponding to the Wideband channel, and curve S6 represents the response curve corresponding to the IR channel.
[0073] It is understandable that the light sensor may also include only five ambient light value channels, namely Red channel, Green channel, Blue channel, Clear channel and Wideband channel, and the infrared intensity can be calculated and determined based on the channel values of the five channels.
[0074] The present disclosure provides a method for detecting ultraviolet rays. Figure 2 As shown, the method includes:
[0075] S200: Acquire ambient light information detected by a light sensor.
[0076] S300: Determine ultraviolet intensity information according to ambient light information and a preset relationship.
[0077] The preset relationship is used to characterize the relationship between ambient light and ultraviolet intensity.
[0078] In this embodiment, when it is necessary to detect the intensity of ultraviolet light in an environment, a light sensor detects and obtains ambient light information. Based on a preset relationship, the ultraviolet intensity information corresponding to the ambient light information is determined to achieve ultraviolet intensity detection. Because light sensors have low power consumption, using them to detect ultraviolet intensity reduces the power consumption of electronic devices. Furthermore, since all electronic devices are equipped with light sensors, ultraviolet intensity detection can be achieved without the need for additional components, thereby reducing the cost and structural complexity of the electronic devices.
[0079] Exemplarily, the ambient light information may include a red channel value, a green channel value, a blue channel value, a transparent channel value, a full-spectrum channel value, and / or an infrared coefficient. The red channel value may be the channel value of the Red channel, the green channel value may be the channel value of the Green channel, the blue channel value may be the channel value of the Blue channel, the transparent channel value may be the channel value of the Clear channel, the full-spectrum channel value may be the channel value of the Wideband channel, and the infrared coefficient may be the channel value of the IR channel. The channel value of each channel may be determined by reading the value of a specific address of the internal register in the light sensor. For example, the specific address may be 0x95 to 0xA0. The values in every two addresses represent the channel value of a channel.
[0080] In one embodiment, if Figure 3 As shown, in step S300, the ultraviolet intensity information is determined according to the ambient light information and the preset relationship in the following manner:
[0081] S310: Determine the infrared coefficient.
[0082] S320: Determine ultraviolet intensity information according to ambient light information, infrared coefficients, and a preset relationship.
[0083] In this embodiment, because the wavelength ranges of both ultraviolet and infrared light often have large full-spectrum channel values and small values in other channels, it is necessary to distinguish between the two wavelength ranges to avoid affecting the determination of ultraviolet intensity information. Since the infrared coefficient is larger in the infrared wavelength range than in the ultraviolet wavelength range, ultraviolet intensity information is determined by determining and combining it with the infrared coefficient for differentiation. By incorporating the infrared coefficient, it is possible to distinguish between low-infrared and high-infrared environments and accurately determine ultraviolet intensity information, thereby improving the accuracy of ultraviolet intensity detection.
[0084] For example, in step S310, the infrared coefficient may be determined by directly using the channel value of the IR channel of the light sensor as the infrared coefficient. This reduces the complexity of ultraviolet intensity detection.
[0085] In one embodiment, the infrared coefficient determined in step S310 may also be determined in the following manner:
[0086] The infrared coefficient is determined according to the red channel value, the green channel value, the blue channel value and the transparent channel value.
[0087] In this embodiment, since using channel values as infrared coefficients may result in large errors, determining the infrared coefficient based on the red channel value, green channel value, blue channel value and transparent channel value can improve the accuracy of the infrared coefficient, thereby improving the accuracy of ultraviolet intensity detection.
[0088] For example, the infrared coefficient is determined according to the red channel value, the green channel value, the blue channel value, and the transparent channel value in the above steps, and can be determined using the following formula:
[0089] IR=(R+G+BC) / (2*C).
[0090] Among them, IR represents the infrared coefficient, R represents the channel value of the Red channel, G represents the channel value of the Green channel, B represents the channel value of the Blue channel, and C represents the channel value of the Clear channel.
[0091] In one embodiment, the preset relationship includes a first preset relationship and a second preset relationship. The first preset relationship is used to represent the relationship between ambient light and ultraviolet intensity when the infrared coefficient is less than or equal to the preset coefficient. The second preset relationship is used to represent the relationship between ambient light and ultraviolet intensity when the infrared coefficient is greater than the preset coefficient. In step S320, the ultraviolet intensity information is determined based on the ambient light information, the infrared coefficient, and the preset relationship in the following manner:
[0092] When the infrared coefficient is less than or equal to the preset coefficient, the ultraviolet intensity information is determined according to the ambient light information and the first preset relationship.
[0093] When the infrared coefficient is greater than the preset coefficient, the ultraviolet intensity information is determined according to the ambient light information and the second preset relationship.
[0094] In this embodiment, since the infrared coefficient is used to distinguish between low-infrared and high-infrared environments, accurate UV intensity information can be determined by simply setting corresponding preset relationships for low-infrared and high-infrared environments. When the infrared coefficient is less than or equal to the preset coefficient, the environment is a low-infrared environment, and UV intensity information is determined based on ambient light information and a first preset relationship. When the infrared coefficient is greater than the preset coefficient, the environment is a high-infrared environment, and UV intensity information is determined based on ambient light information and a second preset relationship. By determining UV intensity information based on two different preset relationships when the infrared coefficients differ, the accuracy of UV intensity detection is improved and the complexity of determining UV intensity information is reduced.
[0095] For example, the preset coefficient may be in the range of 0.7 to 0.9, or may be 0.75, 0.8, 0.85, or the like.
[0096] In one embodiment, the ultraviolet intensity information is determined according to the ambient light information and the first preset relationship in the above step by:
[0097] Ultraviolet intensity information is determined according to the red channel value, the green channel value, the blue channel value, the transparent channel value, the full spectrum channel value, and a first preset relationship.
[0098] In the above step, the ultraviolet intensity information is determined according to the ambient light information and the second preset relationship in the following manner:
[0099] Ultraviolet intensity information is determined according to the red channel value, the green channel value, the blue channel value, the transparent channel value, the full spectrum channel value, and a second preset relationship.
[0100] In this embodiment, since the full-spectrum channel values can reflect the intensities of various types of light, it is necessary to combine the red, green, blue, and transparent channel values to eliminate all light other than ultraviolet light to determine ultraviolet intensity information. When the infrared coefficient is less than or equal to a preset coefficient, the ultraviolet intensity information is determined based on the red, green, blue, transparent, and full-spectrum channel values, and a first preset relationship. When the infrared coefficient is greater than the preset coefficient, the ultraviolet intensity information is determined based on the red, green, blue, transparent, and full-spectrum channel values, and a second preset relationship. By combining the channel values and different preset relationships in different infrared environments, interfering light can be eliminated, thereby improving the accuracy of ultraviolet intensity information detection.
[0101] For example, the first preset relationship and the second preset relationship may be two different first preset formulas and second preset formulas. The first preset formula may be f high (C, R, G, B, W), the second preset formula can be f low (C, R, G, B, W). R represents the channel value of the Red channel, G represents the channel value of the Green channel, B represents the channel value of the Blue channel, C represents the channel value of the Clear channel, and W represents the channel value of the Wideband channel.
[0102] Illustratively, in the above steps, the ultraviolet intensity information is determined based on the red channel value, the green channel value, the blue channel value, the transparent channel value, the full-spectrum channel value, and the first preset relationship, and the red channel value, the green channel value, the blue channel value, the transparent channel value, and the full-spectrum channel value can be substituted into the first preset formula to obtain the ultraviolet intensity information. In the above steps, the ultraviolet intensity information is determined based on the red channel value, the green channel value, the blue channel value, the transparent channel value, the full-spectrum channel value, and the second preset relationship, and the red channel value, the green channel value, the blue channel value, the transparent channel value, and the full-spectrum channel value can be substituted into the second preset formula to obtain the ultraviolet intensity information.
[0103] It is understandable that the first preset relationship and the second preset relationship may be represented by not only formulas but also curves, tables, etc., which are not limited here.
[0104] For example, while determining the ultraviolet intensity information based on the ambient light information and the first preset relationship in the above steps, it is also possible to determine the ultraviolet intensity information by substituting only the full spectrum channel values and one or more of the red channel value, green channel value, blue channel value, and transparent channel value into the first preset relationship. The first preset relationship is different when the number of channel values is different. While determining the ultraviolet intensity information based on the ambient light information and the second preset relationship in the above steps, it is also possible to determine the ultraviolet intensity information by substituting only the full spectrum channel values and one or more of the red channel value, green channel value, blue channel value, and transparent channel value into the second preset relationship. The second preset relationship is different when the number of channel values is different.
[0105] For example, in step S320, ultraviolet intensity information is determined based on the ambient light information, the infrared coefficient, and the preset relationship. In addition to selecting different preset relationships based on the infrared coefficient as described above, the infrared coefficient can also be directly used as the independent variable in the preset relationship, with the infrared coefficient adjusting the ultraviolet intensity information within the preset relationship. In this case, the red channel value, green channel value, blue channel value, transparent channel value, full spectrum channel value, and infrared coefficient need to be substituted into the preset relationship to obtain the ultraviolet intensity information.
[0106] For example, in step S300, the ultraviolet intensity information is determined based on the ambient light information and the preset relationship, and the infrared coefficient may not be determined, and the ultraviolet intensity information is determined directly based on the red channel value, green channel value, blue channel value, transparent channel value and full spectrum channel value in the ambient light information.
[0107] In one embodiment, after determining the ultraviolet intensity information according to the ambient light information and the preset relationship in step S300, the ultraviolet detection method further includes:
[0108] Based on the UV intensity information, determine the UV level.
[0109] In this embodiment, after determining the UV intensity information, the user cannot determine the intensity of UV rays in the environment due to the lack of reference UV intensity information. Based on the UV intensity information, the UV level is determined, allowing the user to determine the intensity of UV rays in the environment. By converting the UV intensity information into a UV level, the user can clearly understand the intensity of UV rays in the environment and take protective measures, thereby improving the reliability of UV detection.
[0110] Illustratively, the step of determining the ultraviolet level according to the ultraviolet intensity information may be determined by looking up a table.
[0111] In one embodiment, the light sensor is an under-screen light sensor. Figure 4 As shown, after obtaining the ambient light information detected by the light sensor in step S200, the ultraviolet detection method further includes:
[0112] S210: Determine the luminous information of the screen.
[0113] S220: Adjust the ambient light information according to the luminous information.
[0114] In this embodiment, when the light sensor is an under-display light sensor, the screen's luminous information affects the ambient light information detected by the light sensor, necessitating adjustment of the ambient light information. Because different luminous information has different effects on ambient light information, the ambient light information is adjusted based on the luminous information to eliminate its influence. By adjusting the ambient light information based on the luminous information, the influence of the UV intensity information is avoided, thereby improving the accuracy of UV detection.
[0115] Exemplarily, the determination of the luminous information of the screen in step S210 may be determined according to the picture displayed on the screen.
[0116] Exemplarily, the adjustment of the ambient light information according to the luminous information in step S220 may be performed in combination with the position of the light sensor and according to the influence of the luminous information at the position of the light sensor.
[0117] Exemplarily, adjusting the ambient light information based on the luminous information in step S220 may include determining the impact of the luminous information on the red channel value, the green channel value, the blue channel value, the transparent channel value, and the full-spectrum channel value, generating corresponding compensation information based on the generated impact, and adjusting the red channel value, the green channel value, the blue channel value, the transparent channel value, and the full-spectrum channel value using the compensation information. That is, the channel values of the red channel, the green channel, the blue channel, the clear channel, and the wideband channel are adjusted using the compensation values of the compensation information.
[0118] For example, when the light sensor is disposed at an opening position of the screen or at a narrow slit position of the screen, since the ambient light information will not be affected by the luminous information of the screen, step S210 and step S220 may not be executed.
[0119] For example, when it is necessary to detect the ultraviolet intensity information, in response to the user's detection operation, the screen is controlled to be turned off or the area where the light sensor is located is controlled to be turned off. In this case, steps S210 and S220 may not be performed.
[0120] In one embodiment, if Figure 5 As shown, after obtaining the ambient light information detected by the light sensor in step S200, the ultraviolet detection method further includes:
[0121] S230: Determine the calibration coefficient.
[0122] S240: Calibrate the ambient light information according to the calibration coefficient.
[0123] In this embodiment, due to variations in the production of different light sensors and the subsequent assembly of the light sensors into electronic devices, these variations can affect the ambient light information detected by the light sensors. During the production process, the electronic devices test the light sensors and determine calibration coefficients based on the test results, which are stored in the electronic devices. After obtaining the ambient light information detected by the light sensors, the stored calibration coefficients are determined and used to calibrate the ambient light information to eliminate these variations. By calibrating the ambient light information using the calibration coefficients, the error in the ambient light information is reduced, thereby improving the accuracy of the UV intensity information detection.
[0124] For example, in step S240, the ambient light information is calibrated according to the calibration coefficients. For example, a calibration coefficient may be set for each channel of the light sensor, and the red channel value, green channel value, blue channel value, transparent channel value, and full-spectrum channel value are calibrated using the corresponding calibration coefficients. That is, the channel values of the red channel, green channel, blue channel, clear channel, and wideband channel are calibrated using the respective calibration coefficients.
[0125] For example, after obtaining the ambient light information detected by the light sensor in step S200, ambient light intensity information and color temperature information may be determined based on the ambient light information. Furthermore, after determining the ultraviolet level, the ambient light intensity information, color temperature information, ultraviolet intensity information, and ultraviolet level may be uploaded so that corresponding devices can obtain and use the above information.
[0126] In one embodiment, if Figure 6 As shown, before obtaining the ambient light information detected by the light sensor in step S200, the ultraviolet detection method further includes:
[0127] S100: Acquire test ambient light information detected by a light sensor under different ambient lights.
[0128] S110: Acquire test ultraviolet intensity information corresponding to the test environment light information.
[0129] S120: Determine a preset relationship based on the test ambient light information and the test ultraviolet intensity information.
[0130] In this embodiment, before detecting UV intensity information, a preset relationship between ambient light and UV intensity needs to be determined. Under different ambient light conditions, test ambient light information detected by the light sensor and the corresponding test UV intensity information are obtained. Based on the test ambient light information and the test UV intensity information, a preset relationship is determined to detect the UV intensity information. By obtaining different information under different ambient light conditions to determine the preset relationship, the preset relationship can be applied to the detection of UV intensity information under different ambient light conditions, thereby improving the reliability of UV detection.
[0131] For example, the ambient light in step S100 can be light from a sunny outdoor day, a cloudy outdoor day, an outdoor nighttime scene, an indoor scene with the lights on, an indoor scene near a window, or a special light source. Special light sources may include light sources A and H. Acquiring test UV intensity information corresponding to the test ambient light information in step S110 can be performed using a UV detector. During the process of determining the preset relationship, the electronic device and the UV detector can be placed close together to improve the accuracy of the test UV intensity information.
[0132] In one embodiment, if Figure 7 As shown, in step S120, the preset relationship is determined according to the test ambient light information and the test ultraviolet intensity information in the following manner:
[0133] S121 , determining the test infrared coefficient corresponding to each test environment light information.
[0134] S122: Determine a first preset relationship based on the test ambient light information in which the test infrared coefficient is less than or equal to the preset coefficient and the corresponding test ultraviolet intensity information.
[0135] S123 . Determine a second preset relationship according to the test ambient light information in which the test infrared coefficient is greater than the preset coefficient and the corresponding test ultraviolet intensity information.
[0136] S124: Use the first preset relationship and the second preset relationship as preset relationships.
[0137] In this embodiment, since it is necessary to distinguish between low-infrared and high-infrared environments during the detection of ultraviolet intensity information, a test infrared coefficient corresponding to each test ambient light information is determined. Based on the test ambient light information with a test infrared coefficient less than or equal to a preset coefficient and the corresponding test ultraviolet intensity information, a first preset relationship is determined, such that the first preset relationship represents the relationship between ambient light and ultraviolet intensity in a low-infrared environment. Based on the test ambient light information with a test infrared coefficient greater than the preset coefficient and the corresponding test ultraviolet intensity information, a second preset relationship is determined, such that the second preset relationship represents the relationship between ambient light and ultraviolet intensity in a high-infrared environment. By determining corresponding preset relationships in environments with varying infrared intensities, the accuracy of ultraviolet intensity information detection is improved and the complexity of determining ultraviolet intensity information is reduced.
[0138] Exemplarily, in step S122, a first preset relationship is determined based on the test environment light information in which the test infrared coefficient is less than or equal to the preset coefficient and the corresponding test ultraviolet intensity information. The channel values of the Red channel, Green channel, Blue channel, Clear channel and Wideband channel in the test environment light information in which the test infrared coefficient is less than or equal to the preset coefficient can be used as independent variables, and the corresponding test ultraviolet intensity information can be used as the dependent variable to generate the first preset formula by fitting.
[0139] Exemplarily, in step S123, the second preset relationship is determined based on the test environment light information in which the test infrared coefficient is greater than the preset coefficient and the corresponding test ultraviolet intensity information. The channel values of the Red channel, Green channel, Blue channel, Clear channel and Wideband channel in the test environment light information in which the test infrared coefficient is greater than the preset coefficient can be used as independent variables, and the corresponding test ultraviolet intensity information can be used as the dependent variable to generate the second preset formula by fitting.
[0140] Exemplarily, in step S120, a preset relationship is determined based on the test ambient light information and the test ultraviolet intensity information. The test infrared coefficient and the channel values of the Red channel, Green channel, Blue channel, Clear channel and Wideband channel in the test ambient light information can also be used as independent variables, and the corresponding test ultraviolet intensity information can be used as the dependent variable to generate a preset formula as the preset relationship through fitting.
[0141] Exemplarily, in step S120, a preset relationship is determined based on the test ambient light information and the test ultraviolet intensity information. The channel values of the Wideband channel and one or more of the Red channel, Green channel, Blue channel, and Clear channel can also be used as independent variables, and the corresponding test ultraviolet intensity information can be used as the dependent variable. A preset formula can be generated as a preset relationship through fitting.
[0142] The present disclosure provides a method for detecting ultraviolet rays. Figure 8 As shown, the method includes:
[0143] S400: Obtain red channel values, green channel values, blue channel values, transparent channel values, and full-spectrum channel values detected by the light sensor.
[0144] S410: Determine whether the light sensor is an under-screen light sensor.
[0145] S420: When the light sensor is an under-screen light sensor, determine the light emitting information of the screen.
[0146] S430 , adjusting the red channel value, the green channel value, the blue channel value, the transparent channel value, and the full-spectrum channel value according to the luminescence information.
[0147] S440: Determine the calibration coefficient.
[0148] S450 , calibrating the red channel value, the green channel value, the blue channel value, the transparent channel value, and the full spectrum channel value according to the calibration coefficient.
[0149] S460 , determining an infrared coefficient according to the red channel value, the green channel value, the blue channel value, and the transparent channel value.
[0150] S470: When the infrared coefficient is less than or equal to the preset coefficient, the red channel value, the green channel value, the blue channel value, the transparent channel value, and the full spectrum channel value are substituted into a first preset formula to obtain ultraviolet intensity information.
[0151] S480: When the infrared coefficient is greater than the preset coefficient, the red channel value, the green channel value, the blue channel value, the transparent channel value, and the full spectrum channel value are substituted into a second preset formula to obtain ultraviolet intensity information.
[0152] S490: Determine the ultraviolet level according to the ultraviolet intensity information.
[0153] In this embodiment, when it is necessary to detect the intensity of ultraviolet light in the environment, the red, green, blue, transparent, and full-spectrum channel values detected by the light sensor are obtained. A determination is made as to whether the light sensor is an under-screen light sensor to determine whether the screen's luminous information affects the ambient light information. If the light sensor is an under-screen light sensor, the red, green, blue, transparent, and full-spectrum channel values are adjusted based on the screen's luminous information to eliminate the impact of the luminous information. A calibration coefficient is determined, and the red, green, blue, transparent, and full-spectrum channel values are calibrated based on the calibration coefficient to eliminate the impact of device differences. After adjusting and calibrating the ambient light information, an infrared coefficient is determined based on the red, green, blue, and transparent channel values. Based on the magnitude of the infrared coefficient, a corresponding preset relationship is selected to determine the ultraviolet intensity information and the corresponding ultraviolet level. Because the light sensor has low power consumption, using the light sensor to detect ultraviolet intensity reduces the power consumption of the electronic device. At the same time, since electronic devices are all equipped with light sensors, the intensity of ultraviolet rays can be detected without adding additional devices, thereby reducing the cost of the electronic devices and the complexity of the electronic device structure.
[0154] In an exemplary embodiment, a UV detection device is provided, which is used to implement the above method. Figure 9 As shown, the ultraviolet detection device may include an acquisition module 100 and a determination module 200, wherein, in the process of implementing the above method,
[0155] The acquisition module 100 is configured to acquire ambient light information detected by the light sensor.
[0156] The determination module 200 is configured to determine ultraviolet intensity information according to the ambient light information and a preset relationship.
[0157] In an exemplary embodiment, a UV detection device is provided, wherein the determination module 200 is configured to:
[0158] Determine the infrared coefficient.
[0159] The ultraviolet intensity information is determined based on the ambient light information, infrared coefficient and preset relationship.
[0160] In an exemplary embodiment, a UV detection device is provided, wherein the determination module 200 is configured to:
[0161] When the infrared coefficient is less than or equal to the preset coefficient, the ultraviolet intensity information is determined according to the ambient light information and the first preset relationship.
[0162] When the infrared coefficient is greater than the preset coefficient, the ultraviolet intensity information is determined according to the ambient light information and the second preset relationship.
[0163] In an exemplary embodiment, a UV detection device is provided, wherein the determination module 200 is configured to:
[0164] Ultraviolet intensity information is determined according to the red channel value, the green channel value, the blue channel value, the transparent channel value, the full spectrum channel value, and a first preset relationship.
[0165] In an exemplary embodiment, a UV detection device is provided, wherein the determination module 200 is configured to:
[0166] Ultraviolet intensity information is determined according to the red channel value, the green channel value, the blue channel value, the transparent channel value, the full spectrum channel value, and a second preset relationship.
[0167] In an exemplary embodiment, a UV detection device is provided, wherein the determination module 200 is configured to:
[0168] The infrared coefficient is determined according to the red channel value, the green channel value, the blue channel value and the transparent channel value.
[0169] In an exemplary embodiment, a UV detection device is provided, wherein the determination module 200 is configured to:
[0170] Based on the UV intensity information, determine the UV level.
[0171] In an exemplary embodiment, a UV detection device is provided, the device further comprising:
[0172] The adjustment module is configured to determine the luminous information of the screen.
[0173] Adjust the ambient light information based on the luminous information.
[0174] In an exemplary embodiment, a UV detection device is provided, the device further comprising:
[0175] The calibration module is configured to determine a calibration coefficient.
[0176] The ambient light information is calibrated according to the calibration coefficient.
[0177] In an exemplary embodiment, a UV detection device is provided, wherein the acquisition module 100 is configured to:
[0178] Under different ambient light conditions, obtain test ambient light information detected by the light sensor.
[0179] Obtain test ultraviolet intensity information corresponding to the test environment light information.
[0180] In an exemplary embodiment, a UV detection device is provided, wherein the determination module 200 is configured to:
[0181] The preset relationship is determined based on the test ambient light information and the test ultraviolet intensity information.
[0182] In an exemplary embodiment, a UV detection device is provided, wherein the determination module 200 is configured to:
[0183] Determine the test infrared coefficient corresponding to each test environment light information.
[0184] A first preset relationship is determined according to the test ambient light information in which the test infrared coefficient is less than or equal to the preset coefficient and the corresponding test ultraviolet intensity information.
[0185] The second preset relationship is determined based on the test ambient light information in which the test infrared coefficient is greater than the preset coefficient and the corresponding test ultraviolet intensity information.
[0186] The first preset relationship and the second preset relationship are used as preset relationships.
[0187] In an exemplary embodiment, an electronic device is provided, such as a mobile phone, a laptop computer, a tablet computer, a wearable device, etc.
[0188] refer to Figure 10As shown, electronic device 400 may include one or more of the following components: a processing component 402 , a memory 404 , a power component 406 , a multimedia component 408 , an audio component 410 , an input / output (I / O) interface 412 , a sensor component 414 , and a communication component 416 .
[0189] The processing component 402 generally controls the overall operation of the electronic device 400, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 402 may include one or more modules to facilitate interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate interaction between the multimedia component 408 and the processing component 402.
[0190] The memory 404 is configured to store various types of data to support operations on the electronic device 400. Examples of such data include instructions for any application or method operating on the electronic device 400, contact data, phone book data, messages, pictures, videos, etc. The memory 404 can be implemented by any type of volatile or non-volatile storage terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0191] The power supply assembly 406 provides power to the various components of the electronic device 400. The power supply assembly 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 400.
[0192] The multimedia component 408 includes a screen that provides an output interface between the electronic device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front camera module and / or a rear camera module. When the electronic device 400 is in an operating mode, such as a shooting mode or a video mode, the front camera module and / or the rear camera module can receive external multimedia data. Each front camera module and the rear camera module can be a fixed optical lens system or have focal length and optical zoom capabilities.
[0193] The audio component 410 is configured to output and / or input audio signals. For example, the audio component 410 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 400 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 404 or transmitted via the communication component 416. In some embodiments, the audio component 410 also includes a speaker for outputting audio signals.
[0194] I / O interface 412 provides an interface between processing component 402 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.
[0195] The sensor assembly 414 includes one or more sensors for providing various aspects of status assessment for the electronic device 400. For example, the sensor assembly 414 can detect the open / closed state of the electronic device 400, the relative positioning of components, such as the display and keypad of the electronic device 400. The sensor assembly 414 can also detect changes in the position of the electronic device 400 or a component of the electronic device 400, the presence or absence of user contact with the electronic device 400, the orientation or acceleration / deceleration of the electronic device 400, and temperature changes of the electronic device 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 414 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0196] The communication component 416 is configured to facilitate wired or wireless communication between the electronic device 400 and other terminals. The electronic device 400 can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, or a combination thereof. In an exemplary embodiment, the communication component 416 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0197] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing terminals (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above-described method.
[0198] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as memory 404 including instructions. The instructions can be executed by processor 420 of electronic device 400 to perform the above-described method. For example, the non-transitory computer-readable storage medium can be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage terminal. When the instructions in the storage medium are executed by the processor of the terminal, the terminal is enabled to perform the method shown in the above-described embodiment.
[0199] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.
[0200] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for detecting ultraviolet light, characterized in that: The ultraviolet detection method comprises: Get the ambient light information detected by the light sensor; determining ultraviolet intensity information based on the ambient light information and a preset relationship; The preset relationship is used to characterize the relationship between ambient light and ultraviolet intensity.
2. The ultraviolet detection method according to claim 1, wherein The determining of ultraviolet intensity information according to the ambient light information and a preset relationship includes: Determine infrared coefficient; The ultraviolet intensity information is determined according to the ambient light information, the infrared coefficient, and the preset relationship.
3. The ultraviolet detection method according to claim 2, wherein The preset relationship includes a first preset relationship and a second preset relationship, the first preset relationship being used to characterize the relationship between the ambient light and the ultraviolet intensity when the infrared coefficient is less than or equal to the preset coefficient, and the second preset relationship being used to characterize the relationship between the ambient light and the ultraviolet intensity when the infrared coefficient is greater than the preset coefficient; The determining the ultraviolet intensity information according to the ambient light information, the infrared coefficient, and the preset relationship includes: When the infrared coefficient is less than or equal to the preset coefficient, determining the ultraviolet intensity information according to the ambient light information and the first preset relationship; When the infrared coefficient is greater than the preset coefficient, the ultraviolet intensity information is determined according to the ambient light information and the second preset relationship.
4. The ultraviolet detection method according to claim 3, wherein: The ambient light information includes a red channel value, a green channel value, a blue channel value, a transparent channel value and a full spectrum channel value; The determining the ultraviolet intensity information according to the ambient light information and the first preset relationship includes: determining the ultraviolet intensity information according to the red channel value, the green channel value, the blue channel value, the transparent channel value, the full spectrum channel value, and the first preset relationship; The determining the ultraviolet intensity information according to the ambient light information and the second preset relationship includes: The ultraviolet intensity information is determined according to the red channel value, the green channel value, the blue channel value, the transparent channel value, the full-spectrum channel value, and the second preset relationship.
5. The ultraviolet detection method according to claim 2, wherein: The ambient light information includes a red channel value, a green channel value, a blue channel value and a transparent channel value; Determining the infrared coefficient includes: The infrared coefficient is determined according to the red channel value, the green channel value, the blue channel value, and the transparent channel value.
6. The ultraviolet detection method according to claim 1, wherein: After determining the ultraviolet intensity information according to the ambient light information and the preset relationship, the ultraviolet detection method further includes: The ultraviolet level is determined according to the ultraviolet intensity information.
7. The ultraviolet detection method according to claim 1, wherein: The light sensor is an under-screen light sensor; after acquiring the ambient light information detected by the light sensor, the ultraviolet detection method further includes: Determine the luminous information of the screen; The ambient light information is adjusted according to the luminescence information.
8. The ultraviolet detection method according to claim 1, wherein: After acquiring the ambient light information detected by the light sensor, the ultraviolet light detection method further includes: Determine calibration factors; The ambient light information is calibrated according to the calibration coefficient.
9. The ultraviolet detection method according to any one of claims 1 to 8, characterized in that: Before acquiring the ambient light information detected by the light sensor, the ultraviolet detection method further includes: Acquiring test ambient light information detected by the light sensor under different ambient lights; Acquiring test ultraviolet intensity information corresponding to the test environment light information; The preset relationship is determined according to the test ambient light information and the test ultraviolet intensity information.
10. The ultraviolet detection method according to claim 9, characterized in that: The determining the preset relationship according to the test ambient light information and the test ultraviolet intensity information includes: Determining the test infrared coefficient corresponding to each of the test environment light information; Determining a first preset relationship based on the test ambient light information in which the test infrared coefficient is less than or equal to a preset coefficient and the corresponding test ultraviolet intensity information; determining a second preset relationship according to the test ambient light information in which the test infrared coefficient is greater than the preset coefficient and the corresponding test ultraviolet intensity information; The first preset relationship and the second preset relationship are used as the preset relationship.
11. An ultraviolet detection device, characterized in that: The ultraviolet detection device comprises: an acquisition module, wherein the acquisition module is configured to acquire ambient light information detected by the light sensor; a determination module, the determination module being configured to determine ultraviolet intensity information based on the ambient light information and a preset relationship; The preset relationship is used to characterize the relationship between ambient light and ultraviolet intensity.
12. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute: Get the ambient light information detected by the light sensor; determining ultraviolet intensity information based on the ambient light information and a preset relationship; The preset relationship is used to characterize the relationship between ambient light and ultraviolet intensity.
13. A non-transitory computer-readable storage medium, characterized in that When the instructions in the storage medium are executed by a processor of a terminal, the terminal is enabled to execute: Get the ambient light information detected by the light sensor; determining ultraviolet intensity information based on the ambient light information and a preset relationship; The preset relationship is used to characterize the relationship between ambient light and ultraviolet intensity.