Focusing method and electronic device

By using two cameras to alternately acquire images and adjusting parameters based on sharpness comparison, the problem of long focusing time with a single camera is solved, resulting in faster focusing speed and higher image brightness.

CN115633253BActive Publication Date: 2026-02-27LENOVO (BEIJING) LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211210032.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-30
Publication Date
2026-02-27
Estimated Expiration
2042-09-30

AI Technical Summary

Technical Problem

In existing technologies, focusing an image using a single camera takes a long time, resulting in a poor user experience.

Method used

Two cameras are used to capture images alternately, and the adjustment parameters are determined based on the sharpness comparison of adjacent frames. Focusing is performed in an alternating manner to shorten the focusing time.

Benefits of technology

It improved focusing efficiency within the same time frame, reduced focusing time by half, ensured image brightness, and increased focusing speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115633253B_ABST
    Figure CN115633253B_ABST
Patent Text Reader

Abstract

The application provides a focusing method, which comprises: obtaining a first image, the first image belonging to a first image group, the first image group comprising a first time interval of two adjacent first images, each first image of the first image group coming from a first camera; obtaining a second image, the second image belonging to a second image group, the second image group comprising a first time interval of two adjacent second images, each second image of the second image group coming from a second camera, the first camera and the second camera being different cameras; determining an adjustment parameter for focusing based on the first image and the second image, the adjustment parameter acting on a target camera; wherein a target time interval of the first image and the second image is less than the first time interval. Meanwhile, the application also provides an electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the image processing technology field, and in particular to a focusing method and electronic device. BACKGROUND

[0002] At present, when focusing a camera, one camera is usually used, and the basic principle is: coarse adjustment, fine adjustment, and finally finding the peak value of image definition as the final focus point. When using one camera for image focusing, the focusing time is relatively long, and the user experience is poor. SUMMARY

[0003] Therefore, the embodiments of the present application aim to provide a focusing method and electronic device.

[0004] To achieve the above-mentioned purpose, the technical scheme of the present application is as follows:

[0005] According to an aspect of the present application, a focusing method is provided, which comprises:

[0006] obtaining a first image, the first image belonging to a first image group, the first image group comprising a first time interval of adjacent two frames of first images, each frame of first images of the first image group coming from a first camera;

[0007] obtaining a second image, the second image belonging to a second image group, the second image group comprising a second time interval of adjacent two frames of second images, each frame of second images of the second image group coming from a second camera, the first camera and the second camera being different cameras;

[0008] determining an adjustment parameter for focusing based on the first image and the second image, the adjustment parameter acting on a target camera;

[0009] wherein the target time interval of obtaining the first image and obtaining the second image is less than the first time interval and the second time interval.

[0010] In the above-mentioned scheme, the method further comprises:

[0011] adjusting the target camera based on the adjustment parameter, the adjustment parameter comprising a target direction and a target distance.

[0012] In the above-mentioned scheme, the determination of the adjustment parameter for focusing based on the first image and the second image comprises:

[0013] if the image parameter of the second image for representing definition is better than the image parameter of the first image, determining a first direction and a first distance;

[0014] If the image parameter for representing the definition of the second image is worse than that of the first image, the second direction and the second distance are determined, the first direction is different from the second direction, and the first distance is different from the second distance.

[0015] In the above solution, the first camera and the second camera are alternately used as the target camera.

[0016] The first image is obtained by the first camera responding to the adjustment parameter, and the first camera is used as the target camera.

[0017] Alternatively, the second image is obtained by the second camera responding to the adjustment parameter, and the second camera is used as the target camera.

[0018] In the above solution, the method further comprises:

[0019] The adjustment parameter for focusing is determined based on the first image and the second image each time an image is obtained by the adjusted target camera, until the image parameter for representing the definition of the second image meets the target condition with the image parameter for representing the definition of the first image.

[0020] In the above solution, the first frame rate at which the first camera obtains the first image is the same as the second frame rate at which the second camera obtains the second image; the first frame rate corresponds to the first time interval, and the second frame rate corresponds to the second time interval.

[0021] In the above solution, the method further comprises:

[0022] A scene parameter for representing a target scene is obtained.

[0023] The first frame rate at which the first camera obtains the first image and the second frame rate at which the second camera obtains the second image are determined based on the scene parameter.

