Camera control method and electronic equipment

By using a focusing model to process images when the camera model is loaded and using a focusing algorithm to control lens movement when the camera model is not loaded, the problems of low image clarity and long acquisition time during image acquisition are solved, achieving efficient image clarity and fast acquisition.

CN121728344APending Publication Date: 2026-03-24HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

During image acquisition, how can we improve image clarity while shortening the time required to acquire clear images, especially when the camera model is not fully loaded, to avoid the problem of low image clarity?

Method used

By using a focusing model for image processing when the camera model is fully loaded, and using a focusing algorithm to determine motion information to control lens movement when the camera model is not fully loaded, the focusing model can be flexibly loaded to improve image clarity by combining camera information matching and model status indication.

Benefits of technology

This technology improves image clarity and shortens the time required to acquire clear images even when the camera model is not fully loaded, thereby reducing resource consumption and user experience latency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121728344A_ABST
    Figure CN121728344A_ABST
Patent Text Reader

Abstract

The embodiment of the invention is applied to the field of image acquisition, and provides a camera control method and electronic equipment, the camera control method is applied to the electronic equipment, the electronic equipment comprises a plurality of cameras, the plurality of cameras correspond to a plurality of focusing models, and the method comprises the following steps: in a continuous image acquisition process, for a newly acquired first image, performing focusing on the first image; under the condition that loading of a first focusing model corresponding to a first camera for collecting the first image is completed, the first image is processed through the first focusing model to determine motion information; under the condition that the loading of the first focusing model is not completed, processing the first image through a first focusing algorithm to determine motion information; and controlling a lens in the first camera to move according to the motion information. Based on the technical method provided by the invention, the time required for acquiring a clear image can be shortened while the definition of the acquired image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image acquisition, and more specifically, to a camera control method and electronic device. Background Technology

[0002] With the rapid development of electronic and image processing technologies, the image capture capabilities of smartphones, tablets, and other smart devices are becoming increasingly powerful. When taking photos with a smart device, in order to capture higher-resolution images, it's necessary to focus on the current scene—that is, adjust the position of the lens in the camera according to the current scene to obtain a clearer image.

[0003] In the process of continuous image acquisition, how to maximize the clarity of the acquired images while minimizing the time required to obtain clear images is an urgent problem to be solved. Summary of the Invention

[0004] This application provides a camera control method that can maximize the clarity of the captured image while shortening the time required to capture a clear image.

[0005] In a first aspect, a camera control method is provided, applied to an electronic device, the electronic device including multiple cameras, the multiple cameras corresponding to multiple focusing models, the method including: during continuous image acquisition, for the most recently acquired first image, if the first focusing model corresponding to the first camera acquiring the first image has been loaded, processing the first image through the first focusing model to determine first motion information, and controlling the lens movement in the first camera according to the first motion information; if the first focusing model has not been loaded, processing the first image through a first focusing algorithm to determine second motion information, and controlling the lens movement in the first camera according to the second motion information.

[0006] The camera control method provided in this application embodiment, when the first focusing model corresponding to the first camera currently acquiring images has been loaded, focuses the first camera through the first focusing model, so that the image acquired by the first camera has higher clarity; when the first focusing model has not been loaded, focusing the first camera through the first focusing algorithm can still improve the clarity of the subsequent images acquired by the first camera to a certain extent, thereby avoiding the phenomenon of low image clarity when the first focusing model has not been loaded. It can improve the clarity of the acquired image as much as possible while shortening the time required to acquire a clear image.

[0007] In some possible implementations, the method further includes: if the camera information of the first camera is the same as the information of the marked camera, determining whether the first focusing model has been loaded completely based on the model state indication information; if the camera information of the first camera is different from the information of the marked camera, determining that the first focusing model has not been loaded completely.

[0008] If the camera information of the first camera is the same as that of the marker camera, it can be determined whether the first focusing model has been loaded successfully based on the model status indication information; if the camera information of the first camera is different from that of the marker camera, it can be determined that the first focusing model has not been loaded successfully. The method for determining whether the first focusing model has been loaded successfully is more flexible.

[0009] In some possible implementations, the method further includes: loading the first focusing model and updating the marked camera information to the camera information of the first camera when the camera information of the first camera is different from the marked camera information.

[0010] If the camera information of the first camera differs from that of the marker camera, a first focusing model is loaded. Once the first focusing model is loaded, the first camera can focus more accurately, further improving the clarity of the images captured by the first camera. Setting the camera information of the first camera to the marker camera information during the loading of the first focusing model avoids redundant loading of the first focusing model.

[0011] In some possible implementations, loading the first focusing model and updating the marked camera information to the camera information of the first camera when the camera information of the first camera is different from the marked camera information includes: loading the first focusing model and updating the marked camera information to the camera information of the first camera when the camera information of the first camera is different from the marked camera information, and when the N consecutive frames of images preceding the first image are all captured by the first camera, where N is a positive integer.

[0012] If all images within a continuous time period are captured by the first camera, the first focusing model can be loaded, and the marked camera information can be updated to the camera information of the first camera. Therefore, if the camera capturing the images changes frequently, meaning that the consecutive N frames preceding the latest captured image are not all captured by the first camera (i.e., the camera capturing the images changes frequently), the first focusing model will not be loaded again, avoiding frequent loading of the focusing model and reducing the consumption of processing resources.

[0013] In some possible implementations, the method further includes: if the camera information of the first camera is different from the marked camera information, determining a first number of images captured by the camera represented by the marked camera information in a consecutive M frames of images preceding the first image, where M is a positive integer and M is less than or equal to N; if the first number is less than a number threshold, determining whether the N frames of images were captured by the first camera.

[0014] In the process of controlling the lens movement in the camera based on each frame of image, the camera information of the camera that captured that frame of image is matched with the marked camera information. Based on the matching result, it is determined whether to compare whether the first camera is the same as the N frames of images preceding the first image. If there are many images captured by cameras represented by the marked camera information in the M consecutive frames preceding the first image, the relatively complex determination of whether all the N consecutive frames preceding the first image were captured by the first camera can be omitted, thereby reducing the consumption of processing resources.

[0015] In some possible implementations, the method further includes: during continuous image acquisition, for each frame acquired, matching the camera information of the camera acquiring the frame with the marked camera information; if the camera information of the camera acquiring the frame is different from the marked camera information and also different from the candidate camera information recorded by the electronic device, then the camera information acquiring the frame is used as the candidate camera information, and a count value is set to 1; if the camera information of the camera acquiring the frame is different from the marked camera information and also different from the candidate camera information, then the count value is incremented by 1; if the camera information of the camera acquiring the frame is the same as the marked camera information, then the count value is set to 0; if, during the acquisition of the first image, the count value is equal to N, and the camera information of the first camera is the same as the candidate camera information, then it is determined that the N frames were acquired by the first camera.

[0016] The system records the number of images continuously captured by other cameras that are different from the camera represented by the marked camera, and determines whether the N consecutive frames before the first image were all captured by the first camera based on the relationship between this number and N. This eliminates the need for the electronic device to record the camera information of each frame separately, reducing the occupation of storage resources and simplifying the method of determining whether the N consecutive frames before the first image were all captured by the first camera.

[0017] In some possible implementations, the method further includes: if the second quantity is less than the quantity threshold, then if the camera information of the camera that acquired the one-frame image is different from the marked camera information, the camera information of the camera that acquired the one-frame image is matched with the candidate camera information, wherein the second quantity is the number of images acquired by the camera represented by the marked camera information in the M consecutive frames preceding the one-frame image, where M is a positive integer and M is less than or equal to N.

[0018] Since M is less than or equal to N, and the second quantity is greater than or equal to the quantity threshold, the camera capturing the image does not change stably. Therefore, the camera information of the camera capturing the image can be not matched with the candidate camera information. That is, no updates or settings are made to the candidate camera information or the count value based on the matching results of the camera information of the camera capturing the image and the candidate camera information, which reduces the consumption of processing resources.

[0019] In some possible implementations, loading the first focusing model includes: if the second focusing model corresponding to the camera represented by the marked camera information has been loaded, then releasing the second focusing model and loading the first focusing model.

[0020] Once the second focusing model corresponding to the camera indicated by the marked camera information has been loaded, and it is determined that the marked camera information will be updated to the camera information of the first camera, the second focusing model is released to reduce resource consumption.

[0021] The second focusing model corresponding to the camera represented by the marked camera information is the same as the focusing model corresponding to the camera represented by the marked camera information before the update. That is, the first focusing model and the second focusing model are different focusing models.

[0022] In some possible implementations, different cameras correspond to different magnification ranges; the first camera is the camera corresponding to the magnification of the image currently displayed on the screen of the electronic device, and the magnification is determined based on a first operation performed by the user when the screen displays the continuously acquired image during the continuous image acquisition process; the first operation is a pinch or expand operation of the image displayed on the screen, or the first operation is a drag operation of the control on the magnification indicator bar displayed on the screen.

