[go: up one dir, main page]

CN109089047B - Method and device for controlling focus, storage medium, and electronic device - Google Patents

Method and device for controlling focus, storage medium, and electronic device Download PDF

Info

Publication number
CN109089047B
CN109089047B CN201811150676.3A CN201811150676A CN109089047B CN 109089047 B CN109089047 B CN 109089047B CN 201811150676 A CN201811150676 A CN 201811150676A CN 109089047 B CN109089047 B CN 109089047B
Authority
CN
China
Prior art keywords
image
focus
depth data
camera
subject
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811150676.3A
Other languages
Chinese (zh)
Other versions
CN109089047A (en
Inventor
陈岩
方攀
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201811150676.3A priority Critical patent/CN109089047B/en
Publication of CN109089047A publication Critical patent/CN109089047A/en
Application granted granted Critical
Publication of CN109089047B publication Critical patent/CN109089047B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/57Mechanical or electrical details of cameras or camera modules specially adapted for being embedded in other devices

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)

Abstract

The application relates to a method and a device for controlling focusing, a storage medium and electronic equipment. And controlling the RGB camera to focus according to the distance from the shooting main body to the TOF camera, and finally shooting the image to be shot by the focused RGB camera to obtain a first target image. The TOF camera is used for simultaneously obtaining the depth data of the whole image by emitting infrared light, and the speed is very high. Therefore, when an image is shot, the distance from the shooting subject to the TOF camera is obtained from the depth data of the image to be shot obtained by the TOF camera very quickly, and the RGB camera is controlled to focus according to the distance from the shooting subject to the TOF camera. And finally, shooting the image to be shot by the focused RGB camera to obtain a first target image. The focusing speed at the time of photographing is finally improved.

Description

控制对焦的方法和装置、存储介质、电子设备Method and device for controlling focus, storage medium, and electronic device

技术领域technical field

本申请涉及计算机技术领域,特别是涉及一种控制对焦的方法和装置、存储介质、电子设备。The present application relates to the field of computer technology, and in particular, to a method and device for controlling focus, a storage medium, and an electronic device.

背景技术Background technique

随着智能移动终端的高速发展,用户使用具有摄像功能的移动终端进行拍照也越来越频繁。在使用移动终端进行拍照的时候,一般都会需要进行对焦操作,可以是移动终端的相机自动进行对焦,也可以是由用户点击屏幕实现对焦。传统的对焦方法处理过程复杂,导致对焦速度较慢。With the rapid development of intelligent mobile terminals, users use mobile terminals with a camera function to take pictures more and more frequently. When a mobile terminal is used to take a picture, a focusing operation is generally required, which may be automatically performed by the camera of the mobile terminal, or may be achieved by the user clicking on the screen. The traditional focusing method has a complicated processing process, resulting in a slow focusing speed.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供一种控制对焦的方法和装置、存储介质、电子设备,可以对提高对焦速度。The embodiments of the present application provide a method and device for controlling focusing, a storage medium, and an electronic device, which can improve the focusing speed.

一种控制对焦的方法,包括:A method of controlling focus, including:

通过TOF摄像头获取待拍摄图像的深度数据;Obtain the depth data of the image to be captured through the TOF camera;

从所述待拍摄图像的深度数据中获取拍摄主体到所述TOF摄像头的距离;Obtain the distance from the subject to the TOF camera from the depth data of the image to be captured;

根据所述拍摄主体到所述TOF摄像头的距离控制RGB摄像头进行对焦;Control the RGB camera to focus according to the distance from the subject to the TOF camera;

由对焦后的RGB摄像头对所述待拍摄图像进行拍摄,得到第一目标图像。The image to be captured is captured by the focused RGB camera to obtain a first target image.

一种控制对焦的装置,所述装置包括:A device for controlling focusing, the device comprising:

待拍摄图像的深度数据获取模块,用于通过TOF摄像头获取待拍摄图像的深度数据;a depth data acquisition module of the image to be shot, used for acquiring the depth data of the image to be shot through the TOF camera;

距离获取模块,用于从所述待拍摄图像的深度数据中获取拍摄主体到所述TOF摄像头的距离;A distance acquisition module for acquiring the distance from the subject to the TOF camera from the depth data of the image to be shot;

对焦模块,用于根据所述拍摄主体到所述TOF摄像头的距离控制RGB摄像头进行对焦;a focusing module, configured to control the RGB camera to focus according to the distance from the shooting subject to the TOF camera;

拍摄模块,用于由对焦后的RGB摄像头对所述待拍摄图像进行拍摄,得到第一目标图像。The photographing module is used for photographing the image to be photographed by the focused RGB camera to obtain a first target image.

一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如上所述的控制对焦的方法的步骤。A computer-readable storage medium having a computer program stored thereon, the computer program implementing the steps of the above-described method for controlling focus when executed by a processor.

一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时执行如上所述的控制对焦的方法的步骤。An electronic device includes a memory, a processor, and a computer program stored on the memory and running on the processor. When the processor executes the computer program, the processor executes the steps of the above-mentioned method for controlling focusing.

上述控制对焦的方法和装置、存储介质、电子设备,通过TOF摄像头获取待拍摄图像的深度数据,从待拍摄图像的深度数据中获取拍摄主体到TOF摄像头的距离。根据拍摄主体到TOF摄像头的距离控制RGB摄像头进行对焦,最后对焦后的RGB摄像头对待拍摄图像进行拍摄,得到第一目标图像。TOF摄像头为通过发射红外光同时得到整幅图像的深度数据,速度非常快。因此,在拍摄图像时,从通过TOF摄像头所获取的待拍摄图像的深度数据中获取拍摄主体到TOF摄像头的距离也非常快,进而根据拍摄主体到TOF摄像头的距离控制RGB摄像头进行对焦。最后对焦后的RGB摄像头对待拍摄图像进行拍摄,得到第一目标图像。所以最终提高了拍摄时的对焦速度。The above-mentioned method and device for controlling focus, storage medium, and electronic device obtain depth data of the image to be shot through the TOF camera, and obtain the distance from the shooting subject to the TOF camera from the depth data of the image to be shot. The RGB camera is controlled to focus according to the distance from the shooting subject to the TOF camera, and the finally focused RGB camera shoots the to-be-shot image to obtain the first target image. The TOF camera obtains the depth data of the entire image at the same time by emitting infrared light, and the speed is very fast. Therefore, when capturing an image, it is also very fast to obtain the distance from the subject to the TOF camera from the depth data of the image to be captured obtained by the TOF camera, and then control the RGB camera to focus according to the distance from the subject to the TOF camera. The finally focused RGB camera shoots the to-be-shot image to obtain the first target image. So the focus speed when shooting is improved in the end.

附图说明Description of drawings

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.

图1为一个实施例中电子设备的内部结构图;1 is an internal structure diagram of an electronic device in one embodiment;

图2为一个实施例中控制对焦的方法的流程图;2 is a flowchart of a method for controlling focusing in one embodiment;

图3为图2中从待拍摄图像的深度数据中获取拍摄主体到TOF摄像头的距离方法的流程图;3 is a flowchart of a method for obtaining the distance from the subject to the TOF camera from the depth data of the image to be captured in FIG. 2;

图4为图3中从待拍摄图像中获取第一焦点的方法的流程图;4 is a flowchart of a method for obtaining a first focus from an image to be captured in FIG. 3;

图5为另一个实施例中控制对焦的方法的流程图;5 is a flowchart of a method for controlling focusing in another embodiment;

图6为一个实施例中控制对焦的装置的结构示意图;6 is a schematic structural diagram of a device for controlling focusing in one embodiment;

图7为另一个实施例中控制对焦的装置的结构示意图;7 is a schematic structural diagram of a device for controlling focusing in another embodiment;

图8为一个实施例中图像处理电路的示意图。FIG. 8 is a schematic diagram of an image processing circuit in one embodiment.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.

图1为一个实施例中电子设备的内部结构示意图。如图1所示,该电子设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该处理器用于提供计算和控制能力,支撑整个电子设备的运行。存储器用于存储数据、程序等,存储器上存储至少一个计算机程序,该计算机程序可被处理器执行,以实现本申请实施例中提供的适用于电子设备的场景识别方法。存储器可包括磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random-Access-Memory,RAM)等。例如,在一个实施例中,存储器包括非易失性存储介质及内存储器。非易失性存储介质存储有操作系统和计算机程序。该计算机程序可被处理器所执行,以用于实现以下各个实施例所提供的一种控制对焦的方法。内存储器为非易失性存储介质中的操作系统计算机程序提供高速缓存的运行环境。网络接口可以是以太网卡或无线网卡等,用于与外部的电子设备进行通信。该电子设备可以是手机、平板电脑或者个人数字助理或穿戴式设备等。FIG. 1 is a schematic diagram of the internal structure of an electronic device in one embodiment. As shown in FIG. 1, the electronic device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor is used to provide computing and control capabilities to support the operation of the entire electronic device. The memory is used for storing data, programs, etc., and at least one computer program is stored in the memory, and the computer program can be executed by the processor to implement the scene recognition method applicable to the electronic device provided in the embodiments of the present application. The memory may include a non-volatile storage medium such as a magnetic disk, an optical disk, and a read-only memory (Read-Only Memory, ROM), or a random-access-memory (Random-Access-Memory, RAM) and the like. For example, in one embodiment, the memory includes a non-volatile storage medium and internal memory. The nonvolatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement a method for controlling focus provided by the following embodiments. Internal memory provides a cached execution environment for operating system computer programs in non-volatile storage media. The network interface can be an Ethernet card or a wireless network card, etc., and is used to communicate with external electronic devices. The electronic device may be a mobile phone, a tablet computer, a personal digital assistant or a wearable device, and the like.