[0024] Different target scenes correspond to different frame rates.

[0025] In the above solution, if the first camera and the second camera are different, the method further comprises:

[0026] An adjustment parameter for focusing is determined based on two adjacent first images in the first image group, and the adjustment parameter acts on the second camera.

[0027] And / or, an adjustment parameter for focusing is determined based on two adjacent second images in the second image group, and the adjustment parameter acts on the first camera.

[0028] The first camera and the second camera take turns capturing images.

[0029] According to another aspect of this application, an electronic device is provided, the electronic device comprising:

[0030] A first camera is used to acquire a first image, the first image belongs to a first image group, the first image group includes a first time interval between two adjacent first images, and the target time interval for acquiring the first image is less than the first time interval.

[0031] The second camera, which is not the same camera as the first camera, is used to obtain a second image. The second image belongs to a second image group. The second image group includes a first time interval between two adjacent frames of the second image. The target time interval for obtaining the second image is less than the first time interval.

[0032] A processor, connected to the first camera and the second camera, is configured to determine adjustment parameters for focusing based on the first image and the second image, the adjustment parameters being applied to the target camera.

[0033] In the above solution, the electronic device further includes:

[0034] A driver, connected to the first camera and the second camera, is used to adjust the lens movement of the first camera and / or the lens movement of the second camera based on the adjustment parameters. Attached Figure Description

[0035] Figure 1 This is a schematic diagram illustrating the implementation process of the focusing method in this application. Figure 1 ;

[0036] Figure 2 This is a schematic diagram illustrating the implementation of the focusing method in this application. Figure 2 ;

[0037] Figure 3 This is a schematic diagram of the structural composition of the electronic device in this application. Detailed Implementation

[0038] In order to make the purposes, technical solutions and advantages of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application. The embodiments in the present application and the features in the embodiments can be combined with each other in a non-conflicting manner. The steps shown in the flowcharts of the drawings can be executed in a computer system such as a group of computer executable instructions. Moreover, although the logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that herein.

[0039] Figure 1 Flowchart for focusing method in the present application Figure 1 As shown in Figure 2 comprises the following steps:

[0040] Step 101, obtaining a first image, the first image belongs to a first image group, the first image group comprises a first time interval of two adjacent first images, and each first image of the first image group is from a first camera;

[0041] Step 102, obtaining a second image, the second image belongs to a second image group, the second image group comprises a second time interval of two adjacent second images, and each second image of the second image group is from a second camera, the first camera and the second camera are not the same camera;

[0042] Step 103, determining an adjustment parameter for focusing based on the first image and the second image, the adjustment parameter acting on a target camera;

[0043] Wherein, the target time interval of obtaining the first image and obtaining the second image is less than the first time interval and the second time interval.

[0044] In the present application, the method can be applied to an electronic device with image acquisition function, which includes but is not limited to mobile phone, tablet computer, camera, monitoring device, watch, smart glasses and the like. The electronic device can have at least two cameras, which can be the same or different.

[0045] In an implementation of the present application, the electronic device has two cameras, referred to as a first camera and a second camera. The electronic device can alternately capture target objects in a target region through the first camera and the second camera. For example, the first camera captures a first frame of image at the first millisecond, the second camera captures a second frame of image after a preset interval, the first camera captures a third frame of image after another preset interval, and the second camera captures a fourth frame of image after another preset interval. It should be noted that if the electronic device includes more than two cameras, the image can also be captured in an alternating manner.

[0046] In the present application, in the same scene, the first frame rate of the first camera for obtaining the first image and the second frame rate of the second camera for obtaining the second image are fixed and the same, so that the first camera captures the first image for focusing, and the frame interval between the first images is the same. The second camera captures the second image for focusing, and the frame interval between the second images is also the same. Since the two cameras alternately capture images, the processing module including the focusing algorithm obtains the image time for half of the frame interval, thereby effectively improving the focusing efficiency and reducing the focusing time. At the same time, since the first frame rate of the first camera for obtaining the first image and the second frame rate of the second camera for obtaining the second image are the same, it can be effectively ensured that in the same scene, whether the first image captured by the first camera or the second image captured by the second camera, the brightness of the first image and the brightness of the second image both satisfy the brightness index. Compared with the image for focusing obtained by reducing the frame interval time by half with only one camera, the image for focusing obtained by two cameras at the same frame rate has a higher image brightness index and the same time reduction as only one camera. Therefore, in the embodiments of the present application, it is not limited to two cameras, and more than two cameras are also covered in the present application. Therefore, the time reduction of more than two cameras can be further improved.

