Method and device for controlling camera module
By controlling the power and reset pin potentials of the camera module, only the camera collecting images remains powered on while other cameras enter the reset state. This solves the problem of excessive power consumption in multi-camera devices, achieves power savings, and ensures the normal startup of camera applications.
Patent Information
- Application Number
- CN202210193693.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-28
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2042-02-28
AI Technical Summary
In multi-camera electronic devices, cameras that are not capturing images remain powered on, resulting in excessive power consumption.
By controlling the power supply and reset pin potential of the camera module, only the camera that needs to capture images is powered on, and other cameras enter the reset state to save power consumption.
This effectively reduces the power consumption of electronic devices while ensuring the normal startup and switching of camera applications.
Smart Images

Figure CN116723390B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminals, and in particular to a method and device for controlling a camera module. Background Art
[0002] Currently, electronic devices (eg, mobile phones) typically integrate multiple cameras, which can be freely combined to form a variety of shooting modes to meet users' shooting needs in different scenarios.
[0003] In a multi-camera scenario, multiple cameras can be powered on simultaneously. However, among the powered-on cameras, usually only one is used to capture images, while the other cameras are not capturing images but are powered on, which results in high power consumption of the electronic device. Summary of the Invention
[0004] The present application provides a method and device for controlling a camera module, which can reduce the power consumption of an electronic device.
[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0006] In a first aspect, a method for controlling a camera module is provided, which is applied to an electronic device, the electronic device including a first camera module and a second camera module, including: the electronic device receives a first operation from a user; wherein the first operation is used to start a photo-taking function or a video-taking function of a camera application; the electronic device obtains a first shooting mode, a first magnification, and a logical camera identification ID corresponding to the first shooting mode of the camera application; the electronic device determines, based on the logical camera ID, that a camera module to be powered on includes the first camera module and the second camera module, determines, based on the first magnification, that a camera module to collect image data includes the first camera module, and determines, based on the first shooting mode and the first magnification, that a camera module to be reset includes the second camera module; the electronic device raises the potential of the power pin and the reset pin of the first camera module and the second camera module; the electronic device controls the first camera module to collect image data; and the electronic device lowers the potential of the reset pin of the second camera module.
[0007] Based on the method provided in the embodiment of the present application, after the electronic device starts the camera application, it can obtain the first shooting mode, the first magnification and the logical camera identification ID corresponding to the first shooting mode of the camera application. According to the first shooting mode, the first magnification and the logical camera identification ID corresponding to the first shooting mode of the camera application, it can be determined that the camera modules to be powered on include the first camera module and the second camera module, the camera modules to collect image data include the first camera module, and the camera modules to be reset include the second camera module. The electronic device can then pull up the potentials of the power pins and reset pins of the first camera module and the second camera module; and control the first camera module to collect image data. In this way, when the camera application is turned on, the first camera module and the second camera module can be powered on first, and then the first camera module can be controlled to collect image data to ensure that the camera application starts normally, and the second camera module can be controlled to enter the reset state (pulling down the potential of the reset pin so that no current flows through the second camera module), thereby saving power consumption.
[0008] In one possible design, the electronic device further includes a third camera module. If the camera modules to be powered on further include a three-camera module, and the camera modules to be reset further include the third camera module, the method further includes: the electronic device raising the potential of the power pin and reset pin of the third camera module; and the electronic device lowering the potential of the reset pin of the third camera module. In this way, when the camera application is activated, the first, second, and third camera modules can be powered on first, and then the first camera module can be controlled to capture image data to ensure the normal startup of the camera application. The second and third camera modules are then controlled to enter a reset state (lowering the potential of the reset pin so that no current flows through the second and third camera modules) to save power.
[0009] In one possible design, the first shooting mode is the default shooting mode after the camera application is launched, or the shooting mode selected by the user after the camera application is launched; the first magnification is the default magnification after the camera application is launched, or the magnification selected by the user after the camera application is launched. The first shooting mode can be, for example, photo mode, large aperture mode, portrait mode, night mode, video mode, movie mode, professional mode, panorama mode, time-lapse photography mode, watermark mode, etc., and this application does not limit this.
[0010] In one possible design, before determining that the camera module to be reset includes the second camera module based on the first shooting mode and the first magnification, the method further includes: the electronic device queries a first corresponding relationship, the first corresponding relationship including the IDs of the camera modules to be reset corresponding to the multiple shooting modes in multiple magnification intervals; wherein the multiple magnification intervals include a first magnification interval, the first magnification belongs to the first magnification interval, the multiple shooting modes include the first shooting mode, and the first shooting mode corresponds to the ID of the second camera module in the first magnification interval. The first corresponding relationship can be, for example, as shown in Table 3 below. Furthermore, after determining that the camera module to be reset includes the second camera module, the second camera module can be controlled to enter a reset state (pulling down the potential of the reset pin so that no current flows through the second camera module), thereby saving power consumption.
[0011] In one possible design, determining that the camera module to be reset includes the second camera module according to the first shooting mode includes: the electronic device determines that the camera module to be reset includes the second camera module according to the model of the electronic device, the first shooting mode and the first magnification. Electronic devices of different models may correspond to different camera modules to be reset under the first shooting mode and the first magnification. After determining the camera module to be reset corresponding to the model of the electronic device under the first shooting mode and the first magnification, the camera module to be reset (the second camera module) can be controlled to enter the reset state (pull down the potential of the reset pin so that no current flows through the second camera module), thereby saving power consumption for the electronic device of the corresponding model.
[0012] In one possible design, the first correspondence includes the IDs of the camera modules to be reset corresponding to the multiple shooting modes corresponding to the model of the electronic device in multiple magnification ranges. Different models of electronic devices may correspond to different camera modules to be reset in different shooting modes and different magnifications. Based on the first correspondence, the camera modules to be reset corresponding to the corresponding shooting modes and corresponding magnifications of different models of electronic devices can be queried. Furthermore, the camera module to be reset can be controlled to enter the reset state (lowering the potential of the reset pin so that no current flows through the corresponding camera module), thereby saving power consumption.
[0013] In one possible design, before the electronic device determines that the camera modules to be powered on include the first camera module and the second camera module based on the logical camera ID, the method further includes: the electronic device queries a second correspondence, the second correspondence including the IDs of the camera modules corresponding to the multiple logical camera IDs; wherein the multiple logical camera IDs include the logical camera ID corresponding to the first shooting mode, and the logical camera ID corresponding to the first shooting mode corresponds to the first camera module and the second camera module. By querying the second correspondence based on the logical camera ID corresponding to the first shooting mode, the camera modules to be powered on (for example, the first camera module and the second camera module) can be obtained. When the first camera module and the second camera module are both in the powered-on state (the potentials of the power pins and reset pins of the first camera module and the second camera module are pulled high), the first camera module and the second camera module can be quickly switched. That is, the camera module for capturing images can be quickly switched from the first camera module to the second camera module, or from the second camera module to the first camera module, thereby reducing the switching delay of the camera modules.
[0014] In one possible design, before determining that the camera module for collecting image data includes the first camera module based on the first magnification, the method further includes: the electronic device queries a third correspondence, the third correspondence including the IDs of the camera modules for collecting image data corresponding to a plurality of magnification intervals; wherein the plurality of magnification intervals includes the first magnification interval, the first magnification belongs to the first magnification interval, and the first magnification interval corresponds to the ID of the first camera module. It is understandable that different camera modules correspond to different viewing angles and thus to different magnifications. When the user switches the magnification, the camera module for collecting image data can be switched to meet the user's needs.
[0015] In one possible design, the power pin includes a low dropout linear regulator (LDO) power pin.
[0016] In one possible design, the method further includes: the electronic device receives a second operation from the user; wherein the second operation is used to switch the first magnification to a second magnification; the electronic device determines that the camera module for collecting image data includes the second camera module based on the second magnification, and determines that the camera module to be reset includes the first camera module; the electronic device controls the first camera module to stop collecting image data and pulls down the potential of the reset pin of the first camera module; the electronic device pulls up the potential of the reset pin of the second camera module and controls the second camera module to collect image data. In this way, when the user switches the magnification, the camera module for collecting image data (e.g., the second camera module) and the camera module to be reset (e.g., the first camera module) can be re-determined based on the switched magnification (the second magnification). Then, the potential of the reset pin of the second camera module can be pulled up to release the second camera module from the reset state, and the second camera module can be controlled to collect image data. The camera module (first camera module) that previously collected image data can be controlled to stop collecting image data, and the potential of the reset pin of the first camera module can be lowered so that the first camera module enters the reset state (the potential of the reset pin is lowered, so that no current flows through the first camera module), thereby saving power consumption.
[0017] In one possible design, the method further includes: the electronic device receiving a third user operation; wherein the third operation is used to disable the photo or video function of the camera application; the electronic device controlling the first camera module to stop acquiring image data and lowering the potential of the power pin and reset pin of the first camera module; and the electronic device lowering the potential of the power pin of the second camera module. In this way, when the camera application is closed, all camera modules are switched to a powered-off state to save power.
[0018] In a second aspect, the present application provides a chip system comprising one or more interface circuits and one or more processors. The interface circuit and the processor are interconnected via a circuit. The chip system can be applied to an electronic device comprising a communication module and a memory. The interface circuit is configured to receive a signal from the memory of the electronic device and send the received signal to the processor, the signal comprising a computer instruction stored in the memory. When the processor executes the computer instruction, the electronic device can execute the method described in the first aspect and any possible design thereof.
[0019] In a third aspect, the present application provides a computer-readable storage medium comprising computer instructions. When the computer instructions are executed on an electronic device (such as a mobile phone), the electronic device executes the method described in the first aspect and any possible design thereof.
[0020] In a fourth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the method described in the first aspect and any possible design thereof.
[0021] In a fifth aspect, embodiments of the present application provide a camera module control device, comprising a processor coupled to a memory, the memory storing program instructions. When the program instructions stored in the memory are executed by the processor, the device implements the method described in the first aspect and any possible design thereof. The device may be an electronic device or a server device; or it may be a component of the electronic device or server device, such as a chip.
[0022] In the sixth aspect, an embodiment of the present application provides a device for controlling a camera module, which can be divided into different logical units or modules according to their functions, and each unit or module performs different functions, so that the device executes the method described in the first aspect above and any possible design method thereof.
[0023] In a seventh aspect, the present application provides an electronic device, comprising a touch screen, a memory, a display screen, one or more camera modules (including a first camera module and a second camera module), and one or more processors. The memory, the display screen, and the camera are coupled to the processor. The camera is used to capture images, the display screen is used to display images captured by the camera or images generated by the processor, and the memory stores computer program code, the computer program code including computer instructions. When the computer instructions are executed by the processor, the electronic device performs the following steps: receiving a first operation from a user; wherein the first operation is used to activate a photo function or a video function of a camera application; obtaining a first shooting mode, a first magnification, and a logical camera identification ID corresponding to the first shooting mode of the camera application; determining, based on the logical camera ID, that the camera modules to be powered on include the first camera module and the second camera module, determining, based on the first magnification, that the camera modules to be imaged include the first camera module, and determining, based on the first shooting mode and the first magnification, that the camera modules to be reset include the second camera module; raising the potentials of the power pins and reset pins of the first camera module and the second camera module; controlling the first camera module to capture image data; and lowering the potential of the reset pin of the second camera module.
[0024] It can be understood that the beneficial effects that can be achieved by the chip system described in the second aspect, the computer-readable storage medium described in the third aspect, the computer program product described in the fourth aspect, and the devices described in the fifth, sixth, and seventh aspects provided above can refer to the beneficial effects in the first aspect and any possible design method thereof, and will not be repeated here.
[0025] Based on the method provided in the embodiment of the present application, after the electronic device starts the camera application, it can obtain the first shooting mode, the first magnification and the logical camera identification ID corresponding to the first shooting mode of the camera application. According to the first shooting mode, the first magnification and the logical camera identification ID corresponding to the first shooting mode of the camera application, it can be determined that the camera modules to be powered on include the first camera module and the second camera module, the camera modules to collect image data include the first camera module, and the camera modules to be reset include the second camera module. The electronic device can then pull up the potentials of the power pins and reset pins of the first camera module and the second camera module; and control the first camera module to collect image data. In this way, when the camera application is turned on, the first camera module and the second camera module can be powered on first, and then the first camera module can be controlled to collect image data, and the second camera module can be controlled to enter the reset state (pulling down the potential of the reset pin so that no current flows through the second camera module), thereby saving power consumption while ensuring the normal startup of the camera application. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0027] Figure 2 A schematic diagram of the software architecture of an electronic device provided in an embodiment of the present application;
[0028] Figure 3A A schematic diagram of the software architecture of another electronic device provided in an embodiment of the present application;
[0029] Figure 3B A schematic diagram of the software architecture of another electronic device provided in an embodiment of the present application;
[0030] Figure 3C A schematic diagram of the software architecture of another electronic device provided in an embodiment of the present application;
[0031] Figure 4 A schematic diagram of interaction between modules provided in an embodiment of the present application;
[0032] Figure 5 A display schematic diagram provided in an embodiment of the present application;
[0033] Figure 6 A schematic diagram of a state machine provided in an embodiment of the present application;
[0034] Figure 7 A schematic diagram of another state machine provided in an embodiment of the present application;
[0035] Figure 8 Another display schematic diagram provided in an embodiment of the present application;
[0036] Figure 9 Another display schematic diagram provided in an embodiment of the present application;
[0037] Figure 10 A schematic diagram of another state machine provided in an embodiment of the present application;
[0038] Figure 11 A schematic diagram of another interaction between modules provided in an embodiment of the present application;
[0039] Figure 12 A schematic diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the present application, unless otherwise specified, " / " indicates that the objects associated before and after are in an "or" relationship. For example, A / B can represent A or B; "and / or" in the present application is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. In addition, in the description of the present application, unless otherwise specified, "multiple" refers to two or more than two. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple. In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit differences. At the same time, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way for easy understanding.
[0041] To make the description of the following embodiments clear and concise, a brief introduction to the relevant concepts or technologies is first given:
[0042] The working status of the camera: In the embodiment of the present application, the camera may include states such as power-on, reset, reset, configuration completed, streaming and power-off.
[0043] When the camera is powered on, the power and reset pins are pulled high, and no register information is configured. Registers may include, for example, registers for controlling automatic white balance (AWB) and auto exposure (AE).
[0044] When the camera is in reset state, the potential of the camera's power pin is pulled high, the potential of the reset pin is pulled low, and the register information is not configured.
[0045] When the camera is in the de-reset state, the power pin and reset pin are pulled high, and no register information is configured. The de-reset state is similar to the power-on state, except that the de-reset state is transitioned from the reset state, while the power-on state is transitioned from the power-off state.
[0046] When the camera is in the configuration complete state, the potential of the camera's power pin is pulled high, the register information configuration is completed, and image data collection has not yet begun.
[0047] When the camera is in the outgoing stream state, the potential of the camera's power pin is pulled high, the potential of the reset pin is pulled high, the register information configuration is completed, and image data can be collected.
[0048] When the camera is powered off, the power pin and reset pin of the camera are pulled low and the register information is cleared.
[0049] Metadata, also known as intermediary data or relay data, is data about data, primarily describing the properties of the data. In embodiments of the present application, metadata may include information indicating whether a camera (e.g., a wide-angle camera, an ultra-wide-angle camera, or a telephoto camera) needs to be reset.
[0050] A structure is a collection of multiple variables or arrays. The variables or arrays can be of the same or different types, and each variable or array is called a member of the structure. In the embodiments of the present application, the structure can be used to indicate the identity of the physical camera to be powered on and / or the identity of the physical camera to be streamed.
[0051] Figure 1 Schematic diagram of the structure of an electronic device 100 provided in an embodiment of the present application. Figure 1As 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, an antenna 1, an 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, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0052] Among them, the sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light 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.
[0053] It should be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 100. In other embodiments, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0054] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0055] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0056] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0057] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.
[0058] It is understood that the interface connection relationship between the modules illustrated in this embodiment is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.
[0059] The charging management module 140 is configured to receive charging input from a charger. While charging the battery 142 , the charging management module 140 can also provide power to the electronic device through the power management module 141 .
[0060] 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 and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, and the wireless communication module 160. In some other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be provided in the same device.
[0061] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0062] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network.
[0063] The mobile communication module 150 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low-noise amplifier (LNA), and the like. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signals modulated by the modem processor and convert them into electromagnetic waves for radiation via the antenna 1.
[0064] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium- or high-frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs sound signals through an audio device (including but not limited to the speaker 170A, the receiver 170B, etc.) or displays images or videos through the display screen 194.
[0065] The wireless communication module 160 can provide wireless communication solutions including WLAN (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc. applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signal, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0066] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0067] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0068] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), a light-emitting diode (LED), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED).
[0069] The electronic device 100 can realize the shooting function through the ISP, camera 193, video codec, GPU, display screen 194 and application processor. The ISP is used to process the data fed back by the camera 193. The camera 193 is used to capture still images or videos. The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. The video codec is used to compress or decompress digital videos. The electronic device 100 can support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as: Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0070] Camera 193 may include 1 to N cameras. For example, the electronic device may include 2 front cameras and 3 rear cameras. Among them, the front camera may include a front main camera and a TOF camera. Among them, the TOF camera may include TX and RX, TX may be used to transmit light signals (infrared light or laser pulses), and RX may be used to receive imaging. TX may be, for example, an infrared light transmitter. RX may be, for example, a complementary metal oxide semiconductor (CMOS) or a charge coupled device (CCD) image sensor. Optionally, the front camera may also include a front secondary camera.
[0071] Among them, the rear camera may include, for example, an ultra-wide-angle camera, a wide-angle camera (also referred to as a main camera), and a telephoto camera, etc. Of course, the rear camera may include other types of cameras, for example, a depth camera module, a black and white camera module, a macro camera module, etc., which is not limited in this application.
[0072] In an embodiment of the present application, a camera module such as an ultra-wide-angle camera, a wide-angle camera, or a telephoto camera may include a power pin and a reset pin. Among them, the power pin may include a low dropout linear voltage regulator (LDO) power pin. When the power pin and the reset pin are pulled high at the same time, the voltage of the camera module increases and current flows through. When the potential of the power pin is pulled high, but the potential of the reset pin is pulled low, the voltage of the camera module increases but no current flows through. When the power pin and the reset pin are pulled low at the same time, the voltage of the camera module decreases and no current flows through.
[0073] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.
[0074] The external memory 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 memory interface 120 to implement a data storage function. For example, files such as music and videos are saved in the external memory card. The internal memory 121 can be used to store computer executable program code, and the executable program code includes instructions. The processor 110 can execute various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. For example, in an embodiment of the present application, the processor 110 can execute instructions stored in the internal memory 121, and the internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0075] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0076] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. The speaker 170A, also known as a "speaker," is used to convert audio electrical signals into sound signals. The receiver 170B, also known as a "handset," is used to convert audio electrical signals into sound signals. The microphone 170C, also known as a "microphone" or "microphone," is used to convert sound signals into electrical signals. The headphone jack 170D is used to connect wired headphones.
[0077] The buttons 190 include a power button, a volume button, etc. The buttons 190 can be mechanical buttons. They can also be touch buttons. The electronic device 100 can receive button inputs and generate key signal inputs related to the user settings and function controls of the electronic device 100. The motor 191 can generate vibration prompts. The motor 191 can be used for incoming call vibration prompts or for touch vibration feedback. The indicator 192 can be an indicator light that can be used to indicate the charging status, power changes, messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or removing it from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
[0078] The methods in the following embodiments can all be implemented in the electronic device 100 having the above hardware structure.
[0079] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present invention, the Android system with a layered architecture is used as an example to illustrate the software structure of the electronic device 100.
[0080] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through interfaces. In some embodiments, the Android system may include an application layer, an application framework layer, an Android runtime (Android runtime) and a system library, a hardware abstraction layer (HAL) and a kernel layer. It should be noted that the embodiments of the present application are illustrated by taking the Android system as an example. In other operating systems (such as Hongmeng system, IOS system, etc.), as long as the functions implemented by each functional module are similar to those of the embodiments of the present application, the solutions of the present application can also be implemented.
[0081] Among them, the application layer can include a series of application packages.
[0082] like Figure 2 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, wireless local area network (WLAN), Bluetooth, music, video, short message, lock screen application, setting application, etc. Of course, the application layer may also include other application packages, such as payment application, shopping application, banking application, chat application or financial application, etc., which are not limited in this application.
[0083] In the embodiment of the present application, an application with a shooting function, such as a camera application, can be installed in the application layer. The camera application has the functions of shooting and recording. Of course, when other applications need to use the shooting function, they can also call the camera application to implement the shooting function.
[0084] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions. For example, it may include an activity manager, a window manager, a content provider, a view system, a resource manager, a notification manager, and a camera service. This embodiment of the application does not impose any restrictions on this.
[0085] The Camera Service can be started when the electronic device is powered on. During operation, the Camera Service can interact with the Camera HAL in the Hardware Abstraction Layer (HAL).
[0086] The system library can include multiple functional modules, such as a surface manager, media libraries, a 3D graphics processing library (such as OpenGL ES), and a 2D graphics engine (such as SGL).
[0087] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
[0088] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0089] OpenGL ES is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0090] SGL is a graphics engine for 2D graphics.
[0091] The Android runtime consists of core libraries and a virtual machine (VM). The Android runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one for Java-based functions and the other for the Android core library. The application layer and application framework layer run in the VM. The VM executes Java files from the application layer and application framework layer as binary files. The VM is responsible for performing functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0092] The HAL layer is an encapsulation of the Linux kernel driver, providing an interface to the upper layer and shielding the implementation details of the low-level hardware.
[0093] The HAL layer may include Wi-Fi HAL, audio HAL, camera HAL, etc.
[0094] The Camera HAL is the core software framework for the Camera application, responsible for interacting with the phone's capture hardware (e.g., the camera). While hiding the implementation details of the hardware (e.g., specific image processing algorithms), the Camera HAL provides the Android system with an interface for accessing the hardware.
[0095] In an embodiment of the present application, the camera HAL may include a sensor node, a multi-camera use case, and a multi-camera decision module. Among them, the multi-camera decision module is used to adapt the initialization phase logic of opening the camera application (for example, determining the ID of the camera to be reset when opening the camera application), switching the camera / phase logic (for example, determining the ID of the camera to be reset when switching the camera) and closing the camera application phase logic (for example, determining the ID of the camera to be reset when closing the camera application), etc. The multi-camera use case is used to encapsulate data. For example, the data can be encapsulated in a structure or metadata. The sensor node is used to interact with the camera driver and send corresponding control commands to the corresponding camera driver according to the camera ID.
[0096] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.
[0097] Among them, the camera driver is the driver layer of the Camera device, which is mainly responsible for interacting with the hardware.
[0098] In the embodiment of the present application, the camera driver may include the driver corresponding to the ultra-wide-angle camera, the driver corresponding to the wide-angle camera, the driver corresponding to the telephoto camera, etc.
[0099] The hardware layer includes a display, a camera, etc. The camera may include, for example, an ultra-wide-angle camera (also referred to as an ultra-wide-angle camera module), a wide-angle camera (also referred to as a wide-angle camera module), a telephoto camera (also referred to as a telephoto camera module), etc.
[0100] Below, taking a mobile phone as an electronic device as an example, the software modules and the interactions between modules involved in the method for controlling the camera module provided in the embodiment of the present application are explained.
[0101] like Figure 3AAs shown in the control flow, in response to a user opening the camera app (i.e., receiving a command to open the camera app), the camera application can determine the current shooting mode (e.g., photo mode), the logical camera ID corresponding to the current shooting mode, and the camera magnification (e.g., 1x). The camera application can send the current shooting mode, logical camera ID, and camera magnification to the camera service. The camera service can send the current shooting mode, logical camera ID, and camera magnification to the multi-camera decision module. The multi-camera decision module can determine the physical camera ID (sensor ID) to be powered on and streamed based on the logical camera ID and camera magnification, and determine the physical camera ID to be reset based on the product model (electronic device model) and the current shooting mode. For example, the cameras to be powered on include ultra-wide-angle cameras, wide-angle cameras, and telephoto cameras; the cameras to be streamed include wide-angle cameras; and the cameras to be reset include ultra-wide-angle cameras and telephoto cameras. The multi-camera decision module can then determine the camera IDs to be powered on, streamed, and reset, and send these camera IDs to the multi-camera use case. The multi-camera use case can send the IDs of cameras to be powered on, streaming, and reset to the sensor node. The sensor node can then send corresponding commands to the corresponding camera drivers based on the IDs of the cameras to be powered on, streaming, and reset. For example, the sensor node can first send a command to the driver corresponding to the wide-angle camera, instructing the wide-angle camera to enter the power-on state; a command to the driver corresponding to the ultra-wide-angle camera, instructing the ultra-wide-angle camera to enter the power-on state; and a command to the driver corresponding to the telephoto camera, instructing the telephoto camera to enter the power-on state. The sensor node can then send a command to the driver corresponding to the wide-angle camera, instructing the wide-angle camera to enter the configuration complete state and streaming state, and a command to the drivers corresponding to the ultra-wide-angle camera and telephoto camera, instructing the ultra-wide-angle camera and telephoto camera to enter the reset state. The driver corresponding to the wide-angle camera can control the wide-angle camera to enter the power-on state, the configuration complete state, and the streaming state, sequentially. The driver corresponding to the ultra-wide-angle camera can control the ultra-wide-angle camera to enter the power-on state and the reset state, sequentially. The driver corresponding to the telephoto camera can control the telephoto camera to enter the power-on state and the reset state, sequentially. In this way, when the camera app is opened, the wide-angle camera can enter the outgoing stream state to collect image data, while the ultra-wide-angle camera and telephoto camera can enter the reset state to save power.
[0102] See also Figure 3ADuring the data stream transmission process, a camera in the outgoing stream state (for example, a wide-angle camera) can capture image data at a certain frame rate. The wide-angle camera can transmit each frame of captured image data to the camera HAL through the camera driver. The camera HAL can report each frame of captured image data after image processing to the camera application through the camera service. The camera application can display each frame of captured image data on the display interface. Alternatively, the camera application can save each frame of captured image data on the phone as a photo or video.
[0103] like Figure 3B As shown, referring to the control flow transmission process, the camera application responds to the user's operation of switching cameras (or switching magnifications) (i.e., receiving an instruction to switch cameras / magnifications) by sending the switched physical camera ID / magnification to the camera service. The camera service can send the switched physical camera ID / magnification to the multi-camera decision module. The multi-camera decision module can redetermine the physical camera ID to be streamed and the physical camera ID to be reset based on the switched physical camera ID / magnification. For example, the camera to be streamed can be updated from a wide-angle camera to an ultra-wide-angle camera, and the camera to be reset can be updated from an ultra-wide-angle camera and a telephoto camera to a wide-angle camera and a telephoto camera (i.e., the telephoto camera remains in a reset state). Then, the multi-camera decision module can send the re-determined camera IDs to be streamed and reset to the multi-camera use case. The multi-camera use case can send the camera IDs to be streamed and reset to the sensor node. The sensor node can send corresponding commands to the corresponding camera driver based on the camera IDs to be streamed and reset. Exemplarily, the sensor node may send a command to the driver corresponding to the wide-angle camera to instruct the wide-angle camera to enter the configuration completion state and the reset state, and send a command to the driver corresponding to the ultra-wide-angle camera to instruct the ultra-wide-angle camera to enter the reset state, the configuration completion state, and the outflow state. The driver corresponding to the wide-angle camera may control the wide-angle camera to enter the configuration completion state and the reset state from the outflow state in sequence. The driver corresponding to the ultra-wide-angle camera may control the ultra-wide-angle camera to enter the reset state, the configuration completion state, and the outflow state from the reset state in sequence. In this way, in response to the user's operation of switching cameras (or switching magnifications), the ultra-wide-angle camera may enter the outflow state to collect image data. The wide-angle camera and the telephoto camera may enter the reset state to save power consumption.
[0104] See also Figure 3BDuring the data stream transmission process, a camera in the outgoing stream state (for example, an ultra-wide-angle camera) can capture image data at a certain frame rate. The ultra-wide-angle camera can transmit each frame of captured image data to the camera HAL through the camera driver. The camera HAL can report each frame of captured image data after image processing to the camera application through the camera service. The camera application can display each frame of captured image data on the display interface. Alternatively, the camera application can save each frame of captured image data on the phone as a photo or video.
[0105] The above describes the situation where the user switches from a wide-angle camera to an ultra-wide-angle camera. Of course, the user can also switch from a wide-angle camera to a telephoto camera, or from an ultra-wide-angle camera to a telephoto camera, and so on. After the user switches from a wide-angle camera or an ultra-wide-angle camera to a telephoto camera, the electronic device can switch the outgoing camera and adjust the camera that needs to enter the reset state accordingly. For example, the outgoing camera can be switched to a telephoto camera, and the wide-angle camera and the ultra-wide-angle camera can enter the reset state. The specific process can be referred to the description of switching from a wide-angle camera to an ultra-wide-angle camera above, and will not be repeated here.
[0106] like Figure 3CAs shown in the control flow transfer process, in response to the user closing the camera application (i.e., receiving a camera shutdown instruction), the camera application can send a camera application shutdown instruction to the camera service. The camera service sends the camera application shutdown instruction to the multi-camera decision module in the camera HAL. The multi-camera decision module can determine the IDs of the cameras to be powered off, stopped, and reset, and then send the IDs of the cameras to be powered off, stopped, and reset to the multi-camera use case. For example, the cameras to be powered off include the wide-angle camera, the ultra-wide-angle camera, and the telephoto camera. The physical cameras to be stopped include the wide-angle camera, and the physical cameras to be reset include the ultra-wide-angle camera and the telephoto camera. The multi-camera use case can send the IDs of the cameras to be powered off, stopped, and reset to the sensor node. The sensor node can send corresponding commands to the corresponding camera driver based on the ID of the camera to be powered off. For example, the sensor node can sequentially send a reset command and a power-off command to the driver corresponding to the ultra-wide-angle camera, a stop-streaming command and a power-off command to the driver corresponding to the wide-angle camera, and a reset command and a power-off command to the driver corresponding to the telephoto camera. The driver for the ultra-wide-angle camera sequentially pulls up the reset pin of the ultra-wide-angle camera to control the ultra-wide-angle camera to enter the reset state, then pulls down the power and reset pins of the ultra-wide-angle camera to control the ultra-wide-angle camera to enter the power-off state. Alternatively, the driver for the ultra-wide-angle camera can directly pull down the power pin of the ultra-wide-angle camera to control the ultra-wide-angle camera to enter the power-off state. The driver for the wide-angle camera sequentially issues a shutdown command to control the wide-angle camera to stop collecting image information, then pulls down the power pin of the wide-angle camera to control the wide-angle camera to enter the power-off state. The driver for the telephoto camera sequentially pulls up the reset pin of the telephoto camera to control the telephoto camera to enter the reset state, then pulls down the power pin of the telephoto camera to control the telephoto camera to enter the power-off state. Alternatively, the driver for the telephoto camera can directly pull down the power pin of the telephoto camera to control the telephoto camera to enter the power-off state. In this way, when the camera application is closed, all cameras are switched to the power-off state.
[0107] like Figure 4 As shown, an embodiment of the present application provides a method for controlling a camera module, comprising:
[0108] 401. In response to receiving an operation from a user to open the camera application, the camera application sends the current shooting mode, logical camera ID, and magnification to the camera service.
[0109] After receiving the user's operation of opening the camera application, the camera application can determine the current shooting mode (first shooting mode), the logical camera ID (logical Camera ID) and the magnification (first magnification).
[0110] It is understood that a variety of shooting modes can be set in the camera application, for example, including photo mode, large aperture mode, portrait mode, night mode, video mode, movie mode, professional mode, panoramic mode, time-lapse photography mode, watermark mode, etc. The current shooting mode can be the default shooting mode or the shooting mode selected by the user. It is understood that when the user opens the camera application, the camera application can use the default shooting mode, which can be the factory setting shooting mode. Or the camera application can use the shooting mode selected by the user the last time the camera was used (i.e., the shooting mode used when the camera application was last closed).
[0111] Different shooting modes may correspond to different logical Camera IDs. For example, when the current shooting mode is photo mode, the logical Camera ID may be 6.
[0112] For example, Figure 5 As shown in (a) of FIG, the electronic device (e.g., mobile phone) can receive an operation of a user clicking on the icon 502 of the camera application on the desktop 501 (i.e., an operation of opening the camera application). In response to the operation of the user clicking on the icon 502 of the camera application on the desktop 501, as shown in FIG. Figure 5 As shown in (b) of FIG. 5 , the mobile phone may display a shooting preview interface 503 corresponding to the current shooting mode (eg, photo mode). The shooting preview interface 503 may include a control 504 for adjusting the magnification and a control 505 . The control 504 may be used to prompt the user that the current magnification is 1x.
[0113] The following example uses the current shooting mode as photo mode, the logical Camera ID as 6, and the magnification as 1x.
[0114] 402. The camera service receives the current shooting mode, logical camera ID, and magnification sent by the camera application, and sends the current shooting mode, logical camera ID, and magnification to the multi-camera decision module in the camera HAL.
[0115] 403. The multi-camera decision module determines the ID of the physical camera to be powered on based on the logical camera ID, determines the ID of the physical camera to be output based on the magnification, and determines the ID of the physical camera to be reset based on the model of the electronic device, the current shooting mode, and the magnification.
[0116] First, we introduce the process of how the multi-camera decision module determines the ID of the physical camera to be powered on based on the logical camera ID.
[0117] The multi-camera decision module can store the corresponding information between the logical camera ID and the physical camera ID. For example, the corresponding information can be shown in Table 1:
[0118] Table 1
[0119]
[0120] The physical camera ID corresponding to the logical camera ID is the ID of the physical camera to be powered on. For example, if the logical camera ID is 6, the physical camera IDs to be powered on can include 0, 1, and 2. In other words, the physical cameras to be powered on can include the ultra-wide-angle camera, the wide-angle camera, and the telephoto camera.
[0121] The following describes the process by which the multi-camera decision module determines the ID of the physical camera to be used for outgoing streaming based on the magnification.
[0122] The multi-camera decision module can store the correspondence information between the magnification range and the ID of the physical camera. For example, the correspondence information can be shown in Table 2:
[0123] Table 2
[0124] Ratio range The physical camera corresponding to the magnification range and the ID of the physical camera [0.5x-0.8x) 0 (Ultra-wide-angle camera ID) [0.8x-1x) 0 (ultra-wide-angle camera ID), 1 (wide-angle camera ID) [1x-4.5x) 1 (Wide-angle camera ID) [4.5x-5x) 1 (wide-angle camera ID), 2 (telephoto camera ID) [5x-50x) 2 (telephoto camera ID)
[0125] The multi-camera decision module can determine the magnification range (for example, [1x-4.5x)) corresponding to the magnification sent by the camera application (for example, 1x). The ID of the physical camera corresponding to the magnification range (for example, [1x-4.5x)) is the ID of the physical camera to be streamed (for example, the ID of the physical camera to be streamed is 1).
[0126] The following describes the process by which the multi-camera decision module determines the ID of the physical camera to be reset based on the model of the electronic device, the current shooting mode, and the magnification.
[0127] The multi-camera decision module can store the corresponding information of the electronic device model, shooting mode, magnification range and the ID of the physical camera to be reset. For example, the corresponding information can be shown in Table 3:
[0128] Table 3
[0129]
[0130] The multi-camera decision module determines the ID of the physical camera to be reset based on the electronic device model, current shooting mode, and magnification. For example, if the electronic device model is Magic 3, the current shooting mode is still mode, and the magnification is 1x (in the range [1x-4.5x]), the IDs of the physical cameras to be reset include 0 and 2. This means that the physical cameras to be reset include the ultra-wide-angle camera and the telephoto camera.
[0131] The following is an example in which the ID of the physical camera to be powered on includes the ID of the wide-angle camera, the ID of the ultra-wide-angle camera, and the ID of the telephoto camera; the ID of the physical camera to be streamed includes the ID of the wide-angle camera; and the ID of the physical camera to be reset includes the ID of the ultra-wide-angle camera and the ID of the telephoto camera.
[0132] 404. The multi-camera decision module sends the ID of the physical camera to be powered on, the ID of the physical camera to be streamed, and the ID of the physical camera to be reset to the multi-camera use case in the camera HAL.
[0133] The multi-camera decision module can send the ID of the physical camera to be powered on, the ID of the physical camera to be streamed, and the ID of the physical camera to be reset to the multi-camera use case respectively. That is, the multi-camera decision module can indicate the ID of the physical camera to be powered on, the ID of the physical camera to be streamed, and the ID of the physical camera to be reset to the multi-camera use case respectively through different instructions. Alternatively, the multi-camera decision module can send the ID of the physical camera to be powered on, the ID of the physical camera to be streamed, and the ID of the physical camera to be reset to the multi-camera use case at the same time. That is, the multi-camera decision module can indicate the ID of the physical camera to be powered on, the ID of the physical camera to be streamed, and the ID of the physical camera to be reset to the multi-camera use case through one instruction. This application does not make any specific restrictions on this.
[0134] 405. The multi-camera use case sends a first structure (carrying an identifier for indicating the physical camera to be powered on), a second structure (carrying an identifier for indicating the physical camera to be streamed), and first metadata (carrying information for indicating the physical camera to be reset) to the sensor node.
[0135] The first structure carries the identifier of the physical camera to be powered on. For example, the first structure may carry the ID of a wide-angle camera, an ultra-wide-angle camera, and a telephoto camera. The second structure carries the identifier of the physical camera to be used for outgoing streaming. For example, the second structure may carry the ID of a wide-angle camera.
[0136] It should be noted that the first structure and the second structure can be the same structure or different structures. The first structure and the second structure can be sent to the sensor node via different messages, or can be sent to the sensor node via the same message, which is not limited in this application.
[0137] Among them, the first metadata carries information for indicating the physical camera to be reset. For example, the first metadata may include reset flags corresponding to the ultra-wide-angle camera and the telephoto camera. The reset flags corresponding to the ultra-wide-angle camera and the telephoto camera may be 1, indicating that the ultra-wide-angle camera and the telephoto camera are the cameras to be reset. Optionally, the first metadata may also carry a reset flag corresponding to the wide-angle camera. The reset flag corresponding to the wide-angle camera may be 0, indicating that the wide-angle camera is not the camera to be reset. In an embodiment of the present application, the use of metadata to carry information for indicating the physical camera to be reset makes the present solution more compatible and adaptable to existing platforms (for example, Qualcomm platforms).
[0138] 406. The sensor node sends a power-on command, a configuration completion command, and a stream output command to the driver corresponding to the wide-angle camera in sequence, sends a power-on command and a reset command to the driver corresponding to the ultra-wide-angle camera in sequence, and sends a power-on command and a reset command to the driver corresponding to the telephoto camera in sequence.
[0139] After receiving the first structure, the second structure, and the first metadata, the sensor node can determine that the physical cameras to be powered on include a wide-angle camera, an ultra-wide-angle camera, and a telephoto camera; the physical cameras to be streamed include a wide-angle camera; and the physical cameras to be reset include an ultra-wide-angle camera and a telephoto camera. Thus, the sensor node can sequentially send a power-on command, a configuration completion command, and a stream-out command to the driver corresponding to the wide-angle camera, so that the wide-angle camera can eventually enter the stream-out state. The sensor node can sequentially send a power-on command and a reset command to the driver corresponding to the ultra-wide-angle camera, so that the ultra-wide-angle camera can eventually enter the reset state. The sensor node can sequentially send a power-on command and a reset command to the driver corresponding to the telephoto camera, so that the telephoto camera can eventually enter the reset state.
[0140] 407. The driver corresponding to the wide-angle camera sequentially raises the levels of the power pin and the reset pin of the wide-angle camera, writes the configuration parameters into the register of the wide-angle camera, and issues a start (STREAMON) command to control the wide-angle camera to start collecting image information.
[0141] The driver corresponding to the wide-angle camera can sequentially receive a power-on command, a configuration completion command, and a stream-out command from the sensor node. In response to the power-on command, the driver corresponding to the wide-angle camera can raise the voltage levels of the wide-angle camera's power and reset pins. In response to the configuration completion command, the driver corresponding to the wide-angle camera can write configuration parameters into the wide-angle camera's registers. The registers may include, for example, registers for controlling white balance and registers for controlling automatic exposure (AE). In response to the stream-out command, the driver corresponding to the wide-angle camera can issue a start (STREAMON) command to control the wide-angle camera to begin collecting image information. In this way, the wide-angle camera can eventually enter the stream-out state and begin collecting image information.
[0142] 408. The driver corresponding to the ultra-wide-angle camera sequentially pulls up the levels of the power pin and the reset pin of the ultra-wide-angle camera, and pulls down the reset pin of the ultra-wide-angle camera to control the ultra-wide-angle camera to enter a reset state.
[0143] The driver corresponding to the ultra-wide-angle camera can sequentially receive power-on and reset commands from the sensor node. In response to the power-on command, the driver corresponding to the ultra-wide-angle camera can pull up the power pin and reset pin of the ultra-wide-angle camera. In response to the reset command, the driver corresponding to the ultra-wide-angle camera can pull down the reset pin. For example, the driver corresponding to the ultra-wide-angle camera can send a command with reset_gpio (general purpose input / output) set to 1 to the ultra-wide-angle camera to pull down the reset pin. In this way, the ultra-wide-angle camera can eventually enter a reset state. In the reset state, no current flows through the ultra-wide-angle camera, which can save power consumption.
[0144] 409. The driver corresponding to the telephoto camera sequentially pulls up the levels of the power pin and the reset pin of the telephoto camera, and pulls down the reset pin of the telephoto camera to control the telephoto camera to enter a reset state.
[0145] The driver for the telephoto camera can sequentially receive power-on and reset commands from the sensor node. In response to the power-on command, the driver for the telephoto camera can pull up the power and reset pins of the telephoto camera. In response to the reset command, the driver for the telephoto camera can pull down the reset pin. For example, the driver for the telephoto camera can send a command with reset_gpio set to 1 to pull down the reset pin. This eventually puts the telephoto camera into a reset state, where no current flows through the camera, saving power.
[0146] It should be noted that there is no necessary execution order between steps 407 to 409. They may be executed simultaneously or one after another. This embodiment does not specifically limit the execution order between the steps.
[0147] In addition, the sensor node can maintain the state machine of each camera during the camera opening phase. The state machine of a camera is a mathematical model used to indicate the state transition of the camera. For example, Figure 6 As shown, during the camera startup phase, the wide-angle camera can first be in the power-on state, then switch to the configuration complete state, then switch to the streaming state (display), and remain in the streaming state. The ultra-wide-angle camera can first be in the power-on state, then switch to the reset state, and remain in the reset state. The telephoto camera can first be in the power-on state, then switch to the reset state, and remain in the reset state.
[0148] 410. The wide-angle camera sends the collected image data to a driver corresponding to the wide-angle camera.
[0149] 411. The driver corresponding to the wide-angle camera sends the image data collected by the wide-angle camera to the sensor node.
[0150] 412. The sensor node sends image data collected by the wide-angle camera to the multi-camera use case.
[0151] 413. The multi-camera use case sends image data collected by the wide-angle camera to the camera service.
[0152] Optionally, the sensor node may directly send image data collected by the wide-angle camera to the camera service, which is not limited in this application.
[0153] 414. The camera service sends image data captured by the wide-angle camera to the camera application.
[0154] 415. The camera application displays image data collected by the wide-angle camera.
[0155] like Figure 5 As shown in (b) in FIG. 5 , the camera application may display a preview interface 503 through the display screen of the mobile phone, and the preview interface 503 may display image data from the wide-angle camera.
[0156] In some cases, the user may switch the magnification in the current shooting mode. At this time, the camera that is out of the stream should be switched and the camera that needs to enter the reset state should be adjusted accordingly. Specifically, the method provided in the embodiment of the present application further includes the following steps:
[0157] 416. In response to the user's operation of switching the magnification, the camera application sends the switched magnification to the camera service.
[0158] The following description takes the case where the camera after switching is an ultra-wide-angle camera and the magnification after switching is 0.7x as an example.
[0159] 417. The camera service receives the switched magnification sent by the camera application and sends the switched magnification to the multi-camera decision module.
[0160] 418. The multi-camera decision module determines the ID of the physical camera to be used for outgoing streaming and the ID of the physical camera to be reset based on the current shooting mode and the magnification after switching.
[0161] The multi-camera decision module can determine the magnification range (e.g., [0.5x-0.8x)) corresponding to the switched magnification (e.g., 0.7x) by looking up a table (e.g., Table 2). This magnification range (e.g., [0.5x-0.8x)) corresponds to the ID of the ultra-wide-angle camera (e.g., ID 0). This means that the ultra-wide-angle camera is the physical camera to be used for streaming, and the ID of the physical camera to be used for streaming is 0.
[0162] The multi-camera decision module can determine the magnification range corresponding to 0.7x in the photo mode (e.g., [0.5x-0.8x)) by looking up a table (e.g., Table 3). This magnification range (e.g., [0.5x-0.8x)) corresponds to the ID of the wide-angle camera and the ID of the telephoto camera (e.g., IDs including 1 and 2). This means that the wide-angle camera and the telephoto camera are the physical cameras to be reset, and the IDs of the physical cameras to be reset include 1 and 2.
[0163] 419. The multi-camera decision module sends the ID of the physical camera to be used for outgoing streaming and the ID of the physical camera to be reset to the multi-camera use case.
[0164] The multi-camera decision module can send the ID of the physical camera to be streamed and the ID of the physical camera to be reset to the multi-camera use case respectively. That is, the multi-camera decision module can indicate the ID of the physical camera to be streamed and the ID of the physical camera to be reset to the multi-camera use case respectively through different instructions. Alternatively, the multi-camera decision module can send the ID of the physical camera to be streamed and the ID of the physical camera to be reset to the multi-camera use case at the same time. That is, the multi-camera decision module can indicate the ID of the physical camera to be streamed and the ID of the physical camera to be reset to the multi-camera use case through one instruction. This application does not make any specific restrictions on this.
[0165] 420. The multi-camera use case sends a third structure (carrying an identifier for indicating a new physical camera to be used for outgoing flow) and second metadata (carrying information for indicating a new physical camera to be reset) to the sensor node.
[0166] The third structure carries the ID of the updated physical camera to be used for outgoing traffic. For example, the third structure may carry the ID of an ultra-wide-angle camera.
[0167] The second metadata carries updated information about the physical camera to be reset. For example, the second metadata may include reset flags corresponding to the wide-angle camera and the telephoto camera. The reset flags corresponding to the wide-angle camera and the telephoto camera may be 1, indicating that the ultra-wide-angle camera and the telephoto camera are the cameras to be reset. Optionally, the first metadata may also carry a reset flag corresponding to the ultra-wide-angle camera. The reset flag corresponding to the ultra-wide-angle camera may be 0, indicating that the ultra-wide-angle camera is not the camera to be reset.
[0168] 421. The sensor node sends a stop flow command and a reset command to the driver corresponding to the wide-angle camera in sequence, and sends a reset command, a configuration completion command, and a flow output command to the driver corresponding to the ultra-wide-angle camera in sequence.
[0169] After receiving the third structure and the second metadata, the sensor node can determine that the new physical camera to be streamed is the ultra-wide-angle camera; the new physical cameras to be reset include the wide-angle camera and the telephoto camera. Therefore, the sensor node can send a stop-streaming command and a reset command to the driver corresponding to the wide-angle camera in sequence, so that the wide-angle camera can finally enter the reset state. The sensor node can send a reset command, a configuration completion command, and a stream-out command to the driver corresponding to the ultra-wide-angle camera in sequence, so that the ultra-wide-angle camera can finally enter the stream-out state. Since the telephoto camera is already in the reset state, the sensor node does not need to send a reset command to the telephoto camera, and the telephoto camera can remain in the reset state.
[0170] 422. The driver corresponding to the wide-angle camera sends a stop (STREAMOFF) command to control the wide-angle camera to stop collecting image information, and then pulls down the reset pin of the wide-angle camera to control the ultra-wide-angle camera to enter the reset state.
[0171] The driver for the wide-angle camera can sequentially receive a stop-streaming command and a reset command from the sensor node. In response to the stop-streaming command, the driver for the wide-angle camera can control the wide-angle camera to stop collecting image information. In response to the reset command, the driver for the wide-angle camera can pull down the reset pin. For example, the driver for the wide-angle camera can send a command with reset_gpio set to 1 to the wide-angle camera to pull down the reset pin. This eventually puts the wide-angle camera into a reset state, in which no current flows through the camera, saving power.
[0172] 423. The driver corresponding to the ultra-wide-angle camera first pulls up the level of the reset pin of the ultra-wide-angle camera to control the ultra-wide-angle camera to enter the reset state, then writes the configuration parameters into the register of the ultra-wide-angle camera, and then issues a start (STREAMON) command to control the ultra-wide-angle camera to start collecting image information.
[0173] The driver corresponding to the ultra-wide-angle camera can receive a reset command, a configuration completion command, and a stream output command from the sensor node in sequence. In response to the reset command, the driver corresponding to the ultra-wide-angle camera can pull up the level of the reset pin of the ultra-wide-angle camera to control the ultra-wide-angle camera to enter the reset state. For example, the driver corresponding to the ultra-wide-angle camera can send a command with reset_gpio set to 0 to the ultra-wide-angle camera to pull up the level of the reset pin. In response to the configuration completion command, the driver corresponding to the ultra-wide-angle camera can write configuration parameters to the registers of the ultra-wide-angle camera. The registers may include, for example, registers for controlling AWB and registers for controlling AE. In response to the stream output command, the driver corresponding to the ultra-wide-angle camera can issue a start (STREAMON) command to control the ultra-wide-angle camera to start collecting image information. In this way, the ultra-wide-angle camera can eventually enter the stream output state and start collecting image information.
[0174] It should be noted that there is no necessary execution order between steps 421 to 423. They may be executed simultaneously or one after another. This embodiment does not specifically limit the execution order between the steps.
[0175] In addition, the sensor node can maintain the state machine of each camera during the camera switching phase. Figure 7 As shown, during the camera switching phase (for example, switching from the wide-angle camera to the ultra-wide-angle camera), the wide-angle camera can transition from the streaming state to the configuration complete state, and then to the reset state. The ultra-wide-angle camera can transition from the reset state to the de-reset state, then to the configuration complete state, and then to the streaming state, and remain in the streaming state. The telephoto camera can remain in the reset state.
[0176] 424. The ultra-wide-angle camera sends the collected image data to a driver corresponding to the ultra-wide-angle camera.
[0177] 425. The driver corresponding to the ultra-wide-angle camera sends the image data collected by the ultra-wide-angle camera to the sensor node.
[0178] 426. The sensor node sends image data collected by the ultra-wide-angle camera to the multi-camera use case.
[0179] 427. The multi-camera use case sends image data collected by the ultra-wide-angle camera to the camera service.
[0180] Optionally, the sensor node may directly send image data collected by the wide-angle camera to the camera service, which is not limited in this application.
[0181] 428. The camera service sends image data captured by the ultra-wide-angle camera to the camera application.
[0182] 429. The camera application displays image data collected by the ultra-wide-angle camera.
[0183] For example, Figure 8 As shown in (a) of FIG, the camera application can display a preview interface 503 through the display screen of the mobile phone. The shooting preview interface 503 may include a control 504 for adjusting the magnification and a control 505. The control 504 can be used to prompt the user that the current magnification is 1x. Figure 8 As shown in (b) of FIG. 5 , in response to the user's operation of reducing the magnification (for example, reducing the magnification to 0.7x), the outgoing camera can be switched to the ultra-wide-angle camera. That is, the preview interface 503 can display image data from the ultra-wide-angle camera.
[0184] The above describes the situation where the user switches from the wide-angle camera to the ultra-wide-angle camera. Of course, the user can also switch from the wide-angle camera to the telephoto camera. After the user switches from the wide-angle camera to the telephoto camera, the electronic device can switch the outgoing camera and adjust the camera that needs to enter the reset state accordingly. For example, the outgoing camera can be switched to the telephoto camera, and the wide-angle camera and ultra-wide-angle camera can enter the reset state. The specific process can be referred to the description of switching from the wide-angle camera to the ultra-wide-angle camera above, and will not be repeated here.
[0185] For example, Figure 9 As shown, the camera application can display a preview interface 503 through the display screen of the mobile phone. In response to the user's operation of increasing the magnification (for example, increasing the magnification to 5x), the preview interface 503 can display image data from the telephoto camera.
[0186] In one possible design, assume that in the range [0.5x-1x), the ultra-wide-angle camera collects image data; in the range [1x-5x), the wide-angle camera collects image data; and in the range [5x-50x), the telephoto camera collects image data. When the user opens the camera app, if the camera app defaults to the current shooting mode as photo mode, the logical camera ID corresponding to the photo mode is 6, and the magnification is 1x. At this time, the cameras to be powered on include the ultra-wide-angle camera, the wide-angle camera, and the telephoto camera; the cameras to be streamed include the wide-angle camera; and the cameras to be reset include the ultra-wide-angle camera and the telephoto camera. If the user continuously increases or decreases the magnification, the state transitions of each camera module can be described as follows.
[0187] On the one hand, in response to the user continuously turning up the magnification (e.g. Figure 9 As shown, the user continues to slide upward in the magnification adjustment area 510 to increase the magnification), and the status of each camera can be as follows Figure 10 As shown in (a) in Figure 10 In (a), when the current magnification is 1x, the wide-angle camera can first be in the power-on state, then transition to the configuration complete state, and then transition to the streaming state, and remain in the streaming state until the user increases the magnification to 5x. After the user increases the magnification to 5x, the wide-angle camera can transition from the streaming state to the configuration complete state, and then transition to the reset state, and remain in the reset state. The ultra-wide-angle camera can first be in the power-on state, then transition to the reset state, and remain in the reset state while the user increases the magnification (for example, from 1x to 50x). The telephoto camera can first be in the power-on state, then transition to the reset state, and remain in the reset state until the user increases the magnification to 4.5x. When the user increases the magnification to 4.5x, the telephoto camera can begin to transition from the reset state to the de-reset state, then transition to the configuration complete state, and then transition to the streaming state, and remain in the streaming state while the user increases the magnification (for example, from 4.5x to 50x). It is understandable that the telephoto camera collects image data in the magnification range of [5x-50x). Based on the method provided in the embodiment of the present application, taking into account the startup delay of the telephoto camera, the telephoto camera can be switched to the outgoing state in advance (for example, the telephoto camera state is switched when the user increases the magnification to 4.5x), thereby avoiding the problem of the telephoto camera not being switched to the outgoing state in time, resulting in the phone screen lagging or black screen. Of course, the magnification at which the telephoto camera state is adjusted can be flexibly configured. The above description uses the example of switching the telephoto camera state at a magnification of 4.5x as an example, and the present application is not limited to this.
[0188] On the other hand, in response to the user continuously turning down the magnification (e.g. Figure 8 As shown in (b) in FIG, the user continues to slide downward in the magnification adjustment area 510 to lower the magnification), and the corresponding status of each camera can be as follows Figure 10 As shown in (b) in Figure 10In (b), when the current magnification is 1x, the wide-angle camera can first be in the power-on state, then transition to the configuration complete state, and then transition to the streaming state, and remain in the streaming state until the user lowers the magnification to 0.8x. After the user lowers the magnification to 0.8x, the wide-angle camera can transition from the streaming state to the configuration complete state, and then transition to the reset state, and remain in the reset state. The ultra-wide-angle camera can first be in the power-on state, then transition to the reset state. Before the user lowers the magnification to 0.8x, the ultra-wide-angle camera can start to transition from the reset state to the de-reset state, then transition to the configuration complete state, and then transition to the streaming state, and remain in the streaming state while the user lowers the magnification (for example, from 0.8x to 0.5x). The telephoto camera can first be in the power-on state, then transition to the reset state, and remain in the reset state while the user lowers the magnification (for example, from 1x to 0.5x). It is understandable that the ultra-wide-angle camera collects image data in the magnification range of [0.5x-1x), and the wide-angle camera collects image data in the range of [1x-5x). Based on the method provided in the embodiment of the present application, taking into account the startup delay of the ultra-wide-angle camera, the wide-angle camera can be delayed in switching to the reset state to avoid the problem of the mobile phone screen lagging or black screen due to the ultra-wide-angle camera not being switched to the outgoing state in time. Of course, the magnification range to which the outgoing state of the wide-angle camera is extended can be flexibly configured. The above takes the example of the wide-angle camera switching from the outgoing state to the reset state starting from 0.8x as an example, and the present application is not limited to this.
[0189] like Figure 11 As shown, when the user closes the camera application, the following steps may also be included:
[0190] 430. In response to receiving the user's operation to close the camera application, the camera application sends a camera application closing instruction to the camera service.
[0191] 431. The camera service receives a camera application close instruction sent by the camera application, and sends the camera application close instruction to the multi-camera decision module in the camera HAL.
[0192] 432. The multi-camera decision module determines the identifier of the physical camera to be powered off, the identifier of the physical camera to be stopped, and the identifier of the physical camera to be reset, and sends the identifier of the physical camera to be powered off, the identifier of the physical camera to be stopped, and the identifier of the physical camera to be reset to the multi-camera use case.
[0193] The multi-camera decision module knows the ID of the physical camera currently streaming and the ID of the physical camera in the reset state. After receiving the camera application shutdown instruction sent by the camera service, the multi-camera decision module can obtain the ID of the physical camera to be stopped based on the ID of the physical camera currently streaming, obtain the ID of the physical camera to be reset based on the ID of the physical camera in the reset state, and obtain the ID of the physical camera to be powered off based on the ID of the physical camera currently streaming and the ID of the physical camera in the reset state.
[0194] For example, if the physical camera currently streaming includes an ultra-wide-angle camera, the identifiers of the physical cameras in the reset state include the wide-angle camera and the telephoto camera. After receiving the camera application shutdown instruction sent by the camera service, the multi-camera decision module determines that the identifiers of the physical cameras to be stopped include the ID of the ultra-wide-angle camera, the identifiers of the physical cameras to be reset include the ID of the wide-angle camera and the ID of the telephoto camera, and the identifiers of the physical cameras to be powered off include the ID of the wide-angle camera, the ID of the ultra-wide-angle camera, and the ID of the telephoto camera.
[0195] 433. The multi-camera use case sends a fourth structure (carrying an identifier for indicating the physical camera to be powered off), a fifth structure (carrying an identifier for indicating the physical camera to be stopped), and third metadata (carrying an identifier for indicating the physical camera to be reset) to the sensor node.
[0196] The fourth structure carries the identifier of the physical camera to be powered off. For example, the fourth structure may carry the ID of the wide-angle camera, the ID of the ultra-wide-angle camera, and the ID of the telephoto camera. The fifth structure carries the identifier of the physical camera to be powered off. For example, the fifth structure may carry the ID of the ultra-wide-angle camera.
[0197] The fourth structure and the fifth structure may be the same structure or different structures. The fourth structure and the fifth structure may be sent to the sensor node via different messages, or may be sent to the sensor node via the same message, which is not limited in this application.
[0198] The following is an example in which the identifier of the physical camera to be stopped includes the ID of the ultra-wide-angle camera, the identifier of the physical camera to be reset includes the ID of the wide-angle camera and the ID of the telephoto camera, and the identifier of the physical camera to be powered off includes the ID of the wide-angle camera, the ID of the ultra-wide-angle camera, and the ID of the telephoto camera.
[0199] 434. The sensor node sends a reset command and a power-off command to the driver corresponding to the wide-angle camera in sequence, sends a stop flow command and a power-off command to the driver corresponding to the ultra-wide-angle camera in sequence, and sends a reset command and a power-off command to the driver corresponding to the telephoto camera in sequence.
[0200] 435. The driver corresponding to the wide-angle camera first pulls up the level of the reset pin of the wide-angle camera to control the wide-angle camera to enter the reset state, and then pulls down the power pin and reset level of the wide-angle camera to control the wide-angle camera to enter the power-off state.
[0201] The driver corresponding to the wide-angle camera can sequentially receive a reset and power-off command from the sensor node. In response to the reset command, the driver corresponding to the wide-angle camera first pulls up the voltage level of the wide-angle camera's reset pin to control the wide-angle camera to enter the reset state. In response to the power-off command, the driver corresponding to the wide-angle camera can pull down the voltage level of the wide-angle camera's power pin to control the wide-angle camera to enter the power-off state.
[0202] 436. The driver corresponding to the ultra-wide-angle camera first sends a stop (STREAMOFF) command to control the ultra-wide-angle camera to stop collecting image information, and then pulls down the power pin and reset level of the ultra-wide-angle camera to control the ultra-wide-angle camera to enter the power-off state.
[0203] The driver for the ultra-wide-angle camera can sequentially receive a stop streaming command and a power-off command from the sensor node. In response to the stop streaming command, the driver for the ultra-wide-angle camera can issue a STREAMOFF command to the ultra-wide-angle camera to stop capturing image information. In response to the power-off command, the driver for the ultra-wide-angle camera can lower the voltage level of the ultra-wide-angle camera's power pin to power the camera down.
[0204] 437. The driver corresponding to the telephoto camera first pulls up the level of the reset pin of the telephoto camera to control the telephoto camera to enter the reset state, and then pulls down the power pin and reset level of the telephoto camera to control the telephoto camera to enter the power-off state.
[0205] The driver for the telephoto camera can sequentially receive a stop streaming command and a power-off command from the sensor node. In response to the stop streaming command, the driver for the telephoto camera can issue a STREAMOFF command to the telephoto camera, stopping image acquisition by the wide-angle camera. In response to the power-off command, the driver for the telephoto camera can lower the voltage level of the telephoto camera's power pin to power the telephoto camera down. This allows all cameras to be powered down when the camera application is closed, saving power.
[0206] In one possible design, the sensor node can directly send a power-off command to the drivers corresponding to the wide-angle camera and the telephoto camera. In response to the power-off command, the drivers corresponding to the wide-angle camera and the telephoto camera can control the wide-angle camera and the telephoto camera to enter the power-off state. In other words, the wide-angle camera and the telephoto camera can enter the power-off state without entering the reset state.
[0207] Some embodiments of the present application provide an electronic device, which may include: a touch screen, a memory, and one or more processors. The touch screen, the memory, and the processor are coupled. The memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device can perform the various functions or steps performed by the electronic device in the above method embodiment. The structure of the electronic device can refer to Figure 1 The structure of the electronic device 100 is shown.
[0208] The present application also provides a chip system (eg, a system on a chip (SoC)). Figure 12 As shown, the chip system includes at least one processor 1201 and at least one interface circuit 1202. The processor 1201 and the interface circuit 1202 can be interconnected via lines. For example, the interface circuit 1202 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 1202 can be used to send signals to other devices (such as the processor 1201 or the touch screen of an electronic device). Exemplarily, the interface circuit 1202 can read instructions stored in the memory and send the instructions to the processor 1201. When the instructions are executed by the processor 1201, the electronic device can execute the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiments of the present application.
[0209] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes the various functions or steps executed by the electronic device in the above-mentioned method embodiment.
[0210] An embodiment of the present application further provides a computer program product. When the computer program product is run on an electronic device, the electronic device is enabled to perform the functions or steps performed by the electronic device in the above method embodiment.
[0211] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned 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.
[0212] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0213] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0214] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0215] If the integrated unit is implemented in the form of 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 solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0216] The above content is only a specific embodiment of this application, but the scope of protection of this application is not limited to this. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A method for controlling a camera module, applied to an electronic device, wherein the electronic device comprises a first camera module and a second camera module, wherein: include: The electronic device receives a first operation from a user; wherein the first operation is used to start a photo taking function or a video recording function of a camera application; The electronic device obtains a first shooting mode, a first magnification, and a logical camera ID corresponding to the first shooting mode of the camera application; The electronic device determines, based on the logical camera ID, that camera modules to be powered on include the first camera module and the second camera module, determines, based on the first magnification, that camera modules for collecting image data include the first camera module, and determines, based on the first shooting mode and the first magnification, that camera modules to be reset include the second camera module; The electronic device raises the potentials of the power pin and the reset pin of the first camera module and the second camera module; The electronic device controls the first camera module to collect image data; The electronic device pulls down the potential of the reset pin of the second camera module.
2. The method according to claim 1, characterized in that The electronic device further includes a third camera module. If the camera module to be powered on further includes the three-camera module, and the camera module to be reset further includes the third camera module, the method further includes: The electronic device raises the potential of the power pin and the reset pin of the third camera module; The electronic device pulls down the potential of the reset pin of the third camera module.
3. The method according to claim 1 or 2, characterized in that The first shooting mode is a default shooting mode after the camera application is started, or a shooting mode selected by a user after the camera application is started; The first magnification is a default magnification after the camera application is started, or a magnification selected by a user after the camera application is started.
4. The method according to claim 1 or 2, characterized in that Before determining, according to the first shooting mode and the first magnification, that the camera module to be reset includes the second camera module, the method further includes: The electronic device queries a first corresponding relationship, where the first corresponding relationship includes IDs of camera modules to be reset corresponding to multiple shooting modes in multiple magnification ranges; The multiple magnification intervals include a first magnification interval, the first magnification belongs to the first magnification interval, the multiple shooting modes include the first shooting mode, and the first shooting mode corresponds to the ID of the second camera module in the first magnification interval.
5. The method according to claim 1 or 2, characterized in that The camera module to be reset determined according to the first shooting mode includes the second camera module including: The electronic device determines, according to the model of the electronic device, the first shooting mode, and the first magnification, that the camera module to be reset includes the second camera module.
6. The method according to claim 4, characterized in that The first corresponding relationship includes the IDs of the camera modules to be reset corresponding to the multiple shooting modes corresponding to the model of the electronic device in multiple magnification ranges.
7. The method according to any one of claims 1, 2 or 6, characterized in that Before the electronic device determines, according to the logical camera ID, that the camera modules to be powered on include the first camera module and the second camera module, the method further includes: The electronic device queries a second corresponding relationship, where the second corresponding relationship includes IDs of camera modules corresponding to the plurality of logical camera IDs; Among them, the multiple logical camera IDs include the logical camera ID corresponding to the first shooting mode, and the logical camera ID corresponding to the first shooting mode corresponds to the first camera module and the second camera module.
8. The method according to any one of claims 1, 2 or 6, characterized in that: Before determining, according to the first magnification, that the camera module for collecting image data includes the first camera module, the method further includes: The electronic device queries a third corresponding relationship, where the third corresponding relationship includes IDs of camera modules to which image data is to be collected corresponding to the plurality of magnification intervals; The multiple magnification intervals include a first magnification interval, the first magnification belongs to the first magnification interval, and the first magnification interval corresponds to the ID of the first camera module.
9. The method according to any one of claims 1, 2 or 6, characterized in that: The power pin includes a low-dropout linear regulator (LDO) power pin.
10. The method according to any one of claims 1, 2 or 6, characterized in that: The method further comprises: The electronic device receives a second operation of the user; wherein the second operation is used to switch the first magnification to a second magnification; The electronic device determines, according to the second magnification, that the camera module to be used for collecting image data includes the second camera module, and determines that the camera module to be reset includes the first camera module; The electronic device controls the first camera module to stop collecting image data and pulls down the potential of the reset pin of the first camera module; The electronic device pulls up the potential of the reset pin of the second camera module and controls the second camera module to collect image data.
11. The method according to any one of claims 1, 2 or 6, characterized in that: The method further comprises: The electronic device receives a third operation from the user; wherein the third operation is used to turn off a photo taking function or a video recording function of a camera application; The electronic device controls the first camera module to stop collecting image data, and pulls down the potentials of the power pin and the reset pin of the first camera module; The electronic device pulls down the potential of the power pin of the second camera module.
12. An electronic device, characterized in that: include: A touch screen, a memory, a camera, a display screen, and one or more processors; the touch screen, the memory, the camera, and the display screen are coupled to the processor; wherein the memory stores computer program code, the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 11.
13. A computer-readable storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, enable the electronic device to execute the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Method for setting, controlling and switching forward and backward CCD camera of mobile terminal
CN101299847A
Camera control method and electronic equipment
CN112422874A