在一个实施例中,如图2所示,提供了一种控制对焦的方法,以该方法应用于图1中的电子设备为例进行说明,包括:In one embodiment, as shown in FIG. 2, a method for controlling focus is provided, and the method is applied to the electronic device in FIG. 1 as an example for description, including:

步骤220,通过TOF摄像头获取待拍摄图像的深度数据。Step 220: Acquire depth data of the image to be shot through the TOF camera.

TOF是Time of flight的简写,直译为飞行时间的意思。TOF摄像头即为飞行时间摄像头。TOF摄像头是通过给目标连续发送光脉冲,然后用传感器接收从物体返回的光,通过探测光脉冲的飞行(往返)时间来得到目标物距离。这种技术与3D激光传感器原理上有着不同点,3D激光传感器是逐点扫描,而TOF摄像头则是同时得到整幅图像的深度信息。此处的待拍摄图像可以指当打开相机时呈现在电子设备显示屏上的预览图像。TOF is the abbreviation of Time of flight, which literally means time of flight. TOF cameras are time-of-flight cameras. The TOF camera continuously sends light pulses to the target, and then uses the sensor to receive the light returned from the object, and obtains the distance of the target object by detecting the flight (round-trip) time of the light pulse. This technology is different in principle from the 3D laser sensor. The 3D laser sensor scans point by point, while the TOF camera obtains the depth information of the entire image at the same time. The image to be captured here may refer to a preview image presented on the display screen of the electronic device when the camera is turned on.

步骤240,从待拍摄图像的深度数据中获取拍摄主体到TOF摄像头的距离。Step 240: Obtain the distance from the shooting subject to the TOF camera from the depth data of the image to be shot.

一般在进行拍摄时,都会有一个拍摄主体。自动对焦时,相机一般会选择离镜头最近且反差最大的物体作为拍摄主体,往往会发生相机自动寻找的拍摄主体并不是用户所需要的拍摄主体的情况,或者被拍摄物体的位置不符合用户的构图,这时就必须要采用手动选择拍摄主体了。例如,当待拍摄图像中前景为人物,背景为蓝天白云的时候,则相机可以自动将人物作为拍摄主体。当然,也可以通过用户手动点击屏幕将预览图像中的人物作为拍摄主体。而当待拍摄图像中背景所占的比例非常小,且前景中包括的人物所占图像的比例非常高,且人物数量比较多,此时通过相机自动确定拍摄主体一般比较难,因此可以通过用户自己通过点击屏幕将预览图像中的某一个或几个人物作为拍摄主体。Usually when shooting, there will be a subject. When autofocusing, the camera generally selects the object closest to the lens and with the greatest contrast as the subject, and it often happens that the subject the camera automatically finds is not the one the user needs, or the position of the object to be photographed does not meet the user's expectations. Composition, then you must use manual selection of the subject. For example, when the foreground of the image to be shot is a person, and the background is a blue sky and white clouds, the camera can automatically take the person as the subject of shooting. Of course, the person in the preview image can also be taken as the subject by manually clicking on the screen by the user. However, when the proportion of the background in the image to be shot is very small, and the proportion of the image included in the foreground is very high, and the number of people is relatively large, it is generally difficult to automatically determine the subject by the camera. Take one or several people in the preview image as the subject by tapping the screen.

在确定了拍摄主体之后,从待拍摄图像的深度数据中获取拍摄主体到TOF摄像头的距离。具体地,从待拍摄图像中获取第一焦点,第一焦点位于拍摄主体上。从待拍摄图像的深度数据中获取到第一焦点对应的深度数据,将第一焦点对应的深度数据作为拍摄主体到TOF摄像头的距离。After the shooting subject is determined, the distance from the shooting subject to the TOF camera is obtained from the depth data of the image to be shot. Specifically, the first focus is acquired from the image to be shot, and the first focus is located on the shooting subject. The depth data corresponding to the first focus is obtained from the depth data of the image to be shot, and the depth data corresponding to the first focus is used as the distance from the shooting subject to the TOF camera.

步骤260,根据拍摄主体到TOF摄像头的距离控制RGB摄像头进行对焦。Step 260, controlling the RGB camera to focus according to the distance from the shooting subject to the TOF camera.

在获取了拍摄主体到TOF摄像头的距离之后,则根据拍摄主体到TOF摄像头的距离计算RGB摄像头的马达参数,再根据计算出的RGB摄像头的马达参数控制RGB摄像头的马达移动,以实现对焦。电子设备上的RGB摄像头的数目不做限定。After the distance from the subject to the TOF camera is obtained, the motor parameters of the RGB camera are calculated according to the distance from the subject to the TOF camera, and then the motor of the RGB camera is controlled to move according to the calculated motor parameters of the RGB camera to achieve focusing. The number of RGB cameras on an electronic device is not limited.

步骤280,由对焦后的RGB摄像头对所述待拍摄图像进行拍摄,得到第一目标图像。Step 280, the image to be captured is captured by the focused RGB camera to obtain a first target image.

通过TOF摄像头所采集的拍摄主体上的第一焦点到TOF摄像头(也可以是成像平面)的深度数据,根据该深度数据控制RGB摄像头进行对焦。具体地,根据该深度数据、RGB摄像头和TOF摄像头同时进行标定的标定数据、以及当前相机中的RGB摄像头的马达参数,将第一焦点到TOF摄像头的深度数据换算成RGB摄像头的马达尝试对焦的移动步数。再将RGB摄像头的马达移动对应的步数,则就可以实现按照第一焦点进行对焦。然后,由对焦后的RGB摄像头对待拍摄图像进行拍摄,就得到了第一目标图像。The depth data from the first focus on the shooting subject to the TOF camera (which may also be an imaging plane) collected by the TOF camera is used, and the RGB camera is controlled to focus according to the depth data. Specifically, according to the depth data, the calibration data that the RGB camera and the TOF camera are calibrated at the same time, and the motor parameters of the RGB camera in the current camera, the depth data from the first focus to the TOF camera is converted into the motor of the RGB camera trying to focus. Move steps. Then, the motor of the RGB camera is moved by the corresponding number of steps, and the focusing according to the first focus can be realized. Then, the image to be shot is captured by the focused RGB camera to obtain the first target image.

本申请实施例中,首先与双目立体相机或三角测量系统比,TOF相机体积小巧,跟一般相机大小相去无几,非常适合于一些需要轻便、小体积相机的场合。TOF相机能够实时快速的计算深度信息,达到几十到100fps。其次,双目立体相机需要用到复杂的相关性算法,处理速度较慢。TOF的深度计算精度不随距离改变而变化,基本能稳定在cm级,这对于一些大范围运动的应用场合非常有意义。且TOF摄像头在暗光环境下仍然能够进行距离测量,解决了RGB摄像头在暗光环境中失焦的问题。In the embodiment of the present application, compared with a binocular stereo camera or a triangulation system, the TOF camera is small in size, which is similar to the size of a general camera, and is very suitable for some occasions that require a light and small-sized camera. TOF cameras can quickly calculate depth information in real time, reaching tens to 100fps. Secondly, the binocular stereo camera needs to use a complex correlation algorithm, and the processing speed is slow. The depth calculation accuracy of TOF does not change with the change of distance, and can basically be stabilized at the cm level, which is very meaningful for some large-scale motion applications. In addition, the TOF camera can still measure the distance in the dark environment, which solves the problem of out-of-focus of the RGB camera in the dark environment.

通过TOF摄像头获取待拍摄图像的深度数据,从待拍摄图像的深度数据中获取拍摄主体到TOF摄像头的距离。根据拍摄主体到TOF摄像头的距离控制RGB摄像头进行对焦。TOF摄像头为通过发射红外光同时得到整幅图像的深度数据,速度非常快。因此,在拍摄图像时,从通过TOF摄像头所获取的待拍摄图像的深度数据中获取拍摄主体到TOF摄像头的距离也非常快,进而根据拍摄主体到TOF摄像头的距离控制RGB摄像头进行对焦。所以最终提高了拍摄时的对焦速度,且对焦的准确性更高,在暗光环境中也可以进行准确对焦。最后由对焦后的RGB摄像头对所述待拍摄图像进行拍摄,得到第一目标图像。显然,经过上述对焦过程后所拍摄的第一目标图像的图像质量将会大大提高。The depth data of the image to be shot is acquired through the TOF camera, and the distance from the subject to the TOF camera is acquired from the depth data of the image to be shot. Control the RGB camera to focus according to the distance from the subject to the TOF camera. The TOF camera obtains the depth data of the entire image at the same time by emitting infrared light, and the speed is very fast. Therefore, when capturing an image, it is also very fast to obtain the distance from the subject to the TOF camera from the depth data of the image to be captured obtained by the TOF camera, and then control the RGB camera to focus according to the distance from the subject to the TOF camera. Therefore, the focusing speed during shooting is finally improved, and the focusing accuracy is higher, and accurate focusing can also be performed in a dark light environment. Finally, the image to be captured is captured by the focused RGB camera to obtain a first target image. Obviously, the image quality of the first target image captured after the above focusing process will be greatly improved.

在一个实施例中,如图3所示,步骤240,从待拍摄图像的深度数据中获取拍摄主体到TOF摄像头的距离,包括:In one embodiment, as shown in FIG. 3, step 240, obtaining the distance from the shooting subject to the TOF camera from the depth data of the image to be shot, including:

步骤242,从待拍摄图像中获取第一焦点,第一焦点位于拍摄主体上。Step 242: Acquire a first focus from the image to be shot, where the first focus is on the shooting subject.