[0047] For example, for a night scene, if the exposure is insufficient, the picture will be relatively dark due to the dark light at night. Therefore, a longer exposure time is required. For a daytime scene, a longer exposure time is not required due to the sufficient light during the day. Therefore, the frame rate of the camera for obtaining the image is different in different scenes. In a daytime scene or a default scene, the frame rate of the first camera and the second camera can be determined as 30 fps, which is fixed. In a night scene, the frame rate of the first camera and the second camera can be determined as 15 fps, thereby ensuring that the first image and the second image for focusing can be obtained in the night scene and satisfy the brightness index.

[0048] In the present application, the electronic device can also classify the images captured by the first camera and the second camera according to the camera identifier, wherein the first images captured by the first camera are classified into a first image group, and the second images captured by the second camera are classified into a second image group, and the first time interval between adjacent two frames of the first images in the first image group can be determined, and the second time interval between adjacent two frames of the second images in the second image group can be determined.

[0049] Here, the first time interval and the second time interval can be the same. For example, 30 frames of pictures are displayed in 1 second, 1000ms / 30 = 33ms, and it is determined that the first time interval and the second time interval can each be 33 milliseconds.

[0050] In the present application, the first frame rate at which the first camera obtains the first images corresponds to the first time interval, and the second frame rate at which the second camera obtains the second images corresponds to the second time interval.

[0051] In the present application, the first images captured by the first camera and the second images captured by the second camera can have a target time interval, wherein the target time interval is less than the first time interval and the second time interval.

[0052] For example, the first time interval is 33 milliseconds, and the target time interval is half of 33 milliseconds, i.e. 16.5 milliseconds. It should be noted that if there are three cameras, the target time interval is one third of 33 milliseconds, i.e. 11 milliseconds; and if there are four cameras, the target time interval is one fourth of 33 milliseconds, i.e. 8.25 milliseconds.

[0053] In the present application, the electronic device can also obtain a scene parameter representing a target scene; determine the first frame rate at which the first camera obtains the first images and the second frame rate at which the second camera obtains the second images based on the scene parameter; wherein different target scenes correspond to different frame rates.

[0054] Here, the target scene includes but is not limited to a daytime scene, a nighttime scene, a cloudy day scene, a sunny day scene, a rainy day scene, and a foggy day scene.

[0055] In one implementation, the electronic device can determine the scene by ISO or a special scene detection algorithm. For example, if it is determined that the current target scene is a daytime scene, the obtained scene parameter is 1, corresponding to a frame rate of 30fps; if it is determined that the current target scene is a nighttime scene, the obtained scene parameter is 2, corresponding to a frame rate of 15fps; and if it is determined that the current target scene is a cloudy day scene, the obtained scene parameter is 3, corresponding to a frame rate of 20fps. Of course, other determination techniques can also be used to determine the scene, which is not limited in the present application.

[0056] In the present application, since the image collection of the first camera and the second camera is alternately performed, after obtaining the first image collected by the first camera, the electronic device can input the first image into the focusing algorithm of the electronic device. Based on the focusing algorithm, the electronic device can compare the first image with the last frame of the second image in the focusing algorithm, and determine the adjustment parameter for focusing according to the comparison result, wherein the adjustment parameter acts on the target camera.

[0057] Here, the target camera can be the camera that responds to the adjustment parameter in the focusing process.

[0058] For example, if the first camera currently responds to the adjustment parameter to perform the collection of the first image, the first camera can be the target camera at this time. If the second camera currently responds to the adjustment parameter to perform the collection of the second image, the second camera is the target camera at this time.

[0059] In the present application, the adjustment parameter can include a target direction and a target distance.

[0060] For example, if the second image is input into the focusing algorithm, the electronic device can compare the second image with the last frame of the first image based on the focusing algorithm to obtain a comparison result. If the comparison result indicates that the image parameter of the second image for representing the sharpness is better than the image parameter of the first image, the first direction and the first distance for focusing are determined, so as to drive the lens of the first camera to move in the first direction by the first distance. If the comparison result indicates that the image parameter of the second image for representing the sharpness is worse than the image parameter of the first image, the second direction and the second distance for focusing are determined, so as to drive the lens of the second camera to move in the second direction by the second distance. The first direction is different from the second direction, and the first distance is different from the second distance.

