Method and device for controlling position of OIS motor

By controlling the OIS motor to the middle position of its travel range during the non-exposure time of the camera module and using INT pin communication, the problem of the OIS motor's stabilization angle limitation is solved, the stabilization effect is improved and the latency is reduced, and the image blur caused by lens shake is improved.

CN121012995APending Publication Date: 2025-11-25HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410608558.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-15
Publication Date
2025-11-25

AI Technical Summary

Technical Problem

The limited stroke of the OIS motor results in a limited stabilization angle. Electronic devices are prone to exceeding the stabilization angle of the OIS during shaking, leading to poor stabilization performance.

Method used

By controlling the OIS motor to move to the middle position of the travel range during the non-exposure time of the camera module, and communicating directly with the SoC using the INT pin, the stabilization angle is avoided. The motor position is adjusted in combination with gyroscope data to achieve the inter-frame centering function.

Benefits of technology

It effectively prevents the OIS motor from exceeding the stabilization angle, improves the stabilization effect, reduces the time delay of inter-frame centering, and improves image blur caused by lens shake.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121012995A_ABST
    Figure CN121012995A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method and device for controlling the position of an OIS motor, relates to the field of terminals, and can effectively avoid exceeding the anti-shake angle of an OIS and improve the anti-shake effect. The method is applied to the electronic equipment, the electronic equipment comprises a system-on-chip SoC and a camera module, the camera module comprises an optical image stabilization (OIS) motor and a lens, the OIS motor is used for adjusting the pose of the lens, the camera module further comprises a target pin, the camera module is connected with the SoC through the target pin, and the method comprises the following steps: starting the camera module in response to a first operation; under the condition that the camera module is in the non-exposure time, the target pin is set to be in a first state; and when the target pin is in the first state, controlling the OIS motor to move to the middle position of the stroke interval of the OIS motor.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the terminal field, and in particular to a method and device for controlling a position of an OIS motor. BACKGROUND

[0002] Optical image stabilization (OIS) technology is a technology for detecting lens shaking through a gyroscope and compensating for the shaking of the lens according to the moving direction and displacement of the lens through a motor, which can effectively improve image blurring caused by lens shaking.

[0003] However, due to the stroke limitation of the motor, the anti-shake angle of OIS is generally about 1 degree. When an electronic device (for example, a mobile phone) is taking a picture during shaking, it is easy to exceed the anti-shake angle of OIS, resulting in poor anti-shake effect. SUMMARY

[0004] Embodiments of the present application provide a method and device for controlling a position of an OIS motor, which can avoid the OIS motor exceeding its stroke range, thereby avoiding exceeding the anti-shake angle of OIS and improving the anti-shake effect.

[0005] To achieve the above object, embodiments of the present application adopt the following technical solutions:

[0006] In a first aspect, a method for controlling a position of an OIS motor is provided, applied to an electronic device, the electronic device including a system-on-chip (SoC) and a camera module, the camera module including an OIS motor and a lens, the OIS motor being configured to adjust a pose of the lens, the camera module further including a target pin, the camera module being connected to the SoC through the target pin, the method including: in response to a first operation, starting the camera module; in a case where the camera module is in a non-exposure time, the target pin being set to a first state; and when the target pin is in the first state, controlling the OIS motor to move to a middle position of a stroke range of the OIS motor.

[0007] Based on the method provided by the embodiments of the present application, in a case where the camera module is in a non-exposure time, the target pin can be set to a first state; when the target pin is in the first state, the OIS motor can be controlled to move to a middle position of a stroke range of the OIS motor, thereby realizing an inter-frame centering function. In this way, the anti-shake angle of OIS can be effectively avoided, and the anti-shake effect can be improved.

[0008] In a possible implementation, the method further includes: when the camera module is in the exposure time, the target pin is set to a second state, the second state being different from the first state; and when the target pin is in the second state, adjusting the position of the OIS motor in the stroke range of the OIS motor according to the data of the gyroscope. In this way, when the camera module is in the exposure time, the target pin can be set to the second state; when the target pin is in the second state, the position of the OIS motor in the stroke range of the OIS motor can be adjusted according to the data of the gyroscope, the OIS anti-shake function is implemented, and image blur caused by lens shaking is improved.

[0009] In a possible implementation, the camera module includes an image sensor, and the camera module is connected to the SoC through the target pin, and the method includes: connecting the image sensor to the SoC through the target pin; when the camera module is in the non-exposure time, setting the target pin to the first state, including: when the camera module is in the non-exposure time, setting the target pin to the first state by the image sensor. In this way, when the camera module is in the non-exposure time, the image sensor can set the target pin to the first state, so that the SoC can control the OIS motor to move to the middle position of the stroke range of the OIS motor according to the state (the first state) of the target pin, the anti-shake angle of the OIS can be effectively avoided, and the anti-shake effect is improved.

[0010] In a possible implementation, the SoC further includes a coprocessor CP, and the image sensor is connected to the SoC through the target pin, and the method includes: connecting the image sensor to the CP through the target pin; and when the target pin is in the first state, controlling the OIS motor to move to the middle position of the stroke range of the OIS motor, including: when the target pin is in the first state, controlling the OIS motor to move to the middle position of the stroke range of the OIS motor by the CP. In this way, the CP can control the OIS motor to move to the middle position of the stroke range of the OIS motor according to the state (the first state) of the target pin, the anti-shake angle of the OIS can be effectively avoided, and the anti-shake effect is improved.

[0011] In a possible implementation, before the CP controls the OIS motor to move to the middle position of the stroke range of the OIS motor, the method further includes: periodically querying, by the CP, the state of the target pin based on a timer. In this way, the CP can learn the state of the target pin in time, so as to perform corresponding processing (for example, when the target pin is in the first state, controlling the OIS motor to move to the middle position of the stroke range of the OIS motor to implement the interframe back centering function) according to the state of the target pin, and reduce the time delay of the interframe back centering.

[0012] In a possible implementation, the SoC includes an application processor (AP), and the AP is connected with the image sensor. The method further includes: in a case where the non-exposure time is greater than or equal to a first time threshold, sending, by the AP, a first instruction to the image sensor, where the first instruction is used to instruct the image sensor to set the target pin to a first state in a case where the camera module is in the non-exposure time. That is, in a case where the non-exposure time of the camera module is greater than or equal to the first time threshold, the interframe interpolation function is enabled. The first time threshold can be determined according to the time consumption of the interframe interpolation. The first time threshold can be greater than or equal to the time length of the interframe interpolation.

[0013] In a possible implementation, the first instruction is further used to instruct the image sensor to set the target pin to a second state in a case where the camera module is in an exposure time. In this way, in a case where the camera module is in the exposure time, the image sensor can set the target pin to the second state; when the target pin is in the second state, the position of the OIS motor in the stroke range of the OIS motor can be adjusted according to the data of the gyroscope, the OIS anti-shake function is implemented, and the image blur caused by the shaking of the lens is improved.

[0014] In a possible implementation, the method further includes: in a case where the non-exposure time is less than the first time threshold, sending, by the AP, a second instruction to the image sensor, where the second instruction is used to instruct the image sensor to always set the target pin to the second state. That is, in a case where the non-exposure time of the camera module is less than the first time threshold, the interframe interpolation function is not enabled. The position of the OIS motor in the stroke range of the OIS motor is adjusted according to the data of the gyroscope only, the OIS anti-shake function is implemented, and the image blur caused by the shaking of the lens is improved.

[0015] In a second aspect, an electronic device is provided, which includes: a system on chip (SoC) and a camera module, the camera module including an OIS motor and a lens, the camera module further including a target pin, the camera module being connected with the SoC through the target pin, the SoC including a memory and one or more processors; the memory being coupled with the processor; wherein the memory is configured to store computer program code, the computer program code including computer instructions; when the computer instructions are executed by the processor, the electronic device is caused to perform any one of the methods provided in the first aspect.

[0016] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, including instructions, which, when executed on a computer, cause the computer to perform any one of the methods provided in the first aspect.

[0017] In a fourth aspect, an embodiment of the present application provides a computer program product including instructions, which, when executed on a computer, cause the computer to perform any one of the methods provided in the first aspect.

[0018] In a fifth aspect, an embodiment of the present application provides a chip system, which comprises a processor, and can further comprise a memory, and is configured to implement any method provided in the first aspect. The chip system can be composed of a chip, or can comprise a chip and other discrete devices.

[0019] It can be understood that the electronic device provided in the second aspect, the computer readable storage medium provided in the third aspect, the computer program product provided in the fourth aspect, and the chip system provided in the fifth aspect are all configured to execute the method described in any possible implementation manner of the first aspect. Therefore, the beneficial effects that can be achieved by the electronic device, the computer readable storage medium, the computer program product, and the chip system can refer to the beneficial effects of any possible implementation manner of the first aspect, which will not be described here again. BRIEF DESCRIPTION OF DRAWINGS

[0020] Figure 1 FIG. 1 is a structural schematic diagram of an electronic device provided in an embodiment of the present application;

[0021] Figure 2A FIG. 2 is another structural schematic diagram of an electronic device provided in an embodiment of the present application;

[0022] Figure 2B FIG. 3 is still another structural schematic diagram of an electronic device provided in an embodiment of the present application;

[0023] Figure 2C FIG. 4 is yet another structural schematic diagram of an electronic device provided in an embodiment of the present application;

[0024] Figure 3 FIG. 5 is a software architecture schematic diagram of an electronic device provided in an embodiment of the present application;

[0025] Figure 4 FIG. 6 is a schematic diagram of a method for controlling a position of an OIS motor provided in an embodiment of the present application;

[0026] Figure 5A FIG. 7 is a display schematic diagram provided in an embodiment of the present application;

[0027] Figure 5B FIG. 8 is a lens shaking schematic diagram provided in an embodiment of the present application;

[0028] Figure 6 FIG. 9 is a processing time schematic diagram of one frame of image provided in an embodiment of the present application;

[0029] Figure 7 FIG. 10 is a schematic diagram of determining a position of an OIS motor based on a state of an INT pin provided in an embodiment of the present application;

[0030] Figure 8A comparison diagram of a waveform without starting inter-frame feedback function and a waveform with starting inter-frame feedback function provided for an embodiment of the present application;

[0031] Figure 9 A structure diagram of yet another electronic device provided for an embodiment of the present application;

[0032] Figure 10 A structure diagram of yet another electronic device provided for an embodiment of the present application;

[0033] Figure 11 A structure diagram of yet another electronic device provided for an embodiment of the present application;

[0034] Figure 12 A structure diagram of yet another electronic device provided for an embodiment of the present application;

[0035] Figure 13 A schematic diagram of a camera module provided for an embodiment of the present application. DETAILED DESCRIPTION

[0036] For the sake of clear and concise description of the following embodiments, first, a brief introduction of related concepts or technologies is given:

[0037] OIS: optical image stabilization, is a technology that detects the shaking (small movement) of the lens through a gyroscope, and then compensates for the shaking of the lens according to the moving direction and displacement of the lens through a motor (e.g., OIS motor), which can effectively improve the image blur caused by the shaking of the lens.

[0038] OIS motor: also known as OIS optical image stabilization motor, is used to adjust the position of optical components (e.g., lens) to avoid or reduce the problem of poor imaging effect caused by the shaking of the lens due to the shaking of the device during the capture of optical signals. The OIS motor can be a linear motor or a voice coil motor (VCM). The VCM is a device that converts electrical energy into mechanical energy, which can realize linear and limited angular motion. The VCM utilizes the interaction between the magnetic poles in the magnetic field from the permanent magnet and the magnetic field generated by the energized coil conductor to produce regular motion. The linear motor can be composed of a stator and a mover. The stator includes a coil and a flexible printed circuit (FPC), and the mover is composed of a mass block and a magnet. The energized coil is subjected to Lorentz force in the magnetic field, and the mover moves reciprocally along the fixed direction to produce vibration, which is a kind of motor that can directly convert electrical energy into linear motion mechanical energy without any intermediate conversion device.

[0039] The OIS motor may include an X-axis motor and a Y-axis motor. The X-axis motor can move in the X-axis direction (e.g., parallel to the short side of the phone) of the coordinate system (based on the coordinate system established by the electronic device (e.g., mobile phone)), and the Y-axis motor can move in the Y-axis direction (e.g., parallel to the long side of the phone).

[0040] It should be understood that OIS motors typically have a travel limit, meaning they have a fixed range of motion and cannot exceed this range. Due to this travel limit, the OIS stabilization angle (the angle of lens tilt that OIS can compensate for in all directions) is generally around 1 degree. When electronic devices (e.g., mobile phones) are shaky while recording, it is easy to exceed the OIS stabilization angle, resulting in poor image stabilization performance.

[0041] To address the aforementioned issues, an inter-frame centering approach can be employed. Inter-frame centering refers to controlling the OIS motor to quickly move to the center of its travel range during the non-exposure time between two frames of the camera module. The center of the OIS motor's travel range can also be called the midpoint of its travel. Using this approach effectively prevents the OIS motor from exceeding its travel range, thus avoiding exceeding the OIS stabilization angle and ultimately improving image stabilization performance.

[0042] For example, such as Figure 1 As shown, the electronic device includes a system-on-chip (SoC), a gyroscope, and a camera module. The camera module includes an OIS controller, an OIS motor, and a lens. The OIS controller may include a microcontroller unit (MCU) and a motor driver. The SoC may include an application processor (AP) and a content processing unit (CP).

[0043] In some implementations, the AP can send an inter-frame return-to-center command to the CP. This command instructs the OIS motor to move to the middle of its travel range during the lens module's non-exposure time. Upon receiving the command, the CP can send a similar command to the OIS controller. The OIS controller, upon receiving this command, can then drive the OIS motor to the middle of its travel range during the non-exposure time. This avoids exceeding the OIS stabilization angle, thus improving image stabilization performance.

[0044] However, since the AP and the CP are two independent processors, they cannot directly communicate with each other, and a message interface (for example, an inter-core communication interface) needs to be established to communicate through the inter-core communication interface. However, the process of the AP communicating with the CP through the inter-core communication interface is time-consuming (for example, 2-5 ms). In this way, when the AP issues an interframe interrupt instruction to the CP, a delay of 2-5 ms is generated, so that the CP cannot timely send the interframe interrupt instruction to the OIS controller, and therefore the OIS controller cannot timely receive the interframe interrupt instruction, so as to fail to timely move the OIS motor to the middle position of the stroke interval of the OIS motor in the non-exposure time.

[0045] Embodiments of the present application provide an electronic device, such as Figure 2A As shown in the figure, the electronic device includes a SoC, a gyroscope, and a camera module. The camera module can include an image sensor, an OIS controller, a motor, and a lens. The image sensor can be a complementary metal oxide semiconductor (CMOS) sensor. The motor can be an OIS motor. The SoC can include an AP and a CP.

[0046] In embodiments of the present application, the camera module can include an INT pin. The INT pin can also be referred to as an INT general purpose input / output port (GPIO). The INT pin can be an interrupt pin. When the INT pin is pulled low, an external interrupt can be triggered, that is, an interrupt signal is generated, notifying an external device (for example, the CP) to perform corresponding processing. The camera module can be connected to the SoC through the INT pin. For example, the CMOS sensor in the camera module can be connected to the CP in the SoC through the INT pin. The CP can be a digital signal processor (DSP), for example. The sensor hub can run on the CP. The CMOS sensor can control the INT pin to be pulled high or low (that is, the INT pin can be set to high or low). The sensor hub of the CP can read the state (low or high) of the INT pin and perform corresponding processing based on the state of the INT pin.

[0047] In a possible design, when the INT pin is in a first state (e.g., a low level state), the sensorhub of the CP can instruct the OIS controller to drive the OIS motor to quickly move to a middle position of a stroke range of the OIS motor, to implement an interframe centering function. In this way, the anti-shake angle of the OIS can be effectively avoided, and the anti-shake effect can be improved. Moreover, the CP can directly determine whether to start the interframe centering function (i.e., instruct the OIS controller to drive the OIS motor to quickly move to the middle position of the stroke range of the OIS motor) based on the state of the INT pin. Compared with the CP receiving an instruction to start or stop the interframe centering function from the AP through the inter-core communication interface, the method provided in this application can enable the CP to start the interframe centering function more timely, and can reduce the latency of the interframe centering function.

[0048] When the INT pin is in a second state (e.g., a high level state), the sensorhub of the CP can instruct the OIS controller to drive the OIS motor to smoothly move to a target position of a stroke range of the OIS motor, to implement a normal anti-shake function of the OIS, and avoid the problem of poor imaging effect caused by lens shaking. The target position can be determined according to the shaking data (movement data of the lens) of the lens collected by the gyroscope.

[0049] In some embodiments, as shown in Figure 2B The OIS controller can include an OIS control submodule 1 (e.g., an OIS IC 1) and an OIS control submodule 2 (e.g., an OIS IC 2). The OIS motor can include an X-axis motor and a Y-axis motor. The OIS IC 1 can drive the X-axis motor to move in the X-axis direction, so that the X-axis motor can push the lens to move in the X-axis direction; and the OIS IC 2 can drive the Y-axis motor to move in the Y-axis direction, so that the Y-axis motor can push the lens to move in the Y-axis direction. The CP can control the X-axis motor and the Y-axis motor to move in the X-axis direction and the Y-axis direction, respectively, through the OIS control submodule 1 and the OIS control submodule 2, respectively.

[0050] Optionally, the OIS control module can further include more submodules, for example, an OIS IC 3. The OIS motor can further include a Z-axis motor. The OIS IC 3 can drive the Z-axis motor to move in the Z-axis direction (e.g., a direction perpendicular to the screen of the mobile phone), which is not limited in the present application.

[0051] Figure 2CAnother structural schematic of an electronic device (for example, the electronic device 100) provided in an embodiment of the present application. The electronic device 100 can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, and a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device, and / or a smart city device, and the specific type of the electronic device is not specially limited in the embodiment of the present application.

[0052] Referring to Figure 2C The electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charge 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, a headset interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, and the like. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric 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, and the like.

[0053] It can be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In another embodiment of the present application, the electronic device 100 can include more or fewer components than the illustration, or combine certain components, or split certain components, or different component arrangements. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.

[0054] The processor 110 can include one or more processing units, such as: the processor 110 can include an application processor (AP), a coprocessor (CP), 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), etc. Among them, different processing units can be independent devices, or can be integrated in one or more processors.

[0055] Among them, the AP is the main processor in the electronic device (for example, a mobile phone), and the running of the operating system and the running of the application program in the mobile phone are all dependent on the AP.

[0056] The CP is a processor that assists the AP in the electronic device, and usually processes simple tasks such as virtual reality, image processing, high-fidelity sound, high-dynamic-range imaging, driving sensors, etc.

[0057] It should be noted that since the AP and the CP are two independent processors, a processing task is usually run on the AP alone or on the CP alone. If a processing task needs to be run on the AP and the CP at the same time, the timing for the processing task needs to be aligned.

[0058] The memory in the processor 110 can also be provided for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can hold instructions or data that the processor 110 has just used or is recycling. If the processor 110 needs to use the instructions or data again, it can be directly called from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thus improving the efficiency of the system.

[0059] In some embodiments, the processor 110 can include one or more interfaces, such as 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, etc.

[0060] 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, etc.

[0061] The antenna 1 and the antenna 2 are used for transmitting and receiving electromagnetic wave signals.

[0062] The mobile communication module 150 can provide a solution including 2G / 3G / 4G / 5G wireless communication applied to the electronic device 100. The mobile communication module 150 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves by the antenna 1, and perform filtering, amplification, etc. on the received electromagnetic waves, and transmit the processed electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can also amplify the signals modulated by the modem processor, and convert the amplified signals into electromagnetic waves radiated by the antenna 1.

[0063] The modem processor can include a modulator and a demodulator. The modulator is used to modulate a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. The low-frequency baseband signal processed by the baseband processor is transmitted to the application processor. The application processor outputs the sound signal through the audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays the image or video through the display screen 194.

[0064] The wireless communication module 160 can provide a solution for wireless communication, including wireless local area networks (WLAN) (such as a wireless fidelity (Wi-Fi) network), Bluetooth (BT), a global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) technology, and the like, which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices that integrate 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 signals, and transmits the processed signals to the processor 110. The wireless communication module 160 can also receive signals to be transmitted from the processor 110, frequency-modulate them, amplify them, and radiate them as electromagnetic waves via the antenna 2.

[0065] In some embodiments, the antenna 1 and the mobile communication module 150 of the electronic device 100 are coupled, and the antenna 2 and the wireless communication module 160 are coupled, so that the electronic device 100 can communicate with a network and other devices through wireless communication technology.

[0066] The electronic device 100 can implement a photographing function through an ISP, a camera 193, a video codec, a GPU, a display 194, and an application processor, and the like. The camera 193 can also be referred to as a camera module.

[0067] The ISP is used to process data fed back by the camera 193. For example, when taking a photo, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing to convert it into an image visible to the naked eye. The ISP can also optimize algorithms for image noise, brightness, and skin color. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be disposed in the camera 193.

[0068] The camera 193 is configured to capture still images or videos. An object projects an optical image through a lens to a photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transmitted to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into a standard image signal in RGB, YUV, or the like. In some embodiments, the electronic device 100 can include one or N cameras 193, where N is an integer greater than 1.

[0069] The digital signal processor is configured to process digital signals, including digital image signals and other digital signals.

[0070] The video codec is configured 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, MPEG 2, MPEG 3, MPEG 4, and the like.

[0071] The external memory interface 120 can be configured to connect an external memory card, such as a Micro SD card, to extend the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to perform data storage functions. For example, music, video, and the like can be saved in the external memory card.

[0072] The internal memory 121 can be configured to store computer executable program codes including instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program required by a function (such as an image playing function, etc.), and the like. The data storage area can store data (such as audio data, etc.) created by the electronic device 100 during use, and the like.

[0073] The motor 191 can be an OIS motor. The OIS motor can include an X-axis motor and a Y-axis motor.

[0074] The methods in the following embodiments can be implemented in the electronic device 100 having the hardware structure described above.

[0075] Figure 3 is a software structure block diagram of an electronic device (e.g., the electronic device 100) provided by an embodiment of the present application. The layered architecture of the electronic device 100 divides the software into several layers, each of which has a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system running in the AP can include an application layer (which can be referred to simply as an application layer), an application framework layer (which can be referred to simply as a framework layer), a hardware abstraction layer (HAL), and a kernel layer. In addition, the Android system can also include an Android runtime and a system library (not shown in the figure).

[0076] The application layer can include a series of application packages.

[0077] As shown in Figure 3 , the application packages can include a camera (application). Optionally, the application packages can also include gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, and the like.

[0078] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications of the application layer. The application framework layer includes some pre-defined functions.

[0079] As shown in Figure 3 , the application framework layer can include a camera service. The application framework layer can also include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0080] The camera service is configured to start a camera process in the hardware abstraction layer in response to an operation of starting a camera application.

[0081] The camera process is included in the hardware abstraction layer. The camera process includes an electric image stabilization (EIS) module (which can also be referred to as an EIS anti-shake module), a camera control module, an OIS control module, a CMOS sensor configuration module, and a non-camera service module.

[0082] The EIS anti-shake module is configured to calculate a non-exposure time of the camera module.

[0083] The camera control module is configured to determine whether the non-exposure time of the camera module satisfies a preset condition. For example, the camera control module is configured to determine whether the non-exposure time of the camera module is greater than or equal to a first time threshold (e.g., 10 ms).

[0084] The camera control module is further configured to generate an instruction to turn on the interframe back-in function when the non-exposure time of the camera module is greater than or equal to a first time threshold. The camera control module is further configured to generate an instruction to turn off the interframe back-in function when the non-exposure time of the camera module is less than the first time threshold.

[0085] The CMOS sensor configuration module is configured to send configuration information to the camera control module, the configuration information being used to configure the turning on and turning off of the interframe back-in function.

[0086] The OIS control module is configured to send an initialization instruction to the SOIS drive module in response to a user turning on the camera module. The initialization instruction is used to instruct to write a back-in PID parameter to a PID register of an OIS controller of the camera module. The back-in PID parameter is used to ensure that the OIS motor is quickly moved to a middle position of a stroke range of the OIS motor.

[0087] The non-camera service module is configured to manage non-camera sensors related to the camera module. For example, the non-camera service module can manage a voice coil motor in the camera module for pushing lens movement, a gyroscope for collecting lens movement data, and the like.

[0088] The kernel layer is a layer between hardware and software. The kernel layer can include an inter-core communication interface (inter-core communication module) and a camera drive module. The kernel layer also includes a display driver, a camera driver, an audio driver, a sensor driver, a Wi-Fi driver, and the like.

[0089] The inter-core communication interface is used to support communication between the AP and the CP. It should be understood that since the AP and the CP are two independent processors, they cannot directly communicate with each other. The EIS anti-shake module, the camera control module, and the OIS control module in the AP can exchange information with the SOIS drive module in the CP through the inter-core communication interface of the kernel layer.

[0090] The camera drive module is configured to start the camera module. The camera drive module is further configured to configure parameters of a register of an OIS controller of the camera module to drive the OIS motor in the camera module to move based on the configured parameters of the register.

[0091] The software framework of the CP can include a sensor hub layer, which can include the SOIS drive module. The sensor hub layer can also include a gyroscope management module, a gyroscope driver, a serial peripheral interface (SPI) driver, an inter-integrated circuit (I2C) driver, and the like, which are not limited in the present application.

[0092] The SOIS driving module can be used for OIS initialization, that is, writing the centering PID parameter to the PID register of the OIS controller of the camera module. In this way, when the motor needs to be centered subsequently, the centering PID parameter can be used to ensure the speed of the motor movement.

[0093] Then, the SOIS driving module can also start a timer, and periodically read the state of the INT pin based on the timer.

[0094] When the INT pin is in the first state (for example, low level), the SOIS driving module switches to the centering PID parameter and sets the middle position of the stroke interval of the OIS motor. When the INT pin is in the second state (for example, high level), the SOIS driving module can switch to the anti-shake PID parameter and calculate the target position of the OIS motor based on the OIS algorithm of the algorithm library and the data collected by the gyroscope. The SOIS driving module can read the data of the gyroscope, determine the target position (OIS target) according to the data of the gyroscope. The SOIS driving module can calculate the target position of the OIS motor based on the OIS algorithm of the algorithm library and the data collected by the gyroscope. The movement of the OIS motor to the target position can push the lens to move to the corresponding position, so as to compensate for the displacement that needs to be compensated due to lens jitter.

[0095] The OIS algorithm of the algorithm library can be a preset anti-shake algorithm, which can be a neural network model, a mathematical model, or a filtering algorithm, and the present application does not limit this.

[0096] The electronic device 100 also includes a hardware layer, which can include a gyroscope and a camera module. The camera module can include a CMOS sensor and an OIS motor. The camera module can also include a lens and an OIS controller and other modules. The OIS motor can include an X-axis motor and a Y-axis motor.

[0097] It should be noted that the electronic device mentioned in the present application can include more or fewer modules in the above electronic device.

[0098] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. In the description of the present application, "at least one" means one or more, and "multiple" means two or more than two. In addition, in order to clearly describe the technical solutions of the embodiments of the present application, "first", "second" and other words are used to distinguish the same items or similar items with basically the same function and effect in the embodiments of the present application. Those skilled in the art can understand that "first", "second" and other words do not limit the number and execution order, and "first", "second" and other words also do not limit the difference.

[0099] The application scenarios provided by the embodiments of the present application are described below.

[0100] In some shooting scenarios, such as vehicle shooting (for example, self-shooting), cycling shooting, boat shooting, and elevator shooting, the shaking angle of the electronic device is large due to the instability of the external environment, which may exceed the anti-shake angle of OIS, resulting in poor shooting effect. The embodiments of the present application provide a method and device for controlling the position of an OIS motor, which can effectively avoid exceeding the anti-shake angle of OIS and improve the anti-shake effect.

[0101] The above is an example of an application scenario, and does not limit the application scenarios of the present application.

[0102] For ease of understanding, the method for controlling the position of an OIS motor provided by the embodiments of the present application is specifically introduced below in combination with the drawings.

[0103] As shown in Figure 4 , the embodiments of the present application provide a method for controlling the position of an OIS motor, applied to an electronic device (for example, a mobile phone), which includes a camera application, an EIS anti-shake module, a camera control module, an OIS control module, an SOIS driving module, a camera module, and the like. The method includes:

[0104] 401. The camera application receives an operation of the user opening the camera module.

[0105] The operation of opening the camera module can be an operation of the user clicking the icon of the camera application on the desktop of the mobile phone, or an operation of the user waking up the camera application by voice. The embodiments of the present application do not limit this. The camera application can be a camera application provided in the system of the electronic device, or a third-party camera application. The embodiments of the present application do not limit this.

[0106] For example, as shown in Figure 5A (a), the electronic device (for example, a mobile phone) can receive an operation of the user clicking the icon 502 of the camera application on the desktop 501 (that is, an operation of opening the camera module). In response to the operation of the user clicking the icon 502 of the camera application on the desktop 501, as shown in Figure 5A (b), the mobile phone can display a shooting preview interface 503 corresponding to the current shooting mode (for example, a photographing mode).

[0107] 402. The camera application sends an initialization instruction to the OIS control module.

[0108] After receiving the operation of the user opening the camera module, the camera application can send an initialization instruction to the OIS control module in the HAL layer through the camera service of the application framework layer.

[0109] The initialization instruction is used to instruct writing the middle-return PID parameter to the PID register of the OIS controller of the camera module. The middle-return PID parameter is used to ensure that the OIS motor is quickly moved to the middle position of the stroke range of the OIS motor.

[0110] It should be understood that a set of anti-shake PID parameters is integrated in the firmware (for example, the OIS controller) of the camera module, and the anti-shake PID parameters are used to ensure that the OIS motor is smoothly moved to a target position of the stroke range of the OIS motor. The target position can be determined according to the lens shake data collected by the gyroscope. The lens shake data collected by the gyroscope can include a lens shake offset.

[0111] In the process of determining the lens shake offset of the electronic device, a coordinate system can be constructed with one vertex of the electronic device as the origin. For example, as shown in (a) of FIG. 1, a coordinate system is formed with the vertex of the upper left corner of the electronic device as the origin, and the two intersecting edges (the long edge and the short edge) of the electronic device as the X-axis and the Y-axis, respectively. At T0 moment, the coordinates of the lens center point are (X0, Y0). Due to the shaking of the electronic device, at T1 moment, as shown in (b) of FIG. 1, the coordinates of the lens center point relative to the origin of the electronic device at T0 moment are (X1, Y1), wherein the difference between (X0, Y0) and (X1, Y1) is the lens shake offset of the lens from T0 moment to T1 moment. The lens shake offset can be obtained by collecting the movement distance of the lens along the X-axis direction and the movement distance of the lens along the Y-axis direction caused by the lens shake through the gyroscope. Figure 5B Figure 5B In the process of determining the lens shake offset of the electronic device, a coordinate system can be constructed with one vertex of the electronic device as the origin. For example, as shown in (a) of FIG. 1, a coordinate system is formed with the vertex of the upper left corner of the electronic device as the origin, and the two intersecting edges (the long edge and the short edge) of the electronic device as the X-axis and the Y-axis, respectively. At T0 moment, the coordinates of the lens center point are (X0, Y0). Due to the shaking of the electronic device, at T1 moment, as shown in (b) of FIG. 1, the coordinates of the lens center point relative to the origin of the electronic device at T0 moment are (X1, Y1), wherein the difference between (X0, Y0) and (X1, Y1) is the lens shake offset of the lens from T0 moment to T1 moment. The lens shake offset can be obtained by collecting the movement distance of the lens along the X-axis direction and the movement distance of the lens along the Y-axis direction caused by the lens shake through the gyroscope.

[0112] However, in the scene requiring OIS fast return, that is, in the case of requiring the OIS motor to be quickly moved to the middle position of the stroke range of the OIS motor, the anti-shake PID parameters integrated in the OIS controller cannot meet the requirement of rapidity. Therefore, it is necessary to write the middle-return PID parameter to the OIS controller to control the OIS motor to be quickly moved to the middle position of the stroke range of the OIS motor.

[0113] In short, the difference between the middle-return PID parameter and the anti-shake PID is that the middle-return PID parameter has a higher requirement on the speed of the motor movement; and the anti-shake PID parameter has a higher requirement on the stability of the motor movement.

[0114] 403、The OIS control module sends an initialization instruction to the SOIS driving module.

[0115] The OIS control module in the HAL layer can send an initialization instruction to the SOIS driving module in the sensorhub layer through an inter-core communication interface.

[0116] ​404、SOIS driving module writes the homing PID parameter to the PID register of the OIS controller according to the initialization instruction.

[0117] After receiving the initialization instruction, the SOIS driving module can write the homing PID parameter to the PID register of the OIS controller of the camera module. In this way, when the motor needs to be homed quickly subsequently, the homing PID parameter can be used to ensure the speed of the motor movement.

[0118] It should be understood that since the time-consuming of writing the homing PID parameter is relatively long, the homing PID parameter can be written to the camera module in the stage of opening the camera module, so that when the motor needs to be homed quickly subsequently, the homing PID parameter can be directly used to ensure the speed of the motor movement.

[0119] 405、SOIS driving module starts a timer.

[0120] The SOIS driving module can create (start) a timer when writing the homing PID parameter or after writing the homing PID parameter to the PID register of the OIS controller.

[0121] The timer can be used to indicate the state of the INT pin periodically. For example, the timer can indicate that the state of the INT pin is queried every 1 ms.

[0122] Further, the SOIS driving module can perform corresponding processing according to the state of the INT pin. For details, please refer to subsequent steps 417 and 418, which are not described here.

[0123] 406、The camera application notifies the EIS anti-shake module that the camera module is turned on.

[0124] It can be understood that after the camera application receives the operation of the user turning on the camera module, the camera module can be started through the camera control module and the camera driving module and the like. After the camera module is started, the camera application can notify the EIS anti-shake module that the camera module is turned on.

[0125] 407、The EIS anti-shake module calculates the non-exposure time of the camera module.

[0126] The non-exposure time of the camera module can be the non-exposure time of each frame of image shot by the camera module, that is, the non-exposure time between every two frames of image.

[0127] It can be understood that the exposure time of the camera module is usually affected by the strength of external light. When the external light is strong, the exposure time is short, and when the external light is weak, the exposure time is long. In this way, images with appropriate brightness can be shot under different ambient light to ensure user experience.

[0128] The EIS anti-shake module can determine the non-exposure time of each frame of image according to the frame interval (processing time of one frame of image), exposure time and readout time.

[0129] For example, as shown in FIG. 4, the non-exposure time of one frame of image is equal to the processing time of one frame of image minus the exposure time and readout time of one frame of image. Wherein, the processing time of one frame of image is equal to 1s / frame rate. Figure 6

[0130] 408. The EIS anti-shake module sends the non-exposure time of the camera module to the camera control module.

[0131] The EIS anti-shake module can send the non-exposure time of each frame of image calculated by it to the camera control module.

[0132] In some cases, the non-exposure times of multiple frames of image taken by the camera module in a period of time can be the same or different, and the embodiments of the present application do not make specific limitation.

[0133] 409. The camera control module determines whether the non-exposure time of the camera module is greater than or equal to a first time threshold (for example, 10ms).

[0134] Wherein, the first time threshold can be determined according to the time consumption in the inter-frame loop. The first time threshold can be greater than or equal to the time length in the inter-frame loop.

[0135] For example, the time length in the inter-frame loop can be 8-10ms, and the first time threshold can be 10ms.

[0136] In the case where the non-exposure time of the camera module is greater than or equal to the first time threshold, steps 410-412 can be executed, i.e. the inter-frame loop function is turned on; in the case where the non-exposure time of the camera module is less than the first time threshold, steps 413-415 can be executed, i.e. the inter-frame loop function is not turned on / closed.

[0137] 410. In the case where the non-exposure time of the camera module is greater than or equal to the first time threshold, the camera control module sends an instruction to turn on the inter-frame loop function to the camera driving module.

[0138] Wherein, the instruction to turn on the inter-frame loop function (first instruction) can include the address of the target register and the first value corresponding to the target register. For example, the first value can be 1, indicating that the inter-frame loop function is turned on.

[0139] ​In some implementations, the camera control module can obtain configuration information of the CMOS sensor from the CMOS sensor configuration module of the HAL layer. This configuration information is used to configure the inter-frame return-to-center (IPC) function to be enabled or disabled. For example, the configuration information may include the address of a target register and different values ​​corresponding to that target register (e.g., a first value and a second value). For example, when the value of the target register (e.g., the first value) is 1, it indicates that the IPC function is enabled; when the value of the target register (e.g., the second value) is 0, it indicates that the IPC function is disabled. Thus, when the camera control module needs to enable the IPC function, it can generate corresponding instructions based on the configuration information.

[0140] The inter-frame return-to-center function refers to setting the target pin (e.g., the INT pin) to a first state (e.g., low level) when the camera module is in the non-exposure time of each frame (or in other words, when the camera module is in the non-exposure time between two frames). The inter-frame return-to-center function also includes setting the target pin to a second state (e.g., high level) when the camera module is in the exposure time between two frames. The first and second states are different. This application uses an example where the first state is low and the second state is high. In practical applications, the first state can also be high and the second state low; this application does not impose a specific limitation.

[0141] 411. The camera driver module sends a command to the CMOS sensor of the camera module to enable the inter-frame return-to-center function.

[0142] After receiving the instruction to enable the inter-frame return-to-center function, the camera driver module can write the first value into the target register of the CMOS sensor according to the address of the target register indicated in the instruction.

[0143] 412. CMOS sensor starts inter-frame centering function.

[0144] When the target register is set to its first value, the CMOS sensor activates the inter-frame return-to-center function. That is, the CMOS sensor can set the target pin (e.g., INT pin) to a first state (e.g., low level) when not in an exposure period, and set it to a second state (e.g., high level) when in an exposure period.

[0145] 413. When the non-exposure time of the camera module is less than the first time threshold, the camera control module sends a command to the camera driver module to disable the inter-frame return-to-center function.

[0146] The instruction (second instruction) for closing the interframe return function can include an address of a target register and a second value corresponding to the target register. For example, the second value can be 0, indicating that the interframe return function is closed.

[0147] 414. The camera driving module sends an instruction for closing the interframe return function to an image sensor of the camera module.

[0148] After receiving the instruction for closing the interframe return function, the camera driving module can write (configure) a second value into a target register of the image sensor according to an address of the target register indicated in the instruction.

[0149] 415. The CMOS sensor closes the interframe return function.

[0150] The CMOS sensor can continuously set a target pin (e.g., an INT pin) to a second state (e.g., high level). That is, the target pin is set to the second state (e.g., high level) regardless of whether it is in a non-exposure time or an exposure time. The state of the target pin is no longer controlled differently between the exposure time and the non-exposure time.

[0151] 416. The SOIS driving module periodically reads the state of the INT pin based on a timer.

[0152] For example, the SOIS driving module can read the state of the INT pin once every 1 ms.

[0153] The state of the INT pin can be a first state or a second state. The first state can be, for example, a low level state, and the second state can be, for example, a high level state.

[0154] If the state of the INT pin is the first state, step 417 can be performed, and if the state of the INT pin is the second state, step 418 can be performed.

[0155] 417. When the INT pin is in the first state (e.g., low level), the SOIS driving module instructs the OIS controller to switch to the return PID parameter and instructs the OIS controller to move the OIS motor to the middle position of the travel interval.

[0156] When the INT pin is in the first state (e.g., low level), the SOIS driver module instructs the OIS controller to switch to the centering PID parameter (e.g., the SOIS driver module can write a first preset value (e.g., 0) to the preset register of the OIS controller so that the OIS controller switches to the centering PID parameter), and instructs the OIS controller to move the OIS motor to the middle position of the stroke range. The OIS controller can drive the OIS motor to quickly move to the middle position of the OIS motor's stroke range based on the centering PID parameter, realizing the inter-frame centering function.

[0157] 418. When the INT pin is in the second state (e.g., high level), the SOIS driver module instructs the OIS controller to switch to the anti-shake PID parameters and determines the target position of the OIS motor based on the data collected by the gyroscope.

[0158] In other words, the SOIS drive module instructs the OIS controller to switch to the stabilization PID parameters (for example, the SOIS drive module can write a second preset value (e.g., 1) to the preset register of the OIS controller so that the OIS controller switches to the stabilization PID parameters), and instructs the OIS controller to drive the OIS motor to move to the target position within the OIS motor's travel range, thereby achieving normal OIS stabilization. This target position can be determined by the SOIS drive module based on the lens shake data collected by the gyroscope and the OIS algorithm. The OIS controller can then drive the OIS motor smoothly to the target position within the OIS motor's travel range based on the stabilization PID parameters, thus achieving normal stabilization.

[0159] The method for controlling the position of the OIS motor provided in the embodiments of this application will be described below with reference to the accompanying drawings.

[0160] For example, such as Figure 7 As shown, during the exposure time of one frame of an image, the INT pin can be set to a high level; during the non-exposure time of one frame of an image, the INT pin can be set to a low level. When the INT pin is set to a high level, the position of the OIS motor (target position) can be determined based on the data collected by the gyroscope (lens shake data). That is, the position of the OIS motor can change based on changes in the gyroscope data. It should be noted that... Figure 7The waveform corresponding to the OIS motor's position is similar to that of the gyroscope, indicating that the OIS motor's position changes according to the gyroscope's data. In practical applications, the waveform corresponding to the OIS motor's position may differ from that of the gyroscope; this application does not impose specific limitations on this. The waveform corresponding to the gyroscope can, for example, be the waveform corresponding to the angular velocity data of the lens along the X or Y axis detected by the gyroscope. When the INT pin is set to a low level, the OIS motor can be quickly moved to the middle position of its travel range. That is, during the non-exposure time of one frame, the OIS motor can return to the middle position of its travel range and no longer change with the gyroscope's data. In this way, the OIS motor can move to the middle position of its travel range during the non-exposure time of each frame, preventing the OIS motor from exceeding its travel range and effectively preventing exceeding the OIS stabilization angle, thus improving / optimizing the stabilization effect.

[0161] Figure 7 The waveform corresponding to the gyroscope can be either the waveform corresponding to the lens's shake data along the X-axis or the waveform corresponding to the lens's shake data along the X-axis. When the waveform corresponding to the gyroscope is the waveform corresponding to the lens's shake data along the X-axis, the waveform corresponding to the OIS motor is the waveform corresponding to the movement trajectory of the OIS motor in the X-axis direction. When the waveform corresponding to the gyroscope is the waveform corresponding to the lens's shake data along the Y-axis, the waveform corresponding to the OIS motor is the waveform corresponding to the movement trajectory of the OIS motor in the Y-axis direction.

[0162] like Figure 8 As shown, without the inter-frame centering function enabled, assuming the time span from frame 1 (e.g., the first frame image) to frame 5 (e.g., the fifth frame image) (including exposure time and non-exposure time, the non-exposure time is not shown), the movement trajectory of the OIS motor can be as follows: Figure 8 The diagram shows a sine wave. It can be seen that when the exposure time is between frame 2 (the second frame) and frame 4 (the fourth frame), the OIS motor's movement trajectory exceeds its travel range, thus exceeding the OIS stabilization angle, resulting in poor image stabilization. With the inter-frame centering function enabled, the OIS motor's movement trajectory follows the sine wave pattern during exposure time; while during non-exposure time, the OIS motor quickly returns to the middle position of its travel range. Thus, when the exposure time is between frame 2 and frame 4, the OIS motor's movement trajectory will not exceed its travel range, thus not exceeding the OIS stabilization angle, improving image stabilization performance.

[0163] Furthermore, in this embodiment, the OIS motor returns to the middle position of the travel range at the non-exposure time between two image frames. Since the camera module (or image sensor) does not produce an image during the non-exposure time, it will not affect the image output and will not cause the problem of frame loss.

[0164] Some embodiments of this application provide an electronic device, such as... Figure 9 As shown, the electronic device may include a SoC and a camera module. The camera module includes an optical image stabilization (OIS) motor and a lens. The OIS motor is used to adjust the pose of the lens. The camera module also includes a target pin (e.g., an INT pin). The camera module is connected to the SoC through the target pin.

[0165] The electronic device can respond to the first operation by activating the camera module; when the camera module is in a non-exposure time, the target pin is set to the first state; when the target pin is in the first state, the OIS motor is controlled to move to the middle position of the OIS motor's stroke range.

[0166] When the camera module is in the exposure time, the target pin is set to the second state, which is different from the first state. When the target pin is in the second state, the position of the OIS motor in the stroke range of the OIS motor is adjusted according to the data of the gyroscope.

[0167] In some implementations, such as Figure 10 As shown, the camera module includes an image sensor (e.g., a CMOS sensor), and the camera module is connected to the SoC via a target pin, including: the image sensor is connected to the SoC via the target pin; when the camera module is in a non-exposure time, the target pin is in a first state, including: when the camera module is in a non-exposure time, the target pin is set to the first state by the image sensor.

[0168] In some implementations, such as Figure 11 As shown, the SoC also includes a coprocessor CP, and an image sensor (e.g., a CMOS sensor) is connected to the CP via a target pin; when the target pin is in a first state, the OIS motor is controlled to move to the middle position of the OIS motor's stroke range, including: when the target pin is in the first state, the CP controls the OIS motor to move to the middle position of the OIS motor's stroke range.

[0169] In some embodiments, before the CP controls the OIS motor to move to the middle position of the stroke range of the OIS motor, the CP can periodically query the state of the target pin based on a timer. For example, the CP can read the state of the INT pin once every 1 ms. The CP can determine whether to enable the inter-frame interpolation function according to the state of the target pin. Compared with the CP receiving an instruction to enable or disable the inter-frame interpolation function from the AP through the inter-core communication interface, according to the embodiments of the present application, the CP can directly determine whether to enable the inter-frame interpolation function according to the state of the target pin, so as to reduce the latency of the inter-frame interpolation.

[0170] In some embodiments, as shown in Figure 12 The SoC includes an application processor AP, the AP is connected with an image sensor, and the AP sends a first instruction to the image sensor in a case where the non-exposure time is greater than or equal to a first time threshold, the first instruction being used to instruct the image sensor to set a target pin to a first state in a case where the camera module is in the non-exposure time.

[0171] In some embodiments, the first instruction is further used to instruct the image sensor to set the target pin to a second state in a case where the camera module is in an exposure time.

[0172] In some embodiments, in a case where the non-exposure time is less than the first time threshold, the AP can send a second instruction to the image sensor, the second instruction being used to instruct the image sensor to always set the target pin to the second state.

[0173] Some embodiments of the present application provide an electronic device, which can include a touch screen, a memory and one or more processors. The touch screen, the memory and the processor are coupled. The memory is configured to store computer program code, the computer program code including computer instructions. When the processor executes the computer instructions, the electronic device can perform each function or step performed by the electronic device in the above-mentioned method embodiments. The structure of the electronic device can refer to the structure of the electronic device 100 shown in Figure 2C .

[0174] The embodiments of the present application also provide a camera module, as shown in Figure 13 The camera module includes an image sensor (for example, a CMOS sensor), an OIS motor and a lens. The camera module further includes a target pin. In a case where the camera module is in a non-exposure time, the target pin can be in a first state; when the target pin is in the first state, the OIS motor can move to a middle position of a stroke range of the OIS motor. In a case where the camera module is in an exposure time, the target pin can be in a second state, the second state being different from the first state. Of course, the camera module can also include other discrete devices, for example, an OIS controller, which is not limited in the embodiments of the present application.

[0175] The embodiment of the present application further provides a computer readable storage medium comprising computer instructions, which, when executed on the electronic device, cause the electronic device to perform each function or step of the method embodiment performed by the electronic device.

[0176] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of functional modules is taken as an example, and in actual application, the above-mentioned functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0177] In several embodiments provided in the present 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 only schematic, for example, the division of the modules or units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another device, or some features can be omitted or not executed. In addition, the coupling or direct coupling or communication connection between the units or components shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0178] The units described as separate components can or can not be physically separated, and the components shown as units can be one physical unit or multiple physical units, that is, can be located in one place or can be distributed to multiple different places. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0179] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0180] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The software product is stored in a storage medium, including a plurality of instructions to make a device (which can be a single-chip microcomputer, a chip, etc.) or a processor execute all or part of the steps of the method described in various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0181] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any change or replacement within the technical scope disclosed in the present application should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method of controlling an OIS motor position, the method comprising: The method is applied to an electronic device, the electronic device comprising a system on chip (SoC) and a camera module, the camera module comprising an optical image stabilization (OIS) motor and a lens, the OIS motor being configured to adjust a pose of the lens, the camera module further comprising a target pin, the camera module being connected to the SoC through the target pin, the method comprising: in response to a first operation, starting the camera module; in a case where the camera module is in a non-exposure time, the target pin is set to a first state; when the target pin is in the first state, controlling the OIS motor to move to a middle position of a stroke range of the OIS motor.

2. The method of claim 1, wherein, The method further comprises: in a case where the camera module is in an exposure time, the target pin is set to a second state, the second state being different from the first state; when the target pin is in the second state, adjusting a position of the OIS motor in the stroke range of the OIS motor according to data of a gyroscope.

3. The method according to claim 1 or 2, characterized in that, The camera module comprises an image sensor, the camera module being connected to the SoC through the target pin, comprising: the image sensor is connected to the SoC through the target pin; in a case where the camera module is in a non-exposure time, the target pin is set to a first state, comprising: in a case where the camera module is in a non-exposure time, the target pin is set to the first state by the image sensor.

4. The method of claim 3, wherein, The SoC further comprises a co-processor (CP), the image sensor being connected to the SoC through the target pin, comprising: the image sensor is connected to the CP through the target pin; when the target pin is in the first state, controlling the OIS motor to move to a middle position of a stroke range of the OIS motor, comprising: when the target pin is in the first state, the CP controls the OIS motor to move to the middle position of the stroke range of the OIS motor.

5. The method of claim 4, wherein, Before the CP controls the OIS motor to move to the middle position of the stroke range of the OIS motor, the method further comprises: the CP periodically queries a state of the target pin based on a timer.

6. The method according to any one of claims 1 to 5, characterized in that, The SoC comprises an application processor (AP), the AP being connected to the image sensor, the method further comprising: in a case where the non-exposure time is greater than or equal to a first time threshold, the AP sends a first instruction to the image sensor, the first instruction being used to instruct the image sensor to set the target pin to the first state in a case where the camera module is in a non-exposure time.

7. The method of claim 6, wherein: the first instruction is further used to instruct the image sensor to set the target pin to the second state in a case where the camera module is in an exposure time.

8. The method according to claim 6 or 7, characterized in that, The method further comprises: in a case where the non-exposure time is less than the first time threshold, the AP sends a second instruction to the image sensor, the second instruction being used to instruct the image sensor to always set the target pin to the second state.

9. An electronic device, comprising: The electronic device comprises a system on chip (SoC) and a camera module, the camera module comprising an OIS motor and a lens, the camera module further comprising a target pin, the camera module being connected with the SoC through the target pin, the SoC comprising a memory and one or more processors; the memory is coupled with the processor; The memory is configured to store computer program code, the computer program code comprising computer instructions; when the computer instructions are executed by the processor, the electronic device performs the method in any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, comprising computer instructions; When the computer instructions run on the electronic device, the electronic device performs the method in any one of claims 1-8.