首先,需要从待拍摄图像中确定拍摄主体,再从拍摄主体上确定第一焦点。上述确定拍摄主体及确定第一焦点的步骤可以由相机自动设置,当然,也可以由用户手动点击电子屏幕上出现的预览图像去确定。相机一般会选择自动选择离镜头最近且反差最大的物体作为拍摄主体,从拍摄主体上选择某一点作为第一焦点。例如,当待拍摄图像中前景为人物,背景为蓝天白云的时候,则相机可以自动将离镜头最近且反差最大的前景人物作为拍摄主体。然后从前景人物的人脸部分选择某一点(例如鼻梁处)作为第一焦点。First, the subject needs to be determined from the image to be captured, and then the first focus needs to be determined from the subject. The above steps of determining the subject and determining the first focus can be automatically set by the camera, and of course, can also be determined by the user manually clicking on the preview image appearing on the electronic screen. The camera generally chooses to automatically select the object closest to the lens with the greatest contrast as the subject, and select a certain point on the subject as the first focus. For example, when the foreground of the image to be shot is a person and the background is a blue sky and white clouds, the camera can automatically take the foreground person who is closest to the lens and has the greatest contrast as the subject. Then select a certain point (eg, the bridge of the nose) from the face part of the foreground person as the first focus.

当通过相机自动确定的拍摄主体和第一焦点不符合用户的拍照需求时,则就可以通过由用户手动点击电子屏幕上出现的预览图像去确定拍摄主体,进一步再从拍摄主体上确定第一焦点。When the shooting subject and the first focus automatically determined by the camera do not meet the user's shooting requirements, the user can manually click the preview image that appears on the electronic screen to determine the shooting subject, and then determine the first focus from the shooting subject. .

步骤244,从待拍摄图像的深度数据中获取到第一焦点对应的深度数据。Step 244: Acquire depth data corresponding to the first focus from the depth data of the image to be captured.

当确定了拍摄主体及第一焦点之后,则就可以从待拍摄图像的深度数据中获取到第一焦点对应的深度数据。该深度数据是由TOF摄像头发射和接收红外光所获取的待拍摄图像的深度数据,获取的过程不仅速度快且准确性高,同时适用于光线较好和暗光环境中。After the shooting subject and the first focus are determined, the depth data corresponding to the first focus can be acquired from the depth data of the image to be shot. The depth data is the depth data of the image to be shot acquired by the TOF camera emitting and receiving infrared light. The acquisition process is not only fast and accurate, but also suitable for bright and dark environments.

步骤246,将第一焦点对应的深度数据作为拍摄主体到TOF摄像头的距离。Step 246, taking the depth data corresponding to the first focus as the distance from the shooting subject to the TOF camera.

拍摄主体到TOF摄像头的距离,可以理解为焦距。将第一焦点对应的深度数据作为拍摄主体到TOF摄像头的距离。后续就可以根据拍摄主体到TOF摄像头的距离控制RGB摄像头进行对焦。The distance from the subject to the TOF camera can be understood as the focal length. The depth data corresponding to the first focus is taken as the distance from the subject to the TOF camera. Subsequently, the RGB camera can be controlled to focus according to the distance from the subject to the TOF camera.

本申请实施例中,当从待拍摄图像中确定了拍摄主体,并进一步从拍摄主体上确定了第一焦点之后。直接从TOF摄像头所获取的待拍摄图像的深度数据中,对应获取第一焦点的深度数据。第一焦点的深度数据即为拍摄主体到TOF摄像头的距离。从TOF摄像头所获取的待拍摄图像的深度数据中,所获取的拍摄主体到TOF摄像头的距离的准确性非常高。因此,进一步提高了后续根据所获取的拍摄主体到TOF摄像头的距离来控制RGB摄像头对焦的准确性。In the embodiment of the present application, after the subject is determined from the image to be captured, and the first focus is further determined from the subject. The depth data of the first focus is correspondingly obtained from the depth data of the to-be-shot image obtained directly from the TOF camera. The depth data of the first focus is the distance from the subject to the TOF camera. From the depth data of the image to be captured obtained by the TOF camera, the accuracy of the obtained distance from the subject to the TOF camera is very high. Therefore, the accuracy of controlling the focus of the RGB camera according to the obtained distance from the subject to the TOF camera is further improved.

在一个实施例中,如图4所示,步骤242,从待拍摄图像中获取第一焦点,第一焦点位于拍摄主体上,包括:In one embodiment, as shown in FIG. 4 , step 242 , acquiring a first focus from the image to be shot, where the first focus is located on the shooting subject, includes:

步骤242a,从待拍摄图像中获取拍摄主体;Step 242a, acquiring the subject from the image to be shot;

步骤242b,从拍摄主体上确定多个待选焦点,多个待选焦点具有不同的深度数据;Step 242b, determining a plurality of focal points to be selected from the shooting subject, and the plurality of focal points to be selected have different depth data;

步骤242c,分别根据每个待选焦点进行拍摄预览,得到多张预览图像;Step 242c, respectively performing a shooting preview according to each focus to be selected to obtain a plurality of preview images;

步骤242d,从多张预览图像中筛选出目标预览图像,获取目标预览图像所对应的待选焦点,将待选焦点作为第一焦点。Step 242d: Screen out the target preview image from the plurality of preview images, obtain the focus to be selected corresponding to the target preview image, and use the focus to be selected as the first focus.

具体地,根据上述实施例中的方法从待拍摄图像中获取拍摄主体之后,再从拍摄主体上确定多个待选焦点,多个待选焦点分别具有不同的深度数据。其中,多个待选焦点的深度数据,可以按照等差数列进行确定。例如,当从待拍摄图像中确定了拍摄主体为人物时,假设待拍摄图像中有多个人物,且多个人物有前有后的站立在一起。此时,多个人物就具有了不同的深度数据。按照等差序列的顺序从这些人物的深度数据中筛选出深度数据,即所筛选出的深度数据呈等差数列排列。例如,从站在最靠近拍摄相机的第一个人物的深度数据中筛选出一个数据(例如是3米),然后再从距离拍摄相机的距离仅次于第一个人物的第二个人物的深度数据中筛选出一个数据(例如是3.05米,此时等差数列的公差为0.05米,当然在其他实施例中可以设置为其他数值),以此类推得到一组等差数列。这些呈等差数列的深度数值所对应的焦点即为待选焦点。Specifically, after the subject is acquired from the image to be shot according to the method in the above embodiment, a plurality of foci to be selected are determined from the subject, and the foci to be selected have different depth data respectively. The depth data of the multiple to-be-selected focal points may be determined according to the arithmetic sequence. For example, when it is determined from the image to be photographed that the subject is a person, it is assumed that there are multiple persons in the image to be photographed, and the multiple persons are standing together one after the other. At this point, multiple characters have different depth data. The depth data is filtered from the depth data of these characters according to the order of the arithmetic sequence, that is, the filtered depth data is arranged in an arithmetic sequence. For example, filter a data from the depth data of the first person standing closest to the camera (for example, 3 meters), and then from the distance of the second person next to the first person from the camera. One piece of data (for example, 3.05 meters is selected from the depth data, at this time, the tolerance of the arithmetic sequence is 0.05 meters, of course, other values can be set in other embodiments), and so on to obtain a set of arithmetic sequences. The focal points corresponding to the depth values in the arithmetic progression are the focal points to be selected.

分别根据每个待选焦点进行拍摄预览,得到多张预览图像。例如,根据待选焦点对待拍摄图像进行拍摄,即为依次根据上述呈等差数列的深度数值对RGB摄像头进行调焦,从而分别得到一组预览图像。每张预览图像所对应的拍摄焦点是不同的,因此每张预览图像的图像质量会有差别。此处的图像质量可以包括清晰度、亮度、色度等,在此处不做限定。Shooting preview is performed according to each focus to be selected, and multiple preview images are obtained. For example, to shoot the to-be-shot image according to the focus to be selected, that is, to adjust the focus of the RGB camera according to the depth values in the arithmetic sequence, so as to obtain a set of preview images respectively. The shooting focus corresponding to each preview image is different, so the image quality of each preview image will be different. The image quality here may include sharpness, brightness, chromaticity, etc., which are not limited here.

在得到一组预览图像之后,从多张预览图像中筛选出目标预览图像,目标预览图像为该组预览图像中图像质量最好的一张预览图像。从多张预览图像中筛选出图像质量最好的一张预览图像,可以由相机内部的处理器自动筛选完成。在筛选出了图像质量最好的一张预览图像之后,获取拍摄该目标预览图像时所对应的待选焦点,将该待选焦点作为第一焦点。最后,在对待处理图像进行正式拍照的时候,就可以根据该第一焦点获取该第一焦点的深度数据,将第一焦点对应的深度数据作为拍摄主体到TOF摄像头的距离。根据拍摄主体到TOF摄像头的距离控制RGB摄像头进行对焦,由对焦后的RGB摄像头对待拍摄图像进行拍摄,得到第一目标图像。After a group of preview images is obtained, a target preview image is selected from the plurality of preview images, and the target preview image is a preview image with the best image quality in the group of preview images. Screening out the preview image with the best image quality from multiple preview images can be done automatically by the processor inside the camera. After a preview image with the best image quality is selected, a focus to be selected corresponding to the preview image of the target is acquired, and the focus to be selected is used as the first focus. Finally, when the image to be processed is formally photographed, the depth data of the first focus can be obtained according to the first focus, and the depth data corresponding to the first focus can be used as the distance from the shooting subject to the TOF camera. The RGB camera is controlled to focus according to the distance from the shooting subject to the TOF camera, and the focused RGB camera shoots the image to be shot to obtain the first target image.