[0061] In the present application, the electronic device determines the adjustment parameter for focusing based on the first image and the second image each time an image is obtained by the adjusted target camera, until the image parameter of the second image for representing the sharpness and the image parameter of the first image for representing the sharpness satisfy a target condition.

[0062] Here, when the image parameter of the second image for representing the sharpness and the image parameter of the first image for representing the sharpness reach a focus state (i.e. adjusting the lens of the camera, when the image to be shot is the clearest, which is the focus), it is determined that the target condition is satisfied.

[0063] Figure 2 The implementation of the focusing method in the present application is illustrated Figure 2 For example, Figure 3As shown, the first camera 201 and the second camera 202 are included, wherein the first image collected by the first camera 201 is attributed to the first image group A, and the second image collected by the second camera 202 is attributed to the second image group B.

[0064] If the current scene is a daytime scene, and the frame rate is 30fps, it is determined that the fixed frame interval between two adjacent first images in the first image group A is 33ms, the fixed frame interval between two adjacent second images in the second image group B is 33ms, and the frame interval between the first camera 201 and the second camera 202 is half of the fixed frame interval, i.e. 16.5ms.

[0065] For example, the electronic device collects an image through the first camera 201 at the first millisecond to obtain a first frame of a first image a, and inputs the first frame of the first image a to a focusing algorithm; then collects an image through the second camera 202 after an interval of 16.5 milliseconds to obtain a second frame of a second image b, and inputs the second frame of the second image b to the focusing algorithm; the focusing algorithm compares the first frame of the first image a and the second frame of the second image b, and if the comparison result indicates that the image definition of the second frame of the second image b is better than that of the first frame of the first image a, the first camera 201 is driven to move a first distance in a first direction; then the first camera 201 collects an image at the moved position after an interval of 16.5 milliseconds to obtain a third frame of a first image c, and inputs the third frame of the first image c to the focusing algorithm; the focusing algorithm compares the third frame of the first image c and the second frame of the second image b, and if the comparison result indicates that the image definition of the third frame of the first image c is better than that of the second frame of the second image b, the second camera 202 is driven to continue moving a first distance in the first direction; then the second camera 202 collects an image at the moved position after an interval of 16.5 milliseconds to obtain a fourth frame of a second image d, and inputs the fourth frame of the second image d to the focusing algorithm; the focusing algorithm compares the fourth frame of the second image d and the third frame of the first image c, and if the comparison result indicates that the image definition of the fourth frame of the second image d is worse than that of the third frame of the first image c, the first camera 201 is driven to move a second distance in a second direction. Here, the second direction can be opposite to the first direction, and the second distance can be smaller than the first distance. Then the first camera 201 collects an image at the moved position after an interval of 16.5 milliseconds to obtain a fifth frame of a first image e, and inputs the fifth frame of the first image e to the focusing algorithm, and the focusing algorithm compares the fifth frame of the first image e and the fourth frame of the second image d, and if the comparison result indicates that the image definition of the fifth frame of the first image e is better than that of the fourth frame of the second image d, the second camera 202 is driven to continue moving a second distance in the second direction, and then the second camera 202 collects an image at the moved position after an interval of 16.5 milliseconds to obtain a sixth frame of a second image f, and inputs the sixth frame of the second image f to the focusing algorithm, and the focusing algorithm compares the sixth frame of the second image f and the fifth frame of the first image e, and if the comparison result indicates that the image definition of the sixth frame of the second image f and the fifth frame of the first image e both meet a preset image definition, it is determined that the focus is achieved, and the focusing process is ended. That is, the focusing algorithm first coarsely adjusts the focal length of the camera, and then finely adjusts the camera on the basis of the coarse adjustment, until the position of the focus point is found.

[0066] Here, since the frame interval between the two cameras is 16.5 milliseconds, it takes 82.5 milliseconds to collect six frames of images. Compared with 165 milliseconds required to collect six frames of images by one camera at a fixed frame interval (such as 33 milliseconds) in the same scene, the time is greatly shortened, and the focusing efficiency is improved. In this way, more frames of images can be collected in the same time (i.e., 165 milliseconds).