[0023] The first operation involves continuously changing the magnification. When user actions cause frequent changes in the magnification range, the camera capturing the image changes frequently. The first focusing model is loaded and its information is set as the marker camera information if all N consecutive frames preceding the first image were captured by the first camera. However, if not all N consecutive frames were captured by the first camera, the first focusing model is not loaded, thus avoiding frequent loading of the focusing model and reducing resource consumption.

[0024] Secondly, a camera control device is provided, including a unit for performing the method of the first aspect. This device may be a terminal device or a chip within the terminal device.

[0025] Thirdly, an electronic device is provided, including a memory and a processor, the memory for storing a computer program, and the processor for calling and running the computer program from the memory, causing the electronic device to perform the method of the first aspect.

[0026] Fourthly, a chip is provided, including a processor and a data interface, wherein the processor reads instructions stored in a memory through the data interface to implement the method of the first aspect.

[0027] Fifthly, a computer-readable storage medium is provided, the computer-readable storage medium storing computer program code for implementing the method of the first aspect.

[0028] In a sixth aspect, a computer program product is provided, the computer program product comprising: computer program code, the computer program code being used to implement the method of the first aspect. Attached Figure Description

[0029] Figure 1 This is a schematic diagram of a graphical user interface of an electronic device provided in an embodiment of this application;

[0030] Figure 2 This is a schematic flowchart of a camera control method;

[0031] Figure 3 This is a schematic flowchart of an image acquisition method provided in an embodiment of this application;

[0032] Figure 4 This is a schematic flowchart of a camera control method provided in an embodiment of this application;

[0033] Figure 5 This is a schematic flowchart illustrating a camera information processing method provided in an embodiment of this application;

[0034] Figure 6 This is a schematic diagram of the filtering process provided in the embodiments of this application;

[0035] Figure 7 This is a schematic diagram of a hardware system for an electronic device applicable to this application;

[0036] Figure 8 This is a schematic diagram of a software system applicable to the electronic device described in this application. Detailed Implementation

[0037] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0038] It should be understood that "at least one" in this application refers to one or more items, and "more than one" refers to two or more items. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. In the description of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, to facilitate a clear description of the technical solutions of this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and that "first," "second," etc., do not necessarily imply differences.

[0039] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0040] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties (e.g., the user has given explicit consent, the user has been notified, etc.), and the collection, use and processing of the relevant data must comply with the relevant regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0041] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0042] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.

[0043] Machine learning is an important branch of artificial intelligence, and deep learning is an important branch of machine learning. Deep learning refers to using multi-layer neural network structures to learn representations of various things in the real world that can be directly used for computer calculations (such as objects in images, sounds in audio, etc.) from big data.

[0044] A neural network model is a mathematical method for simulating the actual neural network in humans. A neural network model is a complex network system formed by extensively interconnecting a large number of simple processing units (called neurons or neural units). A neural network model is a network formed by linking many of these individual neural units together; that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract features from the local receptive field, which can be a region composed of several neural units.

[0045] Deep neural networks (DNNs), also known as multi-layer neural networks, can be understood as neural networks with multiple hidden layers. Based on the position of the layers, DNNs can be divided into three categories: input layers, hidden layers, and output layers. Generally, the first layer is the input layer, the last layer is the output layer, and the layers in between are hidden layers. Layers are fully connected, meaning that any neuron in the i-th layer is connected to any neuron in the (i+1)-th layer. In deep neural networks, more hidden layers allow the network to better represent complex real-world situations. Theoretically, the more parameters a model has, the higher its complexity and "capacity," meaning it can perform more complex learning tasks. Training a deep neural network is essentially the process of learning the weight matrix, with the ultimate goal of obtaining the weight matrix (a weight matrix formed by vectors from many layers) of the trained deep neural network.

[0046] Neural network models can be applied to camera control to achieve focusing.

[0047] With the rapid development of electronic and image processing technologies, the camera functions of smartphones, tablets, and other smart devices are becoming increasingly powerful, with some even rivaling the capabilities of ordinary digital cameras. When taking photos with a smart device, in order to capture clearer images, it's necessary to focus on the current scene—that is, adjust the lens position according to the scene to obtain the highest possible image clarity.

[0048] When the distance between the subject and the image sensor in the camera is the focusing distance, the subject recorded in the image captured by the camera is the sharpest. In other words, if the distance between the subject and the image sensor is the focusing distance, light from the subject can form a sharp image point on the sensor, resulting in a sharp image. A point located at the focusing distance from the image sensor and on the lens axis can be called the camera's focus point. Points within a certain range in front of and behind the focus point along the lens axis can also form relatively sharp image points on the image sensor that are acceptable to the eye. By adjusting the position of the lens in the camera, the focusing distance can be adjusted, thus achieving focusing.

[0049] The following is combined Figure 1 This section describes a scenario where electronic devices acquire images.

[0050] Figure 1Image (a) illustrates a graphical user interface (GUI) for an electronic device, specifically the desktop 1110 of the electronic device. The GUI provides a way for a user to interact with a computer application through graphical elements such as windows, icons, menus, and buttons. When the electronic device detects that the user has clicked on the camera control 1111 of the camera application (app) on the desktop 1110, it can launch the camera application and display, as shown in the image. Figure 1 Another GUI is shown in (b) above. Figure 1 The GUI shown in (b) can be called the first camera interface 1120.

[0051] The first shooting interface 1120 may include a viewfinder 1121. A preview image can be displayed in real time within the viewfinder 1121. The preview image may be an image captured in real time by a camera in an electronic device.

[0052] The electronic device may contain one or more cameras. The image displayed in viewfinder 1121 may be captured by any one of the multiple cameras. The focal length ranges of the multiple cameras in the electronic device may be different. Focal length is a measure of the convergence or divergence of light in an optical system; it refers to the distance from the optical center of the lens to the focal point where parallel light converges when incident. Focal length is an important characteristic of a camera. For example, the multiple cameras may include a main camera, a wide-angle camera, and a telephoto camera. Telephoto cameras generally have a longer focal length and are mainly used to capture distant objects or scenes. Wide-angle cameras generally have a shorter focal length and are typically used to capture wide scenes or landscapes.

[0053] Based on the user's zoom operation, the electronic device can adjust the size of the captured area in the scene represented by the preview image in the viewfinder 1121, that is, adjust the magnification of the image to change the range and level of detail of the content contained in the picture.

[0054] User zoom operations can include pinch and expand operations. A pinch operation refers to the movement of two or more fingers (usually two fingers, such as the thumb and index finger) towards each other on the touchscreen; that is, the fingertips of multiple fingers move towards the center of the screen. Pinch operations are used to simulate the compression or shrinking of objects. Figure 1 As shown in (b), the opposite of the pinching action, the opening action refers to the action of the user's at least two fingers moving away from each other on the display screen of the electronic device.

[0055] The first camera interface 1120 may also include a magnification control 1122. For example... Figure 1As shown in (c), the user can click the magnification control 1122. When the electronic device detects that the user has clicked the magnification control 1122 on the first camera interface 1120, the electronic device can display... Figure 1 The second camera interface 1130 is shown in (d) above. The second camera interface 1130 includes a magnification indicator bar 1132. The magnification indicator bar 1132 includes a slider 1132a and an indicator icon 1132b. Different positions along the length of the slider 1132a represent different magnification levels. The user's zooming operation may also include dragging the slider 1132a along its length. During the dragging operation, the position of the indicator icon 1132b remains unchanged. The magnification level represented by the position where the slider 1132a and the indicator icon 1132b overlap can be understood as the magnification level indicated by the user through the dragging operation.

[0056] Alternatively, the magnification indicator bar 1132 may include a slider, with different positions along the length of the indicator bar 1132 representing different magnifications. The user can drag the slider, and the magnification indicated by the slider's position is the magnification specified by the user.

[0057] Therefore, users can adjust the magnification of the image displayed on the camera interface by dragging controls such as the slider in the slider bar 1132a or the zoom level indicator bar 1132. The electronic device can determine the target zoom level based on the user's zoom operation. The difference between the target zoom level and the original zoom level is proportional to the magnitude of the user's pinch, expand, or drag operation. The original zoom level can be understood as the value displayed by the zoom level control 1122 in the first camera interface 1120 before the user performs the zoom operation.

[0058] The electronic device can capture images using a camera corresponding to the magnification range of the target magnification to obtain a preview image in viewfinder 1121. When the magnification ranges are different, the preview images in viewfinder 1121 can be captured by different cameras. When the magnification is the target magnification, the preview image in viewfinder 1121 is magnified by the same ratio as the preview image in viewfinder 1121 at magnification of 1, equal to the target magnification.

[0059] Different cameras can correspond to different focusing models. During the process of an electronic device acquiring images through a camera corresponding to the magnification range of the target magnification, the electronic device can also process the image acquired by the camera using the focusing model corresponding to that camera to obtain motion information, and control the movement of the lens in the camera according to the motion information to achieve focusing.

[0060] When the system detects that the user has clicked the camera control 1111 to activate the camera, the electronic device can load the focus model corresponding to the main camera, capture an image through the main camera, and display the captured image in the viewfinder 1121. For example... Figure 2 As shown, when the camera that acquires images changes, the electronic device can switch models and control the movement of the lens in the camera through the switched focusing model.