本申请实施例中,在从待处理图像中确定第一焦点的时候,首先从拍摄主体上确定多个待选焦点,每个待选焦点具有不同的深度数据。从而根据多个待选焦点拍摄一组预览图像,这些预览图像则为分别根据具有不同深度数据的焦点拍摄所得。因此,从多个预览图像中筛选出图像质量最好的图像,这样经过对比筛选之后的结果更加准确,更有利于提高所确定的第一焦点的准确性,进而提高根据第一焦点所拍摄出的第一目标图像的图像质量。且深度数据是通过TOF摄像头所获取的,TOF摄像头为通过发射红外光同时得到整幅图像的深度数据,速度非常快。因此,在提高对焦速度的同时也保证了拍摄所得第一目标图像的图像质量。In the embodiment of the present application, when the first focus is determined from the image to be processed, a plurality of focus points to be selected are firstly determined from the shooting subject, and each focus point to be selected has different depth data. Thus, a group of preview images are captured according to the multiple focal points to be selected, and these preview images are captured according to the focal points with different depth data respectively. Therefore, the image with the best image quality is selected from the plurality of preview images, so that the result after the comparison and screening is more accurate, which is more conducive to improving the accuracy of the determined first focus, thereby improving the image captured according to the first focus. The image quality of the first target image. And the depth data is obtained by the TOF camera. The TOF camera obtains the depth data of the entire image at the same time by emitting infrared light, and the speed is very fast. Therefore, while improving the focusing speed, the image quality of the captured first target image is also guaranteed.

在一个实施例中,如图5所示,在步骤280,由对焦后的RGB摄像头对待拍摄图像进行拍摄,得到第一目标图像之后,包括:In one embodiment, as shown in FIG. 5 , in step 280, the image to be captured is captured by the focused RGB camera to obtain the first target image, including:

步骤510,判断第一目标图像的图像质量是否达到预设标准。Step 510: Determine whether the image quality of the first target image reaches a preset standard.

预设标准可以预先存储在电子设备中,例如,可以是图像的清晰度达到某一个标准,或者图像的色彩、亮度达到某一个标准。The preset standard may be pre-stored in the electronic device, for example, the definition of the image may reach a certain standard, or the color and brightness of the image may reach a certain standard.

步骤520,若否,则从待拍摄图像中获取以第一焦点为中心预设范围内的点作为第二焦点,第二焦点位于拍摄主体上。Step 520, if not, acquire a point within a preset range centered on the first focus from the image to be shot as the second focus, and the second focus is located on the shooting subject.

当对初步确定了第一焦点,并根据所获取到的拍摄主体到TOF摄像头的距离控制RGB摄像头进行对焦之后,所拍摄的第一目标图像进行判断图像质量是否达到预设标准时,若判断结果为达到了预设标准,则就不需要再重新确定第二焦点。When the first focus is preliminarily determined, and the RGB camera is controlled to focus according to the obtained distance from the subject to the TOF camera, and the first target image captured is judged whether the image quality reaches the preset standard, if the judgment result is When the preset standard is reached, there is no need to re-determine the second focus.

若判断结果为未达到预设标准,则就需要再次重新确定第二焦点,当然,第二焦点还是位于拍摄主体上。从待拍摄图像中获取以第一焦点为中心预设范围内的点作为第二焦点。例如,可以是在以第一焦点为中心预设范围内向左或向右或向上或向下四个方向分别移动特定数目个像素点,从而将获取到的像素点对应到拍摄主体上的点作为第二焦点。具体是往哪个方向移动,且移动多少个像素点,可以根据第一目标图像的图像质量来进行决定。例如,当第一目标图像的清晰度是低于预设标准,则说明所确定的第一焦点的深度数据是大于拍摄清晰时的焦距的,因此,再确定第二焦点的时候就可以在第一焦点附近选择深度数据略微小于第一焦点的深度数据的点作为第二焦点。假设第一焦点的深度数据为4米,则以0.05米为间距去选择第一焦点附近且深度数据为3.95米的点作为第二焦点。当然,这个区间还可以设置为其他合理的数值。If the judgment result is that the preset standard is not met, the second focus needs to be re-determined again. Of course, the second focus is still on the shooting subject. A point within a preset range centered on the first focus is acquired from the image to be shot as the second focus. For example, it may be to move a specific number of pixels to the left or right, or up or down, respectively, within a preset range centered on the first focus, so that the acquired pixels correspond to the points on the subject as Second focus. Specifically, which direction to move and how many pixels to move can be determined according to the image quality of the first target image. For example, when the clarity of the first target image is lower than the preset standard, it means that the determined depth data of the first focus is greater than the focal length when the shooting is clear. Therefore, when the second focus is determined, the A point near a focal point whose depth data is slightly smaller than that of the first focal point is selected as the second focal point. Assuming that the depth data of the first focus is 4 meters, a point near the first focus and the depth data of 3.95 meters is selected as the second focus with an interval of 0.05 meters. Of course, this interval can also be set to other reasonable values.

当第一目标图像的清晰度是符合预设标准、但亮度是低于预设标准,则说明所确定的第一焦点的深度数据是符合预设标准的,但是第一焦点处的亮度是比较亮的,才会导致所拍摄的整副图像较暗。此时为了让图像的亮度符合预设标准,就可以在第一焦点附近选择深度数据是与第一焦点的深度数据相同,但是亮度是比较暗的点作为第二焦点,此时,再根据第二焦点去拍摄的图像的亮度就会有所提高。When the clarity of the first target image meets the preset standard, but the brightness is lower than the preset standard, it means that the determined depth data of the first focus meets the preset standard, but the brightness at the first focus is relatively bright, will result in a darker entire image. At this time, in order to make the brightness of the image meet the preset standard, the depth data near the first focus can be selected to be the same as the depth data of the first focus, but the brightness is darker as the second focus. The brightness of the image captured by the difocal point will be improved.

步骤530,从待拍摄图像的深度数据中获取到第二焦点对应的深度数据。Step 530: Acquire depth data corresponding to the second focus from the depth data of the image to be captured.

步骤540,将第二焦点对应的深度数据作为拍摄主体到TOF摄像头的距离。Step 540, taking the depth data corresponding to the second focus as the distance from the shooting subject to the TOF camera.

根据第二焦点在待拍摄图像上的位置,从待拍摄图像的深度数据中获取到第二焦点对应的深度数据。将第二焦点对应的深度数据作为拍摄主体到TOF摄像头的距离。可以认为第二焦点对应的深度数据就是焦距。According to the position of the second focus on the image to be captured, the depth data corresponding to the second focus is acquired from the depth data of the image to be captured. The depth data corresponding to the second focus is taken as the distance from the subject to the TOF camera. It can be considered that the depth data corresponding to the second focus is the focal length.

步骤550,根据拍摄主体到TOF摄像头的距离控制RGB摄像头进行对焦。Step 550: Control the RGB camera to focus according to the distance from the shooting subject to the TOF camera.

步骤560,由对焦后的RGB摄像头对待拍摄图像进行拍摄,得到第二目标图像。Step 560, the image to be captured is captured by the focused RGB camera to obtain a second target image.

根据该第二焦点对应的深度数据、RGB摄像头和TOF摄像头同时进行标定的标定数据、以及当前相机中的RGB摄像头的马达参数,将第二焦点到TOF摄像头的深度数据换算成RGB摄像头的马达尝试对焦的移动步数。再将RGB摄像头的马达移动对应的步数,则就可以实现按照第二焦点进行对焦。然后,由重新对焦后的RGB摄像头对待拍摄图像进行拍摄,就得到了第二目标图像。According to the depth data corresponding to the second focus, the calibration data that the RGB camera and the TOF camera are calibrated at the same time, and the motor parameters of the RGB camera in the current camera, convert the depth data from the second focus to the TOF camera into the motor of the RGB camera. The number of steps to move the focus. Then, the motor of the RGB camera is moved by the corresponding number of steps, and the focusing can be achieved according to the second focus. Then, the to-be-shot image is captured by the refocused RGB camera to obtain a second target image.

本申请实施例中,在第一次根据从拍摄主体上粗略获取的第一焦点对应到TOF摄像头所采集的深度数据中,获取了第一焦点的深度数据之后。根据第一焦点的深度数据对RGB摄像头进行对焦,并采用对焦后的RGB摄像头进行拍摄得到第一目标图像。判断第一目标图像的图像质量不符合预设标准,则就需要对对焦效果进行微调。可以尝试在以第一焦点为中心预设范围内向左或向右或向上或向下四个方向分别移动特定数目个像素点,从而将获取到的像素点对应到拍摄主体上的点作为第二焦点。同理根据第二焦点的深度数据对RGB摄像头进行对焦,并采用对焦后的RGB摄像头进行拍摄得到第二目标图像。再次判断第二目标图像的图像质量是否符合预设标准。如此尝试直到所得的图像质量符合预设标准。经过多次去尝试更换焦点位置,这样就可以避免一次性获取的第一焦点不准确,导致后续虽然根据TOF摄像头可以准确地获取到第一焦点的深度数据,但是仍然不能从源头(即焦点位置)提高拍摄图像的质量。In the embodiment of the present application, after the depth data of the first focus is obtained for the first time according to the depth data collected by the TOF camera corresponding to the first focus roughly obtained from the shooting subject. The RGB camera is focused according to the depth data of the first focus, and the first target image is obtained by using the focused RGB camera to shoot. If it is determined that the image quality of the first target image does not meet the preset standard, it is necessary to fine-tune the focusing effect. You can try to move a specific number of pixels to the left or right or up or down within the preset range centered on the first focus, so that the acquired pixels correspond to the points on the subject as the second. focus. Similarly, focus the RGB camera according to the depth data of the second focus, and use the focused RGB camera to shoot to obtain a second target image. It is judged again whether the image quality of the second target image meets the preset standard. This is done until the resulting image quality meets the preset standard. After many attempts to change the focus position, the inaccuracy of the first focus obtained at one time can be avoided, resulting in that although the depth data of the first focus can be accurately obtained according to the TOF camera, it still cannot be obtained from the source (that is, the focus position). ) to improve the quality of the captured image.