[0067] The focusing method provided in the present application can not only improve the number of frames of images collected by the cameras in the same time, but also shorten the time for inputting frame images to the focusing algorithm, so that the focusing time can be reduced by half.

[0068] In the present application, the electronic device can also obtain a current frame rate parameter, compare the current frame rate parameter with a frame rate threshold, and if the comparison result indicates that the current frame rate parameter is less than the frame rate threshold, obtain a synchronization parameter of the camera, and control the first camera and the second camera to collect images of a target object in a target region based on the synchronization parameter. In this way, image collection using two cameras can be started only in the case of low frame rate (such as night scene), which reduces the power consumption of the device while improving the image focusing efficiency in a specific scene.

[0069] Here, the synchronization parameter of the camera can be preset, such as 20 in the night mode, i.e., the frame interval between the two cameras is 20 milliseconds.

[0070] In the present application, in the case where multiple cameras share one focusing mechanism, the electronic device can also obtain a current frame rate parameter, determine a frame interval parameter according to the frame rate parameter, and determine a synchronization parameter of the camera according to the number of cameras of the electronic device and the frame interval parameter.

[0071] For example, if the frame rate is 30 fps, i.e., 30 frames of images are displayed per second, then the frame interval parameter can be obtained by dividing 1000 by the frame rate (30). Here, 1000 refers to 1000 milliseconds. That is, 1000 ms divided by 30 = 33 ms.

[0072] If the current electronic device has two cameras, then the synchronization parameter of the camera can be determined by dividing 33 ms by 2, which is 16.5 milliseconds. If the current electronic device has three cameras, then the synchronization parameter of the camera can be determined by dividing 33 ms by 3, which is 11 milliseconds.

[0073] Since the frame rate of the camera is fixed in a specific scene, and the two cameras in the present application collect images at an interval smaller than the fixed frame rate, more frame images can be collected in the same time, so the speed of the frame images input into the focusing algorithm will be faster, thereby improving the focusing efficiency.

[0074] In the present application, if the first camera and the second camera are different, the electronic device can also determine an adjustment parameter for focusing based on the adjacent two frame first images in the first image group, wherein the adjustment parameter acts on the second camera.

[0075] Here, if the image parameter of the second frame first image in the first image group for representing sharpness is better than the image parameter of the first frame first image, the first direction and the first distance are determined; if the image parameter of the second frame first image for representing sharpness is worse than the image parameter of the first frame first image, the second direction and the second distance are determined, wherein the first frame first image and the second frame first image are adjacent two frame images in the first image group, and the first direction and the second direction are different, and the first distance and the second distance are different.

[0076] Here, if the image parameter of the second frame second image in the second image group for representing sharpness is better than the image parameter of the second frame second image, the first direction and the first distance are determined; if the image parameter of the second frame second image for representing sharpness is worse than the image parameter of the second frame second image, the second direction and the second distance are determined, wherein the second frame second image and the first frame second image are adjacent two frame images in the second image group, and the first direction and the second direction are different, and the first distance and the second distance are different.

[0077] For example, in a daytime scene, the frame interval in the same group of images is 33 milliseconds, and the frame interval between the two cameras is 16.5 milliseconds. The electronic device obtains the first frame first image through the first camera A at the first millisecond, and inputs the first frame first image into the focusing algorithm; obtains the second frame second image through the second camera at an interval of 16.5 milliseconds, and inputs the second frame second image into the focusing algorithm; obtains the third frame first image through the first camera again at an interval of 16.5 milliseconds, and inputs the third frame first image into the focusing algorithm; wherein the configuration parameters of the first camera and the second camera are different, and the frame images input into the focusing algorithm all carry a camera identifier, based on which the frame images from the same camera can be quickly identified.

