Ultraviolet detection method and electronic device
By using ultraviolet and color cameras to capture images in electronic devices and adjusting parameters to optimize imaging, the problem of weather forecasts not being able to provide accurate ultraviolet indicators has been solved, enabling accurate ultraviolet detection and personalized sun protection guidance for the user's location.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2021-10-21
- Publication Date
- 2026-05-22
AI Technical Summary
In existing technologies, the UV index in weather forecasts can usually only provide a rough estimate for a large area and cannot provide accurate UV information for the user's location.
Ultraviolet images are acquired using an ultraviolet camera in an electronic device. The real-time ultraviolet index at the user's location is determined through image processing, and adjustments are made based on parameters such as the image's grayscale value and exposure time to improve detection accuracy.
It enables precise detection of UV index at the user's location, providing a basis for personalized sun protection guidance and reducing the risk of sunburn and skin cancer.
Smart Images

Figure CN116007744B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to ultraviolet detection methods and electronic devices. Background Technology
[0002] Currently, more and more users are paying attention to sun protection for their skin. Sun protection methods include methods and measures to protect against ultraviolet (UV) rays, such as applying sunscreen to block UV rays. In some cases, users can obtain the UV index of the environment from weather forecasts and use this information to guide their sun protection efforts.
[0003] However, the UV index reported in weather forecasts usually provides a rough estimate of the weather conditions over a large area and cannot give an accurate estimate of the UV index at the user's location. Therefore, there is an urgent need to propose a solution that can accurately measure the UV index. Summary of the Invention
[0004] This application provides an ultraviolet (UV) detection method and electronic equipment, which can improve the detection accuracy of UV indicators.
[0005] To achieve the above objectives, the embodiments of this application provide the following technical solutions:
[0006] In a first aspect, a method for detecting ultraviolet light is provided. This method is applied to an electronic device or a component (such as a chip system) capable of performing the functions of the electronic device. The electronic device includes a first camera, which includes an ultraviolet camera. The method includes: detecting a first command, and after detecting the first command, acquiring a first image through the first camera; determining an ultraviolet index based on the first image, and displaying first information; the first command is used to instruct the detection of the ultraviolet index; the first information includes information about the ultraviolet index.
[0007] Compared to weather forecasts, which can only provide a rough estimate of UV index for a large geographical area, the technical solution of this application allows electronic devices to acquire UV images via a UV camera, determine the real-time UV index at the user's location based on the acquired UV images, and then display this UV index to the user. Because the UV index in this solution is obtained from real-time UV images acquired at the user's location, the UV index detection results are more accurate.
[0008] In one possible design, before determining the ultraviolet index based on the first image, second information is displayed to prompt the first camera to be pointed at a target object, including the sky.
[0009] Because different shooting angles and directions of cameras often capture different amounts of light, resulting in different image contents, the user can adjust the shooting direction and angle of the ultraviolet camera to position it towards areas with minimal ultraviolet reflection and scattering. This allows for more effective ultraviolet light collection and improves the accuracy of ultraviolet detection.
[0010] In one possible design, the electronic device further includes a second camera, and the method further includes: acquiring a second image via the second camera; the second camera includes a color camera;
[0011] After acquiring the first image via the first camera, the method further includes:
[0012] The user interface is displayed, which includes a portion of the content of the first image and / or a portion of the content of the second image.
[0013] In one possible design, after capturing a first image through a first camera, third information is displayed, which includes parameters of the first camera, such as sensitivity and exposure time.
[0014] In one possible design, acquiring a second image via a second camera includes: acquiring a second image via a second camera while simultaneously acquiring a first image via a first camera;
[0015] After acquiring the second image through the second camera, the method further includes: determining whether the second image meets the first condition; if the second image meets the first condition, determining the ultraviolet index based on the first image; the first condition includes: the existence of a target object in the second image; or, the first condition includes: the existence of a target object in the second image, and the area ratio of the target object in the second image is greater than or equal to a threshold.
[0016] Because color images typically have more imaging details and higher image quality, color images captured by color cameras can more accurately detect target objects (such as the sky).
[0017] In one possible design, acquiring a second image via a second camera includes: acquiring a second image via a second camera after detecting a first instruction and before acquiring a first image via the first camera;
[0018] After acquiring the second image using the second camera, the method includes: determining whether the second image satisfies the first condition;
[0019] Acquiring a first image through a first camera includes: acquiring the first image through the first camera when it is determined that the second image meets a first condition.
[0020] In one possible design, determining the ultraviolet index based on the first image includes: determining the ultraviolet index based on the grayscale values of the pixels included in the first image.
[0021] In one possible design, after acquiring the first image via the first camera and before determining the ultraviolet index based on the first image, the method further includes:
[0022] If the grayscale value of the first image is the target grayscale, then the parameters of the first camera are adjusted, and a third image is acquired through the first camera, wherein the grayscale value of the third image is the target grayscale value.
[0023] Determining the ultraviolet index based on the first image includes: determining the ultraviolet index based on the first camera parameters corresponding to the first image, the first camera parameters corresponding to the third image, and the target grayscale.
[0024] In one possible design, after acquiring the first image via the first camera and before determining the ultraviolet index based on the first image, the method further includes:
[0025] If the grayscale value of the first image is not the target grayscale, then adjust the parameters of the first camera and acquire a fourth image, the grayscale of the fourth image being the target grayscale.
[0026] Adjust the parameters of the first camera and acquire the fifth image, the grayscale of the fifth image being the target grayscale;
[0027] Determining the ultraviolet index based on the first image includes: determining the ultraviolet index based on the first camera parameters corresponding to the fourth image, the first camera parameters corresponding to the fifth image, and the target grayscale.
[0028] By adjusting the parameters of the ultraviolet camera during image acquisition, the grayscale value of the acquired ultraviolet image can be adjusted, and then the ultraviolet index of the electronic device's location can be determined based on the grayscale value.
[0029] In one possible design, the parameters of the first camera include exposure time and sensitivity.
[0030] In one possible design, since different users are in different locations, the detected UV indexes may also differ. Based on the UV index indicated by the electronic device, personalized sun protection guidance can be provided to different users to reduce the risk of sunburn and skin cancer. Optionally, the electronic device can also detect the user's sunscreen application based on the UV index and indicate the detection results to the user. In this way, users can be guided by the detection results in their daily sun protection routine.
[0031] In a second aspect, an electronic device is provided, the electronic device including a first camera, the first camera including an ultraviolet camera, the electronic device including:
[0032] The processing module is used to detect the first instruction input by the user through the input module;
[0033] The first camera is used to capture the first image after the processing module detects the first instruction;
[0034] The processing module is used to determine the ultraviolet index based on the first image;
[0035] The display module is used to display first information; the first instruction is used to instruct the detection of ultraviolet index; the first information includes information about the ultraviolet index.
[0036] In one possible design, the display module is also used to display second information before the processing module determines the ultraviolet index based on the first image. The second information is used to prompt the first camera to be pointed at a target object, including the sky.
[0037] In one possible design, the electronic device also includes a second camera for capturing a second image; the second camera may include a color camera.
[0038] The display module is also used to display a user interface after the first image is captured by the first camera, the user interface including a portion of the content of the first image, and / or including a portion of the content of the second image.
[0039] In one possible design, the display module is also used to display third information after the first image is acquired by the first camera. The third information includes parameters of the first camera, including sensitivity and exposure time.
[0040] In one possible design, the second camera, used to acquire a second image, includes: acquiring a second image through the second camera while acquiring a first image through the first camera;
[0041] The processing module is further configured to determine whether the second image meets the first condition after the second image is acquired by the second camera; and to determine the ultraviolet index based on the first image if the second image meets the first condition; the first condition includes: the existence of a target object in the second image; or, the first condition includes: the existence of a target object in the second image, and the area ratio of the target object in the second image is greater than or equal to a threshold.
[0042] In one possible design, the second camera, used to acquire a second image, includes: acquiring the second image after the processing module detects the first instruction and before the first camera acquires the first image;
[0043] The processing module is also used to determine whether the second image meets the first condition after the second camera captures the second image;
[0044] A first camera is used to capture a first image, including: capturing the first image when it is determined that a second image meets a first condition.
[0045] In one possible design, the processing module is used to determine the ultraviolet index based on the first image, including: determining the ultraviolet index based on the grayscale values of the pixels included in the first image.
[0046] In one possible design, the processing module is further configured to, if the grayscale value of the first image is a target grayscale, adjust the parameters of the first camera after acquiring the first image and before determining the ultraviolet index based on the first image, and under the condition of the parameters, call the first camera to acquire a third image, wherein the grayscale of the third image is the target grayscale.
[0047] The processing module is used to determine the ultraviolet index based on the first image, including: determining the ultraviolet index based on the first camera parameters corresponding to the first image, the first camera parameters corresponding to the third image, and the target grayscale.
[0048] In one possible design, the processing module is further configured to, after acquiring the first image through the first camera, adjust the parameters of the first camera if the grayscale value of the first image is not the target grayscale, and under the condition of the parameters, call the first camera to acquire a fourth image, the grayscale of the fourth image being the target grayscale.
[0049] The processing module is also used to adjust the parameters of the first camera and acquire a fifth image, the grayscale of which is the target grayscale.
[0050] The processing module is used to determine the ultraviolet index based on the first image, including: determining the ultraviolet index based on the first camera parameters corresponding to the fourth image, the first camera parameters corresponding to the fifth image, and the target grayscale.
[0051] In one possible design, the parameters of the first camera include exposure time and sensitivity.
[0052] In one possible design, the electronic device could also detect the user's sunscreen application based on UV index and display the detection results to the user. This would allow the user to be guided by the detection results in their daily sun protection routine.
[0053] Thirdly, this application provides an electronic device that has the function of implementing the detection method as described in any of the above aspects and any of its possible implementations. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0054] Fourthly, this application provides a computer-readable storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform a detection method as described in any one of the aspects and any possible implementations thereof.
[0055] Fifthly, this application provides a computer program product that, when run on an electronic device, causes the electronic device to perform a detection method as described in any one aspect and any possible implementation thereof.
[0056] Sixthly, a circuit system is provided, the circuit system including processing circuitry configured to perform the detection method as described in any of the above aspects and any of the possible implementations thereof.
[0057] In a seventh aspect, embodiments of this application provide a chip system including at least one processor and at least one interface circuit. The at least one interface circuit is used to perform transceiver functions and send instructions to the at least one processor. When the at least one processor executes the instructions, the at least one processor executes the detection method as described in any of the above aspects and any of the possible implementations. Attached Figure Description
[0058] Figure 1 A schematic diagram illustrating the principle of ultraviolet imaging provided in the embodiments of this application;
[0059] Figures 2A-2D A schematic diagram of the form of an electronic device provided in an embodiment of this application;
[0060] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;
[0061] Figure 4 A schematic diagram of the software architecture of the electronic device provided in the embodiments of this application;
[0062] Figure 5 Interface diagrams provided for embodiments of this application;
[0063] Figure 6A , Figure 6B Interface diagrams provided for embodiments of this application;
[0064] Figures 7-9 Interface diagrams provided for embodiments of this application;
[0065] Figure 10 A schematic diagram illustrating the relationship between various camera parameters and ultraviolet radiation levels provided in this application embodiment;
[0066] Figure 11 A schematic diagram of the method flow provided in the embodiments of this application;
[0067] Figure 12 , Figure 13 This is a schematic diagram of the interface provided for an embodiment of this application;
[0068] Figure 14 A schematic diagram of the detection method flow provided in the embodiments of this application;
[0069] Figure 15 A schematic diagram illustrating the training and use of the classifier provided in the embodiments of this application;
[0070] Figure 16 A schematic diagram of the apparatus provided in the embodiments of this application;
[0071] Figure 17 This is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation
[0072] First, some technical terms involved in the embodiments of this application will be introduced.
[0073] Ultraviolet (UV) imaging: Ultraviolet light wavelengths are outside the visible light spectrum, therefore, they are invisible to the human eye. In some applications, UV light can be used as a light source, employing a UV imaging system for imaging. This technique of capturing and imaging UV light is called UV imaging technology. Through UV imaging, users can observe the UV images formed on objects under UV illumination.
[0074] Unlike RGB images, which typically have three color channels, ultraviolet images are usually grayscale images with only one color channel, namely the gray channel.
[0075] Ultraviolet (UV) imaging systems include UV camera modules. A UV camera module can be, for example, a camera capable of capturing UV light, called a UV camera. Figure 1 As shown, an ultraviolet camera may include components such as a lens and an image sensor. The lens may be made of a material such as, but not limited to, quartz glass, which allows ultraviolet light to pass through. The image sensor can record information about the ultraviolet light that passes through the lens.
[0076] In this embodiment, considering the characteristics of ultraviolet (UV) cameras, they can be applied to UV detection (including but not limited to UV intensity detection). UV images are acquired using the UV camera, and the UV index corresponding to the image is determined based on its characteristics.
[0077] For example, generally speaking, under the same conditions, the stronger the ultraviolet radiation, the greater the amount of light passing through the ultraviolet lens, and correspondingly, the color of the ultraviolet image formed on the image sensor is usually lighter. Therefore, in some embodiments of this application, the intensity of ultraviolet radiation can be determined based on the color intensity of the ultraviolet image. For example, Figure 1 The ultraviolet light intake ratio shown in (1) is... Figure 1 As shown in (2), more ultraviolet light is allowed to pass through, therefore, Figure 1 In (1), the ultraviolet image formed by the ultraviolet camera is brighter and lighter in color.
[0078] This application provides a detection method that can be applied to electronic devices, wherein the electronic devices are equipped with devices having, for example, [missing information]. Figure 1 The ultraviolet camera shown has the following structure. The electronic device in this application embodiment can be a mobile phone, tablet computer, wearable device, in-vehicle device, laptop computer, etc. The mobile phone in this application embodiment can be a foldable screen phone or a non-foldable screen phone. This application embodiment does not impose any restrictions on the specific type of electronic device.
[0079] For example, the layout of the camera on the electronic device 100 can be seen in Figure 2A In this case, the front of the electronic device 100 is the plane where the display screen 194 is located. For example... Figure 2A As shown in (a), camera 1931 is located on the front of electronic device 100, therefore, the camera is a front-facing camera. Figure 2A As shown in (b), the camera 1932 is located on the back of the electronic device 100, so the camera is a rear-facing camera.
[0080] In some embodiments of this application, the camera may include an ultraviolet camera and a color camera. The color camera includes, but is not limited to, an RGB camera.
[0081] Optionally, the solution of this application embodiment can be applied to an electronic device 100 with a foldable screen (i.e., the screen can be folded) having multiple displays.
[0082] In some embodiments, the foldable screen can be a flexible foldable screen. The flexible foldable screen includes a folding axis made of a flexible material. Part or all of the flexible foldable screen may be made of a flexible material. For example, only the foldable portion (such as the folding axis) of the flexible foldable screen may be made of a flexible material, while the other portions may be made of a rigid material; or, the entire flexible foldable screen may be made of a flexible material. The foldable screen can be folded along the folding axis to form at least two sub-screens.
[0083] For example, Figure 2A Figure (c) shows a foldable screen electronic device 100. Responding to user actions, such as... Figure 2AAs shown in (d), the foldable screen is folded inward (or outward) along the folding edge, such that the foldable screen forms at least two sub-screens (e.g., sub-screen A and sub-screen B). Optionally, as... Figure 2A As shown in (e), there is a display screen (e.g., screen C) on the outer side of the fold. If the electronic device 100 has a camera mounted on the surface where screen C is located, then, in the case of... Figure 2A In the scenario shown in (c) where the electronic device 100 is not folded, the camera on screen C is located on the back of the electronic device 100 and can be considered a rear-facing camera. In such cases... Figure 2A In the scenario shown in (e) where the electronic device 100 is folded, the camera on the C screen becomes the front of the electronic device 100 and can be regarded as a front-facing camera. That is to say, the front-facing camera and the rear-facing camera in this application do not limit the nature of the camera itself, but are only an illustration of a positional relationship.
[0084] by Figure 2A Taking foldable screen phones as an example, the ultraviolet camera can be set on a screen such as the C-screen (set up in the form of a punch-hole or under-display camera).
[0085] Optionally, the foldable screen of a foldable electronic device can form multiple (e.g., two, three, etc.) sub-screens. For example, such as... Figure 2B The flexible folding screen shown in (1) may include folding lines 030 and 031. After being folded longitudinally along folding line 030, it can form a screen as shown in Figure 1. Figure 2B Sub-screens 032, 033 and 034 are shown in (2).
[0086] Optionally, the screen arrangement of foldable electronic devices can be such as Figure 2A The vertical screen arrangement shown in (d) can also be, for example, Figure 2C The left and right screen arrangements shown in (1) or (2) are examples of such arrangements. This application does not limit the screen arrangement of foldable electronic devices. For example... Figure 2C The flexible folding screen shown in Figure (1), after being folded laterally along the folding line 040, can form a shape like... Figure 2C Sub-screens 041 and 042 are shown in (2). For example, the foldable screen device in the folded state (see...) Figure 2D The state shown in (1) can be a mobile phone, and the unfolded state can be a tablet computer.
[0087] In the embodiments of this application, the foldable screen can be a single-sided screen (i.e., only one side can display the user interface) or a double-sided screen (i.e., both opposite sides can display the user interface).
[0088] For single-sided foldable screens, folding the screen towards the side that displays the user interface (i.e., the front of the single-sided foldable screen) is called forward folding; folding the screen towards the opposite side (i.e., the back of the single-sided foldable screen) is called reverse folding. For example, Figure 2C (2) shows a schematic diagram of a forward fold. Figure 2D (2) shows a schematic diagram of a reverse fold. Foldable screen devices can determine whether the current fold is forward or reverse.
[0089] For example, Figure 3 A schematic diagram of an electronic device 100 is shown. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0090] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0091] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.
[0092] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0093] In some embodiments of this application, the processor 110 is used to invoke an ultraviolet camera to acquire ultraviolet images and determine ultraviolet indexes based on the ultraviolet images.
[0094] The charging management module 140 is used to receive charging input from the charger.
[0095] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the display 194, the camera 193, etc.
[0096] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0097] Mobile communication module 150 can provide wireless communication solutions including 2G / 3G / 4G / 5G for use on electronic device 100. Wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks) and Bluetooth (BT) for use on electronic device 100.
[0098] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0099] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.
[0100] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.
[0101] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set within the camera 193. For example, the ISP can control the photosensitive element for exposure and image capture based on shooting parameters.
[0102] Camera 193 is used to capture still images or videos. An object passes through the lens, generating an optical image that is projected onto a photosensitive element. This photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP (Image Signal Processor) for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP (Digital Signal Processor) for further processing. The DSP converts the digital image signal into standard RGB, YUV, or other image formats.
[0103] In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1. The cameras 193 may be located in the edge area of the electronic device and may be under-display cameras, pop-up cameras, or punch-hole cameras. The cameras 193 may include rear cameras and front cameras. This application does not limit the specific location and shape of the cameras 193.
[0104] In this embodiment, camera 193 includes a conventional camera and an ultraviolet camera.
[0105] Among these, standard cameras include color cameras. Color cameras can be, but are not limited to, RGB cameras.
[0106] In this embodiment, a color camera can be used to capture images, which can be used to determine the presence of objects such as the sky. The captured color images can also be used to mark ultraviolet radiation levels.
[0107] An ultraviolet camera can be used to collect ultraviolet images, and electronic device 100 can detect ultraviolet indexes based on the collected ultraviolet images.
[0108] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.
[0109] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0110] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.
[0111] In some embodiments, the NPU uses image recognition technology to identify whether the image captured by the camera 193 contains a sky image.
[0112] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0113] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 performs various functional applications and data processing of electronic device 100 by executing instructions stored in internal memory 121 and / or instructions stored in memory disposed in the processor.
[0114] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
[0115] The audio module 170 is used to convert digital audio data into analog audio electrical signals for output, and also to convert analog audio electrical signals into digital audio data for input. The audio module 170 may include an analog-to-digital converter and a digital-to-analog converter. For example, the audio module 170 is used to convert the analog audio electrical signals output from the microphone 170C into digital audio data. The audio module 170 can also be used to encode and decode audio data. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.
[0116] The speaker 170A, also known as a "loudspeaker," is used to convert analog audio electrical signals into sound signals. The electronic device 100 can listen to music or make hands-free calls through the speaker 170A.
[0117] The receiver 170B, also known as the "earpiece," is used to convert analog audio electrical signals into sound signals. When the electronic device 100 answers a telephone call or voice message, the receiver 170B can be brought close to the ear to listen to the voice.
[0118] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into analog audio electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 170C, inputting the sound signal into microphone 170C. Microphone 170C can be a built-in component of electronic device 100 or an external accessory of electronic device 100.
[0119] In some embodiments, the electronic device 100 may include one or more microphones 170C, wherein each or more microphones cooperate to acquire sound signals from various directions and convert the acquired sound signals into analog audio electrical signals, and may also perform noise reduction, sound source identification, or directional recording functions, etc.
[0120] The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0121] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0122] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment of the invention uses a layered architecture as an example to illustrate the software structure of electronic device 100.
[0123] Figure 4 This is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention.
[0124] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the operating system of an electronic device (e.g., the system of the region to be detected) is divided into four layers, from bottom to top: the kernel layer, the hardware abstraction layer (HAL), the application framework layer, and the application layer.
[0125] The kernel layer is the layer between hardware and software. The kernel layer includes at least camera drivers, audio drivers, display drivers, and sensor drivers. Sensor drivers include, but are not limited to, image sensor drivers and acoustic sensor drivers.
[0126] In some embodiments, such as in a sky recognition scenario, kernel-level components such as camera drivers are invoked to activate the camera. Another example is the use of an image sensor driver to invoke an image sensor for image acquisition.
[0127] The Hardware Abstraction Layer (HAL) sits between the kernel layer and the application framework layer. It defines the interface for the hardware implementation of driver applications, translating the values from the hardware implementation into software implementation programming languages. For example, it identifies values from a camera driver, translates them into software programming languages, uploads them to the application framework layer, and then enables the invocation of corresponding functions.
[0128] In some embodiments, HAL can upload sky images captured by camera 193 to the application framework layer for further processing.
[0129] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer obtains raw input events from the kernel layer via the HAL and identifies the controls corresponding to those input events. The application framework layer includes some predefined functions.
[0130] like Figure 4 As shown, the application framework layer may include a view system, a phone manager, a resource manager, a notification manager, a window manager, etc.
[0131] In some embodiments, the application framework layer includes a first module. The first module is used to invoke an ultraviolet camera to acquire ultraviolet images through a camera driver, and to determine the ultraviolet index based on the ultraviolet images.
[0132] Optionally, the first module can be located in other layers, and it can also be divided into more sub-modules. Each sub-module is used to perform a corresponding function.
[0133] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.
[0134] The phone manager is used to provide communication functions for electronic device 100. For example, it manages call status (including connection and disconnection).
[0135] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0136] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.
[0137] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.
[0138] The application layer can include a series of application packages.
[0139] like Figure 4 As shown, the application package may include applications such as camera, video, call, WLAN, music, SMS, Bluetooth, map, calendar, gallery, and navigation.
[0140] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0141] The following will use electronic devices as an example, which have features such as Figure 4 Taking a mobile phone with the illustrated structure as an example, in some embodiments, the mobile phone can activate the ultraviolet detection method of this application embodiment when it detects that preset conditions are met. Optionally, the preset conditions may include, but are not limited to, any one or more of the following conditions: a preset application is activated. The preset application may include, but is not limited to, an application dedicated to ultraviolet detection. Alternatively, the mobile phone may also activate the ultraviolet detection method of this application embodiment after detecting that the user has input a preset command into the mobile phone. This application embodiment does not limit the way the ultraviolet detection function is activated.
[0142] The technical solution of this application embodiment will be introduced below, taking the method of turning on ultraviolet detection by turning on the ultraviolet detection switch in the camera application as an example.
[0143] Optionally, users can instruct the phone to launch the camera application and display a shooting preview interface via touch, button, air gestures, or voice commands. For example, the phone displays... Figure 5 The interface shown in (a) includes a camera application icon 401. Upon detecting a user action such as clicking the camera application icon, the phone launches the camera application and uses a standard camera (e.g., an RGB camera) to capture an image. Figure 5 The shooting preview interface 402 shown in (b) displays the RGB image captured by the RGB camera. Alternatively, upon detecting a user's voice instruction to open the camera application, the phone launches the camera application and uses the RGB camera to capture an image, obtaining... Figure 5 The shooting preview interface 402 is shown in (b). The shooting preview interface may include one or more controls for different functions. For example, it may include an ultraviolet detection control 403. The ultraviolet detection control 403 may be used to enable the ultraviolet detection function of this embodiment or to indicate the detected ultraviolet index.
[0144] Optionally, the shooting preview interface 402 may also include other controls. For example, controls for turning filters on or off, controls for taking the picture, controls for adjusting the focus, and controls for adjusting the screen brightness.
[0145] In some embodiments, such as Figure 5 As shown in (b), if a user's action, such as clicking the ultraviolet detection control 403, is detected, the mobile phone can call the color camera to capture a color image, and can... Figure 5The preview interface 402 shown in (b) displays the captured color image. The phone can also simultaneously capture a color image using the color camera and an ultraviolet camera to capture an ultraviolet image, determining the ultraviolet index based on the captured ultraviolet image. Optionally, the ultraviolet index includes, but is not limited to, ultraviolet intensity, ultraviolet index, and ultraviolet level. Optionally, the phone can also directly display the ultraviolet image captured by the ultraviolet camera.
[0146] Optionally, during the determination of UV index, the mobile phone can display, for example, Figure 5 The prompt message 404 shown in (b) is used to inform the user that the mobile phone is detecting ultraviolet indicators (such as ultraviolet intensity).
[0147] After determining the UV index, the mobile phone can notify the user of the detected UV index. For example, such as... Figure 5 As shown in (c), the mobile phone displays a prompt message 405, which indicates the UV index of 8 and the corresponding UV intensity for this test.
[0148] The technical solution of this application embodiment allows electronic devices to conveniently and quickly obtain the ultraviolet index (such as ultraviolet intensity) of the current location by acquiring images.
[0149] In other embodiments, the mobile phone can also display both ultraviolet and color images simultaneously on the preview screen. For example, upon detecting a user tap... Figure 5 After the camera app icon 401 is shown, the phone displays as follows: Figure 6A The preview interface shown in (a) is as follows. Figure 6A As shown in (a), if a user's action, such as clicking the ultraviolet detection control 403, is detected, the mobile phone can call the color camera to capture a color image, call the ultraviolet camera to capture an ultraviolet image, and can... Figure 6A The preview interface shown in (a) displays the acquired color image and the acquired ultraviolet image. The color image can be used to identify the subject being photographed, and the ultraviolet image can be used to identify the ultraviolet radiation level.
[0150] Optional, such as Figure 6A As shown in (b), when both ultraviolet and color images are displayed in the same preview interface, controls 605 and 606 can also be displayed in the preview interface. Control 605 is used to control the display size of ultraviolet image 603, and control 606 is used to control the display size of color image 602.
[0151] In other embodiments, the mobile phone can display ultraviolet and color images separately in different preview interfaces. The user can choose to switch the image displayed in the current preview interface. Examples include... Figure 6BAs shown in (a), after detecting that the user clicks the ultraviolet detection control 403, the phone calls the color camera to capture a color image and the ultraviolet camera to capture an ultraviolet image, and displays the color image 402 in the preview interface. After detecting that the user clicks the view switching control 406, the phone can display the following in the preview interface: Figure 6B The ultraviolet image 407 is shown in (b). Figure 6B The meaning of (c) can be found in [link to documentation]. Figure 5 The relevant description of (c) will not be repeated here.
[0152] Optionally, upon detecting a user click, such as Figure 6B After the ultraviolet detection control 403 shown in (a) is activated, the phone captures both a color image and an ultraviolet image, and displays the color image in the preview interface by default. Alternatively, the phone captures both a color image and an ultraviolet image, and displays the image selected by the user when they last exited the camera application in the preview interface. For example, if the user selected to display an ultraviolet image in the preview interface when they last used the camera, then this time, if the camera detects that the user clicked on the ultraviolet image... Figure 6B After the ultraviolet detection control 403 shown in (a) is activated, the mobile phone captures color images and ultraviolet images, and displays the ultraviolet images in the preview interface.
[0153] It is understandable that different shooting angles and directions of a camera often result in different light captures, leading to different image content. In this embodiment, the user can adjust the shooting direction and angle of the ultraviolet camera to position it towards a location with minimal ultraviolet reflection and scattering, thereby enabling more effective ultraviolet light collection and improving the accuracy of ultraviolet detection.
[0154] Optional locations with less ultraviolet reflection and scattering include, but are not limited to, the sky.
[0155] In some embodiments, when the user clicks, such as Figure 7 After the ultraviolet detection control 403 shown in (a) is activated, the mobile phone can call the color camera to capture a color image and determine whether the color image meets the first condition; if it is determined that the second image meets the first condition, the ultraviolet index is determined based on the first image. The first condition includes: the second image contains a target object; or, the first condition includes: the second image contains the target object, and the area ratio of the target object in the second image is greater than or equal to a threshold.
[0156] Taking the sky as an example, when the user clicks on it... Figure 7After the ultraviolet detection control 403 shown in (a) is activated, the mobile phone can call the color camera to capture a color image and determine whether the sky exists in the color image. Since color images usually have more imaging details and higher image quality, color images captured by the color camera can more accurately detect target objects (such as the sky).
[0157] In some embodiments, when a user click is detected, such as Figure 7 After the ultraviolet detection control 403 shown in (a) is activated, the mobile phone can display a prompt message 701 (an example of a second message) to prompt the user to point the camera (first camera) at the sky for framing. The mobile phone first captures a color image using the color camera. When it is determined that the sky exists in the captured color image (i.e., the first condition is met), the mobile phone can call the ultraviolet camera to capture an ultraviolet image and determine the ultraviolet index based on the ultraviolet image. Alternatively, after detecting that the user clicks on the control 403, the mobile phone can... Figure 7 After the ultraviolet detection control 403 shown in (a) is activated, the mobile phone can display a prompt message 701 (an example of a second message) to prompt the user to point the camera (first camera) at the sky for framing. The mobile phone captures a color image through the color camera and an ultraviolet image through the ultraviolet camera. Since the ultraviolet camera and the color camera work synchronously, when it is determined that the sky exists in the captured color image (i.e., the first condition is met), it means that the ultraviolet image is also captured by pointing the camera at the sky. Therefore, the mobile phone can determine the ultraviolet index based on the ultraviolet image.
[0158] Optionally, the mobile phone can detect the sky in a color image by setting a color segmentation range for the sky [R1~R2, G1~G2, B1~B2], and then segmenting the pixels in the color image according to this range. Specifically, for a given pixel in the color image, if the R (red) component of that pixel is within the range of R1~R2, the G component is within the range of G1~G2, and the B component is within the range of B1~B2, then that pixel is considered an image pixel of the sky. This process is repeated to detect the image pixels containing the sky in the color image.
[0159] Alternatively, the mobile phone can also use other methods to detect the sky from the color image. For example, it can use machine learning methods to train a classifier for recognizing the sky, and then use that classifier to identify the sky from the color image. The embodiments of this application do not limit the specific implementation of sky detection.
[0160] In some other embodiments, if, for a period of time after the user clicks the UV detection control 403, the color image captured by the phone does not contain the sky, or the area of the sky in the color image is less than a certain percentage (e.g., 90%), the phone can prompt the user to point the camera at the sky. For example, as... Figure 7The preview interface 402 shown in (a) does not include the sky, indicating that the phone's camera is not aimed at the sky. Therefore, the phone can display a prompt message 701 to remind the user to point the camera at the sky. Alternatively, the phone can play a voice prompt to remind the user to point the camera at the sky. This application embodiment does not limit the way the phone prompts the user to adjust the shooting direction and / or angle. The user can adjust the shooting direction and / or angle based on the phone's prompts to point the camera at the sky.
[0161] Next, when the user points the camera at the sky, the phone can use its ultraviolet camera to capture ultraviolet images and determine the ultraviolet index based on the images and the constructed model. Optional, such as... Figure 7 As shown in (b), the mobile phone can display a prompt message 702 to indicate that an ultraviolet (UV) level is being detected. For example, after determining the UV level, the mobile phone can display... Figure 7 Interface 405, shown in (c), is used to indicate the detected ultraviolet radiation level.
[0162] In other cases, users click on things like Figure 5 After the ultraviolet detection control 403 shown in (b) is activated, the camera may be actively pointed at the sky. In this way, when the phone calls the color camera to capture a color image (an example of the second image), it can detect the sky in the color image, meaning the camera is currently pointing at the sky. Upon detecting that the camera is pointing at the sky, the phone can call the ultraviolet camera to capture an ultraviolet image and determine the ultraviolet intensity based on the ultraviolet image.
[0163] It should be noted that the embodiments of this application do not limit the timing of activating the ultraviolet camera. As one possible implementation, the ultraviolet camera and the color camera acquire images simultaneously. For example, upon detecting a user clicking on something such as... Figure 5 When the ultraviolet detection control 403 shown in (b) is activated, the mobile phone calls the ultraviolet camera to acquire an ultraviolet image. Simultaneously, the mobile phone calls the color camera to acquire a color image, and the acquisition by the color camera and the ultraviolet camera is synchronized. As another example, such as... Figure 5 As shown in (a), after detecting that the user clicks the camera app icon 401, the phone can open the camera app and display... Figure 8 The interface shown in (a) is as follows. After detecting that the user clicks the ultraviolet detection control 403, the mobile phone can call the color camera to capture a color image (for object recognition) and simultaneously call the ultraviolet camera to capture an ultraviolet image (for determining the ultraviolet index). Optionally, such as Figure 8 As shown in (a), the mobile phone can display the acquired color image 802 and ultraviolet image 801 in the preview interface. Optionally, as Figure 8As shown in (a), the mobile phone can also display a prompt message 701 to prompt the user to point the camera at the sky for framing.
[0164] While the user adjusts the camera's shooting direction, the phone continuously acquires color images and simultaneously acquires ultraviolet (UV) images. If the acquired color image detects the presence of the sky, the phone can calculate the UV index based on the UV image acquired simultaneously with that color image. Optionally, during the UV index calculation process, the phone can display information such as... Figure 8 The prompt message 702 shown in (b) indicates to the user that the ultraviolet index is being calculated. The phone can also display the acquired color image 804 and ultraviolet image 804 in the preview interface. After determining the ultraviolet index (such as ultraviolet intensity), the phone can display information such as... Figure 8 The interface shown in (c) is used to display this ultraviolet index.
[0165] As another possible implementation, when the ultraviolet detection function is enabled, for example, when the user clicks... Figure 7 Following the ultraviolet detection control 403 shown in (a), the phone first uses the color camera to capture a color image and detects whether the sky exists in the color image. If the phone determines that the sky exists in the color image, it means that the user has pointed the phone's camera at the sky to frame the shot. Then, the phone starts using the ultraviolet camera to capture an ultraviolet image and detects the ultraviolet index based on the ultraviolet image. As another example, such as... Figure 9 As shown in (a), after detecting that the user clicks the ultraviolet detection control 403, the phone first calls the color camera to capture a color image, and then identifies whether the user has pointed the camera at the sky to frame the shot based on the color image. Optionally, during the process of capturing the color image, the phone can display, for example, on the preview interface... Figure 9 The color image captured as shown in (a) can display a prompt message 701 to prompt the user to point the camera at the sky for framing. If the sky is detected in the captured color image, it means that the user has pointed the camera at the sky for framing. Then, the phone can use the ultraviolet camera to capture ultraviolet rays in the direction of the sky and form an ultraviolet image, and then determine the ultraviolet index based on the ultraviolet image. Optionally, after the ultraviolet camera is turned on, as shown in (a), the phone can display a prompt message 701 to prompt the user to point the camera at the sky for framing. Figure 9 As shown in (b), the mobile phone can simultaneously display the ultraviolet image captured by the ultraviolet camera (part of the first image) and the color image captured by the color camera (part of the second image) in the preview interface. About Figure 9 For a description of (c), please refer to Figure 8 The relevant description of (c) will not be repeated here.
[0166] The following describes the specific implementation method for determining ultraviolet indexes based on ultraviolet images.
[0167] As mentioned earlier regarding the principle of ultraviolet imaging, the ultraviolet index can be determined based on the color intensity of an ultraviolet image. In this embodiment, the color intensity of an ultraviolet image can be represented by grayscale values. The grayscale value of an ultraviolet image can refer to the average grayscale value of the ultraviolet image. Optionally, the average grayscale value includes, but is not limited to, any of the following grayscale values: arithmetic mean grayscale value, weighted average grayscale value. In the arithmetic mean grayscale value, each pixel has the same weight.
[0168] In a weighted average grayscale value, different pixels can have different weights. For example, in some scenarios, the brightness of the central portion of an ultraviolet (UV) image may be greater than that of the edge portions. This could be because more UV light illuminates the central portion of the image sensor, while little or no UV light illuminates the edge portions. Therefore, in this case, since UV illumination is concentrated in the central pixels of the UV image, these central pixels are particularly important for UV detection, and thus, a greater weight should be assigned to them. Conversely, a smaller weight should be assigned to the edge pixels of the UV image.
[0169] Optionally, the edge portion and the middle portion of the image can be predefined. For example, pixels spaced at least L (positive integer) pixels from the image center can be considered as the edge portion, and other parts of the image can be considered as the middle portion. Optionally, L can be flexibly determined according to the scenario, for example, it can be determined based on empirical values, and this application embodiment does not limit this. Alternatively, the definition of the edge portion and the middle portion of the image can also be in other ways. For example, assuming the image size is M pixels * N pixels, the image pixels within a square with the image center as the geometric center and a side length of P (positive integer) pixels can be considered as the middle portion of the image, and the image pixels outside the square can be considered as the edge portion of the image. Wherein, P is less than min(M,N), that is, P is less than the minimum value of M and N. This application embodiment does not limit the specific definition of the edge and middle portions.
[0170] Optionally, two weight values can be set: the weight value of the pixels in the middle part of the ultraviolet image is the first weight, and the weight value of the pixels in the edge part of the ultraviolet image is the second weight, and the first weight value is greater than the second weight.
[0171] Alternatively, multiple weight values can be set, with pixels closer to the image center assigned larger weight values and pixels farther from the image center assigned smaller weight values. For example, pixels within a first range of distance from the image center are assigned a first weight, pixels within a second range of distance from the image center are assigned a second weight, and pixels within a third range of distance from the image center are assigned a third weight.
[0172] It is understood that the average grayscale value of a UV image is related not only to UV indicators (such as UV intensity) but also to the parameters of the UV camera. Optionally, the UV camera parameters associated with the average grayscale value of a UV image include, but are not limited to, any one or more of the following: exposure time, ISO.
[0173] Exposure time can be understood as the duration the shutter is open. Typically, in a UV camera, ultraviolet light can only pass through the lens and reach the image sensor when the shutter is open. When the shutter is closed, ultraviolet light is blocked and cannot reach the image sensor. Generally, all other things being equal, a longer exposure time (i.e., a longer shutter open time) allows more ultraviolet light to enter, resulting in a higher average grayscale value and a brighter UV image. Conversely, a shorter exposure time results in a lower average grayscale value and a darker UV image.
[0174] The higher the ISO, the more sensitive the UV camera is to UV light, resulting in a brighter UV image with a higher average grayscale value. Conversely, the lower the ISO, the less sensitive the UV camera is to UV light, resulting in a lower brighter UV image with a lower average grayscale value.
[0175] As can be seen, by adjusting one or more of the aforementioned parameters of the ultraviolet camera, the average grayscale value of the ultraviolet image captured by the camera can be adjusted. As mentioned above, the average grayscale value is related to the detection and identification of ultraviolet radiation. Therefore, one or more of the aforementioned camera parameters are related to the detection and identification of ultraviolet radiation.
[0176] Considering that the ultraviolet (UV) index is related to one or more parameters of the UV camera and the average grayscale value of the UV image, in this embodiment, the UV index can be determined based on the camera parameters and the average grayscale value of the UV image. As one possible implementation, a model is constructed based on the UV camera parameters, the UV index (e.g., UV intensity), and the average grayscale value of the UV image. Subsequently, the mobile phone can determine the UV index based on the known UV camera parameters, the average grayscale value of the UV image, and the constructed model.
[0177] Below, we introduce several schemes for constructing models for detecting ultraviolet (UV) levels, and using these models to determine UV levels.
[0178] Option 1
[0179] The method for constructing the model in this scheme may include the following steps:
[0180] a) Set the ISO to G1, where G1∈[G_min,G_max]. Here, G_min is the minimum ISO of the ultraviolet camera, and G_max is the maximum ISO of the ultraviolet camera.
[0181] During the laboratory testing phase, the ultraviolet camera was pointed at an ultraviolet light source, enabling it to capture the ultraviolet light emitted by the source and form an ultraviolet image. In the process of capturing ultraviolet light and forming the image, the intensity V of the ultraviolet light source was gradually adjusted from low to high. For each intensity level, the exposure time T of the ultraviolet camera was adjusted to ensure that the average grayscale value of the ultraviolet image acquired by the camera reached the target grayscale value.
[0182] Optionally, the target grayscale value range is: Gray ± Q. Gray is the grayscale reference set to avoid overexposure or underexposure. Q is the deviation. Optionally, the values of Gray and Q can be flexibly set according to the actual application scenario without limitation. For example, Gray = 128, Q = 5.
[0183] Through the above steps, each ultraviolet intensity has a corresponding ultraviolet image with a grayscale value within the target grayscale range (e.g., Gray±Q range), and each ultraviolet intensity has a corresponding exposure time T. Next, the exposure time T corresponding to different ultraviolet intensities V is recorded when ISO is G1, and the functional relationship f1 between ultraviolet intensity V and exposure time T under ISO G1 is obtained. For example, Figure 10 This shows an exemplary functional relationship between ultraviolet intensity V and exposure time T when ISO is G1.
[0184] The ultraviolet light source can be a dedicated ultraviolet lamp or other light sources. This application does not limit the type of ultraviolet light source.
[0185] b) Set different ISO values and, following step a), obtain the functional relationship V = fn(T) between exposure time T and ultraviolet intensity V under different ISO conditions. Here, n (a positive integer) represents n different ISO conditions. fn is a function that maps exposure time T to ultraviolet intensity V.
[0186] For example, V = a*T^3 + b*T^2 + c*T + d (Equation 1), where a, b, c, and d represent the coefficients of the function parameters. T^3 represents T raised to the power of 3. For example, the parameters a / b / c / d are estimated based on the polynomial curve corresponding to Equation 1.
[0187] It should be noted that Formula 1 only illustrates one possible mapping relationship between ultraviolet intensity V and exposure time T. It should be understood that the mapping relationship between ultraviolet intensity V and exposure time T can also be other. The embodiments of this application do not limit the specific relationship between the two.
[0188] For example, Figure 10The functional relationship between ultraviolet intensity V and exposure time T is shown when ISO = G2 and ISO = G3, respectively.
[0189] In obtaining Figure 10 The function of ultraviolet intensity V versus exposure time shown can be used as a model for detecting ultraviolet radiation.
[0190] The following introduction is based on, for example Figure 10 The model shown, along with ultraviolet images captured by an ultraviolet camera, illustrates a method for determining environmental ultraviolet radiation indicators. For example... Figure 11 As shown, the method includes:
[0191] S101, The electronic device acquires the first image.
[0192] Taking the simultaneous image acquisition by an ultraviolet camera (an example of a first camera) and a color camera (an example of a second camera) as an example, when the ultraviolet detection function is enabled, for example, when the user clicks... Figure 12 Following the ultraviolet detection control 403 shown in (a) (an example of the first instruction), the mobile phone calls the color camera to capture a color image and the ultraviolet camera to capture an ultraviolet image. Optionally, as... Figure 12 As shown in (a), the mobile phone can display the captured color image 602 and ultraviolet image 601 in the preview interface.
[0193] After acquiring the first image, the electronic device can determine the ultraviolet (UV) index based on the first image. As one possible implementation, the electronic device determines the UV index based on the grayscale values of the pixels included in the first image. The process of the electronic device determining the UV index based on the first image includes the following steps S102-S105a (or A105b).
[0194] S102. The electronic device determines whether the average gray level of the first image is the target gray level. If yes, it executes step S103a; otherwise, it executes step S103b.
[0195] Optionally, the target grayscale can be obtained statistically or empirically. This application does not limit the specific setting of the target grayscale. When the average grayscale of the ultraviolet image is the target grayscale, the ultraviolet image typically does not suffer from overexposure or underexposure.
[0196] Considering that the calculation of average gray level may introduce errors, a certain numerical range can be set when determining whether the gray level of an image is the target gray level. If the gray level of the image is within this range, then the gray level of the image is called the target gray level. For example, the range of the target gray level is 128±5. If the gray level of the image is within the range of 128±5, then the gray level of the image is called the target gray level.
[0197] By setting a target grayscale range, the average grayscale of the ultraviolet image used to detect ultraviolet indicators is kept within a certain range, thus avoiding inaccurate detection caused by overexposure or underexposure of the ultraviolet image.
[0198] S103a, The electronic device obtains the ultraviolet camera parameters corresponding to the first image.
[0199] Optional parameters for the ultraviolet camera include, but are not limited to, exposure time and ISO.
[0200] For example, suppose the first image is Figure 12 Given the ultraviolet image 601 shown in (a), and the calculated average gray level of the ultraviolet image 601 is within 128±5, the ultraviolet camera parameters corresponding to the ultraviolet image 601 are obtained.
[0201] Optional, such as Figure 12 As shown in (a), after obtaining the ultraviolet camera parameters (such as ISO sensitivity = 125, exposure time T = 1 / 100) corresponding to the ultraviolet image 601, the mobile phone can display the ultraviolet camera parameters on the interface.
[0202] Optional, such as Figure 12 As shown in (a), the mobile phone can display the average grayscale of the ultraviolet image 601 in the interface.
[0203] S104a. Adjust the parameters of the ultraviolet camera so that the average gray level of the third image obtained under the ultraviolet camera parameter conditions is the target gray level.
[0204] The ultraviolet camera parameters corresponding to the third image are different from those corresponding to the first image.
[0205] For example, taking the first image as Figure 12 As shown in (a) the ultraviolet image 601, taking the average gray level of ultraviolet image 601 as the target gray level as an example, in obtaining such... Figure 12 After obtaining the ultraviolet camera parameters corresponding to the ultraviolet image 601 shown in (a), the mobile phone adjusts the ultraviolet camera parameters according to a preset algorithm, so that the average gray level of the third image 603 obtained under the adjusted ultraviolet camera parameters is the target gray level. Figure 12 After the first image 601 and the third image 603 shown, the mobile phone can execute step S105a.
[0206] Optional, such as Figure 12 As shown in (b), the mobile phone can display the acquired ultraviolet image 603 in the preview interface.
[0207] Optional, such as Figure 12As shown in (b), the mobile phone can display the ultraviolet camera parameters (an example of third information) corresponding to the ultraviolet image 603 on the interface. The ultraviolet camera parameters include, but are not limited to, sensitivity and exposure time.
[0208] Optional, such as Figure 12 As shown in (b), the mobile phone can display the average grayscale of the ultraviolet image 603 in the interface.
[0209] As another example, taking the first image as an example... Figure 13 Taking image 601 as shown in (a), where the average gray level of image 601 is not within the target gray level, as an example, after the mobile phone acquires image 601, if it is determined that the average gray level of image 601 is not within the target gray level range, the ultraviolet camera parameters can be adjusted to ensure that the average gray level of the acquired ultraviolet images under various parameter conditions is always within the target gray level range, thus preventing inaccurate detection caused by overexposure or underexposure. Optionally, the adjusted ultraviolet camera parameters are as follows: Figure 13 As shown in (b). Optionally, the mobile phone can display the fourth image 604 obtained under the ultraviolet camera parameters as shown in [example image]. Figure 13 As shown in preview (b), it can be seen that the grayscale of image 604 is different from that of image 601.
[0210] Afterwards, the mobile phone can adjust the ultraviolet camera parameters once or multiple times, referring to the scheme in the above embodiments. For example, the ultraviolet camera parameters can be adjusted to... Figure 13 The parameters shown in (c) are optional. The mobile phone can display the ultraviolet image 603 obtained under these ultraviolet camera parameters as shown in [example image]. Figure 13 In the preview interface shown in (c), it can be seen that image 604 and image 603 have the same grayscale. After obtaining... Figure 13 After the fourth image 604 and the third image 603 shown, the mobile phone can execute step S105b.
[0211] S105a. Determine the ultraviolet index based on the ultraviolet camera parameters corresponding to the first image, the ultraviolet camera parameters corresponding to the third image, the target grayscale, and the model.
[0212] For example, in such Figure 12 When the average grayscale of ultraviolet images 601 and 603 shown are both the target grayscale, the ultraviolet camera parameters corresponding to ultraviolet images 601 and 603 are substituted into, for example, Figure 11 The function shown is used to determine the ultraviolet radiation index.
[0213] For example, suppose Figure 10Given G1 = 125 and G2 = 200, and using the UV camera parameters ISO1 = 125 and T1 = 1 / 100 corresponding to UV image 601, the UV intensity V1 under these parameter conditions (G1 = 125, G2 = 200) can be determined. Similarly, using the UV camera parameters ISO = 200 and T = 1 / 125 corresponding to UV image 603, the UV intensity V2 under these parameter conditions (ISO = 200, T = 1 / 125) can be determined. To ensure the accuracy of the UV intensity calculation, the final UV intensity can be determined based on V1 and V2.
[0214] Optionally, the average value of V1 and V2 can be calculated. This average value can be an arithmetic mean or a weighted average, and the embodiments of this application do not limit this. For example, the maximum or minimum value of multiple results can be used as the final ultraviolet index.
[0215] S103b: Adjust the ultraviolet camera parameters so that the average gray level of the fourth image obtained under the ultraviolet camera parameter conditions is the target gray level.
[0216] like Figure 13 As shown in (a), when the ultraviolet detection function is enabled, for example, after the user clicks the ultraviolet detection control 403, the phone uses the ultraviolet camera to capture the first image 601. Calculations show that the brightness of this ultraviolet image 601 is too high, resulting in overexposure. Therefore, the phone can adjust the ultraviolet camera parameters so that the brightness of the ultraviolet image captured by the ultraviolet camera is within a preset range after parameter adjustment. For example, after adjusting the ultraviolet camera parameters, the ultraviolet image captured by the phone's ultraviolet camera is as follows: Figure 13 The ultraviolet image 604 (b) is shown, and the average gray level of ultraviolet image 604 is the target gray level.
[0217] In some embodiments, the mobile phone adjusts the ultraviolet camera parameters in increments, and under the adjusted parameters, captures an ultraviolet image using the ultraviolet camera and calculates the average grayscale of the ultraviolet image. If the average grayscale matches the target grayscale range, the ultraviolet camera parameter is determined to be the parameter to be adjusted to. If the average grayscale does not match the target grayscale range, the mobile phone continues to adjust the ultraviolet camera parameters, captures an ultraviolet image, and calculates the average grayscale of the ultraviolet image until the average grayscale of the ultraviolet image obtained after parameter adjustment is within a preset range, at which point the parameter is determined to be the parameter to be adjusted to. Alternatively,
[0218] In other embodiments, the mobile phone uses its ultraviolet (UV) camera to capture UV images and calculates the required UV camera parameter values based on these images and an algorithm. Optionally, after calculating the UV camera parameter values, the mobile phone can capture a UV image and calculate its average grayscale to determine the accuracy of the UV camera parameter values. Alternatively, the method for adjusting the UV camera can be other than those described in this application; the embodiments of this application do not limit the method for adjusting the UV camera parameters.
[0219] Optional, such as Figure 13 As shown in (b), after the phone adjusts the ultraviolet camera parameters, the adjusted ultraviolet camera parameters can be displayed on the interface.
[0220] For example, when adjusting the parameters of a mobile phone's ultraviolet camera, the ISO can be fixed (e.g., G1), and the exposure time can be adjusted to T1 using an algorithm. This ensures that the average grayscale value of the ultraviolet image reaches the target grayscale value under the conditions of ISO = G1 and T = T1, at which point the adjustment stops. Then, the phone can set the ISO to G2 and use the same adjustment operation to obtain the exposure time T2 corresponding to G2. This ensures that the average grayscale value of the ultraviolet image reaches the target grayscale value under the conditions of ISO = G2 and T = T2, at which point the adjustment stops.
[0221] Alternatively, when adjusting the parameters of a mobile phone's ultraviolet camera, the exposure time can be fixed (e.g., T1). An algorithm can be used to adjust the ISO to G1 until the average grayscale value of the ultraviolet image reaches the target grayscale value, at which point the adjustment stops. Then, the phone can set the exposure time T to T2 and perform the same adjustment operation to obtain the corresponding ISO G2. Under the parameter conditions of ISO = G2 and T = T2, the average grayscale value of the ultraviolet image reaches the target grayscale value, at which point the adjustment stops.
[0222] S104b: Adjust the ultraviolet camera parameters so that the average gray level of the fifth image obtained under the ultraviolet camera parameter conditions is the target gray level.
[0223] S105b: Determine the ultraviolet index based on the ultraviolet camera parameters corresponding to the fourth image, the ultraviolet camera parameters corresponding to the fifth image, the target grayscale, and the model.
[0224] For example, such as Figure 13 The average gray levels of both the UV image 604 and UV image 603 shown are within the target gray level range. Figure 13 Substituting the ultraviolet camera parameters corresponding to the ultraviolet images 604 and 603 shown, such as... Figure 10 The function shown is used to determine the ultraviolet radiation index.
[0225] Figure 13 , Figure 12Two parameter conditions are used to ensure that the average gray level of the ultraviolet image is within the target gray level range (i.e., Figure 12 Adjust the ultraviolet camera parameters once. Figure 13 Taking the adjustment of ultraviolet camera parameters twice as an example, in actual implementation, more or fewer parameter adjustments can be made to obtain the corresponding ultraviolet index under more or fewer parameter conditions. The final comprehensive ultraviolet index is then determined based on the ultraviolet index under different parameter conditions. Because different parameter conditions are taken into account, deviations in the ultraviolet index under certain parameter conditions can be corrected, making the final output ultraviolet index more accurate.
[0226] Option 2
[0227] In this scheme, such as Figure 14 As shown, multiple image features can be extracted from ultraviolet images, and the feature vector composed of these multiple image features can be input into a classifier, which then outputs the ultraviolet index.
[0228] Optionally, image features include, but are not limited to, one or more of the following features: average gray value of the image region, maximum gray value, minimum gray value, difference in gray values between adjacent pixels in the image region, gray value of each pixel in the image region, contrast of the image region, histogram, histogram of oriented gradients (HOG), standard deviation, color level, mean squared error, and variance.
[0229] First, the training process of the classifier involved in the embodiments of this application will be described. The training process is as follows: Figure 15 As shown, training a classifier for identifying ultraviolet (UV) indices requires N (N is a positive integer) samples, which are feature vectors of UV images with known UV indices. Optionally, the training samples can also include labels corresponding to each UV image (representing the UV index corresponding to the UV image). The classifier can be obtained by training on multiple samples.
[0230] Optionally, before training the classifier, the training feature vectors and other data can be processed, such as smoothing or normalizing. Normalization reduces the algorithm's complexity. Smoothing can further include noise reduction and fitting operations to minimize the impact of statistical errors.
[0231] Optionally, to improve the classifier's recognition accuracy, the classifier can be evaluated and tested. When the classifier's recognition rate reaches a certain threshold, it indicates that the classifier has been trained well. If the classifier's recognition rate is low, the classifier can continue to be trained until its recognition accuracy reaches a certain threshold.
[0232] Optionally, the classifier training process can be carried out on the edge (e.g., a mobile phone) or the cloud (e.g., a server). Training can be offline or online. This application embodiment does not limit the specific training method of the classifier. Subsequently, the trained classifier can output the corresponding ultraviolet index of the input ultraviolet image based on the feature vector of the input ultraviolet image with an unknown ultraviolet index.
[0233] In the above embodiments, when establishing the mathematical model, an ultraviolet image is obtained by capturing ultraviolet light directly emitted by the ultraviolet light source. In other embodiments, the model can also be constructed by capturing reflected light. For example, an ultraviolet light source is used to illuminate a target object, and the electronic device captures the ultraviolet light reflected by the target object to form an ultraviolet image. A mathematical model for detecting ultraviolet indicators is then constructed according to the above method.
[0234] The target objects include, but are not limited to, green plants, sand, etc.
[0235] After the model is built, when detecting the ultraviolet index, it is also necessary to point the electronic device at the target object to frame the image. That is, the electronic device needs to be pointed at the target object, call the ultraviolet camera to collect ultraviolet images, and determine the ultraviolet index based on the collected ultraviolet images.
[0236] For some targets, certain parts absorb more ultraviolet (UV) light and reflect less or no UV light. For these parts, less or no UV light passes through the UV camera, and therefore, these parts are usually not visible in UV images. Conversely, other parts absorb less UV light and reflect more UV light. For these parts, more UV light passes through the UV camera, and therefore, these parts are usually visible in UV images.
[0237] The aforementioned Scheme 1 and Scheme 2 are merely two exemplary algorithms. The algorithm used for detecting ultraviolet (UV) indexes in this application embodiment can also be other algorithms, such as logistic regression or other classification algorithms. As long as the algorithm determines the UV index based on the grayscale of the acquired image, it falls within the technical solution scope of this application embodiment. Furthermore, this application embodiment does not limit the type and number of UV camera parameters used for detecting UV indexes. As long as the parameter is related to the grayscale of the UV image, or if adjusting the parameter can adjust the grayscale of the UV image, or if changing the parameter can cause a change in the grayscale of the UV image, then the parameter can be used in the technical solution of this application embodiment. For example, in some other embodiments, the aperture value, a UV camera parameter, can be used in the technical solution for detecting UV indexes in this application embodiment.
[0238] In some embodiments, the phone can also provide users with personalized UV protection recommendations based on the UV index. For example, when the UV index is high, it may prompt the user to apply sunscreen.
[0239] Other embodiments of this application provide an apparatus, which can be the aforementioned electronic device (such as a foldable screen phone). The apparatus may include a display screen, a memory, and one or more processors. The display screen, memory, and processors are coupled. The memory stores computer program code, which includes computer instructions. When the processor executes the computer instructions, the electronic device can perform various functions or steps performed by the mobile phone in the above method embodiments. The structure of the electronic device can be referred to... Figures 2A-2D , Figure 3 The electronic device shown.
[0240] The core structure of this electronic device can be represented as follows: Figure 16 The structure shown may include: a processing module 1301, an input module 1302, a storage module 1303, and a display module 1304.
[0241] The processing module 1301 may include at least one of a central processing unit (CPU), an application processor (AP), or a communication processor (CP). The processing module 1301 can perform operations or data processing related to the control and / or communication with at least one of the other components of the user's electronic device. Specifically, the processing module 1301 can be used to control the content displayed on the main screen according to certain triggering conditions, or to determine the content displayed on the screen according to preset rules. The processing module 1301 is also used to process input instructions or data and determine the display style based on the processed data.
[0242] Input module 1302 is used to acquire user-inputted instructions or data and transmit the acquired instructions or data to other modules of the electronic device. Optionally, the input method of input module 1302 may include touch, gesture, proximity to the screen, or voice input. For example, the input module may be the screen of the electronic device, acquiring user input operations and generating input signals based on the acquired input operations, and transmitting the input signals to processing module 1301. In this embodiment, the input module can be used to receive a first instruction input by the user and / or execute other steps.
[0243] The acquisition module 1306 is used to acquire data and transmit the acquired data to other modules of the electronic device. Optionally, the acquisition module 1306 can be a camera of the electronic device, which can transmit the acquired images to the processing module 1301 and / or perform other steps. The camera includes, but is not limited to, a color camera and an ultraviolet camera.
[0244] The storage module 1303 may include volatile memory and / or non-volatile memory. The storage module is used to store at least one related instruction or data from other modules of the user terminal device; specifically, the storage module may record images captured by the camera.
[0245] The display module 1304 may include, for example, a liquid crystal display (LCD), a light-emitting diode (LED) display, an organic light-emitting diode (OLED) display, a microelectromechanical system (MEMS) display, or an electronic paper display. It is used to display user-viewable content (e.g., text, images, videos, icons, symbols, etc.). In this embodiment, the display module may be implemented as a display screen.
[0246] Optional, Figure 16 The illustrated structure may also include a communication module 1305 for supporting communication between the electronic device and other electronic devices. For example, the communication module may be connected to a network via wireless or wired communication to communicate with other personal terminals or network servers. Wireless communication may employ at least one of the following cellular communication protocols: Long Term Evolution (LTE), LTE-A Advanced, Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Universal Mobile Telecommunications System (UMTS), Wi-Fi, or Global System for Mobile Communications (GSM). Wireless communication may include, for example, short-range communication. Short-range communication may include at least one of Wi-Fi, Bluetooth, Near Field Communication (NFC), Magnetic Stripe Transmission (MST), or GNSS.
[0247] This application also provides a chip system, such as... Figure 17 As shown, the chip system includes at least one processor 1401 and at least one interface circuit 1402. The processor 1401 and the interface circuit 1402 are interconnected via lines. For example, the interface circuit 1402 can be used to receive signals from other devices (e.g., the memory of an electronic device). As another example, the interface circuit 1402 can be used to send signals to other devices (e.g., the processor 1401). Exemplarily, the interface circuit 1402 can read instructions stored in the memory and send those instructions to the processor 1401. When the instructions are executed by the processor 1401, the electronic device can perform the steps in the above embodiments. Of course, the chip system may also include other discrete devices, and this application embodiment does not specifically limit this.
[0248] This application also provides a computer storage medium that includes computer instructions. When the computer instructions are executed on the electronic device, the electronic device causes the electronic device to perform various functions or steps performed by the mobile phone in the above method embodiment.
[0249] This application also provides a computer program product that, when run on a computer, causes the computer to perform the various functions or steps performed by the mobile phone in the above method embodiments.
[0250] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0251] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0252] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0253] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0254] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially or in other words, the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0255] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for ultraviolet detection, characterized in that, The method is applied to an electronic device, the electronic device including a first camera, the first camera including an ultraviolet camera, the method including: The first instruction is used to instruct the detection of ultraviolet radiation indicators. After detecting the first instruction, a first image is captured through the first camera; If the grayscale value of the first image is the target grayscale, then the parameters of the first camera are adjusted, and a third image is acquired through the first camera, wherein the grayscale of the third image is the target grayscale. Determining the ultraviolet index based on the first image includes: determining the ultraviolet index based on the first camera parameters corresponding to the first image, the first camera parameters corresponding to the third image, and the target grayscale. Determine the ultraviolet index based on the first image; The first information is displayed, which includes information about the ultraviolet index.
2. The method according to claim 1, characterized in that, The method further includes: displaying second information before determining the ultraviolet index based on the first image, the second information being used to prompt the first camera to be pointed at a target object, the target object including the sky.
3. The method according to claim 1 or 2, characterized in that, The electronic device further includes a second camera, and the method further includes: acquiring a second image through the second camera; the second camera includes a color camera. After acquiring the first image via the first camera, the method further includes: The user interface displays a portion of the content of a first image and / or a portion of the content of a second image.
4. The method according to claim 1 or 2, characterized in that, After acquiring a first image using a first camera, the method further includes: displaying third information, the third information including parameters of the first camera; the parameters including sensitivity and exposure time.
5. The method according to claim 1 or 2, characterized in that, Acquiring a second image through a second camera includes: simultaneously acquiring a first image through a first camera and acquiring a second image through the second camera; After acquiring the second image through the second camera, the method further includes: determining whether the second image meets a first condition; if the second image meets the first condition, determining an ultraviolet index based on the first image; the first condition includes: the presence of a target object in the second image; or, the first condition includes: the presence of the target object in the second image, and the area ratio of the target object in the second image is greater than or equal to a threshold.
6. The method according to claim 1 or 2, characterized in that, Acquiring a second image via a second camera includes: acquiring a second image via a second camera after detecting the first instruction and before acquiring a first image via a first camera; After acquiring a second image using a second camera, the method includes: determining whether the second image satisfies a first condition; Acquiring the first image through the first camera includes: acquiring the first image through the first camera when it is determined that the second image meets the first condition.
7. The method according to claim 1 or 2, characterized in that, Determining the ultraviolet index based on the first image includes: determining the ultraviolet index based on the grayscale values of the pixels included in the first image.
8. The method according to claim 1 or 2, characterized in that, The method further includes: If the grayscale value of the first image is not the target grayscale, then the parameters of the first camera are adjusted and a fourth image is acquired, wherein the grayscale value of the fourth image is the target grayscale value. Adjust the parameters of the first camera and acquire a fifth image, wherein the grayscale of the fifth image is the target grayscale; Determining the ultraviolet index based on the first image includes: determining the ultraviolet index based on the first camera parameters corresponding to the fourth image, the first camera parameters corresponding to the fifth image, and the target grayscale.
9. The method according to claim 1 or 2, characterized in that, The parameters of the first camera include exposure time and sensitivity.
10. An electronic device, characterized in that, include: A processor, a memory coupled to the processor, the memory for storing computer program code including computer instructions, wherein when the processor reads the computer instructions from the memory, the electronic device causes the electronic device to perform the method of any one of claims 1-9.
11. A computer-readable storage medium storing instructions, characterized in that, When the instructions are executed on an electronic device, the electronic device causes the electronic device to perform the method of any one of claims 1-9.
12. A computer program product containing instructions, characterized in that, When the computer program product is run on an electronic device, the electronic device performs the method of any one of claims 1-9.