在一个实施例中,根据拍摄主体到TOF摄像头的距离控制RGB摄像头进行对焦,包括:In one embodiment, controlling the RGB camera to focus according to the distance from the subject to the TOF camera includes:

根据拍摄主体到TOF摄像头的距离计算RGB摄像头的马达参数;Calculate the motor parameters of the RGB camera according to the distance from the subject to the TOF camera;

根据计算出的RGB摄像头的马达参数控制RGB摄像头的马达移动,以实现对焦。The motor of the RGB camera is controlled to move according to the calculated motor parameters of the RGB camera to achieve focusing.

本申请实施例中,根据拍摄主体到TOF摄像头的距离、RGB摄像头和TOF摄像头同时进行标定的标定数据、以及当前相机中的RGB摄像头的马达参数,将拍摄主体上的第一焦点到TOF摄像头的深度数据换算成RGB摄像头的马达尝试对焦的移动步数。再将RGB摄像头的马达移动对应的步数,则就可以实现按照第一焦点进行对焦。根据TOF摄像头的深度数据,可以实现对RGB摄像头的马达进行快速准确地移动以实现对焦。In the embodiment of the present application, according to the distance from the shooting subject to the TOF camera, the calibration data that the RGB camera and the TOF camera are calibrated at the same time, and the motor parameters of the RGB camera in the current camera, the first focus on the shooting subject is set to the TOF camera. The depth data is converted into the number of steps that the RGB camera's motor tries to focus on. Then, the motor of the RGB camera is moved by the corresponding number of steps, and the focusing according to the first focus can be realized. According to the depth data of the TOF camera, the motor of the RGB camera can be moved quickly and accurately to achieve focusing.

在一个实施例中,通过TOF摄像头获取待拍摄图像的深度数据,包括:In one embodiment, the depth data of the image to be captured is obtained by the TOF camera, including:

通过TOF摄像头分别获取待拍摄图像的不同相位的多帧TOF数据,每个相位对应一帧TOF数据;Obtain multiple frames of TOF data of different phases of the image to be captured through the TOF camera, and each phase corresponds to one frame of TOF data;

将多帧TOF数据进行合成,得到待拍摄图像的深度数据。Multiple frames of TOF data are synthesized to obtain depth data of the image to be captured.

本申请实施例中,待拍摄图像的一帧深度数据一般由4个相位或8个相位所分别对应的一帧TOF数据合成。当选择相位为4时,则通过TOF摄像头分别获取待拍摄图像的4个相位所分别对应的一帧TOF数据,就有了4帧TOF数据。由这4帧TOF数据进行合成,得到待拍摄图像的深度数据。当然,当选择相位为8时,则通过TOF摄像头分别获取待拍摄图像的8个相位所分别对应的一帧TOF数据,就有了8帧TOF数据。由这8帧TOF数据进行合成,得到待拍摄图像的深度数据。In the embodiment of the present application, a frame of depth data of an image to be captured is generally synthesized by a frame of TOF data corresponding to 4 phases or 8 phases respectively. When the selected phase is 4, a frame of TOF data corresponding to the 4 phases of the image to be captured is obtained through the TOF camera, and there are 4 frames of TOF data. The 4 frames of TOF data are synthesized to obtain the depth data of the image to be captured. Of course, when the selected phase is 8, a frame of TOF data corresponding to the 8 phases of the image to be captured is obtained through the TOF camera, and there are 8 frames of TOF data. The 8 frames of TOF data are synthesized to obtain the depth data of the image to be captured.

在一个实施例中,在通过TOF摄像头获取待拍摄图像的深度数据之后,包括:In one embodiment, after acquiring the depth data of the image to be captured by the TOF camera, it includes:

对待拍摄图像的深度数据进行滤波及去噪操作。Filter and denoise the depth data of the image to be captured.

本申请实施例中,可以采用泊松方程滤波、高斯滤波及双边滤波的方法对待拍摄图像的深度数据进行滤波及去噪操作。从而使得进行滤波去噪处理后所得到的待拍摄图像的深度数据更加准确。In the embodiment of the present application, Poisson equation filtering, Gaussian filtering and bilateral filtering methods may be used to perform filtering and denoising operations on the depth data of the image to be captured. Therefore, the depth data of the to-be-shot image obtained after filtering and denoising processing is more accurate.

在一个实施例中,如图6所示,提供了一种控制对焦的装置600包括:待拍摄图像的深度数据获取模块610、距离获取模块620、对焦模块630及拍摄模块640。其中,In one embodiment, as shown in FIG. 6 , an apparatus 600 for controlling focusing is provided, including: a depth data acquisition module 610 , a distance acquisition module 620 , a focusing module 630 and a photographing module 640 of an image to be captured. in,

待拍摄图像的深度数据获取模块610,用于通过TOF摄像头获取待拍摄图像的深度数据;The depth data acquisition module 610 of the image to be shot is used to acquire the depth data of the image to be shot through the TOF camera;

距离获取模块620,用于从待拍摄图像的深度数据中获取拍摄主体到TOF摄像头的距离;A distance acquisition module 620, configured to acquire the distance from the shooting subject to the TOF camera from the depth data of the image to be shot;

对焦模块630,用于根据拍摄主体到TOF摄像头的距离控制RGB摄像头进行对焦;The focusing module 630 is used to control the RGB camera to focus according to the distance from the shooting subject to the TOF camera;

拍摄模块640,用于由对焦后的RGB摄像头对待拍摄图像进行拍摄,得到第一目标图像。The photographing module 640 is used for photographing the image to be photographed by the focused RGB camera to obtain the first target image.

在一个实施例中,距离获取模块620,还用于从待拍摄图像中获取第一焦点,第一焦点位于拍摄主体上;从待拍摄图像的深度数据中获取到第一焦点对应的深度数据;将第一焦点对应的深度数据作为拍摄主体到TOF摄像头的距离。In one embodiment, the distance acquisition module 620 is further configured to acquire a first focus from the image to be shot, where the first focus is located on the subject; acquire depth data corresponding to the first focus from the depth data of the image to be shot; The depth data corresponding to the first focus is taken as the distance from the subject to the TOF camera.

在一个实施例中,距离获取模块620,还用于从待拍摄图像中获取拍摄主体;从拍摄主体上确定多个待选焦点,多个待选焦点具有不同的深度数据;分别根据每个待选焦点进行拍摄预览,得到多张预览图像;从多张预览图像中筛选出目标预览图像,获取目标预览图像所对应的待选焦点,将待选焦点作为第一焦点。In one embodiment, the distance acquisition module 620 is further configured to acquire the subject from the image to be shot; determine multiple focal points to be selected from the subject to be shot, and the multiple focal points to be selected have different depth data; Selecting a focus for shooting and previewing to obtain a plurality of preview images; screening out a target preview image from the plurality of preview images, obtaining a focus to be selected corresponding to the target preview image, and taking the focus to be selected as the first focus.

在一个实施例中,如图7所示,提供了一种控制对焦的装置600还包括:In one embodiment, as shown in FIG. 7 , an apparatus 600 for controlling focusing is provided, further comprising:

判断模块650,用于判断第一目标图像的图像质量是否达到预设标准;A judgment module 650, configured to judge whether the image quality of the first target image reaches a preset standard;

第二焦点获取模块660,用于若否,则从待拍摄图像中获取以第一焦点为中心预设范围内的点作为第二焦点,第二焦点位于拍摄主体上;The second focus acquisition module 660 is configured to, if not, acquire a point within a preset range centered on the first focus from the image to be shot as the second focus, and the second focus is located on the shooting subject;

重新对焦模块670,用于从待拍摄图像的深度数据中获取到第二焦点对应的深度数据;将第二焦点对应的深度数据作为拍摄主体到TOF摄像头的距离;根据拍摄主体到TOF摄像头的距离控制RGB摄像头进行对焦;The refocusing module 670 is used to obtain the depth data corresponding to the second focus from the depth data of the image to be shot; the depth data corresponding to the second focus is used as the distance from the subject to the TOF camera; according to the distance from the subject to the TOF camera Control the RGB camera to focus;

重新拍摄模块680,用于由对焦后的RGB摄像头对待拍摄图像进行拍摄,得到第二目标图像。The re-shooting module 680 is used for capturing the image to be captured by the focused RGB camera to obtain a second target image.

在一个实施例中,对焦模块630,还用于根据拍摄主体到TOF摄像头的距离计算RGB摄像头的马达参数;根据计算出的RGB摄像头的马达参数控制RGB摄像头的马达移动,以实现对焦。In one embodiment, the focusing module 630 is further configured to calculate the motor parameters of the RGB camera according to the distance from the shooting subject to the TOF camera; and control the motor movement of the RGB camera according to the calculated motor parameters of the RGB camera to realize focusing.

在一个实施例中,待拍摄图像的深度数据获取模块610,还用于通过TOF摄像头分别获取待拍摄图像的不同相位的多帧TOF数据,每个相位对应一帧TOF数据;将多帧TOF数据进行合成,得到待拍摄图像的深度数据。In one embodiment, the depth data acquisition module 610 of the image to be shot is further configured to obtain multiple frames of TOF data of different phases of the image to be shot through the TOF camera, and each phase corresponds to one frame of TOF data; Perform synthesis to obtain depth data of the image to be captured.