[0078] The electronic device can compare two adjacent frames (the first frame first image and the third frame first image) from the same first camera based on the camera identifier carried in each frame of image input into the focusing algorithm, and if the comparison result indicates that the image definition of the third frame first image is better than that of the first frame first image, the second camera is driven to move in the first direction by a first distance. Then, after an interval of 16.5 milliseconds, the fourth frame second image is obtained by the second camera at the moved position, and the fourth frame second image is input into the focusing algorithm. The focusing algorithm compares two adjacent frames (the fourth frame second image and the second frame second image) from the same second camera based on the camera identifier carried in the input frame. If the comparison result indicates that the image definition of the fourth frame second image is better than that of the second frame second image, the first camera is driven to continue moving in the first direction by the first distance. Then, after an interval of 16.5 milliseconds, the fifth frame first image is obtained by the first camera at the moved position, and the fifth frame first image is input into the focusing algorithm. The focusing compares two adjacent frames (the fifth frame first image and the third frame first image) from the same first camera based on the camera identifier carried in the input frame. If the comparison result indicates that the image definition of the fifth frame first image is better than that of the third frame first image, the second camera is driven to continue moving in the first direction by the first distance. Then, after an interval of 16.5 milliseconds, the sixth frame second image is obtained by the second camera at the moved position, and the sixth frame second image is input into the focusing algorithm. The focusing algorithm compares two adjacent frames (the sixth frame second image and the fourth frame second image) from the same second camera based on the camera identifier carried in the input frame. If the comparison result indicates that the image definition of the sixth frame second image is worse than that of the fourth frame second image, the first camera is driven to move in the second direction by a second distance. Here, the second direction is opposite to the first direction, and the second distance is smaller than the first distance. That is, the focusing process is coarse adjustment first, and then fine adjustment based on the coarse adjustment. Then, after an interval of 16.5 milliseconds, the seventh frame first image is obtained by the first camera at the moved position, and the seventh frame first image is input into the focusing algorithm. The focusing algorithm compares two adjacent frames (the seventh frame first image and the fifth frame first image) from the same first camera based on the camera identifier carried in the input frame. If the comparison result indicates that the image definition of the seventh frame first image and the fifth frame first image has met the focusing condition, the focusing process is ended.

[0079] In the present application, since the second camera and the first camera alternately perform image acquisition, and the frame interval between the two cameras is half of the frame interval of a single camera, in the case of different cameras, the adjacent two frames of images from the same camera are compared, and the lens moving direction and moving distance of the other camera are determined according to the comparison result, so that the other camera performs image acquisition based on the moved position, which can shorten the focusing time compared with the scheme of focusing through a single camera. For example, the scheme of focusing through a single camera needs 33*2=66 milliseconds to move the lens twice, while the present application needs 16.5+33=49.5 milliseconds to move the lens twice through the two cameras, thereby shortening the focusing time and improving the focusing efficiency.

[0080] Figure 3 The electronic device in the present application is schematically shown in the structural composition diagram as Figure 3 The electronic device 300 can be a terminal with image acquisition function, such as mobile phone, computer, digital broadcast terminal, information transceiver device, game console, tablet device, medical device, fitness device, personal digital assistant, etc. Figure 3 The electronic device 300 shown in the figure includes:

[0081] The first camera 301 is used to obtain a first image, the first image belongs to a first image group, the first image group includes a first time interval of adjacent two frames of first images, and the target time interval of obtaining the first image is less than the first time interval;

[0082] The second camera 302, which is not the same camera as the first camera, is used to obtain a second image, the second image belongs to a second image group, the second image group includes a first time interval of adjacent two frames of second images, and the target time interval of obtaining the second image is less than the first time interval;

[0083] The processor 303 is connected with the first camera 301 and the second camera 302, and is used to determine an adjustment parameter for focusing based on the first image and the second image, and the adjustment parameter acts on a target camera.

[0084] Here, the first camera 301 and the second camera 302 alternately act as the target camera; if the first camera 301 currently performs the acquisition of the first image in response to the adjustment parameter, the first camera 301 acts as the target camera; if the second camera 302 currently performs the acquisition of the second image in response to the adjustment parameter, the second camera 302 acts as the target camera.

[0085] In the preferred scheme, the electronic device further includes:

[0086] The driver 304 has one end connected with the first camera 301 and the second camera 302, and the other end connected with the processor 303, for adjusting the lens movement of the first camera 301 and / or the lens movement of the second camera 302 based on the adjustment parameter.

[0087] Here, the adjustment parameter includes a target direction and a target distance.

[0088] If the image parameter of the first image for representing sharpness is better than the image parameter of the second image, a first direction and a first distance are determined; if the image parameter of the first image for representing sharpness is worse than the image parameter of the second image, a second direction and a second distance are determined, the first direction being different from the second direction, and the first distance being different from the second distance.

[0089] Here, the processor 303 obtains an image by the adjusted target camera each time, and performs the determination of the adjustment parameter for focusing based on the first image and the second image until the image parameter of the second image for representing sharpness and the image parameter of the first image for representing sharpness satisfy a target condition.

[0090] In a preferred solution, the first frame rate at which the first camera 301 obtains the first image is the same as the second frame rate at which the second camera 302 obtains the second image; wherein the first frame rate corresponds to the first time interval, and the second frame rate corresponds to the second time interval.

[0091] In a preferred solution, the processor 303 is further configured to obtain a scene parameter for representing a target scene; determine the first frame rate at which the first camera obtains the first image and the second frame rate at which the second camera obtains the second image based on the scene parameter; wherein different target scenes correspond to different frame rates.

[0092] In this application, the electronic device further includes a memory 305, at least one network interface 307 and a user interface 306. The various components in the electronic device 300 are coupled together by a bus system 308. It can be understood that the bus system 308 is used to realize the connection and communication between the components. The bus system 308 includes not only a data bus, but also a power bus, a control bus and a status signal bus. However, for the purpose of clear illustration, all the buses are marked as the bus system 308 in ​ .

[0093] The user interface 306 can include a display, a keyboard, a mouse, a trackball, a click wheel, a key, a button, a touchpad or a touch screen, etc.

[0094] The focusing method and the electronic device provided in the application, through two cameras, obtain a first image and a second image of two adjacent frames, wherein the first image belongs to a first image group, the second image belongs to a second image group, and a target time interval of the first image and the second image is less than a first time interval of two adjacent frames in the first image group and the second image group, an adjustment parameter for focusing is determined based on the first image and the second image, and the adjustment parameter acts on a target camera. For a scheme of using two cameras for image focusing, compared with a scheme of using one camera for focusing, the application can greatly improve the focusing speed and save the focusing time under the same scene and the same focusing algorithm.

[0095] It can be understood that the memory 305 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a ferromagnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM can be used, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), 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 link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM).The memory 305 described in the embodiments of the present application is intended to include, but not limited to, these and any other suitable type of memory.

[0096] The memory 305 in the embodiments of the present application is used to store various types of data to support the operation of the electronic device 300. Examples of these data include: any computer programs used for operation on the electronic device 300, such as an operating system 3051 and an application program 3052; contact data; phonebook data; messages; pictures; audio, etc. The operating system 3051 contains various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks. The application program 3042 can contain various application programs, such as a media player (Media Player), a browser (Browser), etc., for implementing various application services. The program implementing the method of the embodiments of the present application can be contained in the application program 3052.