[0061] Figure 2 This is a schematic flowchart of a camera control method. Figure 2 The method shown includes steps S210 to S212, and steps S221 to S227.

[0062] Step S210: In response to the user's camera activation operation, launch the camera application. Launching the camera application can also be understood as loading the camera application.

[0063] After the camera application is opened, steps S211 to S212 and steps S221 to S227 can be performed.

[0064] Step S211: Acquire images using a camera.

[0065] Once the camera is turned on, it can be used to control the camera to capture images. The camera can capture images periodically or non-periodically.

[0066] Step S212: Display the acquired image on the screen.

[0067] Once the camera app is open, the electronic device's display screen can show the camera interface, which displays preview images captured by the camera. Each image captured by the camera can be used as a preview image in the viewfinder of the camera interface.

[0068] After performing step S211, steps S221 to S227 can also be performed. It should be understood that step S212 can be performed after each instance of step S211. Similarly, steps S221 to S227 can be performed after each instance of step S211. Alternatively, the time interval between two consecutive instances of step S221 can be preset. Or, the number of times step S212 is performed within the time interval between two consecutive instances of step S221 can be preset. The following explanation uses the example of performing step S221 after each instance of step S211.

[0069] Step S221: Determine whether the camera capturing the image has changed.

[0070] The first focusing model corresponding to the first camera in the electronic device is being loaded or has been loaded.

[0071] When the camera application is launched, a preset camera can be used as the primary camera, and the focusing model corresponding to this preset camera can be used as the primary focusing model. The preset camera can be understood as the camera configured in the electronic device to perform image acquisition by default. For example, the preset camera can be the main camera.

[0072] During the camera application launch process, a preset focus model corresponding to the camera can be loaded. Once the camera application has finished launching, images can be captured using the preset camera.

[0073] Based on the user's zoom operation or the distance between the camera and objects in the scene captured by the camera, the camera used for image acquisition can be adjusted. Therefore, the camera used for image acquisition during multiple iterations of step S211 can be the same or different.

[0074] The process involves determining whether the camera used to capture the images has changed. Specifically, it checks if the camera capturing the latest image is the same as the camera that captured the previous image; that is, it determines whether the images captured in step S221 were captured by the same camera. If the camera used to capture the images has not changed, proceed to step S225. If the camera used to capture the images has changed, proceed to steps S222 through S225.

[0075] Step S222: Release the first focus model.

[0076] Step S223: Based on the correspondence between multiple cameras and multiple focusing models, the focusing model corresponding to the camera that has acquired the latest image is taken as the new first focusing model.

[0077] Step S224: Load the new first focus model.

[0078] Because the camera capturing the image has changed, the focusing model corresponding to the previous camera is different from the focusing model corresponding to the new camera. Therefore, the first focusing model loaded in step S224 is a new first focusing model, which is different from the original first focusing model released in step S222. In other words, the first focusing model loaded in step S224 is the first focusing model most recently determined in step S223, that is, the focusing model corresponding to the camera that captured the latest image.

[0079] Step S225: Determine whether the first focus model has been loaded.

[0080] Loading a model can be understood as transferring the model from non-volatile memory to main memory, i.e., storing the model in main memory and setting up its runtime environment. The loaded model can then be used to receive and process data. Releasing a model can be understood as removing it from main memory, i.e., releasing the memory resources occupied by the model. Main memory can be volatile memory. Volatile memory is a storage device whose data is lost when the power is turned off. Main memory is the preferred choice for processors to handle high-speed data exchange due to its fast access speed and direct access mechanism. While non-volatile memory can maintain data integrity after power failure, its access speed is relatively slow and requires access through a file system or other intermediate layers. Loading a model can improve the processor's processing efficiency.

[0081] During each step S225, the first focusing model is the latest first focusing model, that is, the focusing model corresponding to the camera that acquires the latest image.

[0082] If the camera used to capture images remains unchanged after the camera application is opened, the first focus model is loaded during the opening process of the camera application, meaning the first focus model has already been loaded. If the camera used to capture images changes after the camera application is opened but before step S225, the first focus model may not have been loaded (during steps S222 to S224) or it may have already been loaded.

[0083] If the first focus model has not been fully loaded, the processing based on the acquired image can be terminated. If the first focus model has been fully loaded, steps S226 to S227 can be performed.

[0084] Step S226: The image is processed by the first focusing model to determine motion information.

[0085] Step S227: According to the motion information, control the movement of the lens in the camera that is acquiring the image.

[0086] Through steps S226 to S227, the camera can focus on the object being recorded in the image. Therefore, after the lens moves according to the motion information, when the camera captures an image, it can obtain a clear image.

[0087] Through steps S221 to S227, when the camera that acquires the image changes, the focusing model corresponding to the changed camera is loaded, the image acquired by the changed camera is processed using the focusing model corresponding to the changed camera, and the lens in the changed camera is controlled to move according to the motion information obtained from the processing, so that the changed camera can focus on the object in the scene recorded in the acquired image, and the object is clearer in the next image acquired by the changed camera.

[0088] However, the release and loading of the focus model takes some time. During the switching between focus models corresponding to different cameras, the image displayed in the shooting interface is blurry, resulting in a poor user experience.

[0089] To achieve focus as quickly as possible and ensure that the acquired image reaches a high level of clarity as soon as possible, this application provides an image acquisition method. The method provided in this application can be executed by an electronic device or a software / hardware module within the electronic device capable of image acquisition. For ease of explanation, the following embodiments use an electronic device as an example.

[0090] Figure 3 This is an image acquisition method provided in the embodiments of this application. Figure 3 The method 300 shown includes steps S310 to S340.

[0091] Step S310: Acquire image.

[0092] The electronic device can continuously acquire images through the camera. That is, step S310 can be performed periodically or non-periodically. Continuous image acquisition by the electronic device can also be understood as continuous image acquisition, that is, the electronic device constantly acquires image sequences from sources such as the camera.

[0093] After step S310, steps S320 to S330 can be performed. In some embodiments, after step S310, the electronic device can also perform step S340. Steps S320 to S340 can be performed in parallel.

[0094] For each frame of image captured by the camera, steps S320 to S340 can be performed. Alternatively, step S320 can be performed for each frame of image captured by the camera, while steps S330 and S340 can be performed for a portion of the images. Or, steps S320 and S340 can be performed for each frame of image captured by the camera, while step S330 can be performed for a portion of the images.

[0095] For example, steps S330 and S340 can be performed for images acquired at preset time intervals, or steps S330 and S340 can be performed for images acquired at preset frame intervals. Thus, the electronic device continuously acquires images for performing steps S330 and S340.

[0096] The video stream captured by a camera typically contains multiple consecutive frames, with different frames captured at different times. Processing each frame using step S330 (or steps S330 and S340) would not only increase computational resource consumption but also potentially reduce processing efficiency due to excessive redundant information. Therefore, by pre-setting a frame interval (e.g., taking one frame every five frames), the number of images requiring processing can be significantly reduced while still retaining sufficient information for camera control.

[0097] Specifically, for step S330, which is used to achieve camera focusing, the distance between objects in the scene and the electronic device is generally small during the continuous image acquisition process of the electronic device, as the time intervals between adjacent image acquisitions are relatively short. In other words, after step S330 is performed on the previous frame, step S330 is not performed on the next frame; the camera is controlled to focus based on the next frame. The frame following this next frame can still maintain high clarity. Therefore, performing step S330 on images acquired at preset intervals or at preset frame intervals can reduce the consumption of processing resources while ensuring image clarity.

[0098] Step S320: Store and / or display the image.

[0099] The electronic device can store and / or display each frame of image captured by the camera. The electronic device may include a display screen, through which the images captured by the camera can be displayed.

[0100] Step S330: Based on the camera information of the camera that acquired the image, camera control is performed to achieve focusing.

[0101] Controlling the camera based on camera information allows the camera to focus; see [link / reference] for details. Figure 4 Explanation.

[0102] The following is combined Figure 4 The camera control method provided in the embodiments of this application will be described in detail. Figure 4 This is a schematic flowchart of a camera control method provided in an embodiment of this application. Figure 4 The method shown is applied in an electronic device. This electronic device includes multiple cameras. These multiple cameras correspond to multiple focusing models. Figure 4 The method 400 shown includes steps S410 to S450.

[0103] Step S410: During the continuous image acquisition process, for the latest acquired first image, determine whether the first focus model corresponding to the first camera that acquired the first image has been loaded.

[0104] In a series of continuously captured images, the cameras capturing different images can be the same or different. For example, when the electronic device's display screen shows images captured by the cameras, the electronic device can switch to the camera most suitable for the current shooting scene when needed, based on user operation or a preset algorithm.

[0105] For example, different cameras can correspond to different magnification ranges. After the user adjusts the magnification, the electronic device can capture images through the camera corresponding to the magnification range of the adjusted magnification. In other words, the camera that captures images can change depending on how the user adjusts the magnification.