在一个实施例中,待拍摄图像的深度数据获取模块610,还用于对待拍摄图像的深度数据进行滤波及去噪操作。In one embodiment, the depth data acquisition module 610 of the image to be captured is further configured to perform filtering and denoising operations on the depth data of the image to be captured.

上述控制对焦的装置中各个模块的划分仅用于举例说明,在其他实施例中,可将控制对焦的装置按照需要划分为不同的模块,以完成上述控制对焦的装置的全部或部分功能。The division of each module in the above apparatus for focusing control is only for illustration. In other embodiments, the apparatus for controlling focusing may be divided into different modules as required to complete all or part of the functions of the apparatus for controlling focusing.

在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述各实施例所提供的控制对焦的方法的步骤。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of the methods for controlling focus provided by the foregoing embodiments.

在一个实施例中,提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现上述各实施例所提供的控制对焦的方法的步骤。In one embodiment, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, the control focusing provided by the above embodiments is implemented. steps of the method.

本申请实施例还提供了一种计算机程序产品,当其在计算机上运行时,使得计算机执行上述各实施例所提供的控制对焦的方法的步骤。Embodiments of the present application also provide a computer program product, which, when running on a computer, causes the computer to execute the steps of the methods for controlling focus provided by the above embodiments.

本申请实施例还提供一种电子设备。该电子设备可以为包括手机、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑、穿戴式设备等任意终端设备,以电子设备为手机为例:上述电子设备中包括图像处理电路,图像处理电路可以利用硬件和/或软件组件实现,可包括定义ISP(Image SignalProcessing,图像信号处理)管线的各种处理单元。图8为一个实施例中图像处理电路的示意图。如图8所示,为便于说明,仅示出与本申请实施例相关的图像处理技术的各个方面。The embodiments of the present application also provide an electronic device. The electronic device may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales, a sales terminal), a vehicle-mounted computer, a wearable device, etc. The electronic device is a mobile phone as an example : The above electronic device includes an image processing circuit, and the image processing circuit may be implemented by hardware and/or software components, and may include various processing units that define an ISP (Image Signal Processing, image signal processing) pipeline. FIG. 8 is a schematic diagram of an image processing circuit in one embodiment. As shown in FIG. 8 , for the convenience of description, only various aspects of the image processing technology related to the embodiments of the present application are shown.

如图8所示,图像处理电路包括第一ISP处理器830、第二ISP处理器840和控制逻辑器850。第一摄像头810包括一个或多个第一透镜812和第一图像传感器814。第一图像传感器814可包括色彩滤镜阵列(如Bayer滤镜),第一图像传感器814可获取用第一图像传感器814的每个成像像素捕捉的光强度和波长信息,并提供可由第一ISP处理器830处理的一组图像数据。第二摄像头820包括一个或多个第二透镜822和第二图像传感器824。第二图像传感器824可包括色彩滤镜阵列(如Bayer滤镜),第二图像传感器824可获取用第二图像传感器824的每个成像像素捕捉的光强度和波长信息,并提供可由第二ISP处理器840处理的一组图像数据。As shown in FIG. 8 , the image processing circuit includes a first ISP processor 830 , a second ISP processor 840 and a control logic 850 . The first camera 810 includes one or more first lenses 812 and a first image sensor 814 . The first image sensor 814 may include a color filter array (eg, a Bayer filter), the first image sensor 814 may obtain light intensity and wavelength information captured with each imaging pixel of the first image sensor 814, and provide information that can be accessed by the first ISP A set of image data processed by processor 830. The second camera 820 includes one or more second lenses 822 and a second image sensor 824 . The second image sensor 824 may include a color filter array (eg, a Bayer filter), the second image sensor 824 may acquire light intensity and wavelength information captured with each imaging pixel of the second image sensor 824, and provide information that can be accessed by the second ISP A set of image data processed by processor 840 .

第一摄像头810采集的第一图像传输给第一ISP处理器830进行处理,第一ISP处理器830处理第一图像后,可将第一图像的统计数据(如图像的亮度、图像的反差值、图像的颜色等)发送给控制逻辑器850,控制逻辑器850可根据统计数据确定第一摄像头810的控制参数,从而第一摄像头810可根据控制参数进行自动对焦、自动曝光等操作。第一图像经过第一ISP处理器830进行处理后可存储至图像存储器860中,第一ISP处理器830也可以读取图像存储器860中存储的图像以对进行处理。另外,第一图像经过ISP处理器830进行处理后可直接发送至显示器870进行显示,显示器870也可以读取图像存储器860中的图像以进行显示。The first image captured by the first camera 810 is transmitted to the first ISP processor 830 for processing. After the first ISP processor 830 processes the first image, the statistical data of the first image (such as the brightness of the image, the contrast value of the image, etc.) , image color, etc.) to the control logic 850, and the control logic 850 can determine the control parameters of the first camera 810 according to the statistical data, so that the first camera 810 can perform auto-focus, auto-exposure and other operations according to the control parameters. After being processed by the first ISP processor 830, the first image can be stored in the image memory 860, and the first ISP processor 830 can also read the image stored in the image memory 860 for processing. In addition, after being processed by the ISP processor 830, the first image can be directly sent to the display 870 for display, and the display 870 can also read the image in the image memory 860 for display.

其中,第一ISP处理器830按多种格式逐个像素地处理图像数据。例如,每个图像像素可具有8、10、12或14比特的位深度,第一ISP处理器830可对图像数据进行一个或多个图像处理操作、收集关于图像数据的统计信息。其中,图像处理操作可按相同或不同的位深度计算精度进行。Among them, the first ISP processor 830 processes the image data pixel by pixel in various formats. For example, each image pixel may have a bit depth of 8, 10, 12, or 14 bits, and the first ISP processor 830 may perform one or more image processing operations on the image data, collecting statistical information about the image data. Among them, the image processing operations can be performed with the same or different bit depth calculation precision.

图像存储器860可为存储器装置的一部分、存储设备、或电子设备内的独立的专用存储器,并可包括DMA(Direct Memory Access,直接直接存储器存取)特征。The image memory 860 may be a part of a memory device, a storage device, or an independent dedicated memory within an electronic device, and may include a DMA (Direct Memory Access, direct memory access) feature.

当接收到来自第一图像传感器814接口时,第一ISP处理器830可进行一个或多个图像处理操作,如时域滤波。处理后的图像数据可发送给图像存储器860,以便在被显示之前进行另外的处理。第一ISP处理器830从图像存储器860接收处理数据,并对处理数据进行RGB和YCbCr颜色空间中的图像数据处理。第一ISP处理器830处理后的图像数据可输出给显示器870,以供用户观看和/或由图形引擎或GPU(Graphics Processing Unit,图形处理器)进一步处理。此外,第一ISP处理器830的输出还可发送给图像存储器860,且显示器870可从图像存储器860读取图像数据。在一个实施例中,图像存储器860可被配置为实现一个或多个帧缓冲器。Upon receiving the interface from the first image sensor 814, the first ISP processor 830 may perform one or more image processing operations, such as temporal filtering. The processed image data may be sent to image memory 860 for additional processing before being displayed. The first ISP processor 830 receives processing data from the image memory 860, and performs image data processing in RGB and YCbCr color spaces on the processed data. The image data processed by the first ISP processor 830 may be output to the display 870 for viewing by the user and/or further processed by a graphics engine or a GPU (Graphics Processing Unit, graphics processor). In addition, the output of the first ISP processor 830 may also be sent to the image memory 860 , and the display 870 may read image data from the image memory 860 . In one embodiment, image memory 860 may be configured to implement one or more frame buffers.

第一ISP处理器830确定的统计数据可发送给控制逻辑器850。例如,统计数据可包括自动曝光、自动白平衡、自动聚焦、闪烁检测、黑电平补偿、第一透镜812阴影校正等第一图像传感器814统计信息。控制逻辑器850可包括执行一个或多个例程(如固件)的处理器和/或微控制器,一个或多个例程可根据接收的统计数据,确定第一摄像头810的控制参数及第一ISP处理器830的控制参数。例如,第一摄像头810的控制参数可包括增益、曝光控制的积分时间、防抖参数、闪光控制参数、第一透镜812控制参数(例如聚焦或变焦用焦距)、或这些参数的组合等。ISP控制参数可包括用于自动白平衡和颜色调整(例如,在RGB处理期间)的增益水平和色彩校正矩阵,以及第一透镜812阴影校正参数。Statistics determined by the first ISP processor 830 may be sent to the control logic 850 . For example, the statistics may include first image sensor 814 statistics such as auto exposure, auto white balance, auto focus, flicker detection, black level compensation, first lens 812 shading correction, and the like. The control logic 850 may include a processor and/or a microcontroller executing one or more routines (eg, firmware) that may determine the control parameters and the first camera 810 based on the received statistical data. A control parameter of the ISP processor 830. For example, the control parameters of the first camera 810 may include gain, exposure control integration time, anti-shake parameters, flash control parameters, first lens 812 control parameters (eg, focal length for focusing or zooming), or a combination of these parameters. ISP control parameters may include gain levels and color correction matrices for automatic white balance and color adjustment (eg, during RGB processing), and first lens 812 shading correction parameters.