[0097] The method disclosed in the embodiments of the present application can be applied in the processor 303 or implemented by the processor 303. The processor 303 can be an integrated circuit chip with a processing capability. In the implementation process, each step of the above method can be completed by the integrated logic circuit or the instruction in the form of software in the processor 303. The processor 303 described above can be a general-purpose processor, a digital signal processor (DSP), an image signal processor (ISP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The processor 303 can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiments of the present application, the above-mentioned method can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium, which is located in the memory 305. The processor 303 reads the information in the memory 305 and combines the hardware to complete the steps of the above-mentioned method.

[0098] In an exemplary embodiment, the electronic device 300 can be implemented by one or more Application Specific Integrated Circuits (ASICs), DSPs, Programmable Logic Devices (PLDs), Complex Programmable Logic Devices (CPLDs), Field-Programmable Gate Arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors (Microprocessors), or other electronic elements for executing the aforementioned methods.

[0099] In an exemplary embodiment, the embodiments of the present application further provide a computer readable storage medium, for example, the memory 305 including a computer program, which can be executed by the processor 303 of the electronic device 300 to complete the steps of the aforementioned methods. The computer readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, or CD-ROM, etc.; or can be various devices including one or any combination of the above memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.

[0100] A computer readable storage medium having a computer program stored thereon, which, when executed by a processor, performs any of the steps of the above processing methods.

[0101] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the various components shown or discussed can be through some interfaces, indirect coupling or communication connection between devices or units, which can be electrical, mechanical or other forms.

[0102] The units described above as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place or distributed on multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments of the present application.

[0103] The methods disclosed in the several method embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method embodiments.

[0104] The features disclosed in the several product embodiments provided by the present application can be combined arbitrarily without conflict to obtain new product embodiments.

[0105] The features disclosed in the several method or device embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method embodiments or device embodiments.

[0106] The above description is merely a specific implementation of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A focusing method, the method comprising: A first image is obtained, the first image belongs to a first image group, the first time interval between two adjacent frames of the first image group corresponds to the first frame rate of the first camera, and each frame of the first image group comes from the first camera. A second image is obtained, which belongs to a second image group. The second time interval between two adjacent frames of the second image group corresponds to the second frame rate of the second camera. Each frame of the second image group comes from the second camera. The first camera and the second camera are not the same camera. The second time interval is the same as the first time interval; wherein the time interval between obtaining the first image and obtaining the second image is a target time interval and the target time interval is less than the first time interval or the second time interval; The first image and the second image are alternately input into the focusing algorithm, and the focusing algorithm determines adjustment parameters for focusing based on the first image and the second image, and the adjustment parameters are applied to the target camera.

2. The method according to claim 1, wherein, The method further includes: The target camera is adjusted based on the adjustment parameters, which include the target direction and the target distance.

3. The method according to claim 2, wherein, The step of determining the adjustment parameters for focusing based on the first image and the second image includes: If the image parameters of the second image used to characterize sharpness are better than the image parameters of the first image, a first direction and a first distance are determined; If the image parameters used to characterize sharpness of the second image are inferior to those of the first image, determine the second direction and the second distance, wherein the first direction is different from the second direction and the first distance is different from the second distance.

4. The method according to claim 3, wherein, The first camera and the second camera are used alternately as the target camera; Wherein, the acquisition of the first image is performed by a first camera that responds to the adjustment parameters, and the first camera serves as the target camera; Alternatively, the acquisition of the second image can be performed by a second camera that responds to the adjustment parameters, with the second camera serving as the target camera.

5. The method according to claim 4, wherein, The method further includes: Each time an image is acquired through the adjusted target camera, the adjustment parameters for focusing based on the first and second images are determined once, until the image parameters for sharpness of the second image and the image parameters for sharpness of the first image satisfy the target condition.

6. The method according to claim 1, wherein, The first frame rate at which the first camera obtains the first image is the same as the second frame rate at which the second camera obtains the second image; wherein the first frame rate corresponds to the first time interval, and the second frame rate corresponds to the second time interval.

7. The method according to claim 6, wherein, The method further includes: Obtain scene parameters used to characterize the target scene; Based on the scene parameters, determine the first frame rate at which the first camera obtains the first image and the second frame rate at which the second camera obtains the second image; Different target scenarios correspond to different frame rates.

8. The method according to claim 1, wherein, If the first camera is different from the second camera, the method further includes: Based on two adjacent frames of the first image in the first image group, adjustment parameters for focusing are determined, and the adjustment parameters are applied to the second camera; Alternatively, adjustment parameters for focusing are determined based on two adjacent frames of the second image in the second image group, and these adjustment parameters are applied to the first camera. The first camera and the second camera take turns capturing images.

9. An electronic device, the electronic device comprising: A first camera is used to acquire a first image, the first image belongs to a first image group, and the first time interval between two adjacent frames of the first image group corresponds to the first frame rate of the first camera. A second camera is used to acquire a second image, which belongs to a second image group. The second time interval between two adjacent frames of the second image group corresponds to the second frame rate of the second camera. The first frame rate is the same as the second frame rate, and the second time interval is the same as the first time interval. The time interval between the first image obtained by the first camera and the second image obtained by the second camera is a target time interval, and the target time interval is less than the first time interval or the second time interval; A processor, connected to the first camera and the second camera, is configured to alternately input a focusing algorithm with the first image and the second image, wherein the focusing algorithm is configured to determine adjustment parameters for focusing based on the first image and the second image; and in response to the adjustment parameters for focusing determined by the focusing algorithm, the adjustment parameters are applied to a target camera.

10. The electronic device according to claim 9, wherein, The electronic device also includes: The driver, with one end connected to the first camera and the second camera and the other end connected to the processor, is used to adjust the lens movement of the first camera and / or the lens movement of the second camera based on the adjustment parameters.

Citation Information

Patent Citations

  • Photographing method and device, electronic equipment and storage medium

    CN112492210A