[0106] For example, different distance ranges correspond to different cameras. An electronic device can capture images using the camera corresponding to the distance range recorded in the image captured by the camera, based on the distance between the object and the electronic device. In other words, the camera used for image capture can change as the distance between the object and the electronic device recorded in the captured image changes.

[0107] If the first focus model has been loaded, proceed to steps S420 to S430.

[0108] Step S420: Process the first image using the first focusing model to determine the first motion information.

[0109] Step S430: Control the movement of the lens in the first camera according to the first motion information.

[0110] The first focusing model is the focusing model corresponding to the first camera that captures the latest first image. By controlling the lens movement in the first camera based on the processing results of the first image using the first focusing model, relatively accurate focusing can be achieved.

[0111] Multiple cameras correspond to multiple focusing models. Therefore, the focusing model for each camera is more adapted to processing the images captured by that camera, resulting in more accurate focusing. For an image captured by any one camera, the focusing model corresponding to that camera performs image processing to obtain first motion information, and controls the lens movement of that camera according to the first motion information to achieve focusing.

[0112] If the first focus model has not been fully loaded, proceed to steps S440 to S450.

[0113] Step S440: Process the first image using the first focusing algorithm to determine the second motion information.

[0114] Either the first motion information or the second motion information can be represented as the position of the moving target or as a motion vector. The lens can move in a direction closer to or farther from the sensor. The position of the moving target can be understood as the relative position between the lens and the sensor. The motion vector includes the direction of motion and the distance of motion.

[0115] Step S450: Control the movement of the lens in the first camera according to the second motion information.

[0116] The first focusing algorithm can be understood as a universal focusing algorithm, applicable to images captured by various cameras. This first focusing algorithm can be a phase-based focusing algorithm, such as phase detection autofocus (PDAF), or simply a phase focusing algorithm. Alternatively, it can be other focusing algorithms, such as models obtained through training.

[0117] A camera includes a sensor and a lens. The sensor in a camera can be understood as an image sensor. When multiple phase-sensor pairs are arranged in this sensor, a phase-based focusing algorithm processes the image acquired by the sensor to determine the focus position. In each phase-sensor pair, the first and second photosensitive elements are used to receive light from different sides of their respective pixels. That is, in a phase-sensor pair, the first photosensitive element receives light transmitted through the lens to the first side of the pixel where the first photosensitive element is located, and the second photosensitive element receives light transmitted through the lens to the second side of the pixel where the second photosensitive element is located; the first and second sides represent opposite directions. In the same sensor, the first and second photosensitive elements in different phase-sensor pairs can have the same or different relative positional relationships.

[0118] A phase sensor pair can be a dual pixel formed by occlusion. By occluding one side of a sensor, a first sensor and a second sensor can be formed, wherein the second side of the first sensor is occluded, and the first side of the second sensor is occluded. The first and second sensors in a phase sensor pair can be located in two adjacent, different pixels.

[0119] In other embodiments, a pair of phase-sensitive elements may be disposed in the same pixel. Exemplarily, each pixel in all or part of the pixels may be provided with a first photosensitive element and a second photosensitive element. Each of the first and second photosensitive elements can receive light from the side on which it is located.

[0120] Phase-based autofocus algorithms determine motion information by detecting the distance between a first phase image captured by a first photosensitive element and a second phase image captured by a second photosensitive element in the sensor. By controlling the lens movement in the camera according to this motion information, focusing can be achieved. After controlling the lens movement in the camera according to the motion information, image acquisition using the sensor results in a higher image sharpness.

[0121] However, under certain lighting conditions or with specific image content, phase-based autofocus algorithms often fail to predict the focus position. When capturing images in backlit scenes, scenes with repetitive textures, scenes with weak textures or low contrast such as white walls, high-contrast scenes, or scenes with a lot of moiré patterns (such as scenes including monitor display content), phase-based autofocus algorithms cannot accurately predict the focus position, meaning the accuracy of motion information determined by phase-based autofocus algorithms is low.

[0122] The lens movement in the first camera is controlled based on the processing result of the first image using the first focusing algorithm. However, the focusing accuracy of the first camera for the recorded objects in the acquired first image is relatively low. But compared to not performing focusing processing when the first focusing model corresponding to the first camera for the currently acquired image is not fully loaded, focusing the first camera using the first focusing algorithm when the first focusing model is not fully loaded still results in a relatively clear image. This avoids the phenomenon of low image clarity when the first focusing model is not fully loaded, thus improving the user experience.

[0123] In some cases, electronic devices may record tagged camera information. This tagged camera information indicates that the focus model corresponding to the camera is in a state of about to load, loading, or has already been loaded. Focus models corresponding to cameras different from those indicated by the tagged camera information have not been loaded and are not focus models about to be loaded.

[0124] Therefore, if the camera information of the first camera is the same as that of the marked camera, it can be determined whether the first focusing model has been loaded successfully based on the model status indication information; if the camera information of the first camera is different from that of the marked camera, it can be determined that the first focusing model has not been loaded successfully.

[0125] It should be understood that the electronic device may record one or more marker camera information. When there are multiple marker camera information entries, the camera information of the first camera can be compared sequentially with each marker camera information entry. If the camera information of the first camera matches any marker camera information entry, it can be determined whether the first focusing model has been successfully loaded based on the model status indication information of that marker camera. If the camera information of the first camera does not match any of the marker camera information entries, it can be determined that the first focusing model has not been successfully loaded.

[0126] During the loading process of the first focusing model, the model status indication information can be set to the second identifier. When the first focusing model has been loaded, the model status indication information can be set to the first identifier. Therefore, if the model status indication information is the first identifier, it can be determined that the first focusing model has been loaded; if the model status indication information is the second identifier, it can be determined that the first focusing model has not been loaded.

[0127] It should be understood that when there are multiple labeled camera information entries, model status indication information can be set for each labeled camera information entry. Thus, the model status indication information corresponding to each labeled camera information entry indicates whether the focusing model corresponding to that camera has been loaded.

[0128] In other words, step S410 may also include, for example: Figure 5 Step S502 is shown in the process of performing step S340. That is, both steps S330 and S340 can include step S520. Through step S502, the camera information of the first camera can be matched with the marked camera information. In step S330, if the matching results of S502 are different, steps S440 to S450 can be performed. If the matching results of S502 are the same, it can be determined whether the first focusing model has been loaded completely based on the model status indication information.

[0129] Through steps S410 to S450, when the first focusing model corresponding to the first camera currently acquiring the image has been loaded, the first camera is focused using the first focusing model, resulting in a high-resolution image acquired by the first camera. When the first focusing model has not been loaded, the first focusing algorithm is used to focus the first camera. Although the focusing accuracy may not be as high as that of focusing using the first focusing model, it can still improve the resolution of the image acquired by the first camera. This avoids the phenomenon of low resolution when the first focusing model is not loaded. It can improve the resolution of the acquired image while acquiring a clear image as quickly as possible, thus improving the user experience.

[0130] Step S340 can also be performed while performing steps S320 and S330.

[0131] Step S340: Determine whether to load the focus model corresponding to the camera that captured the image based on the camera information of the camera that captured the image.

[0132] If the camera acquiring images changes, a focusing model corresponding to the camera currently acquiring images can be loaded. For example, if the camera information of the first camera differs from the information of the marker camera, a first focusing model can be loaded, and the camera information of the first camera can be set to the new marker camera information. Therefore, after the first focusing model is loaded, the first camera can be focused using the first focusing model, improving the focusing accuracy of the first camera.

[0133] If the number of camera information markers is at most one, and the camera information of the first camera is different from the camera information of the marker camera, the first focusing model can be loaded and the camera information of the marker camera can be updated to the camera information of the first camera.

[0134] If the camera information of the first camera differs from the information of the marked camera, a first focusing model is loaded. Focusing of the first camera can be achieved after the first focusing model is loaded. Setting the camera information of the first camera to the information of the marked camera during the loading of the first focusing model avoids redundant loading of the first focusing model.

[0135] The release of one focus model and the loading of another focus model by the electronic device can occur simultaneously. Alternatively, if the number of camera information markers is at most one, the electronic device can release one focus model and then load another.

[0136] When updating the marked camera information to the first camera information, the number of marked camera information records in the electronic device is at most one, that is, the number of focusing models in the electronic device that are in a loading or loaded state is at most one. Having fewer focusing models in the electronic device in a loading or loaded state reduces memory usage.

[0137] If the camera information of the first camera is determined to be different from the marked camera information, the second focus model corresponding to the camera represented by the marked camera information may not yet be loaded. For example, if the electronic device releases one focus model and then loads another, after the last update of the marked camera information, the electronic device can release the focus model corresponding to the camera represented by the marked camera information before the last update, and load the focus model corresponding to the camera represented by the marked camera information after the last update is completed. The last updated marked camera information is the marked camera information compared with the camera information of the first camera, i.e., the latest marked camera information. If the camera information of the first camera is different from the marked camera information, the electronic device may not have completed the release of the focus model corresponding to the camera represented by the marked camera information before the last update, and the second focus model corresponding to the marked camera information after the last update may not yet be loaded. In other words, if the second focus model corresponding to the camera represented by the marked camera information may not yet be loaded, the release of the focus model corresponding to the camera represented by the marked camera information before the last update may not yet be completed.

[0138] If the camera information of the first camera is determined to be different from the marked camera information, and if the second focusing model corresponding to the camera represented by the marked camera information has already been loaded, then the second focusing model is released and the first focusing model is loaded. If the camera information of the first camera is determined to be different from the marked camera information, and if the second focusing model corresponding to the camera represented by the marked camera information has not yet been loaded, then the first focusing model can be loaded.

[0139] It should be understood that during the processing based on the first image, the released second focusing model can be understood as the focusing model corresponding to the camera represented by the marked camera information before the update. After the marked camera information is updated, the camera represented by the updated marked camera information is the first camera, and the second focusing model corresponding to the camera represented by the updated marked camera information is the first focusing model corresponding to the first camera. The second focusing model changes after the marked camera information is updated.

[0140] It should be understood that the second focus model corresponding to the camera represented by the marked camera information before the update has not yet been loaded, possibly because the release of the focus model corresponding to the camera represented by the marked camera information before the last update may not have been completed. In this case, the loading of the first focus model can be performed after the release of the focus model corresponding to the camera represented by the marked camera information before the last update is completed; that is, the release of the second focus model corresponding to the camera represented by the marked camera information before the update will not be performed.

[0141] If the second focusing model corresponding to the camera represented by the marked camera information before the update has been loaded, and it is determined that the marked camera information will be updated to the camera information of the first camera, the second focusing model is released, thereby reducing the consumption of resources.

[0142] In some embodiments, if the camera information of the first camera is different from the marker camera information, the first focusing model can be loaded immediately, and the camera information of the first camera can be used as the marker camera information. However, if the camera acquiring the image changes frequently, the electronic device may frequently load the focusing model, consuming more processing resources.

[0143] In other embodiments, when the camera information of the first camera is different from the marked camera information, and the consecutive N frames of images before the first image are all captured by the first camera, a first focusing model can be loaded, and the camera information of the first camera can be set as the marked camera information, where N is a positive integer.

[0144] In other words, if all images within a continuous time period are captured by the first camera, the first focusing model can be loaded, and the marker camera information can be updated to the first camera's information. Therefore, if the camera capturing the images changes frequently, meaning that the consecutive N frames preceding the latest captured image are not all captured by the first camera (i.e., the camera capturing the images changes frequently), the first focusing model will not be loaded again, thus avoiding frequent loading of the focusing model and reducing the consumption of processing resources.

[0145] The value N can be set manually. For example, the time required to acquire N or N+1 frames of images can be less than or equal to the time required to load the focus model.

[0146] To determine whether all N consecutive frames preceding the first image were captured by the first camera, in some embodiments, camera information of the camera that captured each frame in those N consecutive frames can be recorded. The electronic device can record camera information of the camera that captured each frame in the most recent N+1 frames. Here, the first image can be understood as the N+1th frame. If it is determined that the camera information of the camera that captured the first image is different from the marked camera information, the recorded camera information from the first to the Nth frame is matched against the camera information of the camera that captured the first image.

[0147] Recording camera information for each frame of image capture separately consumes significant storage resources. To reduce storage resource consumption, in some embodiments, the number of images continuously captured by other cameras different from the one represented by the marked camera can be recorded, and this number can be used to determine whether all N consecutive frames preceding the first image were captured by the first camera.

[0148] During continuous image acquisition, after each frame is acquired, the camera information of the camera acquiring that frame is matched with the marked camera information. If the camera information of the camera acquiring that frame is different from the marked camera information and also different from the candidate camera information recorded by the electronic device, then the camera information of the camera acquiring that frame can be considered as candidate camera information, and its count is recorded as 1. If the camera information of the camera acquiring that frame is different from the marked camera information and also different from the candidate camera information recorded by the electronic device, then the count is incremented by 1. If the camera information of the camera acquiring that frame is the same as the marked camera information, then the count is recorded as 0.

[0149] In other words, the count value represents the number of images captured by other cameras, different from the camera indicated by the labeled camera, in the images preceding the first image.

[0150] Therefore, if the count value is equal to N when the first image is captured, and the camera information of the first camera is the same as the candidate camera information recorded by the electronic device, then it can be determined that the N consecutive frames of images preceding the first image were captured by the first camera.

[0151] To further reduce the consumption of processing resources, it is also possible to determine whether the N frames preceding the first image were captured by the first camera based on whether the consecutive M frames preceding the first image were captured by the camera indicated by the camera information.

[0152] The first image is the most recently acquired image. That is, for each frame, upon acquisition, the camera information of the camera capturing that frame is matched with the information of the marked camera; that is, it is determined whether the camera information of the camera capturing that frame is the same as the information of the marked camera. If the camera information of the camera capturing that frame is different from the information of the marked camera, or if the camera information of the camera capturing that frame is the same as the information of the marked camera but the model status indicator indicates that the focusing model has not been fully loaded, the first focusing algorithm processes the frame and controls the lens movement of the camera in that frame according to the processed motion information. If the camera information of the camera capturing that frame is the same as the information of the marked camera and the focusing model indicated by the model status indicator is fully loaded, the focusing model corresponding to the camera indicated by the marked camera information processes the frame and controls the lens movement of the camera in that frame according to the processed motion information. The model status indicator indicates whether the focusing model corresponding to the camera indicated by the marked camera information has been fully loaded.

[0153] In other words, for each frame of an image, the camera information of the camera that captured that frame can be matched with the information of the marked camera. Based on the matching result of the camera information of the image's camera and the marked camera information, it can be determined whether to perform a judgment on whether the previous N consecutive frames of images were all captured by the first camera.

[0154] If the camera information of the first camera is different from the information of the marked camera, a first number of images captured by the camera represented by the marked camera information in the M consecutive frames preceding the first image can be determined, where M is a positive integer and M is less than or equal to N. If the first number is less than a threshold, it can be determined whether the N frames preceding the first image were captured by the first camera. If the first number is greater than or equal to the threshold, a large number of images in the M frames were captured by the camera represented by the marked camera information, thus eliminating the need to compare whether the N frames preceding the first image were captured by the same camera as the first camera.

[0155] In the process of controlling the lens movement in the camera based on each frame of image, the camera information of the camera that captured that frame of image is matched with the marked camera information. Based on the matching result, it is determined whether to compare whether the first camera is the same as the N frames of images preceding the first image. If there are many images captured by the camera represented by the marked camera information in the M consecutive frames preceding the first image, it is unnecessary to determine whether all the N consecutive frames preceding the first image were captured by the first camera, thereby reducing the consumption of processing resources.

[0156] In the case where the electronic device continuously captures the number of images from other cameras that are different from the camera represented by the marked camera, it can also match the camera information of the camera in each frame of the consecutive N frames with the candidate camera information, and determine whether to load the first focus model based on the matching result.

[0157] For each frame, the number of images captured by the camera represented by the marked camera information in the preceding M consecutive frames is the second count. If the second count is less than a count threshold, then if the camera information of the camera capturing each frame is different from the marked camera information, the camera information of the camera capturing that frame is matched with candidate camera information. The second count is the number of images captured by the camera represented by the marked camera information in the preceding M consecutive frames, where M is a positive integer and M is less than or equal to N. If the second count is greater than or equal to the count threshold, then the matching of the camera information of the camera capturing that frame with the candidate camera information is no longer performed, and thus the determination of whether the preceding N consecutive frames were captured by the first camera based on the count value is no longer performed.

[0158] Since M is less than or equal to N, and the second quantity is greater than or equal to the quantity threshold, the camera capturing the image does not change stably. Therefore, the camera information of the camera capturing the image can be not matched with the candidate camera information. That is, the matching result of matching the camera information of the camera capturing the image with the candidate camera information is not updated or set, thus reducing the consumption of processing resources.

[0159] When an image captured by a camera is displayed on the screen, the electronic device can determine the magnification of the image displayed on the screen based on the user's first operation. The image displayed on the screen includes continuously captured images. Different cameras correspond to different magnification ranges. The first camera can be the camera corresponding to the magnification of the image currently displayed on the electronic device's screen, and the magnification is determined based on the user's first operation when the image is displayed on the screen.

[0160] The first operation can be an operation that causes a continuous change in magnification. That is, the first operation can be anything. For example, the first operation can be a pinch or expand operation on the image displayed on the screen, or it can be a drag operation on a control on the magnification indicator bar displayed on the screen.

[0161] The first operation continues for a certain period of time. During this period, the electronic device can adjust the magnification during the initial operation. In other words, the electronic device continuously adjusts the magnification during the user's first operation. When the user's actions cause frequent changes in the magnification range, the camera capturing the image changes frequently. By loading the first focusing model and setting the first camera's information as marker camera information when all N consecutive frames preceding the first image were captured by the first camera, and not loading the first focusing model when not all N consecutive frames were captured by the first camera, frequent loading of the focusing model is avoided, reducing the consumption of processing resources.

[0162] When setting the camera information of the first camera as the marker camera information—specifically, updating the marker camera information to the camera information of the first camera (meaning the number of marker camera information is at most one)—frequent changes to the marker camera information can cause the electronic device to continuously load and release the focusing model. During the loading and releasing process, the focusing model cannot perform image processing. In other words, frequent updates to the marker camera information consume significant processing resources of the electronic device, and the improvement effect on the focusing accuracy of the camera, i.e., the clarity of the image captured by the camera, is not significant, or even has a negative impact on improving the clarity of the image captured by the camera.

[0163] For example, if a user accidentally changes the camera used to capture images from one camera identified by the camera information to another, and then quickly reverts to the same camera, if the camera information is updated to the new camera's information when the camera changes, the focus model for that new camera is released and then loaded, then when the camera changes back to the original camera, the camera information needs to be updated again, and the focus model for that new camera needs to be loaded again. During the loading of the new focus model, the image captured by that new camera is processed using a first focus algorithm, resulting in lower focus accuracy for that new camera. Furthermore, the time required to load the focus model for the new camera might be greater than or equal to the time the new camera was used for image capture. Therefore, loading the focus model for the new camera consumes significant processing resources, and the image captured by the electronic device has lower clarity.

[0164] In other words, updating the marked camera information and loading the time point representing the focus model of the camera is crucial for the clarity of the image captured by the electronic device.

[0165] If the first N consecutive frames of images preceding the first image are all captured by the first camera, the first focusing model is loaded and the marked camera information is updated to the camera information settings of the first camera. This can reduce the switching frequency of the focusing model when the camera capturing the images changes frequently, thereby reducing the consumption of processing resources while maintaining high focusing accuracy of the camera.

[0166] For example, it can be done by Figure 5 The camera information processing method shown determines whether to load the focus model corresponding to the camera that acquires and processes the image. Figure 5 This is a schematic flowchart of a camera information processing method provided in an embodiment of this application.

[0167] Figure 5 The method shown includes steps S501 to S510, and steps S521 to S522. Steps S501 to S510 may be performed by the switching control module of the electronic device, and steps S521 to S522 may be performed by the focusing module of the electronic device.

[0168] During the continuous image acquisition process, each frame of image acquired is the latest acquired image, i.e., the first image. Steps S501 to S510 and steps S521 to S522 can be performed based on this frame of image.

[0169] Step S501: Obtain camera information of the first camera that captures the first image.

[0170] Step S502: Match the camera information of the first camera that acquired the first image with the information of the marked camera to obtain the first matching result.

[0171] The first matching result can represent whether the camera information of the camera capturing the first image is the same as the information of the marked camera through different values. For example, a first matching result of 0 can indicate that the camera information of the camera capturing the first image is the same as the information of the marked camera, while a first matching result of 1 can indicate that the camera information of the camera capturing the first image is not the same as the information of the marked camera.

[0172] The first matching result obtained through step S502 can also be used in... Figure 4 The process shown in step S410 is in the process of determining whether the focus model corresponding to the first camera has been loaded.

[0173] If the first matching result is 0, indicating a match, step S503 can be performed. If the first matching result is 1, step S504 can be performed.

[0174] Step S503: The count value is recorded as 0.

[0175] Step S504: Determine whether the first quantity is less than the quantity threshold.

[0176] The first quantity is the number of images captured by the camera in the M frames preceding the first image, represented by the camera information.

[0177] If there are no M frames before the first image, meaning the number of images acquired before the first image is less than M, it can be determined that the first number is less than the number threshold.

[0178] If there are M frames of images prior to the first image, steps S501 to S502 are performed for each frame of image acquired before the first image. After performing step S502 on each frame of the M frames, a first matching result for that frame can be obtained. The first matching result for that frame is used to indicate whether the camera information of the camera that acquired that frame is the same as the information of the marked camera.

[0179] It should be understood that during the processing of the M frames as the newly acquired first images in steps S501 to S510, the marker camera information may be updated. After the marker camera information is updated, the marker camera information is compared with the camera information of the camera acquiring the next frame image, and this updated marker camera information is the new marker camera information.

[0180] The comparison between the first quantity and the quantity threshold can be achieved by applying mean filtering or median filtering to the first matching results of the M frames preceding the first frame image.

[0181] Mean filtering calculates the average of the first matching results for the M frames and compares this average with a mean threshold to determine if the first quantity is less than the threshold. If the first matching result is 1, indicating that the camera information of the camera capturing the first image differs from the marked camera information, and the average is less than or equal to the mean threshold, then the first quantity is less than the threshold. Conversely, if the average is greater than or equal to the mean threshold, then the first quantity is not less than the threshold. The mean threshold can be greater than 0 and less than or equal to 1.

[0182] To calculate the average of the first matching results for M frames, a convolution operation can be performed between the matching result vector and the mean vector. The matching result vector consists of M bits, each representing the first matching result for each frame in the M frames. The mean vector also consists of M bits, each equal to 1 / M.

[0183] When M is an odd number, and the quantity threshold is greater than (M+1) / 2 and less than or equal to (M+1) / 2, the method for determining whether the first quantity is less than the quantity threshold can be to perform median filtering on the first matching results of the M frames. The result of the median filtering is the median of the first matching results of the M frames. Based on this median, it can be determined whether the first quantity is less than the quantity threshold. When the first matching result is 1, indicating that the camera information of the camera that captured the first image is different from the marked camera information, a median filtering result of 0 indicates that the first quantity is less than the quantity threshold, and a median filtering result of 1 indicates that the first quantity is greater than or equal to the quantity threshold.

[0184] like Figure 6 As shown, a first matching result of 0 indicates a match. If, for each frame of image acquired, the first matching result of the preceding M frames is subjected to median filtering, and only a small portion of the M frames are not captured by the camera whose information is labeled, the median filtering result will be 0, and step S505 can be discontinued.

[0185] If the first quantity is less than the quantity threshold, step S505 can be performed. If the first quantity is greater than or equal to the quantity threshold, step S501 is performed again.

[0186] Step S505: Match the camera information of the first camera with the candidate camera information to obtain the second matching result.

[0187] If the second matching result indicates that the camera information of the first camera is different from the marked camera information, step S506 can be performed.

[0188] Step S506: Update the candidate camera information to the camera information of the first camera, and record the count value as 0.

[0189] After step S506, step S501 can be performed again.

[0190] If the second matching result indicates that the camera information of the first camera is the same as the marked camera information, step S507 can be performed.

[0191] Step S507: Determine whether the count value is greater than or equal to N.

[0192] When performing step S507, the count value represents the number of consecutive camera information that is identical to the camera information of the first camera among the camera information of the camera that acquired the image before the first image.

[0193] If the count value is greater than or equal to N, proceed to steps S508 to S509.

[0194] Step S508: Update the marked camera information to the camera information of the first camera, and record the count value as 0.

[0195] Step S509: Output switching information.

[0196] The switching information can instruct the electronic device to load the first focus model corresponding to the first camera.

[0197] Steps S508 to S509 can be performed in parallel. After steps S508 to S509, step S501 can be performed again.

[0198] If it is determined in step S509 that the count value is less than N, proceed to step S510.

[0199] Step S510: Increment the count value by 1.

[0200] After step S510, step S501 can be performed again.

[0201] Step S340 may include Figure 5 Steps S501 to S510 in the method shown. That is, if it is determined in step S340 that the first focusing model is loaded, steps S521 to S522 can also be performed.

[0202] After the switching control module in the electronic device performs step S509, the switching information can be transmitted to the focusing module in the electronic device, and the focusing module can perform steps S521 to S522.

[0203] Step S521: Release the focus model.

[0204] The released focus model can be a focus model that has been loaded or is being loaded. The released focus model can also be the focus model corresponding to the camera represented by the marked camera information before the update.

[0205] Step S522: Load the first focusing model corresponding to the first camera.

[0206] Step S522 can be performed after step S521 has been completed, or step S522 can be performed simultaneously with step S521. If step S522 is performed after step S521, then step S521 can be performed if the focus model corresponding to the camera represented by the previously updated marked camera information is loaded. That is, if the focus model corresponding to the camera represented by the previously updated marked camera information is not loaded, the release of the focus model corresponding to the camera represented by the previously updated marked camera information does not need to be performed.

[0207] In other words, based on the switching information, the focusing module can proceed to step S522 even if the focusing model corresponding to the camera represented by the previously marked camera information is not loaded. Based on the switching information, the focusing module can proceed to steps S521 and S522 if the focusing model corresponding to the camera represented by the previously marked camera information is loaded. The loading of the focusing model corresponding to the camera represented by the previously marked camera information can mean that the focusing model is being loaded or that the focusing model has already been loaded.

[0208] Alternatively, the focusing model released in step S521 can be understood as the focusing model corresponding to any one camera. That is, in step S521, the focusing model is released for all focusing modules that are being loaded, being released, or have been loaded.

[0209] After step S509, if the focusing model receives switching information, the focusing model can set the model status indication information to the second identifier. If the first focusing model has finished loading, the focusing model can set the model status indication information to the first identifier.

[0210] It should be understood that Figure 5 The multiple steps S502 to S510 shown can all be understood as steps performed between two consecutive steps S501. That is, the switching control module in the electronic device can perform step S501 again after steps S503, S506, or S510, or steps S508 to S509, that is, after steps S502 to S510 are completed.

[0211] Considering the processing power limitations of electronic devices, in some cases, [the following is necessary]: Figure 5The information from two adjacent cameras processed by the method shown may not be the information from two adjacent cameras that are capturing images. That is, after completing steps S502 to S510 based on the camera information of the camera that captured one frame of image, the camera information of the camera that captured the latest image can be obtained, and steps S502 to S510 can be performed again based on the camera information of the camera that captured the latest image.

[0212] Therefore, the first quantity in step S504 can also represent the number of camera information messages that are identical to the marked camera information among the M consecutive camera information messages processed before the first image. When comparing the count value with N in step S507, the count value represents the number of consecutive camera information messages that are identical to the first camera information among the camera information messages processed before the first image.

[0213] In some embodiments, step S504 may be omitted. If the first matching result is 1, step S505 may be performed.

[0214] Through steps S505 to S510, by determining that there are N+1 consecutive frames of images all captured by the same camera, frequent switching of the focus model is avoided, improving the stability and anti-interference capability of the camera control process. Therefore, this can also be understood as hysteresis comparison. The module performing steps S505 to S510 can be the hysteresis comparison module in the switching control module.

[0215] For example, step S505 may be performed after step S507 or simultaneously with step S507. If the second matching result in step S505 is different, steps S506 to S507 may be performed. If the second matching result in step S505 is the same and step S507 determines that the count value is greater than or equal to N, steps S508 to S509 are performed. If the second matching result determined in step S505 is the same and step S507 determines that the count value is less than N, step S510 is performed.

[0216] For example, candidate camera information can also be deleted in step S503. In step S505, if the electronic device has not recorded candidate camera information, it can be determined that the second matching result indicates a difference.

[0217] It should be understood that, Figure 2 Each focusing model in the diagram can be a trained model. Training a focusing model can also be achieved through supervised learning. The focusing model can be a neural network, such as a deep neural network (DNN).

[0218] The focusing model for any given camera can be trained based on at least one set of training data corresponding to that camera. Each set of training data for that camera includes a training image and corresponding label motion information. The training image is an image captured by the training camera corresponding to that camera. The training camera has the same camera parameters as the given camera, such as the focal length of the lens, the number and arrangement of photosensitive elements in the sensor, etc. For example, if the sensor of the given camera includes multiple pairs of phase photosensitive elements, the multiple pairs of phase photosensitive elements in the training camera can have the same position as the multiple pairs of phase photosensitive elements in the given camera, and be located in the same position. The lens in the training camera moves according to the label motion information corresponding to the training image, enabling it to focus on the object recorded in the training image. In other words, the label motion information corresponding to the training image can be the motion information that enables the training camera to focus on the object recorded in the training image.

[0219] The initial focusing model processes the training images in the training data corresponding to any given camera to obtain the training motion information corresponding to those images. Based on the difference between the training motion information and the label motion information corresponding to those images, the parameters of the initial focusing model are adjusted. The adjusted initial focusing model is the focusing model for that given camera.

[0220] The difference between the training motion information corresponding to the training image and the label motion information corresponding to the training image can be represented as the loss value. The loss value can be calculated based on a loss function. That is, the loss value is the output value of the loss function.

[0221] In training a deep neural network, to ensure the output closely approximates the desired predicted value, we compare the network's prediction with the target value. Based on the difference, we update the weight vector of each layer (usually pre-configuring parameters before the initial update). For example, if the prediction is too high, the weight vector is adjusted to predict a lower value. This adjustment continues until the deep neural network predicts the target value or a value very close to it. Therefore, we need to predefine "how to compare the difference between the predicted and target values," which is the loss function or objective function. These are important equations used to measure the difference between the predicted and target values. Taking the loss function as an example, a higher output value (loss) indicates a greater difference, and training the deep neural network becomes a process of minimizing this loss.

[0222] The parameters of the initial deblurring model can be adjusted using the back propagation (BP) algorithm. The BP algorithm corrects the parameters of the initial deblurring model during training, gradually reducing the reconstruction error loss. Specifically, forward propagation of the input signal to the output generates error loss; this error loss information is then propagated back to update the parameters of the initial deblurring model, thus bringing the error loss to convergence. The back propagation algorithm is an error-loss-driven backpropagation process aimed at obtaining optimal model parameters, such as the weight matrix.

[0223] Training the focusing model can be performed by a training device. The training device is used to train the model. Figure 3 The steps S310, S320, and S340 shown, and Figure 4 In the method shown, steps S410, S430, and S450 can be performed by the client device, while steps S420 and S440 can be performed by the execution device. The client device can provide input data to the execution device. The execution device processes the input data using a trained model and sends the processing result to the client device. The client device interacts with the user, displays the processing result to the user, or performs subsequent processing based on the processing result and displays the result of the subsequent processing to the user. The input data can be a first image, the processing result of the execution device can be motion information, and the subsequent processing result determined by the client device based on the motion information can be an image captured by the first camera after controlling the lens movement in the first camera based on the motion information.

[0224] Client devices, training devices, and execution devices can be different electronic devices. Both execution devices and client devices can be terminals, such as mobile phones, tablets, laptops, AR / VR devices, in-vehicle terminals, etc., or they can be servers or cloud-based devices. Training devices can be servers or cloud-based devices.

[0225] It should be understood that the above examples are provided to help those skilled in the art understand the embodiments of this application, and are not intended to limit the embodiments of this application to the specific values ​​or scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the above examples, and such modifications or changes also fall within the scope of the embodiments of this application.

[0226] The above text combined Figures 1 to 6 The present application describes in detail the camera control method according to the embodiments of this application. The following will be combined with... Figures 7 to 8 This document describes in detail the device embodiments of this application. It should be understood that the device in the embodiments of this application can execute the various methods described in the foregoing embodiments of this application. That is, the specific working processes of the various products described below can be referred to the corresponding processes in the foregoing method embodiments.

[0227] Figure 7 A hardware system for an electronic device applicable to this application is shown.

[0228] The method provided in this application can be applied to various electronic devices capable of image acquisition, such as mobile phones, tablets, wearable devices, laptops, netbooks, personal digital assistants (PDAs), and in-vehicle devices. This application does not impose any restrictions on the specific type of electronic device.

[0229] Figure 7A schematic diagram of the structure of electronic device 100 is shown. 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 150, a power management module 151, a battery 142, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0230] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0231] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0232] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.

[0233] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0234] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0235] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0236] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP 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 image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0237] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.

[0238] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input data and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.

[0239] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.

[0240] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0241] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100.

[0242] Figure 8 This is a software structure block diagram of an electronic device 100 according to an embodiment of this application. The layered architecture divides the software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the system libraries of the Android runtime, and the kernel layer. The application layer may include a series of application packages.

[0243] like Figure 8 As shown, the application layer can include applications such as camera, calendar, call, map, navigation, WLAN, Bluetooth, music, video, SMS, wallpaper, photo album, and multimedia editor.

[0244] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0245] like Figure 8 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, toggle control module, etc.

[0246] The window manager manages window programs. It can obtain the screen size, determine the presence of a status bar, lock the screen, and capture screenshots. The content provider stores and retrieves data, making this data accessible to applications. The view system includes visual controls, such as controls for displaying text and controls for displaying images. The view system can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon can include views for displaying text and views for displaying images. The phone manager provides communication functionality for the electronic device 100. The resource manager provides various resources for applications. The notification manager allows applications to display notification information in the status bar, which can be used to convey informational messages and can disappear automatically after a short pause without user interaction.

[0247] The Android runtime consists of core libraries and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system.

[0248] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.

[0249] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0250] A system library can include multiple functional modules. For example, it may include a surface manager, media libraries, a 3D graphics processing library, and a 2D graphics engine. It may also include a focus module.

[0251] The Surface Manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The Media Library supports playback and recording of various common audio and video formats, as well as still image files. The Media Library supports multiple audio and video encoding formats. The 3D Graphics Processing Library implements 3D graphics drawing, image rendering, compositing, and layer processing. The 2D Graphics Engine is the drawing engine for 2D graphics.

[0252] The kernel layer is the layer between hardware and software. It can include driver modules and the hardware abstraction layer (HAL). Driver modules in the kernel layer can include display drivers, camera drivers, audio drivers, and sensor drivers, etc. The hardware abstraction layer (HAL) is the interface layer located between the operating system kernel and the hardware circuitry; its purpose is to abstract the hardware.

[0253] When the camera application detects that the user has tapped the camera control in the photo-taking interface, the application can send photo-taking control information to the camera driver in the kernel layer. Upon receiving this information, the camera driver can then control the first camera to capture an image. The first camera is the one the camera application selects from among multiple cameras to perform image capture.

[0254] HAL is used to receive images captured by any one of the multiple cameras in an electronic device, transmit the images to the camera application in the application layer and the focus module in the system library, and transmit the camera information of the first camera to the switching control module.

[0255] The camera application generates the camera window, which includes an image. It also transmits the camera window to the view system. The view system generates the camera interface based on the camera window and transmits it to the display driver in the kernel-level driver module. The display driver controls the display screen to show the camera interface.

[0256] The switching control module is used to determine whether the first focusing model corresponding to the first camera has been fully loaded based on the camera information of the first camera. If the camera information of the first camera is different from the information of the marker camera, or if the camera information of the first camera is the same as the information of the marker camera and the model status indication information obtained from the focusing module indicates that the model has not been fully loaded, the algorithm indication information instructs the first focusing algorithm in the focusing module to process the image to determine motion information. If the camera information of the first camera is the same as the information of the marker camera and the model status indication information obtained from the focusing module indicates that the model has been fully loaded, the algorithm indication information instructs the fully loaded focusing model in the focusing module to process the image to determine motion information.

[0257] The focusing model is used to transmit motion information to the camera driver in the driving module. The camera driver controls the lens movement in the first camera according to the motion information, so that the first camera can focus on the object recorded in the image.

[0258] The switching control module is also used to determine, based on the camera information of the first camera, whether to switch the marked camera information and the focus model in the focus model, and if it is determined that the marked camera information and the focus model in the focus model should be switched, update the marked camera information to the camera information of the first device head, and send switching information to the focus module, the switching information indicating that the first focus model should be loaded.

[0259] The focusing module can also be used to load a first focusing model based on switching information. The focusing model can also be used to unload a previously loaded focusing model. The focusing module sets the model status indication information to a second identifier after receiving switching information, and sets the model status indication information to a first identifier after the first focusing model has finished loading. The first status information indicates that the focusing model has not finished loading. The second status information indicates that the focusing model has finished loading.

[0260] The focusing module may include a first focusing algorithm. After the first focusing model is loaded, the focusing module may include the first focusing model.

[0261] This application provides a camera control device, including various functional units for executing the camera control method provided in this application. The term "unit" here can be implemented in software and / or hardware, and is not specifically limited thereto.

[0262] For example, a "unit" can be a software program, a hardware circuit, or a combination of both that implements the above functions. The hardware circuit may include an application-specific integrated circuit (ASIC), electronic circuitry, a processor (e.g., a shared processor, a proprietary processor, or a group processor) and memory for executing one or more software or firmware programs, integrated logic circuitry, and / or other suitable components that support the described functions.

[0263] Therefore, the units of the various examples described in the embodiments of this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0264] This application also provides a chip, which includes a data interface and one or more processors. When the one or more processors execute instructions, they read instructions stored in a memory through the data interface to implement the camera control method described in the above method embodiments.

[0265] The one or more processors can be general-purpose processors or special-purpose processors. For example, the one or more processors can be central processing units (CPUs), digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, such as discrete gate, transistor logic devices, or discrete hardware components.

[0266] The chip can be used as a component of a terminal device or other electronic device. For example, the chip can be located in electronic device 100.

[0267] Processors and memory can be configured separately or integrated together. For example, processors and memory can be integrated onto a system-on-a-chip (SoC) in a terminal device. That is, the chip can also include memory.

[0268] The memory may contain a program that can be run by a processor to generate instructions, causing the processor to execute the camera control method and / or deblurring model training method described in the above method embodiments according to the instructions.

[0269] Optionally, the memory may also store data. Optionally, the processor may also read data stored in the memory, which may be stored at the same memory address as the program, or the data may be stored at a different memory address than the program.

[0270] This chip can be installed in an electronic device. The electronic device includes multiple cameras, which correspond to multiple focus models.

[0271] For example, the memory can be used to store the relevant programs of the camera control method provided in the embodiments of this application, and the processor can be used to call the relevant programs of the graphics processing method stored in the memory to implement the camera control method of the embodiments of this application.

[0272] For example, during continuous image acquisition, for the newly acquired first image, if the first focusing model corresponding to the first camera that acquired the first image has been loaded, the first image is processed by the first focusing model to determine first motion information, and the lens movement in the first camera is controlled according to the first motion information; if the first focusing model has not been loaded, the first image is processed by the first focusing algorithm to determine second motion information, and the lens movement in the first camera is controlled according to the second motion information.

[0273] This application also provides a computer program product that, when executed by a processor, implements the camera control method described in any of the method embodiments of this application.

[0274] The computer program product can be stored in memory, for example, it is a program. The program is eventually converted into an executable object file that can be executed by the processor after processes such as preprocessing, compilation, assembly and linking.

[0275] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer, implements the camera control method described in any of the method embodiments of this application. The computer program may be a high-level language program or an executable object program.

[0276] The computer-readable storage medium is, for example, memory. Memory can be volatile or non-volatile, or it can include both volatile and non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0277] In the description of this application, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance, or a specific order or sequence. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.

[0278] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0279] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0280] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0281] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and other division methods may exist in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0282] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0283] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0284] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A camera control method, characterized in that, Applied to an electronic device, the electronic device including multiple cameras, the multiple cameras corresponding to multiple focus models, the method includes: During the continuous image acquisition process, for the latest acquired first image, when the first focusing model corresponding to the first camera that acquired the first image has been loaded, the first image is processed by the first focusing model to determine the first motion information, and the lens movement in the first camera is controlled according to the first motion information. If the first focusing model is not fully loaded, the first image is processed by the first focusing algorithm to determine the second motion information, and the lens in the first camera is controlled to move according to the second motion information.

2. The method according to claim 1, characterized in that, The method further includes: If the camera information of the first camera is the same as the information of the marked camera, determine whether the first focusing model has been loaded based on the model status indication information; If the camera information of the first camera is different from the information of the marked camera, it is determined that the first focusing model has not been fully loaded.

3. The method according to claim 2, characterized in that, The method further includes: If the camera information of the first camera is different from the marked camera information, the first focusing model is loaded, and the marked camera information is updated to the camera information of the first camera.

4. The method according to claim 3, characterized in that, The step of loading the first focusing model and updating the marked camera information to the camera information of the first camera when the camera information of the first camera is different from the marked camera information includes: If the camera information of the first camera is different from the marked camera information, and the first camera captures N consecutive frames before the first image, the first focusing model is loaded, and the marked camera information is updated to the camera information of the first camera, where N is a positive integer.

5. The method according to claim 4, characterized in that, The method further includes: If the camera information of the first camera is different from the marked camera information, determine a first number of images captured by the camera represented by the marked camera information in the M consecutive frames of images preceding the first image, where M is a positive integer and M is less than or equal to N; If the first number is less than the number threshold, determine whether the N frames of images were captured by the first camera.

6. The method according to claim 4 or 5, characterized in that, The method further includes: During the continuous image acquisition process, for each frame of image acquired, the camera information of the camera that acquired the frame of image is matched with the marked camera information; If the camera information of the camera that captures the frame of an image is different from the information of the marked camera, and the camera information of the camera that captures the frame of an image is different from the candidate camera information recorded by the electronic device, the camera information of the camera that captures the frame of an image shall be used as the candidate camera information, and the count value shall be recorded as 1. If the camera information of the camera that captures the frame of an image is different from the information of the marked camera, and the camera information of the camera that captures the frame of an image is the same as the information of the candidate camera, then the count value is incremented by 1. If the camera information of the camera that captures the frame of the image is the same as the information of the marked camera, the count value is recorded as 0; If, when the first image is captured, the count value is equal to N, and the camera information of the first camera is the same as the candidate camera information, then it is determined that the N frames of images were captured by the first camera.

7. The method according to claim 6, characterized in that, The method further includes: If the second quantity is less than the quantity threshold, then if the camera information of the camera that captured the one frame image is different from the marked camera information, the camera information of the camera that captured the one frame image is matched with the candidate camera information. The second quantity is the number of images captured by the camera represented by the marked camera information in the M consecutive frames of images preceding the one frame image, where M is a positive integer and M is less than or equal to N.

8. The method according to any one of claims 3-7, characterized in that, Loading the first focusing model includes: If the second focus model corresponding to the camera indicated by the marked camera information has been loaded, then the second focus model is released and the first focus model is loaded.

9. The method according to any one of claims 1-8, characterized in that, Different cameras correspond to different magnification ranges; The first camera is the camera corresponding to the magnification of the image currently displayed on the screen of the electronic device. The magnification is determined based on the first operation performed by the user when the screen displays the continuously acquired image during the continuous image acquisition process. The first operation is a pinch or expand operation on the image displayed on the display screen, or the first operation is a drag operation on the control on the magnification indicator bar displayed on the display screen.

10. An electronic device, characterized in that, The device includes a processor and a memory, the memory being used to store a computer program, and the processor being used to retrieve and run the computer program from the memory, causing the electronic device to perform the method of any one of claims 1 to 9.

11. A chip, characterized in that, It includes a processor and a data interface, wherein the processor reads instructions stored in memory through the data interface to implement the method as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program for implementing the method of any one of claims 1 to 9.