同样地,第二摄像头820采集的第二图像传输给第二ISP处理器840进行处理,第二ISP处理器840处理第一图像后,可将第二图像的统计数据(如图像的亮度、图像的反差值、图像的颜色等)发送给控制逻辑器850,控制逻辑器850可根据统计数据确定第二摄像头820的控制参数,从而第二摄像头820可根据控制参数进行自动对焦、自动曝光等操作。第二图像经过第二ISP处理器840进行处理后可存储至图像存储器860中,第二ISP处理器840也可以读取图像存储器860中存储的图像以对进行处理。另外,第二图像经过ISP处理器840进行处理后可直接发送至显示器870进行显示,显示器870也可以读取图像存储器860中的图像以进行显示。第二摄像头820和第二ISP处理器840也可以实现如第一摄像头810和第一ISP处理器830所描述的处理过程。Similarly, the second image captured by the second camera 820 is transmitted to the second ISP processor 840 for processing. After the second ISP processor 840 processes the first image, the statistical data of the second image (such as the brightness of the image, the The contrast value, the color of the image, etc.) are sent to the control logic 850, and the control logic 850 can determine the control parameters of the second camera 820 according to the statistical data, so that the second camera 820 can perform auto-focus, auto-exposure and other operations according to the control parameters . The second image can be stored in the image memory 860 after being processed by the second ISP processor 840, and the second ISP processor 840 can also read the image stored in the image memory 860 for processing. In addition, after being processed by the ISP processor 840, the second image can be directly sent to the display 870 for display, and the display 870 can also read the image in the image memory 860 for display. The second camera 820 and the second ISP processor 840 can also implement the processing procedures as described for the first camera 810 and the first ISP processor 830 .

以下为运用图8中图像处理技术实现图像处理方法的步骤。The following are steps for implementing the image processing method using the image processing technology in FIG. 8 .

本申请所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。合适的非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM),它用作外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDR SDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)。Any reference to a memory, storage, database, or other medium as used herein may include non-volatile and/or volatile memory. Suitable nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are relatively specific and detailed, but should not be construed as a limitation on the scope of the patent of the present application. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.

Claims (14)

1.一种控制对焦的方法,其特征在于,包括:1. a method for controlling focus, is characterized in that, comprises: 通过TOF摄像头获取待拍摄图像的深度数据;Obtain the depth data of the image to be captured through the TOF camera; 从所述待拍摄图像的深度数据中获取拍摄主体到所述TOF摄像头的距离;Obtain the distance from the subject to the TOF camera from the depth data of the image to be captured; 根据所述拍摄主体到所述TOF摄像头的距离控制RGB摄像头进行对焦;Control the RGB camera to focus according to the distance from the subject to the TOF camera; 由对焦后的RGB摄像头对所述待拍摄图像进行拍摄,得到第一目标图像;The image to be captured is captured by the focused RGB camera to obtain a first target image; 判断所述第一目标图像的图像质量是否达到预设标准;所述图像质量包括清晰度和亮度;Determine whether the image quality of the first target image reaches a preset standard; the image quality includes clarity and brightness; 若否,则基于第一目标图像的不同质量参数与预设标准的比较结果,在所述待拍摄图像中获取以第一焦点为中心预设范围内的点作为第二焦点,所述第一焦点及所述第二焦点位于拍摄主体上;If not, based on the comparison result of the different quality parameters of the first target image and the preset standard, a point within a preset range centered on the first focus is acquired in the to-be-shot image as the second focus. the focus and the second focus are located on the subject; 从所述待拍摄图像的深度数据中获取到所述第二焦点对应的深度数据;acquiring depth data corresponding to the second focus from the depth data of the to-be-shot image; 将所述第二焦点对应的深度数据作为所述拍摄主体到所述TOF摄像头的距离;Taking the depth data corresponding to the second focus as the distance from the shooting subject to the TOF camera; 根据所述拍摄主体到所述TOF摄像头的距离控制RGB摄像头进行对焦;Control the RGB camera to focus according to the distance from the subject to the TOF camera; 由对焦后的RGB摄像头对所述待拍摄图像进行拍摄,得到第二目标图像。The image to be captured is captured by the focused RGB camera to obtain a second target image. 2.根据权利要求1所述的方法,其特征在于,所述从所述待拍摄图像的深度数据中获取拍摄主体到所述TOF摄像头的距离,包括:2. The method according to claim 1, wherein the obtaining the distance from the subject to the TOF camera from the depth data of the to-be-shot image comprises: 从所述待拍摄图像中获取第一焦点;obtaining a first focus from the to-be-shot image; 从所述待拍摄图像的深度数据中获取到所述第一焦点对应的深度数据;acquiring depth data corresponding to the first focus from the depth data of the to-be-shot image; 将所述第一焦点对应的深度数据作为所述拍摄主体到所述TOF摄像头的距离。The depth data corresponding to the first focus is taken as the distance from the shooting subject to the TOF camera. 3.根据权利要求2所述的方法,其特征在于,所述从所述待拍摄图像中获取第一焦点,所述第一焦点位于拍摄主体上,包括:3 . The method according to claim 2 , wherein the acquiring a first focus from the to-be-shot image, the first focus being located on a shooting subject, comprises: 3 . 从所述待拍摄图像中获取拍摄主体;acquiring the subject from the to-be-shot image; 从所述拍摄主体上确定多个待选焦点,所述多个待选焦点具有不同的深度数据;Determine a plurality of to-be-selected focal points from the photographic subject, and the plurality of to-be-selected focal points have different depth data; 分别根据每个所述待选焦点进行拍摄预览,得到多张预览图像;Shooting and previewing according to each of the to-be-selected focal points, respectively, to obtain a plurality of preview images; 从所述多张预览图像中筛选出目标预览图像,获取所述目标预览图像所对应的待选焦点,将所述待选焦点作为第一焦点。A target preview image is selected from the plurality of preview images, a focus to be selected corresponding to the target preview image is acquired, and the focus to be selected is used as the first focus. 4.根据权利要求1所述的方法,其特征在于,所述根据所述拍摄主体到所述TOF摄像头的距离控制RGB摄像头进行对焦,包括:4. The method according to claim 1, wherein the controlling the RGB camera to focus according to the distance from the shooting subject to the TOF camera, comprising: 根据所述拍摄主体到所述TOF摄像头的距离计算RGB摄像头的马达参数;Calculate the motor parameters of the RGB camera according to the distance from the shooting subject to the TOF camera; 根据计算出的所述RGB摄像头的马达参数控制所述RGB摄像头的马达移动,以实现对焦。The motor of the RGB camera is controlled to move according to the calculated motor parameters of the RGB camera, so as to realize focusing. 5.根据权利要求1所述的方法,其特征在于,所述通过TOF摄像头获取待拍摄图像的深度数据,包括:5. The method according to claim 1, wherein the obtaining the depth data of the image to be captured by the TOF camera comprises: 通过TOF摄像头分别获取待拍摄图像的不同相位的多帧TOF数据,每个相位对应一帧TOF数据;Obtain multiple frames of TOF data of different phases of the image to be captured through the TOF camera, and each phase corresponds to one frame of TOF data; 将所述多帧TOF数据进行合成,得到待拍摄图像的深度数据。The multiple frames of TOF data are synthesized to obtain the depth data of the image to be captured. 6.根据权利要求1所述的方法,其特征在于,在所述通过TOF摄像头获取待拍摄图像的深度数据之后,包括:6. The method according to claim 1, characterized in that, after obtaining the depth data of the image to be captured by the TOF camera, comprising: 对所述待拍摄图像的深度数据进行滤波及去噪操作。Filtering and denoising operations are performed on the depth data of the to-be-shot image. 7.一种控制对焦的装置,其特征在于,所述装置包括:7. A device for controlling focusing, wherein the device comprises: 待拍摄图像的深度数据获取模块,用于通过TOF摄像头获取待拍摄图像的深度数据;a depth data acquisition module of the image to be shot, used for acquiring the depth data of the image to be shot through the TOF camera; 距离获取模块,用于从所述待拍摄图像的深度数据中获取拍摄主体到所述TOF摄像头的距离;A distance acquisition module for acquiring the distance from the subject to the TOF camera from the depth data of the image to be shot; 对焦模块,用于根据所述拍摄主体到所述TOF摄像头的距离控制RGB摄像头进行对焦;a focusing module, configured to control the RGB camera to focus according to the distance from the shooting subject to the TOF camera; 拍摄模块,用于由对焦后的RGB摄像头对所述待拍摄图像进行拍摄,得到第一目标图像;a shooting module, used for shooting the image to be shot by the focused RGB camera to obtain a first target image; 判断模块,用于判断所述第一目标图像的图像质量是否达到预设标准;所述图像质量包括清晰度和亮度;a judgment module for judging whether the image quality of the first target image reaches a preset standard; the image quality includes clarity and brightness; 第二焦点获取模块,用于若否,则基于第一目标图像的不同质量参数与预设标准的比较结果,从所述待拍摄图像中获取以第一焦点为中心预设范围内的点作为第二焦点,所述第一焦点及所述第二焦点位于拍摄主体上;The second focus acquisition module is configured to, if not, acquire a point within a preset range centered on the first focus from the to-be-shot image based on the comparison result of different quality parameters of the first target image and a preset standard as a second focus, the first focus and the second focus are located on the subject; 重新对焦模块,用于从所述待拍摄图像的深度数据中获取到所述第二焦点对应的深度数据;将所述第二焦点对应的深度数据作为所述拍摄主体到所述TOF摄像头的距离;根据所述拍摄主体到所述TOF摄像头的距离控制RGB摄像头进行对焦;A refocusing module, configured to obtain the depth data corresponding to the second focus from the depth data of the to-be-shot image; take the depth data corresponding to the second focus as the distance from the shooting subject to the TOF camera ; Control the RGB camera to focus according to the distance from the shooting subject to the TOF camera; 重新拍摄模块,用于由对焦后的RGB摄像头对所述待拍摄图像进行拍摄,得到第二目标图像。The re-shooting module is used for capturing the image to be captured by the focused RGB camera to obtain a second target image. 8.根据权利要求7所述的装置,其特征在于,8. The device of claim 7, wherein 所述距离获取模块,还用于从所述待拍摄图像中获取第一焦点;The distance acquisition module is further configured to acquire the first focus from the to-be-shot image; 从所述待拍摄图像的深度数据中获取到所述第一焦点对应的深度数据;acquiring depth data corresponding to the first focus from the depth data of the to-be-shot image; 将所述第一焦点对应的深度数据作为所述拍摄主体到所述TOF摄像头的距离。The depth data corresponding to the first focus is taken as the distance from the shooting subject to the TOF camera. 9.根据权利要求8所述的装置,其特征在于,9. The device of claim 8, wherein 所述距离获取模块,还用于从所述待拍摄图像中获取拍摄主体;The distance acquisition module is further configured to acquire a subject from the to-be-shot image; 从所述拍摄主体上确定多个待选焦点,所述多个待选焦点具有不同的深度数据;Determine a plurality of to-be-selected focal points from the photographic subject, and the plurality of to-be-selected focal points have different depth data; 分别根据每个所述待选焦点进行拍摄预览,得到多张预览图像;Shooting and previewing according to each of the to-be-selected focal points, respectively, to obtain a plurality of preview images; 从所述多张预览图像中筛选出目标预览图像,获取所述目标预览图像所对应的待选焦点,将所述待选焦点作为第一焦点。A target preview image is selected from the plurality of preview images, a focus to be selected corresponding to the target preview image is acquired, and the focus to be selected is used as the first focus. 10.根据权利要求7所述的装置,其特征在于,10. The device of claim 7, wherein: 所述对焦模块,还用于根据所述拍摄主体到所述TOF摄像头的距离计算RGB摄像头的马达参数;根据计算出的所述RGB摄像头的马达参数控制所述RGB摄像头的马达移动,以实现对焦。The focusing module is also used to calculate the motor parameters of the RGB camera according to the distance from the shooting subject to the TOF camera; control the motor movement of the RGB camera according to the calculated motor parameters of the RGB camera to realize focusing . 11.根据权利要求7所述的装置,其特征在于,11. The device of claim 7, wherein: 所述待拍摄图像的深度数据获取模块,还用于通过TOF摄像头分别获取待拍摄图像的不同相位的多帧TOF数据,每个相位对应一帧TOF数据;The depth data acquisition module of the image to be shot is also used to obtain multiple frames of TOF data of different phases of the image to be shot through the TOF camera, and each phase corresponds to a frame of TOF data; 将所述多帧TOF数据进行合成,得到待拍摄图像的深度数据。The multiple frames of TOF data are synthesized to obtain the depth data of the image to be captured. 12.根据权利要求7所述的装置,其特征在于,12. The apparatus of claim 7, wherein 所述待拍摄图像的深度数据获取模块,还用于对所述待拍摄图像的深度数据进行滤波及去噪操作。The depth data acquisition module of the to-be-captured image is further configured to perform filtering and denoising operations on the depth data of the to-be-captured image. 13.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至6中任一项所述的控制对焦的方法的步骤。13. A computer-readable storage medium on which a computer program is stored, wherein the computer program realizes the steps of the method for controlling focusing according to any one of claims 1 to 6 when the computer program is executed by the processor . 14.一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至6中任一项所述的控制对焦的方法的步骤。14. An electronic device comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor implements any one of claims 1 to 6 when the processor executes the computer program. The steps of a method of controlling focus.
CN201811150676.3A 2018-09-29 2018-09-29 Method and device for controlling focus, storage medium, and electronic device Active CN109089047B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811150676.3A CN109089047B (en) 2018-09-29 2018-09-29 Method and device for controlling focus, storage medium, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811150676.3A CN109089047B (en) 2018-09-29 2018-09-29 Method and device for controlling focus, storage medium, and electronic device

Publications (2)

Publication Number Publication Date
CN109089047A CN109089047A (en) 2018-12-25
CN109089047B true CN109089047B (en) 2021-01-12

Family

ID=64842971

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811150676.3A Active CN109089047B (en) 2018-09-29 2018-09-29 Method and device for controlling focus, storage medium, and electronic device

Country Status (1)

Country Link
CN (1) CN109089047B (en)

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109831609A (en) * 2019-03-05 2019-05-31 上海炬佑智能科技有限公司 TOF depth camera and its Atomatic focusing method
CN109905599A (en) * 2019-03-18 2019-06-18 信利光电股份有限公司 A kind of human eye focusing method, device and readable storage medium storing program for executing
CN110095078B (en) * 2019-05-07 2021-02-23 歌尔光学科技有限公司 Imaging method, device and computer-readable storage medium based on TOF system
CN110276767B (en) 2019-06-28 2021-08-31 Oppo广东移动通信有限公司 Image processing method and apparatus, electronic device, computer-readable storage medium
CN110267041B (en) 2019-06-28 2021-11-09 Oppo广东移动通信有限公司 Image encoding method, image encoding device, electronic device, and computer-readable storage medium
CN110248096B (en) 2019-06-28 2021-03-12 Oppo广东移动通信有限公司 Focusing method and apparatus, electronic device, computer-readable storage medium
CN112154650A (en) * 2019-08-13 2020-12-29 深圳市大疆创新科技有限公司 Focusing control method and device for shooting device and unmanned aerial vehicle
CN110660090B (en) 2019-09-29 2022-10-25 Oppo广东移动通信有限公司 Subject detection method and apparatus, electronic device, computer-readable storage medium
CN110708463B (en) * 2019-10-09 2021-08-24 Oppo广东移动通信有限公司 Focusing method, device, storage medium and electronic device
CN110796041B (en) 2019-10-16 2023-08-18 Oppo广东移动通信有限公司 Subject identification method and device, electronic device, computer-readable storage medium
CN110784653A (en) * 2019-11-20 2020-02-11 香港光云科技有限公司 Dynamic focusing method based on flight time and camera device thereof
CN112991439B (en) * 2019-12-02 2024-04-16 宇龙计算机通信科技(深圳)有限公司 Method, device, electronic equipment and medium for positioning target object
CN111402314A (en) * 2019-12-30 2020-07-10 香港光云科技有限公司 Material attribute parameter obtaining method and device
CN114982214A (en) * 2020-02-07 2022-08-30 Oppo广东移动通信有限公司 Electronic device, method of controlling electronic device, and computer-readable storage medium
CN111526282A (en) * 2020-03-26 2020-08-11 香港光云科技有限公司 Method and device for shooting with adjustable depth of field based on flight time
CN114244999B (en) * 2020-09-09 2023-11-24 北京小米移动软件有限公司 Automatic focusing method, device, image pickup apparatus and storage medium
CN112770100B (en) * 2020-12-31 2023-03-21 南昌欧菲光电技术有限公司 Image acquisition method, photographic device and computer readable storage medium
CN112752026A (en) * 2020-12-31 2021-05-04 深圳市汇顶科技股份有限公司 Automatic focusing method, automatic focusing device, electronic equipment and computer readable storage medium
CN114125434A (en) * 2021-11-26 2022-03-01 重庆盛泰光电有限公司 3D correcting unit of TOF camera
CN117115189A (en) * 2023-07-10 2023-11-24 中铁第一勘察设计院集团有限公司 Track 3D geometric shape monitoring method and system based on machine vision

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10021284B2 (en) * 2015-08-27 2018-07-10 Samsung Electronics Co., Ltd. Epipolar plane single-pulse indirect TOF imaging for automotives
CN106412445A (en) * 2016-11-29 2017-02-15 广东欧珀移动通信有限公司 Control method, control device and electronic device
CN106998389A (en) * 2017-03-09 2017-08-01 广东欧珀移动通信有限公司 Control method, control device and electronic device for automatic composition
CN207218938U (en) * 2017-09-15 2018-04-10 深圳奥比中光科技有限公司 Multi-functional 3D imaging modules and mobile terminal

Also Published As

Publication number Publication date
CN109089047A (en) 2018-12-25

Similar Documents

Publication Publication Date Title
CN109089047B (en) Method and device for controlling focus, storage medium, and electronic device
CN107948519B (en) Image processing method, device and equipment
CN108055452B (en) Image processing method, device and equipment
CN108024054B (en) Image processing method, device, device and storage medium
US10825146B2 (en) Method and device for image processing
US11431915B2 (en) Image acquisition method, electronic device, and non-transitory computer readable storage medium
CN107948500A (en) Image processing method and device
CN110225248A (en) Image acquisition method and apparatus, electronic device, computer-readable storage medium
CN110536057A (en) Image processing method and device, electronic equipment and computer readable storage medium
CN108154514A (en) Image processing method, device and equipment
CN111932587A (en) Image processing method and device, electronic equipment and computer readable storage medium
CN110213498B (en) Image generation method and apparatus, electronic device, computer-readable storage medium
CN110213494A (en) Photographing method and device, electronic equipment and computer readable storage medium
CN113875219B (en) Image processing method and device, electronic device, computer-readable storage medium
CN110266966A (en) Image generation method and device, electronic equipment and computer readable storage medium
CN110349163A (en) Image processing method and apparatus, electronic device, computer-readable storage medium
CN112019734B (en) Image acquisition method and device, electronic equipment and computer readable storage medium
CN108156369A (en) Image processing method and device
CN113298735A (en) Image processing method, image processing device, electronic equipment and storage medium
CN112866547A (en) Focusing method and device, electronic equipment and computer readable storage medium
CN112866554B (en) Focusing method and apparatus, electronic device, computer-readable storage medium
CN109447925B (en) Image processing method and device, storage medium, electronic device
CN109582811B (en) Image processing method, apparatus, electronic device, and computer-readable storage medium
CN110545384A (en) Focusing method and apparatus, electronic device, computer-readable storage medium
HK1251749B (en) Image processing method, device and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant