CN113747085B - Method and device for shooting video - Google Patents

Method and device for shooting video Download PDF

Info

Publication number
CN113747085B
CN113747085B CN202011043999.XA CN202011043999A CN113747085B CN 113747085 B CN113747085 B CN 113747085B CN 202011043999 A CN202011043999 A CN 202011043999A CN 113747085 B CN113747085 B CN 113747085B
Authority
CN
China
Prior art keywords
image
images
terminal
camera
target 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
CN202011043999.XA
Other languages
Chinese (zh)
Other versions
CN113747085A (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to PCT/CN2021/094695 priority Critical patent/WO2021244295A1/en
Publication of CN113747085A publication Critical patent/CN113747085A/en
Application granted granted Critical
Publication of CN113747085B publication Critical patent/CN113747085B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/84Camera processing pipelines; Components thereof for processing colour signals
    • H04N23/88Camera processing pipelines; Components thereof for processing colour signals for colour balance, e.g. white-balance circuits or colour temperature control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • H04N5/2628Alteration of picture size, shape, position or orientation, e.g. zooming, rotation, rolling, perspective, translation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording

Landscapes

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

Abstract

本申请公开了拍摄视频的方法和装置,涉及拍照和图像处理技术领域,可以使希区柯克变焦视频的白平衡效果更好,以提高希区柯克变焦视频的质量。方法包括:在终端距离目标主体越来越远时,针对第一场景实时采集包括目标主体的N+1个图像。对于后采集的N个图像,基于“用于保证时域相邻图像的白平衡一致性”的神经网络进行白平衡处理,得到N个优化图像。对N个优化图像进行放大裁剪,得到N个目标图像;N个目标图像中目标主体的大小与采集的第一个图像中目标主体的大小一致,N个目标图像中目标主体的相对位置,与第一个图像中目标主体的相对位置一致;N个目标图像与第一个图像的大小一致。基于N个目标图像和第一个图像生成希区柯克变焦视频。

Figure 202011043999

The application discloses a method and device for shooting video, which relate to the technical field of photographing and image processing, and can make the white balance effect of the Hitchcock zoom video better, so as to improve the quality of the Hitchcock zoom video. The method includes: collecting N+1 images including the target subject in real time for the first scene when the terminal is farther and farther away from the target subject. For the N images collected later, the white balance processing is performed based on the neural network "used to ensure the white balance consistency of adjacent images in time domain", and N optimized images are obtained. Enlarge and crop N optimized images to obtain N target images; the size of the target subject in the N target images is consistent with the size of the target subject in the first image collected, and the relative position of the target subject in the N target images is the same as The relative position of the target subject in the first image is consistent; the size of the N target images is consistent with the first image. Generate a Hitchcock zoom video based on N target images and the first image.

Figure 202011043999

Description

拍摄视频的方法和装置Method and device for shooting video

本申请要求于2020年05月30日提交国家知识产权局、申请号为202010480536.3、申请名称为“一种区分主体人物和背景的变焦方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application submitted to the State Intellectual Property Office on May 30, 2020, with the application number 202010480536.3 and the application name "A Zooming Method and Device for Distinguishing Subject Characters and Backgrounds", the entire content of which is passed References are incorporated in this application.

技术领域technical field

本申请涉及拍照技术领域和图像处理技术领域,尤其涉及拍摄视频的方法和装置。The present application relates to the field of photographing technology and the field of image processing technology, and in particular to a method and device for shooting video.

背景技术Background technique

随着手机摄像功能的飞跃发展,越来越多摄影用户开始尝试在视频中加入电影拍摄元素,以增加画面的丰富性和高级感,同时可以让用户体验到更加炫酷、惊艳的视觉效果。希区柯克变焦视频就是满足这种视觉效果的其中之一。With the rapid development of mobile phone camera functions, more and more photography users are trying to add movie shooting elements to the video to increase the richness and high-level sense of the picture, and at the same time allow users to experience more cool and stunning visual effects. Hitchcock's zoom video is one of them that meets this visual effect.

希区柯克变焦是一种特殊的视频拍摄手法。在拍摄希区柯克变焦视频的过程中,摄像机前进或后退,并且在前进或后退的同时改变焦距,以使目标主体在所采集的图像中大小不变,而背景图像发生剧烈改变。这种效果可以用来体现主体人物丰富的情感,给用户带来空间压缩或扩张的紧张感和冲击感,进而获得超脱常规的视频录制体验。Hitchcock zoom is a special video shooting technique. During a Hitchcock zoom video, the camera moves forward or backward, and changes focus while moving forward or backward, so that the subject of interest remains the same size in the captured image while the background image changes drastically. This effect can be used to reflect the rich emotions of the main character, bringing users a sense of tension and impact of space compression or expansion, and then obtain an unconventional video recording experience.

因此,如何实现希区柯克变焦成为亟待解决的技术问题。Therefore, how to realize the Hitchcock zoom has become a technical problem to be solved urgently.

发明内容Contents of the invention

本申请实施例提供了拍摄视频的方法和装置,可以使得获得的希区柯克变焦视频的白平衡效果更好,从而提高希区柯克变焦视频的质量,进而提高用户体验。The embodiments of the present application provide a video shooting method and device, which can make the obtained Hitchcock zoom video have a better white balance effect, thereby improving the quality of the Hitchcock zoom video, and further improving user experience.

为达到上述目的,本申请采用如下技术方案:In order to achieve the above object, the application adopts the following technical solutions:

第一方面,提供一种拍摄视频的方法,该方法应用于终端。该方法包括:针对第一场景实时采集N+1个图像,该N+1个图像中均包括目标主体;其中,在采该集N+1个图像的过程中,终端距离目标主体越来越远。N是大于等于1的整数。对该于N+1个图像中后采集的N个图像,基于预设神经网络进行白平衡处理,得到N个优化图像;预设神经网络用于保证时域相邻图像的白平衡一致性。对该N个优化图像进行放大并裁剪,得到N个目标图像;其中,N个目标图像中的每个目标图像中的目标主体的大小与N+1个图像中采集的第一个图像中目标主体的大小一致,N个目标图像中的每个目标图像中的目标主体的相对位置,与第一个图像中目标主体的相对位置一致。N个目标图像与第一个图像的大小一致。基于N个目标图像和第一个图像生成希区柯克变焦视频。In a first aspect, a method for shooting a video is provided, and the method is applied to a terminal. The method includes: collecting N+1 images in real time for the first scene, and the N+1 images all include the target subject; wherein, during the process of collecting the N+1 images, the terminal is getting closer and closer to the target subject Far. N is an integer greater than or equal to 1. For the N images collected after the N+1 images, white balance processing is performed based on the preset neural network to obtain N optimized images; the preset neural network is used to ensure the white balance consistency of adjacent images in the temporal domain. The N optimized images are enlarged and cropped to obtain N target images; wherein, the size of the target subject in each target image in the N target images is the same as the target in the first image collected in the N+1 images The size of the subject is consistent, and the relative position of the target subject in each of the N target images is consistent with the relative position of the target subject in the first image. The N target images are the same size as the first image. Generate a Hitchcock zoom video based on N target images and the first image.

本技术方案,在获取希区柯克变焦视频的过程中,对实时采集到的N+1个图像中的后N个图像进行了白平衡处理,以使得处理后的图像与所采集的N+1个图像中的第一个图像的白平衡一致。这样,可以使得获得的希区柯克变焦视频的白平衡效果更好,从而提高希区柯克变焦视频的质量,进而提高用户体验。In this technical solution, in the process of obtaining the Hitchcock zoom video, white balance processing is performed on the last N images of the N+1 images collected in real time, so that the processed images are consistent with the collected N+1 images. The white balance of the first image in 1 image is the same. In this way, the white balance effect of the obtained Hitchcock zoom video can be better, thereby improving the quality of the Hitchcock zoom video, thereby improving user experience.

在一种可能的设计中,N+1个图像包括在前采集的N1+1个图像和在后采集的N2个图像,其中,N1+1个图像由终端的第一摄像头采集得到,N2个图像由终端的第二摄像头采集得到;N1和N2均是大于等于1的整数。也就是说,本申请实施例提供的技术方案可以应用于在切换摄像头的场景中拍摄希区柯克变焦视频。In a possible design, the N+1 images include N1+1 images collected before and N2 images collected later, where the N1+1 images are collected by the first camera of the terminal, and the N2 images The image is collected by the second camera of the terminal; both N1 and N2 are integers greater than or equal to 1. That is to say, the technical solution provided by the embodiment of the present application can be applied to shooting a Hitchcock zoom video in a scene of switching cameras.

在一种可能的设计中,针对第一场景实时采集N+1个图像,包括:获取N+1个图像中的第i个图像的拍摄倍率;其中,2≤i≤N,i是整数;如果第i个图像的拍摄倍率在第一拍摄倍率范围内,则基于终端的第一摄像头针对第一场景采集N+1个图像中的第i+1个图像;如果第i个图像的拍摄倍率在第二拍摄倍率范围内,则基于终端的第二摄像头针对第一场景采集N+1个图像中的第i+1个图像。其中,第一摄像头的倍率是a,第二摄像头的倍率是b;a<b;第一拍摄倍率范围是[a,b);第二拍摄倍率范围是大于等于b的范围。In a possible design, collecting N+1 images in real time for the first scene includes: obtaining the shooting magnification of the i-th image in the N+1 images; wherein, 2≤i≤N, i is an integer; If the shooting magnification of the i-th image is within the first shooting magnification range, the first camera based on the terminal captures the i+1th image among the N+1 images for the first scene; if the shooting magnification of the i-th image Within the second shooting magnification range, the i+1 th image of the N+1 images is collected for the first scene based on the second camera of the terminal. Wherein, the magnification of the first camera is a, and the magnification of the second camera is b; a<b; the first shooting magnification range is [a, b); the second shooting magnification range is greater than or equal to b.

也就是说,终端基于第i个图像的拍摄倍率,确定采集第i+1个图像的摄像头。这样,终端可以通过切换摄像头的方式,放大后续采集的图像中的目标主体的大小,相比传统技术,有助于使所获得的希区柯克变焦效果视频的清晰度更高,从而提高用户体验。That is to say, based on the shooting magnification of the i-th image, the terminal determines the camera that captures the i+1-th image. In this way, the terminal can enlarge the size of the target subject in the subsequent captured image by switching the camera. Compared with the traditional technology, it helps to make the obtained video with the Hitchcock zoom effect higher in definition, thereby improving user experience.

在一种可能的设计中,第i个图像的拍摄倍率是基于第i个图像中目标主体的大小相对于第一个图像中目标主体的大小的缩放倍率,和采集第一个图像的摄像头的倍率确定的。In a possible design, the shooting magnification of the i-th image is based on the zoom magnification of the size of the target subject in the i-th image relative to the size of the target subject in the first image, and the magnification of the camera that captures the first image The magnification is fixed.

在一种可能的设计中,第i个图像中的目标主体的大小通过以下至少一个特征来表征:第i个图像中的目标主体的宽度,第i个图像中的目标主体的高度,第i个图像中的目标主体的面积,或者,第i个图像中的目标主体的所占的像素点的数量。In one possible design, the size of the target subject in the i-th image is characterized by at least one of the following features: the width of the target subject in the i-th image, the height of the target subject in the i-th image, the i-th The area of the target subject in the i-th image, or the number of pixels occupied by the target subject in the i-th image.

在一种可能的设计中,该方法还包括:采用实例分割算法从第i个图像中提取目标主体,以确定第i个图像中的目标主体的大小。这样,有助于提高确定第i个图像中的目标主体的大小的精确度。In a possible design, the method further includes: using an instance segmentation algorithm to extract the target subject from the i-th image, so as to determine the size of the target subject in the i-th image. In this way, it is helpful to improve the accuracy of determining the size of the target subject in the i-th image.

在一种可能的设计中,该方法还包括:在当前预览界面中,显示第一信息。第一信息用于指示停止拍摄希区柯克变焦视频。这样,用户可以获知什么时候停止移动终端,从而提高用户体验。In a possible design, the method further includes: displaying first information in the current preview interface. The first information is used to instruct to stop shooting the Hitchcock zoom video. In this way, the user can know when to stop the mobile terminal, thereby improving user experience.

在一种可能的设计中,该方法还包括:在当前预览界面中,显示第二信息。第二信息用于指示目标主体静止。由于希区柯克变焦视频的要求之一是各图像中的目标主体的位置一致,因此,基于该可能的设计,用户可以在获取希区柯克变焦视频的过程中,获知当前是否满足获取希区柯克变焦视频的要求,从而提高用户体验。In a possible design, the method further includes: displaying second information in the current preview interface. The second information is used to indicate that the target subject is stationary. Since one of the requirements of the Hitchcock zoom video is that the positions of the target subjects in each image are consistent, based on this possible design, the user can know whether the current acquisition target is met during the process of acquiring the Hitchcock zoom video. Zone Kirk zooms video requirements, thereby improving user experience.

在一种可能的设计中,该方法还包括:在当前预览界面中,显示第三信息,第三信息用于指示目标主体在当前预览图像的中央。这样,用户可以基于是否终端显示第三信息确定是否移动终端,从而有助于提高希区柯克视频的质量。其中,当前预览界面包含当前预览图像(即摄像头采集的图像)和除当前预览图像之外的信息(如拍摄控件、指示信息等)。In a possible design, the method further includes: displaying third information in the current preview interface, where the third information is used to indicate that the target subject is at the center of the current preview image. In this way, the user can determine whether to move the terminal based on whether the terminal displays the third information, thereby helping to improve the quality of the Hitchcock video. Wherein, the current preview interface includes the current preview image (ie, the image captured by the camera) and information other than the current preview image (such as shooting controls, instruction information, etc.).

在一种可能的设计中,该方法还包括:针对第一场景实时采集N+1个图像,包括:在目标主体在当前预览图像的中央时,采集N+1个图像中的第一个图像。这样,有助于提高希区柯克视频的质量。In a possible design, the method further includes: collecting N+1 images in real time for the first scene, including: when the target subject is in the center of the current preview image, collecting the first image of the N+1 images . In this way, it helps to improve the quality of Hitchcock's video.

在一种可能的设计中,该方法还包括:显示用户界面,用户界面中包含第一控件,第一控件用于指示由近及远拍摄希区柯克变焦视频。针对第一场景实时采集N+1个图像,包括:接收针对第一控件的操作,响应于该操作,针对第一场景实时采集N+1个图像。In a possible design, the method further includes: displaying a user interface, where the user interface includes a first control, and the first control is used to indicate that the Hitchcock zoom video is taken from near to far. Collecting N+1 images for the first scene in real time includes: receiving an operation on the first control, and collecting N+1 images for the first scene in real time in response to the operation.

在一种可能的设计中,终端的移动速度小于等于预设速度。这样,有助于提高希区柯克变焦视频的质量。In a possible design, the moving speed of the terminal is less than or equal to a preset speed. In this way, it helps to improve the quality of the Hitchcock zoom video.

在一种可能的设计中,预设神经网络用于结合历史网络层的特征图,对待处理图像的白平衡增益进行预测,以保证时域相邻图像的白平衡一致性;其中,历史网络层是预测在待处理图像之前且与待处理图像时域连续的图像的白平衡增益时所使用的网络层。示例的,待处理图像是上述N个图像中的其中一个。该白平衡网络融合了当前帧和历史帧的网络层特征信息。这样,考虑多帧的信息,有助于使得帧与帧之间的白平衡增益预测值更为接近,从而使得该白平衡网络更稳定,进而使得对连续多个图像进行白平衡处理后所得到的图像之间的白平衡一致性效果更好。In a possible design, the preset neural network is used to predict the white balance gain of the image to be processed in combination with the feature map of the historical network layer, so as to ensure the consistency of white balance of adjacent images in the time domain; wherein, the historical network layer is the network layer used when predicting the white balance gain of the image before and temporally continuous with the image to be processed. Exemplarily, the image to be processed is one of the above N images. The white balance network fuses the network layer feature information of the current frame and the historical frame. In this way, considering the information of multiple frames helps to make the predicted value of white balance gain between frames closer, so that the white balance network is more stable, and then the white balance obtained after performing white balance processing on multiple consecutive images White balance consistency between images is better.

在一种可能的设计中,预设神经网络基于预设约束条件训练得到;其中,预设约束条件包括:用于模拟时域连续的多个图像的白平衡增益预测值一致。In a possible design, the preset neural network is trained based on preset constraint conditions; wherein, the preset constraint conditions include: the white balance gain prediction values for simulating multiple images continuous in time domain are consistent.

在一种可能的设计中,对于N+1个图像中后采集的N个图像,基于预设神经网络进行白平衡处理,得到N个优化图像,包括:将N+1个图像中的第j个图像输入到预设神经网络,得到第j个图像的白平衡增益预测值;其中,2≤j≤N-1,j是整数。将第j个图像的白平衡增益预测值作用于第j个图像,得到第j个图像对应的优化图像;其中,N个优化图像包括第j个图像对应的优化图像。In a possible design, for the N images collected later in the N+1 images, white balance processing is performed based on the preset neural network to obtain N optimized images, including: the j-th image in the N+1 images input the image to the preset neural network to obtain the white balance gain prediction value of the jth image; where, 2≤j≤N-1, j is an integer. Applying the white balance gain prediction value of the jth image to the jth image to obtain an optimized image corresponding to the jth image; wherein, the N optimized images include the optimized image corresponding to the jth image.

第二方面,提供一种拍摄视频的方法,该方法应用于终端,该方法包括:针对第一场景采集N+1个图像,N+1个图像中均包括目标主体;其中,在采集N+1个图像的过程中,终端距离目标主体越来越近;N是大于等于1的整数。N+1个图像中的第一个图像由终端的第一摄像头采集得到,N+1个图像中的后N个图像中的部分或全部图像由终端的第二摄像头采集得到,第二摄像头的倍率小于第一摄像头的倍率。N+1个图像中后采集的N个图像中目标主体的大小小于或等于N+1个图像中采集的第一个图像中的目标主体的大小。对于N+1个图像中后采集的N个图像,基于预设神经网络进行白平衡处理,得到N个优化图像;预设神经网络用于保证时域相邻图像的白平衡一致性。对N个优化图像进行放大并裁剪,得到N个目标图像。其中,N个目标图像中的每个目标图像中的目标主体的大小与N+1个图像中采集的第一个图像中目标主体的大小一致,N个目标图像中每个目标图像中的目标主体的相对位置,与第一个图像中目标主体的相对位置一致;N个目标图像与第一个图像的大小一致。基于N个目标图像和第一个图像,生成希区柯克变焦视频。In a second aspect, a method for shooting a video is provided, the method is applied to a terminal, and the method includes: collecting N+1 images for the first scene, and each of the N+1 images includes a target subject; wherein, during the collection of N+1 In the process of one image, the terminal is getting closer and closer to the target subject; N is an integer greater than or equal to 1. The first image of the N+1 images is collected by the first camera of the terminal, part or all of the images of the last N images of the N+1 images are collected by the second camera of the terminal, and the The magnification is smaller than that of the first camera. The size of the target subject in the N images acquired later in the N+1 images is smaller than or equal to the size of the target subject in the first image acquired in the N+1 images. For the N images collected later in the N+1 images, white balance processing is performed based on the preset neural network to obtain N optimized images; the preset neural network is used to ensure the white balance consistency of adjacent images in the temporal domain. Enlarge and crop the N optimized images to obtain N target images. Wherein, the size of the target subject in each of the N target images is consistent with the size of the target subject in the first image collected in the N+1 images, and the target in each of the N target images The relative position of the subject is consistent with the relative position of the target subject in the first image; the size of N target images is consistent with the first image. Based on the N target images and the first image, generate a Hitchcock zoom video.

可选的,该N+1个图像可以是连续采集的N+1个图像,即实时采集的N+1个图像。Optionally, the N+1 images may be N+1 images collected continuously, that is, N+1 images collected in real time.

该技术方案中,在终端距离目标主体越来越近的场景中,通过切换成倍率更小的摄像头采集在后的图像,从而实现在后采集的图像中目标主体的大小小于或等于在前采集的图像中目标主体的大小。并且,在获取希区柯克变焦视频的过程中,对采集到的N+1个图像中的后N个图像进行了白平衡处理,以使得处理后的图像与所采集的N+1个图像中的第一个图像的白平衡一致。这样,可以使得获得的希区柯克变焦视频的白平衡效果更好,从而提高希区柯克变焦视频的质量,提高了用户体验。In this technical solution, in the scene where the terminal is getting closer and closer to the target subject, the subsequent image is collected by switching the camera with a smaller magnification, so that the size of the target subject in the post-collected image is smaller than or equal to the front-collected image The size of the target subject in the image of . Moreover, in the process of obtaining the Hitchcock zoom video, white balance processing is performed on the last N images of the collected N+1 images, so that the processed images are consistent with the collected N+1 images The white balance of the first image in is consistent. In this way, the white balance effect of the obtained Hitchcock zoom video can be better, thereby improving the quality of the Hitchcock zoom video and improving user experience.

在一种可能的设计中,N个图像包括在前采集的N1个图像和在后采集的N2个图像,其中,N1个图像由第二摄像头采集得到,N2个图像由终端的第三摄像头采集得到;N1和N2均是大于等于1的整数。In a possible design, the N images include N1 images collected before and N2 images collected later, where the N1 images are collected by the second camera, and the N2 images are collected by the third camera of the terminal Obtained; N1 and N2 are integers greater than or equal to 1.

在一种可能的设计中,针对第一场景实时采集N+1个图像,包括:获取N+1个图像中的第i个图像的拍摄倍率;其中,2≤i≤N,i是整数;如果第i个图像的拍摄倍率在第一拍摄倍率范围内,则基于第二摄像头针对第一场景采集N+1个图像中的第i+1个图像;如果第i个图像的拍摄倍率在第二拍摄倍率范围内,则基于终端的第三摄像头针对第一场景采集N+1个图像中的第i+1个图像;其中,第二摄像头的倍率是b,第三摄像头的倍率是c;b>c;第一拍摄倍率范围是大于等于b的范围;第二拍摄倍率范围是[c,b)。In a possible design, collecting N+1 images in real time for the first scene includes: obtaining the shooting magnification of the i-th image in the N+1 images; wherein, 2≤i≤N, i is an integer; If the shooting magnification of the i-th image is within the first shooting magnification range, then based on the second camera, the i+1th image in the N+1 images is collected for the first scene; if the shooting magnification of the i-th image is at Within the second shooting magnification range, the third camera based on the terminal collects the i+1th image among the N+1 images for the first scene; wherein, the magnification of the second camera is b, and the magnification of the third camera is c; b>c; the first shooting magnification range is greater than or equal to b; the second shooting magnification range is [c, b).

也就是说,终端基于第i个图像的拍摄倍率,确定采集第i+1个图像的摄像头。这样,终端可以采用比采集在前的图像时所使用的摄像头的倍率更小的摄像头采集在后的图像,即通过切换成更小倍率的摄像头实现对目标主体的缩小,这样,不需要对采集后的图像进行“补边”,从而提高用户体验。That is to say, based on the shooting magnification of the i-th image, the terminal determines the camera that captures the i+1-th image. In this way, the terminal can use a camera with a smaller magnification than the camera used to capture the previous image to capture the subsequent image, that is, the target subject can be reduced by switching to a camera with a smaller magnification. The final image is "filled" to improve user experience.

在一种可能的设计中,第i个图像的拍摄倍率是基于第i个图像中目标主体的大小相对于第一个图像中目标主体的大小的缩放倍率,和采集第一个图像的摄像头的倍率确定的。In a possible design, the shooting magnification of the i-th image is based on the zoom magnification of the size of the target subject in the i-th image relative to the size of the target subject in the first image, and the magnification of the camera that captures the first image The magnification is fixed.

在一种可能的设计中,第i个图像中的目标主体的大小通过以下至少一个特征来表征:第i个图像中的目标主体的宽度,第i个图像中的目标主体的高度,第i个图像中的目标主体的面积,或者,第i个图像中的目标主体的所占的像素点的数量。In one possible design, the size of the target subject in the i-th image is characterized by at least one of the following features: the width of the target subject in the i-th image, the height of the target subject in the i-th image, the i-th The area of the target subject in the i-th image, or the number of pixels occupied by the target subject in the i-th image.

在一种可能的设计中,该方法还包括:采用实例分割算法从第i个图像中提取目标主体,以确定第i个图像中的目标主体的大小。这样,有助于提高确定第i个图像中的目标主体的大小的精确度。In a possible design, the method further includes: using an instance segmentation algorithm to extract the target subject from the i-th image, so as to determine the size of the target subject in the i-th image. In this way, it is helpful to improve the accuracy of determining the size of the target subject in the i-th image.

在一种可能的设计中,该方法还包括:在当前预览界面中,显示第一信息,第一信息用于指示停止拍摄希区柯克变焦视频。这样,有助于指示用户在合适的时候,停止移动终端,从而提高用户体验。In a possible design, the method further includes: displaying first information in the current preview interface, where the first information is used to indicate to stop shooting the Hitchcock zoom video. In this way, it is helpful to instruct the user to stop the mobile terminal at an appropriate time, thereby improving user experience.

在一种可能的设计中,该方法还包括:在当前预览界面中,显示第二信息,第二信息用于指示目标主体静止。基于该可能的设计,用户可以在获取希区柯克变焦视频的过程中,获知当前是否满足获取希区柯克变焦视频的要求,从而提高用户体验。In a possible design, the method further includes: displaying second information in the current preview interface, where the second information is used to indicate that the target subject is still. Based on this possible design, during the process of obtaining the Hitchcock zoom video, the user can know whether the current requirements for obtaining the Hitchcock zoom video are met, thereby improving user experience.

在一种可能的设计中,该方法还包括:在当前预览界面中,显示第三信息,第三信息用于指示目标主体在当前预览图像的中央。这样,用户可以基于是否终端显示第三信息确定是否移动终端,从而有助于提高希区柯克视频的质量。In a possible design, the method further includes: displaying third information in the current preview interface, where the third information is used to indicate that the target subject is at the center of the current preview image. In this way, the user can determine whether to move the terminal based on whether the terminal displays the third information, thereby helping to improve the quality of the Hitchcock video.

在一种可能的设计中,该针对第一场景采集N+1个图像,包括:在目标主体在当前预览图像的中央时,采集第一个图像。这样,有助于提高希区柯克视频的质量。In a possible design, the collecting N+1 images for the first scene includes: collecting the first image when the target subject is in the center of the current preview image. In this way, it helps to improve the quality of Hitchcock's video.

在一种可能的设计中,该方法还包括:显示用户界面,所述用户界面中包含第二控件,第二控件用于指示由远及近拍摄希区柯克变焦视频。针对第一场景采集N+1个图像,包括:接收针对第二控件的操作,响应于该操作,针对第一场景采集N+1个图像。In a possible design, the method further includes: displaying a user interface, where the user interface includes a second control, and the second control is used to indicate that the Hitchcock zoom video is taken from far to near. Collecting N+1 images for the first scene includes: receiving an operation on the second control, and collecting N+1 images for the first scene in response to the operation.

在一种可能的设计中,终端的移动速度小于等于预设速度。这样,有助于提高高希区柯克变焦视频的质量。In a possible design, the moving speed of the terminal is less than or equal to a preset speed. In this way, it helps to improve the quality of high Hitchcock zoom videos.

在一种可能的设计中,预设神经网络用于结合历史网络层的特征图,对待处理图像的白平衡增益进行预测,以保证时域相邻图像的白平衡一致性;其中,历史网络层是预测在待处理图像之前且与待处理图像时域连续的图像的白平衡增益时所使用的网络层。其有益效果可以参考上述第一方面的相关可能的设计。In a possible design, the preset neural network is used to predict the white balance gain of the image to be processed in combination with the feature map of the historical network layer, so as to ensure the consistency of white balance of adjacent images in the time domain; wherein, the historical network layer is the network layer used when predicting the white balance gain of the image before and temporally continuous with the image to be processed. For its beneficial effects, reference may be made to related possible designs of the above-mentioned first aspect.

在一种可能的设计中,预设神经网络基于预设约束条件训练得到;其中,预设约束条件包括:用于模拟时域连续的多个图像的白平衡增益预测值一致。In a possible design, the preset neural network is trained based on preset constraint conditions; wherein, the preset constraint conditions include: the white balance gain prediction values for simulating multiple images continuous in time domain are consistent.

在一种可能的设计中,对于N+1个图像中后采集的N个图像,基于预设神经网络进行白平衡处理,得到N个优化图像,包括:将N+1个图像中的第j个图像输入到预设神经网络,得到第j个图像的白平衡增益预测值;其中,2≤j≤N-1,j是整数。将第j个图像的白平衡增益预测值作用于第j个图像,得到第j个图像对应的优化图像;其中,N个优化图像包括第j个图像对应的优化图像。In a possible design, for the N images collected later in the N+1 images, white balance processing is performed based on the preset neural network to obtain N optimized images, including: the j-th image in the N+1 images input the image to the preset neural network to obtain the white balance gain prediction value of the jth image; where, 2≤j≤N-1, j is an integer. Applying the white balance gain prediction value of the jth image to the jth image to obtain an optimized image corresponding to the jth image; wherein, the N optimized images include the optimized image corresponding to the jth image.

第三方面,提供了一种拍摄视频的方法,应用于终端,终端包括第一摄像头和第二摄像头,第一摄像头的倍率与第二摄像头的倍率不同。该方法包括:通过第一摄像头和第二摄像头在第一时刻针对第一场景分别采集第一图像和第二图像;其中,第一图像和第二图像中均包含目标主体。基于视频的预设播放时长和预设播放帧率,确定第一图像和第二图像之间的待插入图像的帧数N,N是大于等于1的整数。基于帧数N、第一图像和第二图像,确定N个待插入图像。基于第一图像、第二图像和N个待插入图像,生成视频;该视频中各图像中的目标主体的大小逐渐变大或逐渐变小。In a third aspect, a method for shooting video is provided, which is applied to a terminal. The terminal includes a first camera and a second camera, and the magnification of the first camera is different from that of the second camera. The method includes: respectively collecting a first image and a second image for a first scene at a first moment by using a first camera and a second camera; wherein both the first image and the second image contain a target subject. Based on the preset playback duration and preset playback frame rate of the video, determine the frame number N of the image to be inserted between the first image and the second image, where N is an integer greater than or equal to 1. Based on the frame number N, the first image and the second image, N images to be inserted are determined. A video is generated based on the first image, the second image and the N images to be inserted; in the video, the size of the target subject in each image gradually becomes larger or smaller.

该技术方案中,终端通过多个摄像头在同一时刻针对同一场景采集多帧图像,并基于该多帧图像进行插帧,从而生成视频,该视频中各图像中的目标主体的大小逐渐变大或逐渐变小。这样,相比传统技术,有助于提高所生成的视频的质量。另外,有助于提升动图效果的趣味性,增强用户对终端的粘性。In this technical solution, the terminal collects multiple frames of images for the same scene at the same time through multiple cameras, and interpolates frames based on the multiple frames of images to generate a video in which the size of the target subject in each image gradually becomes larger or larger. Gradually get smaller. This helps to improve the quality of the generated video compared to conventional techniques. In addition, it helps to improve the fun of the animation effect and enhance the user's stickiness to the terminal.

在一种可能的设计中,终端还包括第三摄像头,第三摄像头的倍率在第一摄像头与第二摄像头的倍率之间。该方法还包括:通过第三摄像头在第一时刻针对第一场景采集第三图像;其中,第三图像包含目标主体。基于帧数N、第一图像和第二图像,确定N个待插入图像,包括:基于帧数N、第一图像、第二图像和第三图像,确定N个待插入图像。这样,有助于进一步提升视频的质量。In a possible design, the terminal further includes a third camera, and the magnification of the third camera is between those of the first camera and the second camera. The method further includes: collecting a third image for the first scene at the first moment by using the third camera; wherein, the third image includes the target subject. Determining the N images to be inserted based on the frame number N, the first image and the second image includes: determining the N images to be inserted based on the frame number N, the first image, the second image and the third image. In this way, it helps to further improve the quality of the video.

第四方面,提供了一种终端。In a fourth aspect, a terminal is provided.

在一种可能的设计中,该终端可以用于执行上述第一方面至第三方面提供的任一种方法。本申请可以根据上述第一方面至第三方面提供的任一种方法,对该终端进行功能模块的划分。例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。示例性的,本申请可以按照功能将该终端划分为采集单元、处理单元和显示单元等。上述划分的各个功能模块执行的可能的技术方案和有益效果的描述均可以参考上述第一方面至第三方面提供的相应技术方案,此处不再赘述。In a possible design, the terminal may be used to execute any one of the methods provided in the first aspect to the third aspect above. The present application may divide the terminal into functional modules according to any one of the methods provided in the first aspect to the third aspect. For example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. Exemplarily, the present application may divide the terminal into a collection unit, a processing unit, a display unit, and the like according to functions. For descriptions of possible technical solutions and beneficial effects performed by the above-mentioned divided functional modules, reference may be made to the corresponding technical solutions provided in the first aspect to the third aspect above, which will not be repeated here.

在另一种可能的设计中,该装置包括存储器和处理器,所述存储器用于存储计算机指令,所述处理器用于调用所述计算机指令,以执行如第一方面至第三方面提供的任一种方法。其中,上述第一方面至第三方面提供的任一种方法中的采集步骤,在该可能的设计中具体可以替换为控制采集步骤。上述相应方法中的显示步骤,在该可能的设计中具体可以替换为控制显示步骤。In another possible design, the device includes a memory and a processor, the memory is used to store computer instructions, and the processor is used to call the computer instructions to perform any of the functions provided in the first aspect to the third aspect. a way. Wherein, the collection step in any one of the methods provided by the first aspect to the third aspect may be specifically replaced by a control collection step in this possible design. In this possible design, the display step in the corresponding method above can be replaced by a control display step.

第五方面,提供了一种终端,包括:处理器、存储器和摄像头。该摄像头用于采集图像等,存储器用于存储计算机程序和指令,处理器用于调用该计算机程序和指令,与该一个或多个摄像头协同执行上述第一方面至第三方面提供的相应技术方案。In a fifth aspect, a terminal is provided, including: a processor, a memory, and a camera. The camera is used to collect images, etc., the memory is used to store computer programs and instructions, and the processor is used to call the computer programs and instructions, and cooperate with the one or more cameras to execute the corresponding technical solutions provided by the first aspect to the third aspect above.

第六方面,提供了一种计算机可读存储介质,如计算机非瞬态的可读存储介质。其上储存有计算机程序(或指令),当该计算机程序(或指令)在计算机上运行时,使得该计算机执行上述第一方面至第三方面提供的任一种方法。其中,上述第一方面至第三方面提供的任一种方法中的采集步骤,在该可能的设计中具体可以替换为控制采集步骤。上述相应方法中的显示步骤,在该可能的设计中具体可以替换为控制显示步骤。In a sixth aspect, a computer-readable storage medium is provided, such as a non-transitory computer-readable storage medium. A computer program (or instruction) is stored thereon, and when the computer program (or instruction) is run on the computer, the computer is made to execute any one of the methods provided in the first aspect to the third aspect above. Wherein, the collection step in any one of the methods provided by the first aspect to the third aspect may be specifically replaced by a control collection step in this possible design. In this possible design, the display step in the corresponding method above can be replaced by a control display step.

第七方面,提供了一种计算机程序产品,当其在计算机上运行时,使得第一方面至第三方面提供的任一种方法被执行。其中,上述第一方面至第三方面提供的任一种方法中的采集步骤,在该可能的设计中具体可以替换为控制采集步骤。上述相应方法中的显示步骤,在该可能的设计中具体可以替换为控制显示步骤。A seventh aspect provides a computer program product, which, when running on a computer, causes any one of the methods provided in the first aspect to the third aspect to be executed. Wherein, the collection step in any one of the methods provided by the first aspect to the third aspect may be specifically replaced by a control collection step in this possible design. In this possible design, the display step in the corresponding method above can be replaced by a control display step.

可以理解的是,上述提供的任一种终端、计算机存储介质、计算机程序产品或芯片系统等均可以应用于上文所提供的对应的方法,因此,其所能达到的有益效果可参考对应的方法中的有益效果,此处不再赘述。It can be understood that any terminal, computer storage medium, computer program product, or chip system provided above can be applied to the corresponding method provided above. Therefore, the beneficial effects that it can achieve can refer to the corresponding The beneficial effects in the method will not be repeated here.

在本申请中,上述终端或者各功能模块的名字对设备或功能模块本身不构成限定,在实际实现中,这些设备或功能模块可以以其他名称出现。只要各个设备或功能模块的功能和本申请类似,属于本申请权利要求及其等同技术的范围之内。In this application, the names of the above-mentioned terminals or functional modules do not limit the devices or functional modules themselves. In actual implementation, these devices or functional modules may appear with other names. As long as the functions of each device or functional module are similar to those of the present application, they fall within the scope of the claims of the present application and their equivalent technologies.

本申请的这些方面或其他方面在以下的描述中会更加简明易懂。These or other aspects of the present application will be more clearly understood in the following description.

附图说明Description of drawings

图1为本申请实施例可适用的一种终端的硬件结构示意图;FIG. 1 is a schematic diagram of a hardware structure of a terminal applicable to an embodiment of the present application;

图2为本申请实施例可适用的一种终端的软件结构框图;FIG. 2 is a software structural block diagram of a terminal applicable to an embodiment of the present application;

图3为本申请实施例提供的一种启动希区柯克变焦视频拍摄模式的界面变化示意图;FIG. 3 is a schematic diagram of interface changes for starting the Hitchcock zoom video shooting mode provided by the embodiment of the present application;

图4为本申请实施例提供的一种计算机设备的硬件结构示意图;FIG. 4 is a schematic diagram of a hardware structure of a computer device provided by an embodiment of the present application;

图5为本申请实施例提供的一种训练白平衡网络之前的训练数据准备过程的流程示意图;FIG. 5 is a schematic flowchart of a training data preparation process before training a white balance network provided by an embodiment of the present application;

图6为本申请实施例提供的一种训练白平衡网络时所使用的网络架构的示意图;FIG. 6 is a schematic diagram of a network architecture used in training a white balance network provided by an embodiment of the present application;

图7为本申请实施例提供的另一种训练白平衡网络时所使用的网络架构的示意图;FIG. 7 is a schematic diagram of another network architecture used in training the white balance network provided by the embodiment of the present application;

图8为本申请实施例提供的一种预测阶段所使用的网络架构的示意图;FIG. 8 is a schematic diagram of a network architecture used in the prediction stage provided by the embodiment of the present application;

图9为本申请实施例提供的一种白平衡增益预测方法的流程示意图;FIG. 9 is a schematic flowchart of a white balance gain prediction method provided by an embodiment of the present application;

图10为本申请实施例提供的一种拍摄视频的方法的流程示意图;FIG. 10 is a schematic flowchart of a method for shooting a video provided in an embodiment of the present application;

图11为本申请实施例提供的一种启动由近及远模式拍摄希区柯克变焦视频的界面变化示意图;FIG. 11 is a schematic diagram of interface changes for starting Hitchcock zoom video shooting from near and far modes provided by the embodiment of the present application;

图12为本申请实施例提供的一组界面示意图;Figure 12 is a schematic diagram of a set of interfaces provided by the embodiment of the present application;

图13为本申请实施例提供的另一组界面示意图;Fig. 13 is another set of interface diagrams provided by the embodiment of the present application;

图14为本申请实施例提供的另一组界面示意图;Fig. 14 is another set of interface diagrams provided by the embodiment of the present application;

图15为本申请实施例提供的另一组界面示意图;Fig. 15 is another set of interface diagrams provided by the embodiment of the present application;

图16为本申请实施例提供的另一组界面示意图;Fig. 16 is another set of interface diagrams provided by the embodiment of the present application;

图17为本申请实施例提供的另一组界面示意图;Fig. 17 is a schematic diagram of another set of interfaces provided by the embodiment of the present application;

图18为本申请实施例提供的另一组界面示意图;Fig. 18 is another set of interface diagrams provided by the embodiment of the present application;

图19a为本申请实施例提供的一种终端采集图像的方法的流程示意图;FIG. 19a is a schematic flowchart of a method for capturing images by a terminal provided in an embodiment of the present application;

图19b为本申请实施例提供的一种确定采集图像的摄像头的方法的流程示意图;Fig. 19b is a schematic flowchart of a method for determining a camera for capturing an image provided by an embodiment of the present application;

图20为本申请实施例提供的一种实例分割的示意图;FIG. 20 is a schematic diagram of instance segmentation provided by the embodiment of the present application;

图21为本申请实施例提供的一种终端采集图像的过程示意图;FIG. 21 is a schematic diagram of a process of capturing images by a terminal provided in an embodiment of the present application;

图22a为本申请实施例提供的一种终端采集到的图像的示意图;FIG. 22a is a schematic diagram of an image collected by a terminal provided in an embodiment of the present application;

图22b为本申请实施例提供的另一种终端所采集到的图像的示意图;FIG. 22b is a schematic diagram of an image collected by another terminal provided in an embodiment of the present application;

图23a为本申请实施例提供的一种当前预览界面的示意图;Fig. 23a is a schematic diagram of a current preview interface provided by the embodiment of the present application;

图23b为本申请实施例提供的另一种当前预览界面的示意图;Fig. 23b is a schematic diagram of another current preview interface provided by the embodiment of the present application;

图23c为本申请实施例提供的另一种当前预览界面的示意图;Fig. 23c is a schematic diagram of another current preview interface provided by the embodiment of the present application;

图24为本申请实施例提供的一种对所采集的图像进行放大并裁剪的示意图;Fig. 24 is a schematic diagram of zooming in and cropping a collected image provided by an embodiment of the present application;

图25为本申请实施例提供的另一种拍摄视频的方法的流程示意图;FIG. 25 is a schematic flowchart of another method for shooting video provided in the embodiment of the present application;

图26为传统技术中希区柯克变焦视频中对所采集的图像进行处理的过程示意图;Fig. 26 is a schematic diagram of the process of processing the collected images in the Hitchcock zoom video in the traditional technology;

图27为本申请实施例提供的另一种拍摄视频的方法的流程示意图;FIG. 27 is a schematic flowchart of another method for shooting video provided in the embodiment of the present application;

图28为本申请实施例提供的一种对图像进行处理的过程示意图;FIG. 28 is a schematic diagram of an image processing process provided by an embodiment of the present application;

图29为本申请实施例提供的一种终端的结构示意图;FIG. 29 is a schematic structural diagram of a terminal provided in an embodiment of the present application;

图30为本申请实施例提供的另一种终端的结构示意图。FIG. 30 is a schematic structural diagram of another terminal provided by an embodiment of the present application.

具体实施方式detailed description

在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。In the embodiments of the present application, words such as "exemplary" or "for example" are used as examples, illustrations or illustrations. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application shall not be interpreted as being more preferred or more advantageous than other embodiments or design schemes. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete manner.

在本申请实施例中,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。In the embodiments of the present application, the terms "first" and "second" are used for description purposes only, and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of indicated technical features. Thus, a feature defined as "first" and "second" may explicitly or implicitly include one or more of these features. In the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

在本申请实施例中,术语“一致”仅用于描述相同或相似(即相差不大)。相差不大可以通过相应参数之差小于等于阈值来体现。例如,目标主体的大小一致,是指目标主体的大小相同或相差小于等于阈值等。In the embodiments of the present application, the term "consistent" is only used to describe the same or similar (that is, little difference). The small difference can be reflected by the fact that the difference between the corresponding parameters is less than or equal to the threshold. For example, the same size of the target subjects means that the sizes of the target subjects are the same or the difference is less than or equal to a threshold.

本申请实施例提供的拍摄视频的方法可以应用于终端中,该终端可以是带有摄像头的终端,如智能手机、平板电脑、可穿戴设备、AR/VR设备,也可以是个人计算机(personalcomputer,PC)、个人数字助理(personal digital assistant,PDA)、上网本等设备,还可以是其他任一能够实现本申请实施例的终端。本申请对终端的具体形态不予限定。The method for shooting video provided in the embodiment of the present application can be applied to a terminal, and the terminal can be a terminal with a camera, such as a smart phone, a tablet computer, a wearable device, an AR/VR device, or a personal computer (personal computer, A PC), a personal digital assistant (personal digital assistant, PDA), a netbook, or any other terminal capable of implementing the embodiments of the present application. The present application does not limit the specific form of the terminal.

在本申请中,终端的结构可以如图1所示。如图1所示,终端100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。In this application, the structure of the terminal may be as shown in FIG. 1 . As shown in FIG. 1, the terminal 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, a battery 142, Antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, A display screen 194, a subscriber identification module (subscriber identification module, SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, bone conduction sensor 180M, etc.

可以理解的是,本实施例示意的结构并不构成对终端100的具体限定。在另一些实施例中,终端100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structure shown in this embodiment does not constitute a specific limitation on the terminal 100 . In other embodiments, the terminal 100 may include more or fewer components than shown in the illustration, or combine some components, or separate some components, or arrange different components. The illustrated components can be realized in hardware, software or a combination of software and hardware.

处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。例如,在本申请中,处理器110可以控制摄像头193针对第一场景实时采集N+1个图像,N+1个图像中均包括目标主体。其中,在采集N+1个图像的过程中,摄像头193距离目标主体越来越远;N是大于等于1的整数。然后,对于N+1个图像中后采集的N个图像,处理器110可以基于预设神经网络进行白平衡处理,得到N个优化图像;预设神经网络用于保证时域相邻图像的白平衡一致性。接着,处理器110可以对N个优化图像进行放大并裁剪,得到N个目标图像;其中,N个目标图像中的目标主体的大小与N+1个图像中采集的第一个图像中目标主体的大小一致,N个目标图像中目标主体的相对位置,与第一个图像中目标主体的相对位置一致;N个目标图像与第一个图像的大小一致。最后,处理器110可以基于N个目标图像和第一个图像生成希区柯克变焦视频。该技术方案的相关说明可以参考下文。The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor ( image signal processor (ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc. Wherein, different processing units may be independent devices, or may be integrated in one or more processors. For example, in this application, the processor 110 may control the camera 193 to collect N+1 images for the first scene in real time, and each of the N+1 images includes the target subject. Wherein, during the process of collecting N+1 images, the camera 193 is getting farther and farther away from the target subject; N is an integer greater than or equal to 1. Then, for the N images collected after the N+1 images, the processor 110 can perform white balance processing based on the preset neural network to obtain N optimized images; the preset neural network is used to ensure the whitening of adjacent images in the time domain. Balance consistency. Next, the processor 110 can enlarge and crop the N optimized images to obtain N target images; wherein, the size of the target subject in the N target images is the same as that of the target subject in the first image collected in the N+1 images The size of the target subject in the N target images is consistent with the relative position of the target subject in the first image; the size of the N target images is consistent with the first image. Finally, the processor 110 may generate a Hitchcock zoom video based on the N target images and the first image. For the relevant description of the technical solution, please refer to the following.

其中,控制器可以是终端100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。Wherein, the controller may be the nerve center and command center of the terminal 100 . The controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.

处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated access is avoided, and the waiting time of the processor 110 is reduced, thereby improving the efficiency of the system.

在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuitsound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purposeinput/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuitsound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver (universal asynchronous receiver) /transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input and output (general-purpose input/output, GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and/or A universal serial bus (universal serial bus, USB) interface, etc.

MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(displayserial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现终端100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现终端100的显示功能。The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 . The MIPI interface includes a camera serial interface (camera serial interface, CSI), a display serial interface (displayserial interface, DSI), and the like. In some embodiments, the processor 110 communicates with the camera 193 through a CSI interface to realize the shooting function of the terminal 100 . The processor 110 communicates with the display screen 194 through the DSI interface to realize the display function of the terminal 100 .

GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193 , the display screen 194 , the wireless communication module 160 , the audio module 170 , the sensor module 180 and so on. The GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.

USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB TypeC接口等。USB接口130可以用于连接充电器为终端100充电,也可以用于终端100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他终端,例如AR设备等。The USB interface 130 is an interface conforming to the USB standard specification, and specifically may be a Mini USB interface, a Micro USB interface, a USB TypeC interface, and the like. The USB interface 130 can be used to connect a charger to charge the terminal 100, and can also be used to transmit data between the terminal 100 and peripheral devices. It can also be used to connect headphones and play audio through them. This interface can also be used to connect other terminals, such as AR devices.

可以理解的是,本实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对终端100的结构限定。在本申请另一些实施例中,终端100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules shown in this embodiment is only for schematic illustration, and does not constitute a structural limitation of the terminal 100 . In other embodiments of the present application, the terminal 100 may also adopt different interface connection modes in the foregoing embodiments, or a combination of multiple interface connection modes.

电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。The power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 . The power management module 141 receives the input from the battery 142 and/or the charging management module 140 to provide power for the processor 110 , the internal memory 121 , the display screen 194 , the camera 193 , and the wireless communication module 160 . The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 may also be disposed in the processor 110 . In some other embodiments, the power management module 141 and the charging management module 140 may also be set in the same device.

终端100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the terminal 100 can be realized by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

终端100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The terminal 100 realizes the display function through the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emittingdiode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrixorganic light emitting diode的,AMOLED),柔性发光二极管(flex light-emittingdiode,FLED),Miniled,MicroLed,Micro-oled,量子点发光二极管(quantum dot lightemitting diodes,QLED)等。在一些实施例中,终端100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos and the like. The display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light emitting diode). AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oled, quantum dot light-emitting diodes (quantum dot light emitting diodes, QLED), etc. In some embodiments, the terminal 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

终端100的显示屏194上可以显示一系列图形用户界面(graphical userinterface,GUI),这些GUI都是该终端100的主屏幕。一般来说,终端100的显示屏194的尺寸是固定的,只能在该终端100的显示屏194中显示有限的控件。控件是一种GUI元素,它是一种软件组件,包含在应用程序中,控制着该应用程序处理的所有数据以及关于这些数据的交互操作,用户可以通过直接操作(direct manipulation)来与控件交互,从而对应用程序的有关信息进行读取或者编辑。一般而言,控件可以包括图标、按钮、菜单、选项卡、文本框、对话框、状态栏、导航栏、Widget等可视的界面元素。A series of graphical user interfaces (graphical user interface, GUI) can be displayed on the display screen 194 of the terminal 100 , and these GUIs are the main screen of the terminal 100 . Generally, the size of the display screen 194 of the terminal 100 is fixed, and only limited controls can be displayed on the display screen 194 of the terminal 100 . A control is a GUI element, which is a software component contained in an application that controls all the data processed by the application and the interaction of these data. Users can interact with the control through direct manipulation. , so as to read or edit the relevant information of the application. Generally speaking, controls may include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and Widgets.

终端100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The terminal 100 can realize the shooting function through the ISP, the camera 193 , the video codec, the GPU, the display screen 194 and the application processor.

ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。The ISP is used for processing the data fed back by the camera 193 . For example, when taking a picture, open the shutter, the light is transmitted to the photosensitive element of the camera through the lens, and the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be located in the camera 193 .

摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,终端100可以包括1个或N个摄像头193,N为大于1的正整数。例如,上述摄像头193可以包括主摄像头、长焦摄像头、广角摄像头、红外摄像头、深度摄像头或者黑白摄像头等一种或者至少两种摄像头。结合本申请实施例提供的技术方案,第一终端可以采用上述一种或者至少两种摄像头采集图像,并将采集到的图像进行处理(如融合等),得到预览图像(如第一预览图像或第二预览图像等)。Camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects it to the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a complementary metal-oxide-semiconductor (complementary metal-oxide-semiconductor, CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. DSP converts digital image signals into standard RGB, YUV and other image signals. In some embodiments, the terminal 100 may include 1 or N cameras 193, where N is a positive integer greater than 1. For example, the aforementioned camera 193 may include one or at least two types of cameras such as a main camera, a telephoto camera, a wide-angle camera, an infrared camera, a depth camera, or a black and white camera. In combination with the technical solutions provided in the embodiments of the present application, the first terminal may use one or at least two of the above-mentioned cameras to collect images, and process (such as fusion, etc.) the collected images to obtain a preview image (such as the first preview image or second preview image, etc.).

数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当终端100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the terminal 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.

视频编解码器用于对数字视频压缩或解压缩。终端100可以支持一种或多种视频编解码器。这样,终端100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital video. Terminal 100 may support one or more video codecs. In this way, the terminal 100 can play or record videos in various encoding formats, for example: moving picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现终端100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。The NPU is a neural-network (NN) computing processor. By referring to the structure of biological neural networks, such as the transfer mode between neurons in the human brain, it can quickly process input information and continuously learn by itself. Applications such as intelligent cognition of the terminal 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.

外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展终端100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal 100 . The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. Such as saving music, video and other files in the external memory card.

内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行终端100的各种功能应用以及数据处理。例如,在本实施例中,处理器110可以通过执行存储在内部存储器121中的指令,获取终端100的姿势。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储终端100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。处理器110通过运行存储在内部存储器121的指令,和/或存储在设置于处理器中的存储器的指令,执行终端100的各种功能应用以及数据处理。The internal memory 121 may be used to store computer-executable program codes including instructions. The processor 110 executes various functional applications and data processing of the terminal 100 by executing instructions stored in the internal memory 121 . For example, in this embodiment, the processor 110 may acquire the gesture of the terminal 100 by executing instructions stored in the internal memory 121 . The internal memory 121 may include an area for storing programs and an area for storing data. Wherein, the stored program area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.) and the like. The data storage area can store data created during the use of the terminal 100 (such as audio data, phonebook, etc.) and the like. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (universal flash storage, UFS) and the like. The processor 110 executes various functional applications and data processing of the terminal 100 by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.

终端100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The terminal 100 may implement an audio function through an audio module 170 , a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, and an application processor. Such as music playback, recording, etc.

音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be set in the processor 110 , or some functional modules of the audio module 170 may be set in the processor 110 .

扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。终端100可以通过扬声器170A收听音乐,或收听免提通话。Speaker 170A, also referred to as a "horn", is used to convert audio electrical signals into sound signals. Terminal 100 can listen to music through speaker 170A, or listen to hands-free calls.

受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当终端100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。Receiver 170B, also called "earpiece", is used to convert audio electrical signals into sound signals. When the terminal 100 answers a phone call or voice information, the receiver 170B can be placed close to the human ear to listen to the voice.

麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。终端100可以设置至少一个麦克风170C。在另一些实施例中,终端100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,终端100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。The microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can put his mouth close to the microphone 170C to make a sound, and input the sound signal to the microphone 170C. The terminal 100 may be provided with at least one microphone 170C. In some other embodiments, the terminal 100 may be provided with two microphones 170C, which may also implement a noise reduction function in addition to collecting sound signals. In some other embodiments, the terminal 100 can also be equipped with three, four or more microphones 170C to realize sound signal collection, noise reduction, identify sound sources, realize directional recording functions, and the like.

耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The earphone interface 170D is used for connecting wired earphones. The earphone interface 170D may be the USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.

压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。终端100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,终端100根据压力传感器180A检测所述触摸操作强度。终端100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal. In some embodiments, pressure sensor 180A may be disposed on display screen 194 . There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may be comprised of at least two parallel plates with conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The terminal 100 determines the strength of the pressure from the change in capacitance. When a touch operation acts on the display screen 194, the terminal 100 detects the intensity of the touch operation according to the pressure sensor 180A. The terminal 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view short messages is executed. When a touch operation whose intensity is greater than or equal to the first pressure threshold acts on the icon of the short message application, the instruction of creating a new short message is executed.

陀螺仪传感器180B可以用于确定终端100的运动姿势。在一些实施例中,可以通过陀螺仪传感器180B确定终端100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测终端100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消终端100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B may be used to determine the motion posture of the terminal 100 . In some embodiments, the angular velocity of the terminal 100 around three axes (ie, x, y and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for image stabilization. Exemplarily, when the shutter is pressed, the gyro sensor 180B detects the shaking angle of the terminal 100, and calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to counteract the shaking of the terminal 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.

气压传感器180C用于测量气压。在一些实施例中,终端100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In some embodiments, the terminal 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.

磁传感器180D包括霍尔传感器。终端100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当终端100是翻盖机时,终端100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。The magnetic sensor 180D includes a Hall sensor. The terminal 100 may use the magnetic sensor 180D to detect the opening and closing of the flip holster. In some embodiments, when the terminal 100 is a clamshell machine, the terminal 100 can detect the opening and closing of the clamshell according to the magnetic sensor 180D. Furthermore, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, features such as automatic unlocking of the flip cover are set.

加速度传感器180E可检测终端100在各个方向上(一般为三轴)加速度的大小。当终端100静止时可检测出重力的大小及方向。还可以用于识别终端姿势,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the acceleration of the terminal 100 in various directions (generally three axes). The magnitude and direction of gravity can be detected when the terminal 100 is stationary. It can also be used to recognize terminal gestures, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.

距离传感器180F,用于测量距离。终端100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,终端100可以利用距离传感器180F测距以实现快速对焦。The distance sensor 180F is used to measure the distance. The terminal 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the terminal 100 may use the distance sensor 180F for distance measurement to achieve fast focusing.

接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。终端100通过发光二极管向外发射红外光。终端100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定终端100附近有物体。当检测到不充分的反射光时,终端100可以确定终端100附近没有物体。终端100可以利用接近光传感器180G检测用户手持终端100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes. The light emitting diodes may be infrared light emitting diodes. The terminal 100 emits infrared light through the light emitting diode. The terminal 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it may be determined that there is an object near the terminal 100 . When insufficient reflected light is detected, the terminal 100 may determine that there is no object near the terminal 100 . The terminal 100 can use the proximity light sensor 180G to detect that the user holds the terminal 100 close to the ear to make a call, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode, automatic unlock and lock screen in pocket mode.

环境光传感器180L用于感知环境光亮度。终端100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测终端100是否在口袋里,以防误触。The ambient light sensor 180L is used for sensing ambient light brightness. The terminal 100 may adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the terminal 100 is in the pocket, so as to prevent accidental touch.

指纹传感器180H用于采集指纹。终端100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The terminal 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, access to the application lock, take pictures with fingerprints, answer incoming calls with fingerprints, and so on.

温度传感器180J用于检测温度。在一些实施例中,终端100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,终端100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,终端100对电池142加热,以避免低温导致终端100异常关机。在其他一些实施例中,当温度低于又一阈值时,终端100对电池142的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 180J is used to detect temperature. In some embodiments, the terminal 100 uses the temperature detected by the temperature sensor 180J to implement a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds the threshold, the terminal 100 executes reducing the performance of a processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection. In some other embodiments, when the temperature is lower than another threshold, the terminal 100 heats the battery 142 to avoid abnormal shutdown of the terminal 100 due to low temperature. In some other embodiments, when the temperature is lower than another threshold, the terminal 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.

触摸传感器180K,也称“触控器件”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于终端100的表面,与显示屏194所处的位置不同。The touch sensor 180K is also called "touch device". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”. The touch sensor 180K is used to detect a touch operation on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the terminal 100 , which is different from the position of the display screen 194 .

骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice. The bone conduction sensor 180M can also contact the human pulse and receive the blood pressure beating signal. In some embodiments, the bone conduction sensor 180M can also be disposed in the earphone, combined into a bone conduction earphone. The audio module 170 can analyze the voice signal based on the vibration signal of the vibrating bone mass of the vocal part acquired by the bone conduction sensor 180M, so as to realize the voice function. The application processor can analyze the heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 180M, so as to realize the heart rate detection function.

按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。终端100可以接收按键输入,产生与终端100的用户设置以及功能控制有关的键信号输入。The keys 190 include a power key, a volume key and the like. The key 190 may be a mechanical key. It can also be a touch button. The terminal 100 may receive key input and generate key signal input related to user settings and function control of the terminal 100 .

马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。The motor 191 can generate a vibrating reminder. The motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations applied to different applications (such as taking pictures, playing audio, etc.) may correspond to different vibration feedback effects. The motor 191 may also correspond to different vibration feedback effects for touch operations acting on different areas of the display screen 194 . Different application scenarios (for example: time reminder, receiving information, alarm clock, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 can be an indicator light, and can be used to indicate charging status, power change, and can also be used to indicate messages, missed calls, notifications, and the like.

另外,在上述部件之上,运行有操作系统。例如苹果公司所开发的iOS操作系统,谷歌公司所开发的Android开源操作系统,微软公司所开发的Windows操作系统等。在该操作系统上可以安装运行应用程序。In addition, an operating system runs on top of the above components. For example, the iOS operating system developed by Apple, the Android open source operating system developed by Google, and the Windows operating system developed by Microsoft. Applications can be installed and run on this operating system.

终端100的操作系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明终端100的软件结构。The operating system of the terminal 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. In this embodiment of the present application, an Android system with a layered architecture is taken as an example to illustrate the software structure of the terminal 100 .

图2是本申请实施例的终端100的软件结构框图。FIG. 2 is a block diagram of the software structure of the terminal 100 according to the embodiment of the present application.

分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate through software interfaces. In some embodiments, the Android system is divided into four layers, which are, from top to bottom, the application program layer, the application program framework layer, the Android runtime (Android runtime) and the system library, and the kernel layer.

应用程序层可以包括一系列应用程序包。如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。例如,在拍照时,相机应用可以访问应用程序框架层提供的相机接口管理服务。The application layer can consist of a series of application packages. As shown in Figure 2, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message. For example, when taking pictures, the camera application can access the camera interface management service provided by the application framework layer.

应用程序框架层为应用程序层的应用程序提供应用编程接口(applicationprogramming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。例如,在本申请实施例中,在拍照时,应用程序框架层可以为应用程序层提供拍照功能相关的API,并为应用程序层提供相机接口管理服务,以实现拍照功能。The application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions. As shown in Figure 2, the application framework layer can include window managers, content providers, view systems, phone managers, resource managers, notification managers, and so on. For example, in the embodiment of the present application, when taking a photo, the application framework layer may provide the application layer with an API related to the photo taking function, and provide the application layer with a camera interface management service to realize the photo taking function.

窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。A window manager is used to manage window programs. The window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc.

内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。Content providers are used to store and retrieve data and make it accessible to applications. Said data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebook, etc.

视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. The view system can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.

电话管理器用于提供终端100的通信功能。例如通话状态的管理(包括接通,挂断等)。The phone manager is used to provide a communication function of the terminal 100 . For example, the management of call status (including connected, hung up, etc.).

资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.

通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,终端振动,指示灯闪烁等。The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify the download completion, message reminder, etc. The notification manager can also be a notification that appears on the top status bar of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, prompting text information in the status bar, emitting a prompt sound, terminal vibration, and indicator light flashing, etc.

Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。Android Runtime includes core library and virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.

核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。The core library consists of two parts: one part is the function function that the java language needs to call, and the other part is the core library of Android.

应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The application layer and the application framework layer run in virtual machines. The virtual machine executes the java files of the application program layer and the application program framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。A system library can include multiple function modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.

表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.

媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of various commonly used audio and video formats, as well as still image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing, etc.

2D图形引擎是2D绘图的绘图引擎。2D graphics engine is a drawing engine for 2D drawing.

内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。The kernel layer is the layer between hardware and software. The kernel layer includes at least a display driver, a camera driver, an audio driver, and a sensor driver.

需要说明的是,本申请实施例虽然以Android系统为例进行说明,但是其基本原理同样适用于基于iOS或Windows等操作系统的终端。It should be noted that although the embodiment of the present application uses the Android system as an example for illustration, its basic principles are also applicable to terminals based on operating systems such as iOS or Windows.

下面结合图1和视频拍摄场景,示例性说明终端100软件以及硬件的工作流程。The workflow of the software and hardware of the terminal 100 will be exemplarily described below with reference to FIG. 1 and the video shooting scene.

首先,触摸传感器180K接收到对相机应用图标的触摸操作触摸操作,上报给处理器110,使得处理器110响应于上述触摸操作,启动相机应用,并在显示屏194上显示该相机应用的用户界面,如图3中的a图所示。此外,本申请实施例中还可以通过其它方式使得终端100启动相机应用,并在显示屏194上显示相机应用的用户界面。例如,终端100在黑屏、显示锁屏界面或者解锁后显示某一用户界面时,可以响应于用户的语音指令或者快捷操作等,启动相机应用,并在显示屏194上显示相机应用的用户界面。其中,相机的用户界面上包含“夜景”“人像”“拍照”“录像”“更多”等控件。First, the touch sensor 180K receives a touch operation on the icon of the camera application, and reports the touch operation to the processor 110, so that the processor 110 responds to the touch operation, starts the camera application, and displays the user interface of the camera application on the display screen 194 , as shown in Figure 3a. In addition, in the embodiment of the present application, the terminal 100 can also start the camera application in other ways, and display the user interface of the camera application on the display screen 194 . For example, when the terminal 100 is on a black screen, displays a lock screen interface, or displays a certain user interface after unlocking, it may respond to a user's voice command or shortcut operation, etc., to start the camera application, and display the camera application user interface on the display screen 194. Among them, the user interface of the camera includes controls such as "night view", "portrait", "photographing", "video recording" and "more".

其次,触摸传感器180K接收到对“录像”控件的触摸操作,上报给处理器110,使得处理器110响应于上述触摸操作,将“录像”控件突出显示,如图3中的b图所示,图3中的b图中“录像”控件加边框以突出显示;并启动录像功能,显示录像功能下的用户界面,如图3中的c图所示。录像功能下的用户界面包括“希区柯克变焦视频”“普通视频”“更多”等控件。Secondly, the touch sensor 180K receives a touch operation on the "recording" control and reports it to the processor 110, so that the processor 110 highlights the "recording" control in response to the above touch operation, as shown in Figure 3 b, In figure b in Figure 3, the "recording" control is highlighted with a frame; and the recording function is started, and the user interface under the recording function is displayed, as shown in figure c in Figure 3 . The user interface under the recording function includes controls such as "Hitchcock Zoom Video", "Normal Video" and "More".

接着,触摸传感器180K接收到对“希区柯克变焦视频”控件的触摸操作,上报给处理器110,使得处理器110响应于上述触摸操作,将“希区柯克变焦视频”控件突出显示,如图3中的d图所示,图3中的d图中“希区柯克变焦视频”控件加边框以突出显示;并采用希区柯克变焦视频拍摄模式开始录像,即开始拍摄希区柯克变焦视频。Next, the touch sensor 180K receives a touch operation on the "Hitchcock zoom video" control, and reports it to the processor 110, so that the processor 110 highlights the "Hitchcock zoom video" control in response to the touch operation, As shown in figure d in Figure 3, the "Hitchcock Zoom Video" control in Figure 3 d is highlighted with a border; and the Hitchcock zoom video shooting mode is used to start video recording, that is, to start shooting Hitchcock Kirk Zoom video.

本申请实施例中还可以通过其它方式使得终端100启动希区柯克变焦视频拍摄模式。例如,终端100可以响应于用户的语音指令或快捷操作等,启动希区柯克变焦视频拍摄模式。In the embodiment of the present application, the terminal 100 can also be enabled to start the Hitchcock zoom video shooting mode in other ways. For example, the terminal 100 may start the Hitchcock zoom video shooting mode in response to the user's voice command or shortcut operation.

如图4所示,为本申请实施例提供的一种计算机设备30的硬件结构示意图。该计算机设备30包括处理器301、存储器302、通信接口303以及总线304。其中,处理器301、存储器302以及通信接口303之间可以通过总线304连接。As shown in FIG. 4 , it is a schematic diagram of a hardware structure of a computer device 30 provided in the embodiment of the present application. The computer device 30 includes a processor 301 , a memory 302 , a communication interface 303 and a bus 304 . Wherein, the processor 301 , the memory 302 and the communication interface 303 may be connected through a bus 304 .

处理器301是计算机设备30的控制中心,可以是一个通用CPU,也可以是其他通用处理器等。其中,通用处理器可以是微处理器或者是任何常规的处理器等。The processor 301 is the control center of the computer device 30, and may be a general-purpose CPU or other general-purpose processors. Wherein, the general-purpose processor may be a microprocessor or any conventional processor.

作为示例,处理器301可以包括一个或多个CPU,例如图4中所示的CPU 0和CPU 1。As an example, the processor 301 may include one or more CPUs, such as CPU 0 and CPU 1 shown in FIG. 4 .

存储器302可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(electricallyerasable programmable read-only memory,EEPROM)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。The memory 302 may be a read-only memory (read-only memory, ROM) or other types of static storage devices that can store static information and instructions, a random access memory (random access memory, RAM) or other types that can store information and instructions The dynamic storage device can also be an electrically erasable programmable read-only memory (electrically erasable programmable read-only memory, EEPROM), a magnetic disk storage medium or other magnetic storage devices, or can be used to carry or store instructions or data structures desired program code and any other medium that can be accessed by a computer, but not limited thereto.

一种可能的实现方式中,存储器301可以独立于处理器301存在。存储器302可以通过总线304与处理器301相连接,用于存储数据、指令或者程序代码。处理器301调用并执行存储器302中存储的指令或程序代码时,能够实现本申请实施例提供的训练白平衡网络之前的训练数据准备过程的相应方法,以及训练白平衡网络的方法等。In a possible implementation manner, the memory 301 may exist independently of the processor 301 . The memory 302 may be connected to the processor 301 through the bus 304 and used for storing data, instructions or program codes. When the processor 301 invokes and executes the instructions or program codes stored in the memory 302, it can realize the corresponding method of the training data preparation process before training the white balance network and the method of training the white balance network provided by the embodiment of the present application.

另一种可能的实现方式中,存储器302也可以和处理器301集成在一起。In another possible implementation manner, the memory 302 may also be integrated with the processor 301 .

通信接口303,可以是任意能够输入参数信息的器件如通信接口等,本申请实施例不作限定。其中,通信接口可以包括接收单元和发送单元。例如,该通信接口303可以用于向终端100发送训练好的白平衡网络的相关信息(如相关参数的值)等。The communication interface 303 may be any device capable of inputting parameter information, such as a communication interface, which is not limited in this embodiment of the present application. Wherein, the communication interface may include a receiving unit and a sending unit. For example, the communication interface 303 may be used to send related information (such as values of related parameters) of the trained white balance network to the terminal 100 .

总线304,可以是工业标准体系结构(industry standard architecture,ISA)总线、外部设备互连(peripheral component interconnect,PCI)总线或扩展工业标准体系结构(extended industry standard architecture,EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。为便于表示,图4中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 304 may be an industry standard architecture (industry standard architecture, ISA) bus, a peripheral component interconnect (peripheral component interconnect, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, etc. The bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in FIG. 4 , but it does not mean that there is only one bus or one type of bus.

需要指出的是,图4中示出的结构并不构成对该计算机设备30的限定,除图4所示部件之外,该计算机设备30可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。It should be pointed out that the structure shown in FIG. 4 does not constitute a limitation to the computer device 30. In addition to the components shown in FIG. 4, the computer device 30 may include more or less components than shown in the illustration, or Combining certain parts, or different arrangements of parts.

另外需要指出的是,图4所示的计算机设备30具体可以是上文中提供的任一种终端100,也可以是任一种网络设备,如接入网设备(如基站)等。It should also be pointed out that the computer device 30 shown in FIG. 4 may specifically be any terminal 100 provided above, or any network device, such as an access network device (such as a base station).

以下,结合附图,说明本申请实施例提供的技术方案:The technical solutions provided by the embodiments of the present application are described below in conjunction with the accompanying drawings:

本申请实施例提供的拍摄视频的方法,可以应用于拍摄希区柯克变焦视频。并且,在拍摄希区柯克变焦视频的过程中,基于白平衡网络对所采集的图像进行白平衡处理,以使时域相邻图像的白平衡一致。其中:The method for shooting a video provided in the embodiment of the present application can be applied to shooting a Hitchcock zoom video. Moreover, in the process of shooting the Hitchcock zoom video, the white balance processing is performed on the collected images based on the white balance network, so that the white balance of adjacent images in the time domain is consistent. in:

白平衡是描述中红、绿、蓝三基色混合生成后白色精确度的一项指标。白平衡是电视摄像领域一个非常重要的概念,通过它可以解决和色调处理的一系列问题。White balance is an index that describes the accuracy of white after the three primary colors of red, green and blue are mixed. White balance is a very important concept in the field of TV photography, through which a series of problems with color tone processing can be solved.

白平衡增益,是对图像的白平衡进行矫正的参数。White balance gain is a parameter to correct the white balance of the image.

白平衡网络是用于对图像的白平衡增益进行预测的网络。白平衡网络可以是深度学习网络,如神经网络等。A white balance network is a network used to predict the white balance gain of an image. The white balance network can be a deep learning network, such as a neural network.

白平衡一致性是指通过使用近似的白平衡增益对时域相邻的图像进行处理,使得处理后得到的图像之间的白平衡效果相同或相似。具体的,使用本申请实施例提供的白平衡网路对时域相邻的图像进行处理,使得处理后得到的图像之间的白平衡效果相同或相似。White balance consistency refers to processing adjacent images in the time domain by using an approximate white balance gain, so that the white balance effects between the processed images are the same or similar. Specifically, the white balance network provided by the embodiment of the present application is used to process the temporally adjacent images, so that the white balance effects of the processed images are the same or similar.

作为举例说明,终端连续采集的图像,或者基于终端连续采集的图像进行处理后得到的图像;都可以理解为时域相邻的图像。As an example, the images continuously collected by the terminal, or the images obtained after processing based on the images continuously collected by the terminal, can be understood as adjacent images in time domain.

以下,对本申请实施例中提供的白平衡网络进行说明:The following describes the white balance network provided in the embodiment of the present application:

训练数据准备过程:Training data preparation process:

如图5所示,为本申请实施例提供的一种训练白平衡网络之前的训练数据准备过程的流程示意图。训练白平衡网络之前的训练数据准备过程可以由上文中所描述的计算机设备30执行。图5所示的方法包括以下步骤:As shown in FIG. 5 , it is a schematic flowchart of a training data preparation process before training a white balance network provided in an embodiment of the present application. The training data preparation process before training the white balance network can be performed by the computer device 30 described above. The method shown in Figure 5 includes the following steps:

S101:计算机设备获取通过多个摄像头(如主摄像头、广角摄像头等)采集的多种环境(如不同色温、不同亮度、不同视角等的室内外环境)下的原始图像。S101: The computer device acquires original images in various environments (such as indoor and outdoor environments with different color temperatures, different brightnesses, and different viewing angles) collected by multiple cameras (such as a main camera, a wide-angle camera, etc.).

S102:对于每个原始图像,计算机设备对该原始图像中灰色或白色部分进行参数提取,得到该原始图像的白平衡增益。S102: For each original image, the computer device extracts parameters of the gray or white part of the original image to obtain a white balance gain of the original image.

这里的白平衡增益在训练阶段用于作为白平衡网络的预测目标,因此,为了区别下文中的白平衡增益预测值,下文中将此处得到的白平衡增益称为白平衡增益参考值。The white balance gain here is used as the prediction target of the white balance network during the training phase. Therefore, in order to distinguish the white balance gain prediction value below, the white balance gain obtained here is called the white balance gain reference value hereinafter.

可选的,原始图像中的灰色或白色部分可以基于标准色卡对比得到。Optionally, the gray or white part in the original image can be obtained based on standard color card comparison.

S103:对于每个原始图像,计算机设备对该原始图像进行数据增强,得到一组增强后的图像。一组增强后的图像用于确定一个原始样本。S103: For each original image, the computer device performs data enhancement on the original image to obtain a set of enhanced images. A set of enhanced images is used to determine an original sample.

为了方便描述,下文中将每一组增强后的图像称为一个图像组。For convenience of description, each group of enhanced images is referred to as an image group hereinafter.

实现方式1:一个图像组作为一个原始样本。一个图像组包括P个图像,P是大于等于2的整数。一个图像组中的P个图像用于模拟摄像头采集的时域连续的P个图像。Implementation 1: An image group is used as an original sample. An image group includes P images, and P is an integer greater than or equal to 2. The P images in an image group are used to simulate the P consecutive images collected by the camera in the time domain.

可选的,一个图像组中的P个图像用于模拟同一摄像头采集的P个时域连续的图像。Optionally, the P images in an image group are used to simulate P consecutive images in time domain collected by the same camera.

可选的,一个图像组中的P个图像用于模拟不同摄像头切换前后采集的P个时域连续的图像。Optionally, the P images in an image group are used to simulate P time-domain continuous images collected before and after switching between different cameras.

其中,一个图像组中的第一个图像可以是基于该图像组对应的原始图像在一组随机数的基础上生成的,当然本申请实施例不限于此。Wherein, the first image in an image group may be generated based on a set of random numbers based on the original image corresponding to the image group, of course, this embodiment of the present application is not limited thereto.

实现方式2:一个图像组和该图像组对应的原始图像作为一个原始样本。一个图像组包括Q个图像,Q是大于等于1的整数。一个图像组中的图像和该图像组对应的原始图像,用于模拟摄像头采集的时域连续的Q+1个图像。Implementation 2: An image group and the original image corresponding to the image group are used as an original sample. An image group includes Q images, and Q is an integer greater than or equal to 1. The images in an image group and the original images corresponding to the image group are used to simulate Q+1 consecutive images collected by the camera in time domain.

可选的,一个图像组中的Q个图像和该图像组对应的原始图像,用于模拟同一摄像头采集的Q+1个时域连续的图像。Optionally, the Q images in an image group and the original images corresponding to the image group are used to simulate Q+1 time-domain continuous images collected by the same camera.

可选的,一个图像组中的Q个图像和该图像组对应的原始图像,用于模拟不同摄像头切换前后采集的Q+1个时域连续的图像。Optionally, the Q images in an image group and the original images corresponding to the image group are used to simulate Q+1 time-domain continuous images collected before and after different cameras are switched.

示例的,在一个原始样本中,原始图像可以作为第1个图像,该原始图像对应的图像组中的图像作为该原始样本中的第2个图像至第Q+1个图像。For example, in an original sample, the original image may be used as the first image, and the images in the image group corresponding to the original image are used as the second image to the Q+1th image in the original sample.

通常,一部分原始样本用于模拟同一摄像头采集的多个时域连续的图像,另一部分原始样本用于模拟不同摄像头切换前后采集的多个时域连续的图像。这样,能够使得基于所有原始样本训练得到的白平衡网络,同时适用于不切换摄像头的场景和切换摄像头的场景。Usually, a part of the original samples is used to simulate multiple time-domain continuous images collected by the same camera, and another part of the original samples is used to simulate multiple time-domain continuous images collected before and after switching between different cameras. In this way, it is possible to make the white balance network trained based on all original samples applicable to the scene of not switching the camera and the scene of switching the camera at the same time.

需要说明的是,为了方便说明,下文中均以一个原始样本是一个图像组(即上述实现方式1)为例进行说明。It should be noted that, for the convenience of description, an original sample is an image group (that is, the above-mentioned implementation mode 1) as an example for description below.

S104:对于每个原始样本,计算机设备将该原始样本中的图像转换到同一颜色空间,得到一个样本。所有样本组成训练数据。S104: For each original sample, the computer device converts the image in the original sample into the same color space to obtain a sample. All samples constitute the training data.

可选的,颜色空间可以是红绿蓝(red green blue,RGB)颜色空间等,当然具体实现时不限于此。Optionally, the color space may be a red green blue (red green blue, RGB) color space, etc., of course, the specific implementation is not limited thereto.

可选的,训练数据中的所有样本均使用同一颜色空间。Optionally, all samples in the training data use the same color space.

需要说明的是,样本中的图像属于同一颜色空间,是为了在预测阶段,避免(或消除)不同摄像头模组之间的差异。另外,如果一个原始样本中的多个图像本身就在同一个颜色空间,则可以不执行转换到同一颜色空间的步骤。该情况下,基于同一原始图像得到的一组增强后的图像被称为一个图像组。It should be noted that the images in the samples belong to the same color space in order to avoid (or eliminate) differences between different camera modules in the prediction stage. In addition, if multiple images in an original sample are in the same color space, the step of converting to the same color space may not be performed. In this case, a group of enhanced images obtained based on the same original image is called an image group.

训练阶段:Training phase:

如图6所示,为本申请实施例提供的一种训练白平衡网络时所使用的网络架构的示意图。As shown in FIG. 6 , it is a schematic diagram of a network architecture used in training a white balance network provided by an embodiment of the present application.

in(n)表示样本中的第n个图像。n是一个样本中的图像个数,n大于等于2,n是整数。in(n-a)表示样本中的第n-a个图像。a<n,a是整数。in(n) represents the nth image in the sample. n is the number of images in a sample, n is greater than or equal to 2, and n is an integer. in(n-a) represents the n-ath image in the sample. a<n, a is an integer.

out(n)表示第一子网络的输入是in(n)时第一子网络的输出。out(n-a)表示第一子网络的输入是in(n-a)时第一子网络的输出。out(n) indicates the output of the first subnetwork when the input of the first subnetwork is in(n). out(n-a) indicates the output of the first sub-network when the input of the first sub-network is in(n-a).

mem(n-1,1)表示样本中的第n-1个图像对应的特征图至第1个图像对应的特征图。mem(n-a-1,1)表示样本中的第n-a-1个图像对应的特征图至第1个图像对应的特征图。mem(n-1, 1) represents the feature map corresponding to the n-1th image in the sample to the feature map corresponding to the first image. mem(n-a-1, 1) represents the feature map corresponding to the n-a-1th image in the sample to the feature map corresponding to the first image.

其中,第n-1个图像对应的特征图是第一子网络的输入为in(n-1)时,第一子网络包括的网络层的特征图。本申请实施例对该网络层具体是第一子网络中的哪个或哪些网络层,以及每个网络层的具体实现方式均不进行限定。另外,一个样本中的不同图像对应的特征图可以是第一子网络中的同一网络层的特征图或不同网络层的特征图。Wherein, the feature map corresponding to the n-1th image is the feature map of the network layer included in the first sub-network when the input of the first sub-network is in(n-1). The embodiment of the present application does not limit which network layer or layers in the first subnetwork the network layer is specifically, nor the specific implementation manner of each network layer. In addition, the feature maps corresponding to different images in a sample may be feature maps of the same network layer or feature maps of different network layers in the first sub-network.

损失函数(loss)用于在训练过程进行约束,从而实现“out(n)、out(n-1)……out(n-a)一致”的训练目标。The loss function (loss) is used to constrain the training process, so as to achieve the training goal of "out(n), out(n-1)...out(n-a) consistent".

在训练过程中,对于训练数据中的任意一个样本:During training, for any sample in the training data:

首先,计算机设备将该样本中的第n-a个图像至第n个图像分别输入到图6所示的网络架构中,该网络架构输出一组白平衡增益预测值out(n-a)至out(n)。First, the computer device inputs the n-a-th image to the n-th image in the sample into the network architecture shown in Figure 6, and the network architecture outputs a set of white balance gain prediction values out(n-a) to out(n) .

其次,计算机设备使用该样本对应的原始图像的白平衡增益参考值作为监督,使“out(n-a)……out(n)”中的每个值,尽量接近该原始图像的白平衡增益参考值为目标,调整第一子网络中的参数的取值。Secondly, the computer device uses the white balance gain reference value of the original image corresponding to the sample as supervision, so that each value in "out(n-a)...out(n)" is as close as possible to the white balance gain reference value of the original image As the target, adjust the values of the parameters in the first subnetwork.

以此类推,依次将多个样本输入到该网络架构中,重复执行上述步骤。并且,在执行的过程中,使用损失函数进行约束,以使得同一样本对应的“out(n-a)……out(n)”、以及该样本对应的原始图像的白平衡增益参考值一致。当该网络架构的准确率达到某一预设准确率时,说明该白平衡网络已训练好。By analogy, multiple samples are input into the network architecture in turn, and the above steps are repeated. Moreover, during the execution process, the loss function is used to constrain, so that the "out(n-a)...out(n)" corresponding to the same sample and the white balance gain reference value of the original image corresponding to the sample are consistent. When the accuracy of the network architecture reaches a preset accuracy, it means that the white balance network has been trained.

也就是说,白平衡网络是基于“用于模拟时域连续的多个图像的白平衡增益预测值一致”的这一约束条件训练得到的。That is to say, the white balance network is trained based on the constraint condition that "the predicted values of the white balance gain for simulating consecutive images in time domain are consistent".

图6中,时域连续的a+1个图像的白平衡增益预测值之间采用一致性监督方式进行监督。In FIG. 6 , the white balance gain prediction values of consecutive a+1 images in the time domain are supervised by a consistent supervision method.

在一个示例中,如果n=2,a=1,则训练白平衡网络时所使用的网络架构可以如图7所示。In an example, if n=2 and a=1, the network architecture used when training the white balance network can be as shown in FIG. 7 .

在训练时,对于训练数据中的任意一个样本:During training, for any sample in the training data:

首先,计算机设备将该样本中的第一个图像作为in(1),第二个图像作为in(2)输入到图7所示的网络架构中,该网络架构输出一对白平衡增益预测值out(1)和out(2)。First, the computer device inputs the first image in the sample as in(1) and the second image as in(2) into the network architecture shown in Figure 7, and the network architecture outputs a pair of white balance gain prediction values out (1) and out (2).

其次,计算机设备使用样本对应的原始图像的白平衡增益参考值作为监督,并结合该网络架构输出的白平衡增益预测值out(1)和out(2),调整该白平衡网络的参数的取值。Secondly, the computer equipment uses the white balance gain reference value of the original image corresponding to the sample as supervision, and combines the white balance gain prediction values out(1) and out(2) output by the network architecture to adjust the parameters of the white balance network. value.

以此类推,依次将多个样本输入到该网络架构中,重复执行上述步骤。并且,在执行的过程中,使用损失函数进行约束,以使得同一样本对应的“out(1)和out(2)”、以及该样本对应的原始图像的白平衡增益参考值一致。当该网络架构的准确率达到某一预设准确率时,说明该白平衡网络已训练好。By analogy, multiple samples are input into the network architecture in turn, and the above steps are repeated. Moreover, during the execution process, a loss function is used to constrain so that "out(1) and out(2)" corresponding to the same sample and the white balance gain reference value of the original image corresponding to the sample are consistent. When the accuracy of the network architecture reaches a preset accuracy, it means that the white balance network has been trained.

图7中,时域连续的2个图像的白平衡增益预测值之间采用一致性监督方式进行监督。In Fig. 7, the white balance gain prediction values of two consecutive images in the time domain are supervised by a consistent supervision method.

预测阶段:Forecast phase:

如图8所示,为本申请实施例提供的一种预测阶段所使用的网络架构的示意图。As shown in FIG. 8 , it is a schematic diagram of a network architecture used in the prediction stage provided by the embodiment of the present application.

图8中的白平衡网络中的第一子网络是训练阶段结束时的第一子网络。The first sub-network in the white balance network in Fig. 8 is the first sub-network at the end of the training phase.

in(t)表示该白平衡网络的输入,用于输入待预测图像。in(t) represents the input of the white balance network, which is used to input the image to be predicted.

out(t)是该白平衡网络的输入是in(t)时,该白平衡网络的输出。out(t) is the output of the white balance network when the input of the white balance network is in(t).

mem(t-1,t-T)表示基于该白平衡网络对采集的第t-1个图像的白平衡增益进行预测的过程中所使用的第一目标网络层输出的特征图(下文中称为第t-1个图像对应的特征图),至基于该白平衡网络对采集的第t-T个图像的白平衡增益进行预测的过程中所使用的第二目标网络层输出的特征图(下文中称为第t-T个图像对应的特征图)。mem(t-1, t-T) represents the feature map output by the first target network layer used in the process of predicting the white balance gain of the collected t-1th image based on the white balance network (hereinafter referred to as the first The feature map corresponding to the t-1 image), to the feature map (hereinafter referred to as the feature map (hereinafter referred to as The feature map corresponding to the t-Tth image).

可选的,T的取值是可以调整的。通常,T的取值越大,使用该白平衡网络预测的时域连续的多个图像的白平衡增益的整体波动范围越小,也就是说,T的取值越大,使用该白平衡网络对时域连续的多个图像进行白平衡处理后,所得到的图像之间的白平衡一致性效果更好。Optionally, the value of T can be adjusted. Generally, the larger the value of T, the smaller the overall fluctuation range of the white balance gain of multiple consecutive images in the time domain predicted by the white balance network, that is, the larger the value of T, the smaller the overall fluctuation range of the white balance gain of the multiple images in the temporal domain predicted by the white balance network. After the white balance processing is performed on multiple consecutive images in the time domain, the white balance consistency between the obtained images is better.

mem(t-1,t-T)具体是哪个或哪些特征图,会随着t的取值的更新而更新。例如,在T=3的情况下,假设t=5,则mem(t-1,t-T)表示采集的第4个图像对应的特征图至采集的第1个图像对应的特征图。假设t=6,则mem(t-1,t-T)表示采集的第5个图像对应的特征图至采集的第2个图像对应的特征图。Which or which feature maps mem(t-1, t-T) is specifically will be updated as the value of t is updated. For example, in the case of T=3, assuming t=5, mem(t-1, t-T) represents the feature map corresponding to the fourth image collected to the feature map corresponding to the first image collected. Assuming t=6, then mem(t-1, t-T) represents the feature map corresponding to the collected fifth image to the feature map corresponding to the collected second image.

在预测时,对于采集的第t个图像,将该图像作为in(t)输入到图8所示的白平衡网络中,该白平衡网络在mem(t-1,t-T)的约束下,输出的out(t)为白平衡增益预测值。When predicting, for the tth image collected, the image is input as in(t) into the white balance network shown in Figure 8, and the white balance network is under the constraint of mem(t-1, t-T), the output The out(t) is the white balance gain prediction value.

也就是说,该白平衡网络用于结合历史网络层的特征图(即mem(t-1,t-T)),对待处理图像(即in(t))的白平衡增益进行预测,以保证时域相邻图像的白平衡一致性。其中,历史网络层是预测在待处理图像之前且与待处理图像时域连续的图像的白平衡增益时所使用的网络层。That is to say, the white balance network is used to predict the white balance gain of the image to be processed (ie in(t)) in combination with the feature map of the historical network layer (ie mem(t-1, t-T)), so as to ensure that the time domain White balance consistency of adjacent images. Wherein, the historical network layer is the network layer used when predicting the white balance gain of the image before and temporally continuous with the image to be processed.

如图9所示,为本申请实施例提供的一种白平衡增益预测方法的流程示意图。该技术方案的执行主体可以是上文中提供的计算机设备30。图9所示的方法可以包括以下步骤:As shown in FIG. 9 , it is a schematic flowchart of a white balance gain prediction method provided by the embodiment of the present application. The subject of execution of this technical solution may be the computer device 30 provided above. The method shown in Figure 9 may include the following steps:

S201:计算机设备获取第一待预测图像和第一待预测图像的原始颜色空间。其中,第一待预设图像的原始颜色空间,是采集该待预测图像时所使用的摄像头的颜色空间。S201: The computer device acquires a first image to be predicted and an original color space of the first image to be predicted. Wherein, the original color space of the first image to be preset is the color space of the camera used when collecting the image to be predicted.

其中,第一待预测图像可以是同一摄像头采集的连续多个图像中的非首个图像中的任意一个图像,也可以是不同摄像头采集的连续多个图像中的非首个图像中的任意一个图像。Wherein, the first image to be predicted may be any one of the non-first images among the consecutive multiple images collected by the same camera, or any one of the non-first images among the consecutive multiple images collected by different cameras image.

S202:计算机设备将第一待预测图像的原始颜色空间转换到预设颜色空间,得到第二待预测图像。其中,预设颜色空间为训练阶段中所使用的颜色空间。S202: The computer device converts the original color space of the first image to be predicted into a preset color space to obtain a second image to be predicted. Wherein, the preset color space is the color space used in the training phase.

需要说明的是,如果第一待预测图像的原始颜色空间为预设颜色空间,则可以不执行S202,该情况下,以下步骤中的“第二待预测图像”可以替换为“第一待预测图像”。It should be noted that, if the original color space of the first image to be predicted is the preset color space, S202 may not be performed. In this case, "the second image to be predicted" in the following steps may be replaced with "the first image to be predicted image".

S203:计算机设备将第二待预测图像作为in(t)输入到白平衡网络(例如图8所示的白平衡网络),该白平衡网络在mem(t-1,t-T)的约束之下,输出的out(t)为白平衡增益预测值。S203: The computer device inputs the second image to be predicted as in(t) to the white balance network (such as the white balance network shown in FIG. 8 ), the white balance network is under the constraint of mem(t-1, t-T), The output out(t) is the white balance gain prediction value.

S204:计算机设备将该预测值转换到原始颜色空间,并将转换后的预测值作用于第一待预测图像,得到第一待预测图像对应的优化图像。S204: The computer device converts the predicted value into the original color space, and applies the converted predicted value to the first image to be predicted to obtain an optimized image corresponding to the first image to be predicted.

将转换后的预测值作用于第一待预测图像,得到第一待预测图像对应的优化图像,可以包括:将转换后的预测值与第一待预测图像中的每个像素的像素值相乘,得到新的像素值,并将该像素值作为第一待预测图像对应的优化图像中与该像素对应的像素的像素值。Applying the converted predicted value to the first image to be predicted to obtain an optimized image corresponding to the first image to be predicted may include: multiplying the converted predicted value by the pixel value of each pixel in the first image to be predicted , to obtain a new pixel value, and use the pixel value as the pixel value of the pixel corresponding to the pixel in the optimized image corresponding to the first image to be predicted.

其中,该优化图像为基于白平衡网络对第一待预测图像进行处理后得到的图像。在本申请实施例认为:对时域连续的多个图像中非首个图像中的每个图像执行S201-S204的处理之后所得到的图像与该时域连续的多个图像中的第一个图像之间具有白平衡一致性。Wherein, the optimized image is an image obtained after processing the first image to be predicted based on the white balance network. In the embodiment of the present application, it is considered that: the image obtained after performing the processing of S201-S204 on each of the non-first images among the multiple consecutive images in the temporal domain is the first of the multiple consecutive images in the temporal domain There is white balance consistency between images.

传统的白平衡网络,通常只考虑单帧信息,这会导致帧与帧之间的白平衡增益预测值存在跳变,也就是说,帧与帧之间的白平衡增益预测值的整体波动范围较大。The traditional white balance network usually only considers single frame information, which will cause jumps in the predicted value of white balance gain between frames, that is, the overall fluctuation range of the predicted value of white balance gain between frames larger.

而本申请实施例提供的白平衡网络融合了当前帧和历史帧的网络层特征(feature)信息(即特征图,具体为上文中的mem(t-1,t-T))。这样,考虑多帧的信息,有助于使得帧与帧之间的白平衡增益预测值更为接近,从而使得该白平衡网络更稳定。更具体的,由于上述技术方案中,当前帧与历史帧之间是时域连续的。因此,上述技术方案提供的白平衡网络,使得时域连续的多个图像的白平衡增益预测值更为接近,即,使用该白平衡网络预测的连续多个图像的白平衡增益的整体波动范围更小,从而使得该白平衡网络更稳定,也就是说,使得对连续多个图像进行白平衡处理后所得到的图像之间的白平衡一致性效果更好。However, the white balance network provided by the embodiment of the present application integrates the network layer feature (feature) information of the current frame and the historical frame (that is, the feature map, specifically mem(t-1, t-T) above). In this way, considering the information of multiple frames helps to make the white balance gain prediction values between frames closer, thus making the white balance network more stable. More specifically, in the above technical solution, the current frame and the history frame are continuous in time domain. Therefore, the white balance network provided by the above technical solution makes the white balance gain prediction values of multiple consecutive images in the time domain closer, that is, the overall fluctuation range of the white balance gain of the continuous multiple images predicted by the white balance network is smaller, so that the white balance network is more stable, that is, the white balance consistency between images obtained after performing white balance processing on multiple consecutive images is better.

需要说明的是,本申请实施例提供的白平衡网络在训练过程中,以“同一原始图像增强得到的图像的白平衡增益预测值一致”为约束。而实际上,并不能保证连续多个图像的白平衡增益预测值完全相同,而是有一定的波动。但是,相比现有技术中基于单帧预测白平衡增益的网络来说,本申请实施例提供的白平衡网络有助于使得时域连续多个图像的白平衡增益的整体波动范围降低,从而提高白平衡网络的稳定性。It should be noted that, during the training process of the white balance network provided in the embodiment of the present application, "the white balance gain prediction values of images enhanced from the same original image are consistent" is the constraint. In fact, it cannot be guaranteed that the white balance gain prediction values of multiple consecutive images are exactly the same, but there are certain fluctuations. However, compared with the network in the prior art based on single-frame prediction of white balance gain, the white balance network provided by the embodiment of the present application helps to reduce the overall fluctuation range of white balance gain of multiple consecutive images in the time domain, thereby Improve the stability of the white balance network.

此外,传统的白平衡网络,是基于同一摄像头采集的多个图像进行训练的,这会导致传统的白平衡网络不能应用于多摄切换场景中。In addition, the traditional white balance network is trained based on multiple images collected by the same camera, which will cause the traditional white balance network to not be applied to multi-camera switching scenarios.

而本申请实施例针对多摄切换场景进行了数据增强。具体可以体现在对白平衡网络进行训练时,所使用的训练数据中包含用于模拟多摄切换场景前后连续多个图像的样本。由于多摄切换时一般有视角、尺寸和入图统计的变化,在训练时通过数据增强模拟多摄切换场景,这样,有助于约束网络的预测值在多摄切换场景下保持一致。However, in the embodiment of the present application, data enhancement is performed for a multi-camera switching scene. Specifically, it can be reflected in the fact that when training the white balance network, the training data used includes samples for simulating multiple consecutive images before and after the multi-camera switching scene. Since there are generally changes in viewing angle, size, and image input statistics during multi-camera switching, the multi-camera switching scene is simulated through data enhancement during training, which helps to constrain the prediction value of the network to be consistent in the multi-camera switching scene.

本申请实施例对上文提供的白平衡网络的应用不做限制。The embodiment of the present application does not limit the application of the white balance network provided above.

以下,说明本申请实施例提供的白平衡网络的在拍摄希区柯克变焦视频时的应用。Hereinafter, the application of the white balance network provided by the embodiment of the present application when shooting a Hitchcock zoom video is described.

希区柯克变焦视频中不同图像中的目标主体的大小一致(如相同或相差不大)、且不同图像中的目标主体的相对位置一致(如相同或相差不大)。可选的,不同图像中的目标主体的姿势一致(如姿势相同或姿势相似)。例如,不同图像中的目标主体的大小一致,可以包括:不同图像中的目标主体的轮廓(或最小外接矩形)相对于一致。例如,不同图像中的目标主体的相对位置一致,可以包括:不同图像中的目标主体相对于背景中的同一静态对象的相对位置一致。例如,不同图像中的目标主体的中心位置(或轮廓或最小外接矩形)相对于背景中的同一静态对象的中心位置(或轮廓或最小外接矩形)一致。例如,姿势相似可以包括整体姿势相同(如均是站姿、坐姿或卧姿),而局部姿势存在差异(如手势不同等)。The size of the target subjects in different images in the Hitchcock zoom video is consistent (eg, the same or not much different), and the relative positions of the target subjects in different images are consistent (eg, the same or not much different). Optionally, the poses of the target subjects in different images are consistent (for example, the poses are the same or the poses are similar). For example, the consistent sizes of the target subjects in different images may include: the contours (or minimum circumscribed rectangles) of the target subjects in different images are relatively consistent. For example, the consistent relative positions of the target subjects in different images may include: the consistent relative positions of the target subjects in different images with respect to the same static object in the background. For example, the center positions (or outlines or minimum enclosing rectangles) of target subjects in different images are consistent with the center positions (or outlines or minimum enclosing rectangles) of the same static object in the background. For example, similar postures may include the same overall postures (such as standing, sitting or lying postures), but differences in local postures (such as different gestures, etc.).

需要说明的是,在一个实例中,希区柯克变焦视频中不同图像中的目标主体的大小一致,是指希区柯克变焦视频的不同图像中的目标主体不存在跳变,或者跳变程度较小,从而使得用户感觉不到这种跳变,或者用户能够接受这种跳变。It should be noted that, in an example, the size of the target subject in different images in the Hitchcock zoom video is consistent, which means that the target subject in different images of the Hitchcock zoom video does not have a jump, or jumps The degree is relatively small, so that the user cannot feel the jump, or the user can accept the jump.

需要说明的是,在一个实例中,希区柯克变焦视频中不同图像中的目标主体的相对位置一致,是指希区柯克变焦视频的不同图像中的目标主体是静止的,或者是动态变化程度较小的,从而使得用户感觉不到这种动态变化,或者用户能够接受这种动态变化。It should be noted that, in an example, the relative positions of the target subjects in different images in the Hitchcock zoom video are consistent, which means that the target subjects in different images of the Hitchcock zoom video are still or dynamic The degree of change is small, so that the user does not feel this dynamic change, or the user can accept this dynamic change.

如图10所示,为本申请实施例提供的一种拍摄视频的方法的流程示意图。该方法应用于终端。该终端包括至少两个摄像头。本实施例提供的技术方案应用于由近及远地拍摄希区柯克变焦视频的场景中,即在拍摄希区柯克变焦视频的过程中,终端与目标主体之间的距离越来越远。As shown in FIG. 10 , it is a schematic flowchart of a method for shooting a video provided in the embodiment of the present application. This method is applied to the terminal. The terminal includes at least two cameras. The technical solution provided in this embodiment is applied to the scene of shooting Hitchcock zoom video from near to far, that is, in the process of shooting Hitchcock zoom video, the distance between the terminal and the target subject is getting farther and farther .

本实施例中是在终端距离目标主体越来越远的条件下拍摄希区柯克变焦视频,不切换摄像头时,在后采集的图像中的目标主体的大小小于在前采集的图像中的目标主体的大小,而希区柯克变焦视频的不同图像中的目标主体的大小一致,因此,为了实现希区柯克变焦视频,需要对后采集的图像进行放大。而直接对图像进行放大,会导致放大后的图像不清晰。In this embodiment, the Hitchcock zoom video is shot under the condition that the terminal is farther and farther away from the target subject. When the camera is not switched, the size of the target subject in the image collected later is smaller than the target in the image collected before The size of the subject, and the size of the target subject in different images of the Hitchcock zoom video is consistent, so in order to realize the Hitchcock zoom video, the post-acquisition image needs to be enlarged. However, if the image is directly enlarged, the enlarged image will not be clear.

基于此,本实施例提供的技术方案的基本原理为:终端可以采用比采集在前的图像时所使用的摄像头的倍率更大的摄像头采集在后的图像,即通过切换成更大倍率的摄像头实现对目标主体的放大,这样,相比“对后采集的图像进行放大”的技术方案,有助于提高图像的清晰度。Based on this, the basic principle of the technical solution provided by this embodiment is: the terminal can use a camera with a larger magnification than the camera used to capture the previous image to capture the subsequent image, that is, by switching to a camera with a larger magnification Realize the enlargement of the target subject, so that, compared with the technical solution of "enlarging the image collected later", it is helpful to improve the definition of the image.

图10所示的方法可以包括以下步骤:The method shown in Figure 10 may include the following steps:

S300:终端确定由近及远地拍摄希区柯克变焦视频,并确定初始摄像头。S300: The terminal determines to shoot the Hitchcock zoom video from near to far, and determines an initial camera.

可选的,终端可以在用户的指示下,确定由近及远地拍摄希区柯克变焦视频。Optionally, the terminal may determine to shoot the Hitchcock zoom video from near to far under the instruction of the user.

例如,结合图3中的d图,响应于对“希区柯克变焦视频”控件的触摸操作,终端还可以在用户界面上显示“由近及远模式”401控件和“由远及近模式”402控件,如图11中的a图所示。基于此,用户可以通过对“由近及远模式”401控件进行触摸操作,响应于该触摸操作,终端突出显示“由近及远模式”401控件(如加粗显示该控件的边框),如图11中的b图所示,同时开始启动由近及远模式拍摄希区柯克变焦视频。For example, in combination with diagram d in Figure 3, in response to the touch operation on the "Hitchcock zoom video" control, the terminal can also display the "near to far mode" 401 control and the "far to near mode" control on the user interface "402 control, as shown in figure a in Figure 11. Based on this, the user can perform a touch operation on the "near to far mode" 401 control, and in response to the touch operation, the terminal highlights the "near to far mode" 401 control (for example, the border of the control is displayed in bold), as shown in As shown in figure b in FIG. 11 , start shooting Hitchcock zoom video in the near and far mode at the same time.

需要说明的是,终端还可以以其他方式(如语音指令方式或快捷键方式等)启动由近及远模式拍摄希区柯克变焦视频,本申请实施例对此不进行具体限定。It should be noted that the terminal can also start shooting the Hitchcock zoom video in the near-to-far mode in other ways (such as voice command mode or shortcut key mode, etc.), which is not specifically limited in this embodiment of the present application.

由于在本实施例中,如果终端切换摄像头,则切换成更大倍率的摄像头,因此,初始摄像头的倍率通常不是终端中倍率最大的摄像头,通常可以预定义初始摄像头是终端中倍率较小(如最小)的一个摄像头。Because in this embodiment, if the terminal switches the camera, it will switch to a camera with a larger magnification. Therefore, the magnification of the initial camera is usually not the camera with the largest magnification in the terminal. Usually, it can be predefined that the initial camera is a camera with a smaller magnification in the terminal (such as minimum) of a camera.

S301:终端针对第一场景实时采集N+1个图像,N+1个图像中均包括目标主体。其中,在采集N+1个图像的过程中,该终端距离目标主体越来越远。N是大于等于1的整数。S301: The terminal collects N+1 images in real time for the first scene, and all of the N+1 images include a target subject. Wherein, during the process of collecting N+1 images, the terminal is getting farther and farther away from the target subject. N is an integer greater than or equal to 1.

可选的,N+1个图像可以是终端连续采集的N+1个图像。Optionally, the N+1 images may be N+1 images continuously collected by the terminal.

可选的,N+1个图像中的第一个图像,是终端在“希区柯克变焦视频”模式下,开始拍摄时,终端保存的第一个图像。Optionally, the first image among the N+1 images is the first image saved by the terminal when the terminal starts shooting in the "Hitchcock zoom video" mode.

其中,第一场景可以理解为终端执行S301时,终端的摄像头拍摄视野内的拍摄场景或者其周边可以遍及的场景,与用户所处的环境、终端的姿态或者摄像头的参数有关,本申请不做限定。Among them, the first scene can be understood as the shooting scene within the field of view of the terminal's camera or the surrounding scene when the terminal executes S301, which is related to the user's environment, the posture of the terminal, or the parameters of the camera. limited.

其中,目标主体可以为一个物体,该目标主体的位置在拍摄过程中可以不发生移动,也可以在同一深度横向移动。Wherein, the target subject may be an object, and the position of the target subject may not move during the shooting process, or may move laterally at the same depth.

或者,该目标主体也可以包括深度相同的多个物体,该多个物体的整体可以作为目标主体。在一些实施例中,当目标主体包括多个物体时,该多个物体的图像相连接或有部分重叠。在视频拍摄过程中,随着用户与目标主体之间的距离的变化,不同深度的物体成像大小的变化幅度不同。因而,在用户与目标主体之间的距离变化时,不同深度的物体难以同时实现图像的大小基本不变。因此,为保持目标主体图像的大小基本不变,目标主体中的多个物体应具有相同的深度。Alternatively, the target subject may also include multiple objects with the same depth, and the entirety of the multiple objects may serve as the target subject. In some embodiments, when the target subject includes multiple objects, the images of the multiple objects are connected or partially overlapped. During video shooting, as the distance between the user and the target subject changes, the imaging size of objects at different depths varies in different ranges. Therefore, when the distance between the user and the target subject changes, it is difficult for objects of different depths to simultaneously keep the size of the image substantially constant. Therefore, to keep the size of the subject image substantially constant, multiple objects in the subject should have the same depth.

其中,该目标主体可以是终端自动确定的或者用户指定的,以下针对这两种情况分别进行说明。Wherein, the target subject may be automatically determined by the terminal or specified by the user, and the following two cases will be described respectively.

(1)、终端自动确定目标主体,该目标主体可以包括一个或多个物体。(1) The terminal automatically determines the target subject, and the target subject may include one or more objects.

在一些实施例中,目标主体为预设类型的物体。例如,该预设类型的物体为人物、动物、著名建筑或标志物等。终端基于预览图像确定预设类型的物体为目标主体。In some embodiments, the target subject is a predetermined type of object. For example, objects of the preset type are people, animals, famous buildings or landmarks, and the like. The terminal determines an object of a preset type as the target subject based on the preview image.

在另一些实施例中,目标主体为在预览图像上的图像位于中心区域的物体。用户感兴趣的目标主体通常会正对着变焦摄像头,因而目标主体在预览图像上的图像通常位于中心区域。In some other embodiments, the target subject is an object whose image is located in a central area on the preview image. The target subject that the user is interested in is usually facing the zoom camera, so the image of the target subject on the preview image is usually located in the center area.

在另一些实施例中,目标主体为在预览图像上的图像靠近中心区域且面积大于预设阈值1的物体。用户感兴趣的目标主体通常会对着变焦摄像头且离变焦摄像头较近,从而目标主体在预览图像上的图像靠近中心区域且面积大于预设阈值1。In some other embodiments, the target subject is an object whose image on the preview image is close to the central area and whose area is larger than the preset threshold 1 . The target subject that the user is interested in usually faces the zoom camera and is relatively close to the zoom camera, so that the image of the target subject on the preview image is close to the central area and the area is larger than the preset threshold 1.

在另一些实施例中,目标主体为在预览图像上的图像靠近中心区域的预设类型的物体。In some other embodiments, the target subject is an object of a preset type whose image is close to a central area on the preview image.

在另一些实施例中,目标主体为在预览图像上的图像靠近中心区域,且面积大于预设阈值的预设类型的物体。In some other embodiments, the target subject is a preset type of object whose area on the preview image is close to a central area and whose area is greater than a preset threshold.

在另一些实施例中,目标主体为在预览图像上的图像靠近中心区域,且深度最小的预设类型的物体。当在预览图像上的图像靠近中心区域的预设类型的物体包括多个深度不同的物体时,目标对象为其中深度最小的物体。In some other embodiments, the target subject is a preset type of object whose image is close to the central area on the preview image and has the smallest depth. When the preset type of objects near the central area of the image on the preview image includes a plurality of objects with different depths, the target object is the object with the smallest depth among them.

在一些实施例中,终端默认目标主体仅包括一个物体。In some embodiments, the terminal defaults that the target subject only includes one object.

可以理解的是,终端自动确定目标主体的方式还可以有多种,本申请实施例对该方式不予具体限定。It can be understood that there may be multiple ways for the terminal to automatically determine the target subject, which is not specifically limited in this embodiment of the present application.

在一些实施例中,终端确定目标主体后,可以通过显示提示信息或语音播报等方式将目标主体提示给用户。In some embodiments, after determining the target subject, the terminal may prompt the target subject to the user by displaying prompt information or voice broadcast.

例如,预设类型为人物,终端确定目标主体为在预览图像上的图像靠近中心区域的预设类型的人物1。示例性的,参见图12中的(a),终端可以通过方框501将人物1框选出来,以提示用户该人物1为目标主体。For example, the preset type is a person, and the terminal determines that the target subject is a preset type of person 1 whose image is close to a central area on the preview image. Exemplarily, referring to (a) in FIG. 12 , the terminal may select character 1 through block 501 to prompt the user that character 1 is a target subject.

再例如,预设类型为人物,终端确定目标主体为在预览图像上的图像靠近中心区域,且具有相同深度的预设类型的人物2和人物3。示例性的,参见图12中的(b),终端可以通过圆圈502将人物2和人物3框选出来,以提示用户人物2和人物3为目标主体。For another example, the preset type is a person, and the terminal determines that the target subject is the person 2 and the person 3 of the preset type whose images on the preview image are close to the central area and have the same depth. For example, referring to (b) in FIG. 12 , the terminal may select character 2 and character 3 through the circle 502 to prompt the user that character 2 and character 3 are target subjects.

再例如,预设类型包括人物和动物,终端确定目标主体为在预览图像上的图像靠近中心区域且具有相同深度的预设类型的人物4和动物1。示例性的,参见图12中的(c),终端可以通过显示提示信息来提示用户人物4和动物1为目标主体。For another example, the preset type includes characters and animals, and the terminal determines that the target subject is the preset type of people 4 and animal 1 whose images on the preview image are close to the central area and have the same depth. Exemplarily, referring to (c) in FIG. 12 , the terminal may prompt the user that the character 4 and the animal 1 are target subjects by displaying prompt information.

可以理解的是,终端将目标主体提示给用户的方式还可以有多种,本申请实施例对该方式不予具体限定。It can be understood that there may be multiple manners in which the terminal prompts the target subject to the user, and this embodiment of the present application does not specifically limit the manner.

在一些实施例中,终端自动确定目标主体后,还可以响应于用户的操作修改目标主体,例如切换、增加或删除目标主体等。In some embodiments, after the terminal automatically determines the target subject, it may also modify the target subject in response to user operations, such as switching, adding or deleting the target subject.

例如,在图13中的(a)所示的情况下,终端自动确定的目标主体为人物1,终端检测到用户点击预览图像上的人物5的操作后,如图13中的(b)所示,将目标主体由人物1修改为人物5。For example, in the situation shown in (a) in FIG. 13 , the target subject automatically determined by the terminal is person 1, and after the terminal detects that the user clicks on character 5 on the preview image, the terminal automatically clicks on character 5 on the preview image, as shown in (b) in FIG. As shown, change the target subject from character 1 to character 5.

再例如,在图14中(a)所示的情况下,终端自动确定的目标主体为人物1,终端检测到用户拖动方框以同时框选人物1和人物5的操作后,如图14中的(b)所示,将目标主体由人物1修改为人物1和人物5。For another example, in the situation shown in (a) in Figure 14, the target subject automatically determined by the terminal is character 1, and after the terminal detects the user's operation of dragging a box to simultaneously select character 1 and character 5, as shown in Figure 14 As shown in (b), the target subject is changed from character 1 to character 1 and character 5.

再例如,在图15中的(a)所示的情况下,终端自动确定的目标主体为人物1和人物5,终端检测到用户可以点击人物5的操作后,如图15中的(b)所示,将目标主体由人物1和人物5修改为人物1。For another example, in the case shown in (a) in Figure 15, the target subjects automatically determined by the terminal are characters 1 and 5, and after the terminal detects that the user can click on character 5, the terminal will click on the character 5, as shown in (b) in Figure 15 As shown, change the target subject from Character 1 and Character 5 to Character 1.

再例如,终端根据用户的指示首先进入目标主体修改模式后,再响应于用户的操作修改目标主体。For another example, the terminal first enters the target subject modification mode according to the user's instruction, and then modifies the target subject in response to the user's operation.

可以理解的是,用户修改目标主体的方式还可以有多种,本申请实施例对该方式不予具体限定。It can be understood that there may be multiple ways for the user to modify the target body, which is not specifically limited in this embodiment of the present application.

(2)、用户指定目标主体,该目标主体包括一个或多个物体。(2) The user specifies a target subject, and the target subject includes one or more objects.

终端进入希区柯克模式后,可以响应于用户在预览界面上的预设操作确定目标主体。该预设操作用于指定某个或某些物体为目标对象。其中,该预设操作可以是触摸操作、语音指令操作或手势操作等,本申请实施例不予限定。例如,该触摸操作可以是单击、双击、长按、压力按或圈定对象的操作等。After the terminal enters the Hitchcock mode, it can determine the target subject in response to the user's preset operation on the preview interface. This default operation is used to designate one or some objects as the target object. Wherein, the preset operation may be a touch operation, a voice command operation, or a gesture operation, etc., which is not limited in this embodiment of the present application. For example, the touch operation may be single click, double click, long press, pressure press, or an operation of delimiting an object, and the like.

示例性的,在图16中的(a)所示的预览界面上,终端检测到用户双击预览图像上人物1的操作后,如图16中的(b)所示将人物1确定为目标主体。Exemplarily, on the preview interface shown in (a) in FIG. 16 , after the terminal detects that the user double-clicks the operation of character 1 on the preview image, it determines character 1 as the target subject as shown in (b) in FIG. 16 .

在另一些实施例中,终端进入希区柯克模式后,可以提示用户指定目标主体。示例性的,参见图17中的(a),终端可以显示提示信息:请指定目标主体,以使得目标主体在拍摄过程中的图像大小基本不变。而后,终端响应于用户在预览界面上的预设操作确定目标主体。比如,终端检测到用户划圈圈定图17中的(a)所示的人物1的操作后,如图17中的(b)所示将对应的人物1确定为目标主体。再比如,终端检测到用户语音指示人物为目标主体的操作后,将人物1确定为目标主体。In other embodiments, after the terminal enters the Hitchcock mode, the user may be prompted to specify the target subject. Exemplarily, referring to (a) in FIG. 17 , the terminal may display a prompt message: please specify a target subject so that the image size of the target subject during shooting is basically unchanged. Then, the terminal determines the target subject in response to the user's preset operation on the preview interface. For example, after the terminal detects the user's operation of circling the character 1 shown in (a) in FIG. 17 , it determines the corresponding character 1 as the target subject as shown in (b) in FIG. 17 . For another example, the terminal determines character 1 as the target subject after detecting the operation of the user's voice indicating that the character is the target subject.

再示例性的,在目标主体为预设物体类型且预设物体类型为人物的情况下,参见图18中的(a),终端可以显示提示信息:检测到一个人物,是否指定该人物为目标主体,以使得目标主体在拍摄过程中的图像大小基本不变?而后,终端响应于用户点击“是”控件的操作后,如图18中的(b)所示确定该人物为目标主体。As another example, in the case that the target subject is a preset object type and the preset object type is a person, referring to (a) in FIG. Subject, so that the image size of the target subject is basically unchanged during shooting? Then, after the terminal responds to the user's operation of clicking the "Yes" control, as shown in (b) in FIG. 18 , it determines that the character is the target subject.

在一些实施例中,若终端默认目标主体仅包括一个物体,则当用户指定多个物体为目标主体时,终端可以提示用户:请仅选择一个物体作为目标主体。In some embodiments, if the terminal defaults that the target subject only includes one object, when the user specifies multiple objects as the target subject, the terminal may prompt the user: please select only one object as the target subject.

与终端自动确定目标主体后类似,终端响应于用户的预设操作确定目标主体后,也可以通过显示提示信息或语音播报等方式将目标主体提示给用户。并且,终端也可以响应于用户的操作修改目标主体,例如切换、增加或删除目标主体。此处不再赘述。Similar to after the terminal automatically determines the target subject, after the terminal determines the target subject in response to the user's preset operation, it can also prompt the target subject to the user by displaying prompt information or voice broadcast. Moreover, the terminal may also modify the target subject in response to the user's operation, such as switching, adding or deleting the target subject. I won't repeat them here.

其中,终端针对第一场景实时采集N+1个图像,是指终端在拍摄的过程中针对第一场景采集N+1个图像,而非在拍摄之前已经获取到的针对第一场景的N+1个图像。Wherein, the terminal collects N+1 images for the first scene in real time, which means that the terminal collects N+1 images for the first scene during the shooting process, instead of the N+1 images for the first scene that have been obtained before shooting. 1 image.

可选的,如图19a所示,S301可以包括以下步骤S301 a-S301d:Optionally, as shown in FIG. 19a, S301 may include the following steps S301a-S301d:

S301 a:终端采用初始摄像头针对第一场景采集第一个图像,第一个图像包括目标主体。S301 a: The terminal uses the initial camera to collect a first image for the first scene, where the first image includes a target subject.

S301 b:终端采用初始摄像头针对第一场景采集第二个图像,第二个图像包括目标主体。S301b: The terminal uses the initial camera to collect a second image for the first scene, where the second image includes the target subject.

S301c:终端基于第i个图像的拍摄倍率,确定采集第i+1个图像的摄像头。i≥2,i是整数。具体实现方式可以参考下文。第i个图像包括目标主体。S301c: Based on the shooting magnification of the i-th image, the terminal determines the camera that captures the i+1-th image. i≥2, i is an integer. For specific implementation, refer to the following. The i-th image includes the target subject.

S301d:终端采用所确定的采集第i+1个图像的摄像头,采集第i+1个图像。S301d: The terminal collects the i+1th image by using the determined camera that collects the i+1th image.

以此类推,终端可以采集到N+1个图像。By analogy, the terminal can collect N+1 images.

在一种实现方式中,N+1个图像包括在前采集的N1+1个图像和在后采集的N2个图像,其中,N1+1个图像是由终端的第一摄像头采集得到,N2个图像是由终端的第二摄像头采集得到;N1和N2均是大于等于1的整数。也就是说,本申请实施例提供的技术方案可以应用于在切换摄像头的场景中拍摄希区柯克变焦视频。当然,具体实现时,在拍摄一段希区柯克变焦视频的过程中,可以多次切换摄像头。In an implementation manner, the N+1 images include N1+1 images collected before and N2 images collected later, where the N1+1 images are collected by the first camera of the terminal, and the N2 images The image is collected by the second camera of the terminal; both N1 and N2 are integers greater than or equal to 1. That is to say, the technical solution provided by the embodiment of the present application can be applied to shooting a Hitchcock zoom video in a scene of switching cameras. Of course, in actual implementation, the camera can be switched multiple times during the shooting of a Hitchcock zoom video.

在该实现方式中,结合上述S301 a-S301d可知:In this implementation, it can be known from the above S301a-S301d that:

N1+1个图像中的第二个图像至第N1个图像相对第一个图像的缩放倍率,均属于第一拍摄倍率范围。第一拍摄倍率范围与第一摄像头对应。The scaling ratios of the second image to the N1th image in the N1+1 images relative to the first image all belong to the first shooting ratio range. The first shooting magnification range corresponds to the first camera.

N1+1个图像中的第N1+1个图像和N2个图像中的前N2-1个图像相对第一个图像的缩放倍率,均属于第二拍摄倍率范围。第二拍摄倍率范围与第二摄像头对应。The zoom ratios of the N1+1th image in the N1+1 images and the first N2-1 images in the N2 images relative to the first image all belong to the second shooting ratio range. The second shooting magnification range corresponds to the second camera.

在另一种实现方式中,N+1个图像均由第一摄像头拍摄采集得到。也就是说,本申请实施例提供的技术方案可以应用于在不切换摄像头的场景中拍摄希区柯克变焦视频。In another implementation manner, the N+1 images are all captured by the first camera. That is to say, the technical solution provided by the embodiment of the present application can be applied to shooting a Hitchcock zoom video in a scene without switching cameras.

可选的,如图19b所示,S301c可以包括以下步骤:S301c-1至S301c-3:Optionally, as shown in FIG. 19b, S301c may include the following steps: S301c-1 to S301c-3:

S301c-1:终端基于第一个图像对第i个图像进行防抖处理。具体的,终端确定第一个图像中的特征点的位置,并基于第一个图像中的特征点的位置,对第i个图像中的与该特征点相匹配的特征点的位置进行运动补偿,从而实现对第i个图像进行防抖处理。S301c-1: The terminal performs anti-shake processing on the i-th image based on the first image. Specifically, the terminal determines the position of the feature point in the first image, and based on the position of the feature point in the first image, performs motion compensation for the position of the feature point in the i-th image that matches the feature point , so as to implement anti-shake processing on the i-th image.

本申请实施例对终端执行防抖处理时所采用的防抖处理技术不进行限定,例如,防抖处理技术可以是光学防抖处理技术、人工智能(artificial intelligence,AI)防抖处理技术或电子处理防抖技术等。The embodiment of the present application does not limit the anti-shake processing technology adopted when the terminal performs anti-shake processing. For example, the anti-shake processing technology may be optical anti-shake processing technology, artificial intelligence (artificial intelligence, AI) anti-shake processing technology or electronic Handle anti-shake technology, etc.

需要说明的是,S301c-1是可选的步骤。对于上述N个图像中的每个图像均执行S301c-1之后,从整体上而言,有助于进入缩放倍率计算模块(即终端中用于计算缩放倍率的模块)的视频(即所采集的后N个图像)抖动较弱(即使得该视频整体更佳稳定/平滑),从而使得所获得的缩放倍率的精确度更大。It should be noted that S301c-1 is an optional step. After S301c-1 is executed for each of the above N images, as a whole, the video (that is, the collected The next N images) jitter is weaker (ie makes the video overall better stabilized/smooth), allowing greater precision in the obtained zoom ratio.

S301c-2:终端获取第i个图像的拍摄倍率。如果终端执行S301c-1,则这里的第i个图像具体是经防抖处理后的第i个图像。S301c-2: The terminal acquires the shooting magnification of the i-th image. If the terminal executes S301c-1, the i-th image here is specifically the i-th image after anti-shake processing.

可选的,第i个图像的拍摄倍率是基于第i个图像相对于第一个图像的缩放倍率,和采集第一个图像的摄像头的倍率确定的。第i个图像相对第一个图像的缩放倍率是:基于第i个图像中的目标主体的大小和第一个图像中的目标主体的大小确定的。Optionally, the shooting magnification of the i-th image is determined based on the zooming magnification of the i-th image relative to the first image, and the magnification of the camera that captures the first image. The zoom ratio of the i-th image relative to the first image is determined based on the size of the target subject in the i-th image and the size of the target subject in the first image.

例如,ci=c1/(di/d1)。其中,di是第i个图像中的目标主体的大小,d1是第一个图像中的目标主体的大小。di/d1是第i个图像相对第一个图像的缩放倍率。c1是第一摄像头的倍率,ci是第i个图像的拍摄倍率。For example, ci=c1/(di/d1). where di is the size of the target subject in the i-th image, and d1 is the size of the target subject in the first image. di/d1 is the zoom ratio of the i-th image relative to the first image. c1 is the magnification of the first camera, and ci is the shooting magnification of the i-th image.

可选的,图像中的目标主体的大小通过以下特征1-4中的至少一个特征来表征:Optionally, the size of the target subject in the image is characterized by at least one of the following features 1-4:

特征1:该图像中的目标主体的宽度。Feature 1: The width of the target subject in this image.

特征2:该图像中的目标主体的高度。Feature 2: The height of the target subject in this image.

特征3:该图像中的目标主体的面积。Feature 3: The area of the target subject in the image.

特征4:该图像中的目标主体所占的像素点的数量。Feature 4: the number of pixels occupied by the target subject in the image.

例如,以特征2表征目标主体在一个图像中的大小为例,第i个图像的拍摄倍率可以基于公式ci=c1/(hi/h1)得到。其中,hi是第i个图像中的目标主体的高度,h1是第一个图像中的目标主体的高度。hi/h1是第i个图像相对于第一个图像的缩放倍率。c1是第一摄像头的倍率,ci是第i个图像的拍摄倍率。For example, taking feature 2 representing the size of the target subject in an image as an example, the shooting magnification of the i-th image can be obtained based on the formula ci=c1/(hi/h1). where hi is the height of the target subject in the i-th image and h1 is the height of the target subject in the first image. hi/h1 is the zoom ratio of the i-th image relative to the first image. c1 is the magnification of the first camera, and ci is the shooting magnification of the i-th image.

可选的,S301c-2可以包括:终端从第i个图像中提取目标主体,并基于该目标主体的大小与第一个图像的目标主体的大小,确定第i个图像相对于第一个图像的缩放倍率。Optionally, S301c-2 may include: the terminal extracts the target subject from the i-th image, and based on the size of the target subject and the size of the target subject in the first image, determine zoom ratio.

本申请实施例对终端从图像中提取目标主体的具体实现方式不进行限定。例如,终端通过主体分割算法、主体骨骼点检测算法和主体轮廓检测算法等中的一种或多种,从图像中提取目标主体。The embodiment of the present application does not limit the specific implementation manner of extracting the target subject from the image by the terminal. For example, the terminal extracts the target subject from the image by using one or more of a subject segmentation algorithm, a subject bone point detection algorithm, and a subject contour detection algorithm.

示例的,主体分割算法包括实例分割算法。具体的,终端使用实例分割算法从第i个图像提取目标主体的实例分割掩膜,然后,将从第i个图像提取的目标主体的实例分割掩膜的大小除以从第一个图像提取的目标主体的实例分割掩膜的大小,得到第i个图像相对于第一个图像的缩放倍率。如图20所示,为本申请实施例提供的一种实例分割的示意图。其中,图20中的a图表示第i个图像,图20中的b图表示第i个图像中的目标主体的实例分割掩膜,在该掩膜中,像素值大于0的像素是表示目标主体的像素,其他区域是表示背景的像素。Exemplarily, subject segmentation algorithms include instance segmentation algorithms. Specifically, the terminal uses the instance segmentation algorithm to extract the instance segmentation mask of the target subject from the i-th image, and then divides the size of the instance segmentation mask of the target subject extracted from the i-th image by the size of the instance segmentation mask extracted from the first image The size of the instance segmentation mask of the target subject to obtain the scaling factor of the i-th image relative to the first image. As shown in FIG. 20 , it is a schematic diagram of instance segmentation provided by the embodiment of the present application. Among them, graph a in Fig. 20 represents the i-th image, and graph b in Fig. 20 represents the instance segmentation mask of the target subject in the i-th image. In this mask, pixels with pixel values greater than 0 represent the target The pixels of the subject, and the other regions are the pixels representing the background.

实例分割算法是像素级别的分割方法,基于实例分割算法提取的目标主体的精确度更大,这有助于使得终端计算得到的缩放倍率更精确。比如,在目标主体包括多人的情况下,也可以有效地区分主体人像和背景。The instance segmentation algorithm is a pixel-level segmentation method, and the accuracy of the target subject extracted based on the instance segmentation algorithm is greater, which helps to make the zoom ratio calculated by the terminal more accurate. For example, when the target subject includes multiple people, it can also effectively distinguish the subject portrait from the background.

S301c-3:如果第i个图像的拍摄倍率在第一拍摄倍率范围,则终端确定采集第i+1个图像的摄像头是第一摄像头。如果第i个图像的拍摄倍率在第二拍摄倍率范围,则确定采集第i+1个图像的摄像头是第二摄像头。第一拍摄倍率范围与第一摄像头对应,第二拍摄倍率范围与第二摄像头对应。S301c-3: If the shooting magnification of the i-th image is within the first shooting magnification range, the terminal determines that the camera that captures the i+1-th image is the first camera. If the shooting magnification of the i-th image is within the second shooting magnification range, it is determined that the camera that captures the i+1-th image is the second camera. The first shooting magnification range corresponds to the first camera, and the second shooting magnification range corresponds to the second camera.

也就是说,终端基于第i个图像的拍摄倍率,确定采集第i+1个图像的摄像头。由于相邻两个图像中的目标主体的大小/目标主体的位置相差不会太大,因此,终端可以基于第i个图像的拍摄倍率所确定的摄像头,采集第i+1个图像。That is to say, based on the shooting magnification of the i-th image, the terminal determines the camera that captures the i+1-th image. Since the size/position of the target subject in two adjacent images does not differ too much, the terminal can capture the i+1th image based on the camera determined by the shooting magnification of the i-th image.

可选的,第一摄像头的倍率是a,第二摄像头的倍率是b;a<b;第一拍摄倍率范围是[a,b),第二拍摄倍率范围是大于等于b的范围。Optionally, the magnification of the first camera is a, and the magnification of the second camera is b; a<b; the first shooting magnification range is [a, b), and the second shooting magnification range is a range greater than or equal to b.

例如,以终端中包括广角摄像头、主摄摄像头为例,由于广角摄像头的倍率是0.6,主摄摄像头的倍率等于1,因此,广角摄像头对应的拍摄倍率范围是[0.6,1),主摄摄像头对应的拍摄倍率范围是大于等于1的范围。For example, taking the terminal including a wide-angle camera and a main camera as an example, since the magnification of the wide-angle camera is 0.6, and the magnification of the main camera is equal to 1, the shooting magnification range corresponding to the wide-angle camera is [0.6,1), and the main camera The corresponding shooting magnification range is a range greater than or equal to 1.

进一步可选的,如果终端中还包括第三摄像头,且第三摄像头的倍率是c,a<b<c,则第一拍摄倍率范围是[a,b),第二拍摄倍率范围是[b,c);第三摄像头对应的拍摄倍率范围是大于等于c的范围。Further optionally, if the terminal also includes a third camera, and the magnification of the third camera is c, a<b<c, then the first shooting magnification range is [a, b), and the second shooting magnification range is [b , c); the shooting magnification range corresponding to the third camera is greater than or equal to c.

例如,以终端中包括广角摄像头、主摄摄像头和长焦摄像头为例,由于广角摄像头的倍率是0.6,主摄摄像头的倍率是1,长焦摄像头的倍率是w,w是大于1的整数,因此,广角摄像头对应的拍摄倍率范围是[0.6,1),主摄摄像头对应的拍摄倍率范围是[1,w),长焦摄像头对应的拍摄倍率范围是大于等于w的范围。For example, taking a terminal including a wide-angle camera, a main camera and a telephoto camera as an example, since the magnification of the wide-angle camera is 0.6, the magnification of the main camera is 1, and the magnification of the telephoto camera is w, where w is an integer greater than 1, Therefore, the shooting magnification range corresponding to the wide-angle camera is [0.6, 1), the shooting magnification range corresponding to the main camera is [1, w), and the shooting magnification range corresponding to the telephoto camera is a range greater than or equal to w.

基于此,在示例1中,若通过广角摄像头采集第一个图像,且经计算得到第i个图像相对于第一个图像的缩放倍率是0.5,则第i个图像的拍摄倍率是0.6/0.5=1.2。假设长焦摄像头的倍率是10(即w=10),由于第i个图像的拍摄倍率(即1.2)在主摄摄像头对应的拍摄倍率范围(即[1,10))内,因此,终端确定使用主摄摄像头采集第i+1个图像。Based on this, in example 1, if the first image is captured by a wide-angle camera, and the zoom ratio of the i-th image relative to the first image is calculated to be 0.5, then the shooting ratio of the i-th image is 0.6/0.5 = 1.2. Assuming that the magnification of the telephoto camera is 10 (that is, w=10), since the shooting magnification of the i-th image (that is, 1.2) is within the shooting magnification range corresponding to the main camera (that is, [1, 10)), the terminal determines Use the main camera to capture the i+1th image.

又如,以终端中包括广角摄像头、主摄摄像头、第一长焦摄像头和第二长焦摄像头为例,由于广角摄像头的倍率是0.6,主摄摄像头的倍率是1,第一长焦摄像头的倍率是w1,第二长焦摄像头的倍率是w2,1<w1<w2,则广角摄像头对应的拍摄倍率范围是[0.6,1),主摄摄像头对应的拍摄倍率范围是[1,w1),第一长焦摄像头对应的拍摄倍率范围是[w1,w2),第二长焦摄像头对应的拍摄倍率范围是大于等于w2的范围。As another example, taking a terminal including a wide-angle camera, a main camera, a first telephoto camera, and a second telephoto camera as an example, since the magnification of the wide-angle camera is 0.6, and the magnification of the main camera is 1, the magnification of the first telephoto camera The magnification is w1, the magnification of the second telephoto camera is w2, 1<w1<w2, then the shooting magnification range corresponding to the wide-angle camera is [0.6, 1), and the shooting magnification range corresponding to the main camera is [1, w1), The shooting magnification range corresponding to the first telephoto camera is [w1, w2), and the shooting magnification range corresponding to the second telephoto camera is a range greater than or equal to w2.

基于此,在示例2中,若通过广角摄像头采集第一个图像,且经计算得到第i个图像相对于第一个图像的缩放倍率是0.2,则第i个图像的拍摄倍率是0.6/0.2=3。假设第一长焦摄像头的倍率是2(即w1=2),第二长焦摄像头的倍率是10(即w2=10),由于第i个图像的拍摄倍率(即3)在第一长焦摄像头对应的拍摄倍率范围(即[2,10))内,因此,终端确定使用第一长焦摄像头采集第i+1个图像。Based on this, in Example 2, if the first image is captured by a wide-angle camera, and the calculated zoom ratio of the i-th image relative to the first image is 0.2, then the shooting ratio of the i-th image is 0.6/0.2 =3. Suppose the magnification of the first telephoto camera is 2 (that is, w1=2), and the magnification of the second telephoto camera is 10 (that is, w2=10), since the shooting magnification of the i-th image (that is, 3) is in the first telephoto The shooting magnification range corresponding to the camera (that is, [2, 10)), therefore, the terminal determines to use the first telephoto camera to capture the i+1th image.

需要说明的是,在具体实现时,终端也可以在第i个图像的拍摄倍率达到某一摄像头对应的拍摄倍率范围的最小临界值之前的一个小范围内时,就切换成该摄像头,以降低因切换摄像头而导致的拍摄时延的问题。It should be noted that, in specific implementation, the terminal may also switch to the camera when the shooting magnification of the i-th image reaches the minimum critical value of the shooting magnification range corresponding to a certain camera, so as to reduce the The problem of shooting delay caused by switching cameras.

如图21所示,为本申请实施例提供的一种终端采集N+1个图像的过程示意图。其中,该终端包括摄像头1至摄像头x,x是大于等于2的整数,编号越大的摄像头的倍率越大。As shown in FIG. 21 , it is a schematic diagram of a process of collecting N+1 images by a terminal provided in the embodiment of the present application. Wherein, the terminal includes a camera 1 to a camera x, where x is an integer greater than or equal to 2, and a camera with a larger number has a larger magnification.

基于图21,终端采集N+1个图像的过程可以包括以下步骤:Based on Figure 21, the process for the terminal to collect N+1 images may include the following steps:

终端使用摄像头1(即初始摄像头)采集第1个图像。The terminal uses camera 1 (that is, the initial camera) to capture the first image.

终端使用摄像头1采集第2个图像,并基于第1个图像对第2个图像进行防抖处理,然后获取经防抖处理的第2个图像相对第1个图像的缩放倍率。如果基于该缩放倍率确定第2个图像的拍摄倍率在摄像头a对应的拍摄倍率范围内,则使用摄像头a采集第3个图像。其中,1≤a≤x。The terminal uses camera 1 to capture the second image, performs anti-shake processing on the second image based on the first image, and then obtains the zoom ratio of the anti-shake processed second image relative to the first image. If it is determined based on the magnification that the shooting magnification of the second image is within the range of shooting magnification corresponding to the camera a, the camera a is used to capture the third image. Among them, 1≤a≤x.

终端使用摄像头a采集第3个图像,并对第3个图像进行防抖处理,然后获取经防抖处理的第3个图像相对第1个图像的缩放倍率。如果基于该缩放倍率确定第3个图像的拍摄倍率在在摄像头b对应的拍摄倍率范围内,则使用摄像头b采集第4个图像。其中,a≤b≤x。The terminal uses camera a to capture the third image, performs anti-shake processing on the third image, and then obtains the zoom ratio of the anti-shake processed third image relative to the first image. If it is determined based on the magnification that the shooting magnification of the third image is within the range of shooting magnification corresponding to the camera b, the camera b is used to capture the fourth image. Among them, a≤b≤x.

以此类推,终端采集第4个至第N+1个图像。By analogy, the terminal collects the 4th to N+1th images.

可选的,N+1个图像中在后采集的图像中的目标主体的大小小于第一个图像中的目标主体的大小。Optionally, the size of the target subject in the image acquired later in the N+1 images is smaller than the size of the target subject in the first image.

在一种实现方式中,N+1个图像中,在后采集的图像中的目标主体的大小,小于在前采集的图像中的目标主体的大小。如图22a所示,为本申请实施例提供的一种终端在S301中所采集到的图像的示意图。图22a中的a图表示终端采集的第一个图像,b图表示终端采集的第二个图像,c图表示终端采集的第三个图像。In an implementation manner, among the N+1 images, the size of the target subject in the image collected later is smaller than the size of the target subject in the image collected before. As shown in FIG. 22a , it is a schematic diagram of an image collected by a terminal in S301 according to an embodiment of the present application. Figure a in Figure 22a shows the first image collected by the terminal, picture b shows the second image collected by the terminal, and picture c shows the third image collected by the terminal.

在另一种实现方式中,N+1个图像中,在后采集的图像中的目标主体的大小,可能大于在前采集的图像中的目标主体的大小,但小于第一个图像中的目标主体的大小。如图22b所示,为本申请实施例提供的一种终端在S301中所采集到的图像的示意图。图22b中是以N+1=3为例。图22b中的a图表示终端采集的第一个图像,b图表示终端采集的第二个图像,c图表示终端采集的第三个图像。In another implementation, in the N+1 images, the size of the target subject in the later captured image may be larger than the target subject in the previous captured image, but smaller than the target in the first image The size of the subject. As shown in FIG. 22b , it is a schematic diagram of an image collected by a terminal in S301 according to an embodiment of the present application. In Fig. 22b, N+1=3 is taken as an example. Figure a in Figure 22b shows the first image collected by the terminal, picture b shows the second image collected by the terminal, and picture c shows the third image collected by the terminal.

以下通过一个示例说明,N+1个图像中,在后采集的图像中的目标主体的大小,可能大于在前采集的图像中的目标主体的大小,但小于第一个图像中的目标主体的大小。An example is used below to illustrate that in the N+1 images, the size of the target subject in the image collected later may be larger than the size of the target subject in the image collected before, but smaller than the size of the target subject in the first image size.

假设第一个图像中的目标主体的大小是d,采集第一个图像的摄像头是1X摄像头,那么,由于采集第一个图像和第二个图像使用的均是1X摄像头,因此,以第二个图像中的目标主体的大小是d/2为例,第二个图像相对于第一个图像的缩放倍率是0.5,因此,第二个图像的拍摄倍率是1/0.5=2。后续终端可以采用2X摄像头采集第三个图像。一方面,由于终端采用2X摄像头采集第三个图像,而采用1X摄像头采集第二个图像,因此,可能第三个图像中的目标主体的大小大于第二个图像中的目标主体的大小。另一方面,由于在采集第二个至第三个图像的过程中,终端距离目标主体越来越远,因此,第三个图像中的目标主体的大小小于第一个图像中的目标主体的大小。Assuming that the size of the target subject in the first image is d, and the camera that captures the first image is a 1X camera, then, since both the first image and the second image are captured using a 1X camera, the second The size of the target subject in the first image is d/2 as an example, the zoom ratio of the second image relative to the first image is 0.5, therefore, the shooting ratio of the second image is 1/0.5=2. Subsequent terminals can use the 2X camera to capture the third image. On the one hand, since the terminal uses the 2X camera to capture the third image and the 1X camera to capture the second image, it is possible that the size of the target subject in the third image is larger than that in the second image. On the other hand, since the terminal is farther and farther away from the target subject in the process of acquiring the second to third images, the size of the target subject in the third image is smaller than that of the target subject in the first image. size.

可选的,该方法还可以包括:终端在当前预览界面中,显示第一信息,第一信息用于指示停止拍摄希区柯克变焦视频。Optionally, the method may further include: the terminal displays first information in the current preview interface, and the first information is used to instruct to stop shooting the Hitchcock zoom video.

例如,终端可以在当前使用的摄像头是该终端中最大倍率的摄像头时,在当前预览界面中,显示第一信息。对于用户来说,可以在获取到第一信息之后的一段时间内停止拍摄希区柯克变焦视频。For example, the terminal may display the first information on the current preview interface when the currently used camera is the camera with the highest magnification in the terminal. For the user, it is possible to stop shooting the Hitchcock zoom video within a period of time after obtaining the first information.

在终端与目标主体之间的距离越来越远的情况下拍摄希区柯克变焦视频,若当前使用的摄像头是该终端中最大倍率的摄像头,则由于当前摄像头的倍率不能更大,因此终端不能再切换摄像头,此时,通过在当前预览界面上显示第一信息,有助于提示用户及时停止拍摄视频,否则终端后续采集的图像仅能通过放大,来使得放大后的图像中的目标主体的大小与第一个图像中的目标主体的大小一致,这会导致基于后续采集的图像生成的目标图像的清晰度不高。也就是说,本申请实施例提供了一种指导用户停止拍摄希区柯克变焦视频的方法,这有助于提高用户体验。When the distance between the terminal and the target subject is getting farther and farther away, if the currently used camera is the camera with the largest magnification in the terminal, the terminal The camera can no longer be switched. At this time, by displaying the first information on the current preview interface, it is helpful to prompt the user to stop shooting the video in time, otherwise the subsequent images collected by the terminal can only be enlarged to make the target subject in the enlarged image The size of is consistent with the size of the target subject in the first image, which results in poor clarity of the target image generated based on subsequent acquired images. That is to say, the embodiment of the present application provides a method for instructing the user to stop shooting the Hitchcock zoom video, which helps to improve the user experience.

本申请实施例对第一信息具体包含哪些信息,来指示停止拍摄希区柯克变焦视频不进行限定。例如,可以直接指示“当前使用的摄像头是该终端中最大倍率的摄像头”,也可以通过指示“请停止录制视频”来间接指示当前使用的摄像头是该终端中最大倍率的摄像头”。如图23a所示,为本申请实施例提供的一种当前预览界面的示意图。当前预览界面中包含当前播放的希区柯克变焦视频的图像501(即当前预览图像),以及第一信息“请停止录制视频”502。In this embodiment of the present application, there is no limitation on what information is specifically included in the first information to indicate to stop shooting the Hitchcock zoom video. For example, you can directly indicate that "the camera currently used is the camera with the highest magnification in this terminal", or you can indirectly indicate that the camera currently in use is the camera with the highest magnification in this terminal by indicating "Please stop recording video". As shown in Figure 23a Shown, is the schematic diagram of a kind of current preview interface that the embodiment of the present application provides.In the current preview interface, the image 501 (being the current preview image) of the currently played Hitchcock zoom video is included in the current preview interface, and the first information "please stop recording Video" 502.

可选的,该方法还可以包括:终端在当前预览界面中,显示第二信息,第二信息用于指示目标主体静止。Optionally, the method may further include: the terminal displays second information in the current preview interface, where the second information is used to indicate that the target subject is still.

例如,终端可以在确定当前预览图像中的目标主体的位置,与在前的预览图像中的目标主体的位置一致的情况下,在当前预览界面中显示第二信息。由于希区柯克变焦视频的要求之一是各图像中的目标主体的位置一致,因此,这样,用户可以在获取希区柯克变焦视频的过程中,获知当前是否满足获取希区柯克变焦视频的要求,从而提高用户体验。For example, the terminal may display the second information on the current preview interface when determining that the position of the target subject in the current preview image is consistent with the position of the target subject in the previous preview image. Since one of the requirements of the Hitchcock zoom video is that the position of the target subject in each image is consistent, so, in this way, the user can know whether the current condition of obtaining the Hitchcock zoom video is satisfied during the process of obtaining the Hitchcock zoom video. Video requirements, thereby improving user experience.

本申请实施例对第一信息具体包含哪些信息,来指示目标主体静止不进行限定。例如,如图23b所示,为本申请实施例提供的一种当前预览界面的示意图。当前预览界面中包含当前呈现的希区柯克变焦视频的图像501(即当前预览图像),以及第二信息“目标主体静止”503。In this embodiment of the present application, there is no limitation on what information is specifically included in the first information to indicate that the target subject is stationary. For example, as shown in FIG. 23b, it is a schematic diagram of a current preview interface provided by the embodiment of the present application. The current preview interface includes an image 501 of the currently presented Hitchcock zoom video (that is, the current preview image) and second information 503 "target subject is still".

可选的,该方法还可以包括:终端在当前预览界面中,显示第三信息,第三信息用于指示目标主体在当前预览图像的中央。这样,用户可以基于在终端中没有显示第三信息时,移动终端,从而使得目标主体在当前预览图像的中央,这有助于提高希区柯克视频的质量。Optionally, the method may further include: the terminal displays third information in the current preview interface, the third information is used to indicate that the target subject is in the center of the current preview image. In this way, when the third information is not displayed in the terminal, the user can move the terminal so that the target subject is in the center of the current preview image, which helps to improve the quality of the Hitchcock video.

例如,终端可以在检测到当前预览图像中目标主体的位置(如目标主体的中心,或目标主体的轮廓或目标主体的最小外界矩形等),在当前预览图像的预设中央区域(即以当前预览图像的中心为中心的一个预设区域)中时,在当前预览界面中,显示第三信息。For example, after the terminal detects the position of the target subject in the current preview image (such as the center of the target subject, or the outline of the target subject or the minimum outer rectangle of the target subject, etc.), When the center of the preview image is in a preset area), the third information is displayed in the current preview interface.

本申请实施例对第三信息具体包含哪些信息,来指示目标主体在当前预览图像的中央不进行限定。例如,如图23c所示,为本申请实施例提供的一种当前预览界面的示意图。当前预览界面中包含当前呈现的希区柯克变焦视频的图像501(即当前预览图像),以及第三信息“目标主体在当前预览图像的中央”504。In this embodiment of the present application, there is no limitation on what information is specifically included in the third information to indicate that the target subject is in the center of the current preview image. For example, as shown in FIG. 23c, it is a schematic diagram of a current preview interface provided by the embodiment of the present application. The current preview interface includes an image 501 of the currently presented Hitchcock zoom video (that is, the current preview image) and third information 504 "the target subject is in the center of the current preview image".

可替换地,终端可以在当前预览界面中,显示第四信息,第四信息用于指示目标主体不在当前预览图像的中央。这样,用户可以基于在终端中显示了第四信息时,移动终端,从而使得目标主体在当前预览图像的中央,这有助于提高希区柯克视频的质量。Alternatively, the terminal may display fourth information on the current preview interface, where the fourth information is used to indicate that the target subject is not in the center of the current preview image. In this way, when the fourth information is displayed in the terminal, the user can move the terminal so that the target subject is in the center of the current preview image, which helps to improve the quality of the Hitchcock video.

可选的,针对第一场景实时采集N+1个图像,包括:在目标主体在当前预览图像的中央时,采集第一个图像。这样,有助于提高希区柯克视频的质量。Optionally, collecting N+1 images in real time for the first scene includes: collecting the first image when the target subject is in the center of the current preview image. In this way, it helps to improve the quality of Hitchcock's video.

可选的,在采集N+1的图像的过程中,终端的移动速度小于等于预设速度。Optionally, during the process of collecting N+1 images, the moving speed of the terminal is less than or equal to a preset speed.

由于终端中的摄像头的数量有限,而终端移动速度过快可能导致切换摄像头的速度过快,而当切换到最大倍率的摄像头时,不能再切换摄像头。在使用最大倍率的摄像头采集图像时,随着终端距离目标主体越来越远,在后采集的图像中的目标主体越来越小,在生成希区柯克变焦视频时,需要对这些图像进行放大,这会导致图像的清晰度不高。基于此,提出该可能的设计。这样,有助于提高希区柯克变焦视频的质量。Since the number of cameras in the terminal is limited, and the terminal moves too fast, the camera may be switched too fast, and when the camera with the maximum magnification is switched, the camera cannot be switched. When using the camera with the maximum magnification to collect images, as the terminal is farther away from the target subject, the target subject in the captured image becomes smaller and smaller. When generating a Hitchcock zoom video, these images need to be processed Zoom in, which results in poor image clarity. Based on this, this possible design is proposed. In this way, it helps to improve the quality of the Hitchcock zoom video.

本申请实施例对预设速度的具体取值不进行限定,例如,可以是经验值。The embodiment of the present application does not limit the specific value of the preset speed, for example, it may be an empirical value.

S302:对于N+1个图像中后采集的N个图像,终端基于预设神经网络进行白平衡处理,得到N个优化图像。预设神经网络用于保证时域相邻图像的白平衡一致性。S302: For N images collected later among the N+1 images, the terminal performs white balance processing based on a preset neural network to obtain N optimized images. The preset neural network is used to ensure the white balance consistency of adjacent images in time domain.

这里的预设神经网络,可以是上文由本申请实施例提供的白平衡网络,如图8所示的白平衡网络。终端可以在网络设备中下载预设神经网络,或者可以通过本地训练得到预设神经网络。本申请实施例对此不进行限定。The preset neural network here may be the white balance network provided above by the embodiment of the present application, such as the white balance network shown in FIG. 8 . The terminal can download the preset neural network in the network device, or can obtain the preset neural network through local training. This embodiment of the present application does not limit it.

可选的,由于不同摄像头拍摄的图像之间存在一些差异,因此,终端可以将N+1个图像中后采集的N个图像中的每个图像,除了进行白平衡处理之外,还可以进行亮度、色度等参数进行矫正,以避免(或尽量避免)因切换摄像头而导致的图像不一致的问题。Optionally, since there are some differences between the images captured by different cameras, the terminal can take each of the N images collected after the N+1 images, in addition to performing white balance processing, it can also perform Brightness, chromaticity and other parameters are corrected to avoid (or try to avoid) the problem of image inconsistency caused by switching cameras.

例如,对于图像色度和亮度来说,分别获取时域相邻的图像的亮度值/色度值,并获取亮度值/色度值的乘性因子或加性因子对该图像的亮度值/色度进行换算,使在后的图像的亮度/色度值换算后接近在前的图像的亮度值/色度值,从而使得时域相邻的图像的亮度值/色度值保持一致性。For example, for image chroma and luminance, respectively obtain the luminance value/chroma value of the temporally adjacent image, and obtain the multiplicative factor or additive factor of the luminance value/chroma value to the luminance value/chroma value of the image The chromaticity is converted, so that the luminance/chromaticity value of the subsequent image is close to the luminance value/chromaticity value of the previous image after conversion, so that the luminance value/chromaticity value of adjacent images in the temporal domain remains consistent.

S303:终端对N个优化图像进行放大并裁剪,得到N个目标图像;其中,N个目标图像中的目标主体的大小与N+1个图像中采集的第一个图像中目标主体的大小一致,N个目标图像中目标主体的相对位置,与第一个图像中目标主体的相对位置一致;N个目标图像与第一个图像的大小一致。S303: The terminal enlarges and cuts the N optimized images to obtain N target images; wherein, the size of the target subject in the N target images is consistent with the size of the target subject in the first image collected in the N+1 images , the relative position of the target subject in the N target images is consistent with the relative position of the target subject in the first image; the size of the N target images is consistent with the first image.

基于上文中的描述可知,在后采集的图像中的目标主体的大小小于第一个图像中的目标主体的大小,因此,终端需要对在后采集的N个图像的对应的N个优化图像进行放大并裁剪。Based on the above description, it can be seen that the size of the target subject in the later acquired image is smaller than the size of the target subject in the first image, therefore, the terminal needs to perform optimization on the corresponding N optimized images of the N later acquired images Zoom in and crop.

终端对N个优化图像进行放大,以使得放大后的N个优化图像中的目标主体的大小与第一个图像中的目标主体大小一致,且放大后的N个优化图像中的目标主体的相对位置,与第一个图像中目标主体的相对位置一致。终端对放大后的N个图像进行裁剪,得到N个目标图像,以使得N个目标图像中的每个图像与第一图像的大小一致。The terminal enlarges the N optimized images, so that the size of the target subject in the enlarged N optimized images is consistent with the size of the target subject in the first image, and the relative size of the target subject in the enlarged N optimized images is position, consistent with the relative position of the target subject in the first image. The terminal crops the enlarged N images to obtain N target images, so that each of the N target images has the same size as the first image.

在一个示例中,如图24所示。图24中的a图表示N+1个图像中的第一个图像,图24中的b图表示N个优化图像中的其中一个优化图像。图24中的c图表示对图24中的b图所示的优化图像进行放大后得到的图像,其中,放大后的图像中的目标主体的大小与图24中的a图中所示的第一个图像中的目标主体的大小一致。图24中的d图表示对图24中的c图所示的图像进行裁剪后得到的目标图像,该目标图像的尺寸与图24中的a图所示的第一个图像的尺寸相同,其中,在裁剪的过程中,尽量保证该目标图像中目标主体的位置与第一个图像中目标主体的位置一致。In one example, as shown in FIG. 24 . Diagram a in FIG. 24 represents the first image among the N+1 images, and diagram b in FIG. 24 represents one of the optimized images among the N optimized images. Figure c in Figure 24 represents the image obtained after enlarging the optimized image shown in figure b in Figure 24, wherein the size of the target subject in the enlarged image is the same as that shown in figure a in Figure 24 The size of the target subjects in one image is consistent. Diagram d in FIG. 24 represents the target image obtained after cropping the image shown in diagram c in FIG. 24 , and the size of the target image is the same as that of the first image shown in diagram a in FIG. 24 , wherein , in the cropping process, try to ensure that the position of the target subject in the target image is consistent with the position of the target subject in the first image.

需要说明的是,由于“终端与目标主体之间的距离”与“终端与背景中的对象之间的距离”不同,因此,在采集N+1个图像中的不同的两个图像中,这两个图像中的目标主体的缩放倍率与这两个图像中背景中的同一对象的缩放倍率不同。这会使得对一个优化图像进行放大裁剪之后得到的目标图像中的背景,与第一个图像中的背景不同。例如,图24中的a图和d图中的背景不同。基于此,终端可以基于N个目标图像和第一个图像生成“不同图像中的目标主体的大小一致,相对位置一致,而背景不一致”的希区柯克变焦视频。It should be noted that since the "distance between the terminal and the target subject" and "the distance between the terminal and the object in the background" are different, in two different images among the collected N+1 images, this The magnification of the target subject in the two images is different from the magnification of the same object in the background in the two images. This will result in a different background in the target image after zooming in and cropping an optimized image than in the first image. For example, the backgrounds in panels a and d in Figure 24 are different. Based on this, the terminal can generate a Hitchcock zoom video in which "the size and relative position of the target subjects in different images are consistent, but the background is inconsistent" based on the N target images and the first image.

S304:终端基于N个目标图像和第一个图像生成希区柯克变焦视频。S304: The terminal generates a Hitchcock zoom video based on the N target images and the first image.

希区柯克变焦视频中的相邻图像之间的播放时间间隔可以是预定义的。The playback time interval between adjacent images in a Hitchcock zoom video can be predefined.

在一种实现方式中,终端在拍摄的过程中,实时呈现希区柯克变焦视频。也就是说,边生成希区柯克变焦视频边呈现所生成的希区柯克变焦视频。In an implementation manner, the terminal presents the Hitchcock zoom video in real time during shooting. That is, the generated Hitchcock zoom video is presented while generating the Hitchcock zoom video.

该情况下,终端执行上述S302和S303时:对于第i个图像,在执行S301d之后将第i个图像输入到预设神经网络中,得到第i个图像对应的优化图像。并对第i个图像对应的优化图像进行放大并裁剪,得到该优化图像对应的目标图像。也就是说,在采集到一个图像之后,即可对该图像进行白平衡处理、放大、裁剪、呈现(即显示目标图像)等。并且,在对该图像进行处理的过程中,可以采集并处理下一个图像。而非在获得N+1个图像之后才执行S302,以及在针对所有图像执行S302之后才执行S303。In this case, when the terminal executes the above S302 and S303: for the i-th image, after executing S301d, input the i-th image into the preset neural network to obtain an optimized image corresponding to the i-th image. And the optimized image corresponding to the i-th image is enlarged and cropped to obtain the target image corresponding to the optimized image. That is to say, after an image is captured, white balance processing, enlargement, cropping, presentation (that is, displaying the target image) and the like can be performed on the image. And, during the process of processing the image, the next image can be collected and processed. Instead of executing S302 after obtaining N+1 images, and executing S303 after executing S302 for all images.

在另一种实现方式中,终端可以在获得N+1个图像之后才执行S302,以及在针对所有图像执行S302之后才执行S303。也就是说,终端对所采集的N+1个图像进行后处理,从而获得希区柯克变焦视频。In another implementation manner, the terminal may execute S302 after obtaining N+1 images, and execute S303 after executing S302 for all images. That is to say, the terminal performs post-processing on the collected N+1 images, so as to obtain the Hitchcock zoom video.

需要说明的是,如果在获得N+1个图像的过程中,采集图像的摄像头进行了切换,则可能由于切换摄像头导致目标主体在切换摄像头前后所采集的不同图像中的位置不同,也就是说,目标主体可能会出现不稳定的情况。It should be noted that if the camera for capturing images is switched during the process of obtaining N+1 images, the position of the target subject in the different images captured before and after switching the camera may be different due to the switching of the camera, that is to say , the target subject may experience instability.

基于此,可选的,该方法还可以包括:终端获取第一个图像中的目标主体的位置信息,以及,N个目标图像中的每个目标图像中的目标主体的位置信息;然后,对于N个目标图像中的每个目标图像,基于主体稳像算法和第一个图像中的目标主体的位置信息,对该目标图像进行稳像处理,得到新的目标图像。其中,新的目标图像中目标主体的位置与第一个图像中的目标主体的位置一致。Based on this, optionally, the method may further include: the terminal acquires the position information of the target subject in the first image, and the position information of the target subject in each of the N target images; then, for For each of the N target images, image stabilization processing is performed on the target image based on the subject image stabilization algorithm and the position information of the target subject in the first image to obtain a new target image. Wherein, the position of the target subject in the new target image is consistent with the position of the target subject in the first image.

示例的,若上文中采用实例分割算法得到目标主体的掩膜,则可以基于目标主体掩膜获得目标主体在相应图像中的位置信息。结合目标主体的位置信息对目标主体位置区域进行特征点检测,可以有效排除目标主体区域外的特征点的影响。通过对目标主体区域的特征点进行稳像处理,可以得到新的目标图像。For example, if the instance segmentation algorithm is used to obtain the mask of the target subject, the position information of the target subject in the corresponding image can be obtained based on the target subject mask. Combined with the location information of the target subject, the feature point detection is performed on the target subject location area, which can effectively eliminate the influence of feature points outside the target subject area. A new target image can be obtained by performing image stabilization on the feature points of the target subject area.

本申请实施例对主体稳像算法不进行限定。例如,可以是AI稳像算法。The embodiment of the present application does not limit the subject image stabilization algorithm. For example, it can be an AI image stabilization algorithm.

基于此,上述S304中,终端基于N个目标图像和第一个图像生成希区柯克变焦视频,具体包括:终端基于N个新的目标图像和第一个图像生成希区柯克变焦视频。这样,可以使得所得到的希区柯克变焦视频的主体稳定。Based on this, in the above S304, the terminal generates the Hitchcock zoom video based on the N target images and the first image, which specifically includes: the terminal generates the Hitchcock zoom video based on the N new target images and the first image. In this way, the subject of the resulting Hitchcock zoom video can be stabilized.

本申请实施例提供的拍摄视频的方法中,在获取希区柯克变焦视频的过程中,对实时采集到的N+1个图像中的后N个图像进行了白平衡处理,以使得处理后的图像与所采集的N+1个图像中的第一个图像的白平衡一致。这样,可以使得获得的希区柯克变焦视频的白平衡效果更好,从而提高希区柯克变焦视频的质量,提高了用户体验。另外,在本申请实施例中,终端可以通过切换摄像头的方式,放大后续采集的图像中的目标主体的大小,相比传统技术,有助于使所获得的希区柯克变焦效果视频的清晰度更高,从而提高用户体验。In the video shooting method provided in the embodiment of the present application, in the process of obtaining the Hitchcock zoom video, white balance processing is performed on the last N images of the N+1 images collected in real time, so that after processing The image of is consistent with the white balance of the first image in the N+1 images collected. In this way, the white balance effect of the obtained Hitchcock zoom video can be better, thereby improving the quality of the Hitchcock zoom video and improving user experience. In addition, in the embodiment of the present application, the terminal can enlarge the size of the target subject in the subsequent captured image by switching the camera, which helps to make the obtained Hitchcock zoom effect video clearer than the traditional technology. Higher degree, thereby improving user experience.

如图25所示,为本申请实施例提供的另一种拍摄视频的方法的流程示意图。该方法应用于终端。该终端包括至少两个摄像头。本实施例提供的技术方案应用于由远及近地拍摄希区柯克变焦视频的场景,即在拍摄希区柯克变焦视频的过程中,终端与目标主体之间的距离越来越近。As shown in FIG. 25 , it is a schematic flowchart of another method for shooting a video provided in the embodiment of the present application. This method is applied to the terminal. The terminal includes at least two cameras. The technical solution provided by this embodiment is applied to the scene of shooting the Hitchcock zoom video from far to near, that is, during the shooting of the Hitchcock zoom video, the distance between the terminal and the target subject is getting closer and closer.

本实施例中是在终端距离目标主体越来越近的条件下拍摄希区柯克变焦视频,不切换摄像头时,在后采集的图像中的目标主体的大小大于在前采集的图像中的目标主体的大小。而希区柯克变焦视频中不同图像中的目标主体的大小一致,因此,需要对后采集的图像进行缩小。由于对在后采集的图像进行缩小之后,需要进行“补边”处理,以使“补边”后的图像的大小与终端采集的第一个图像的大小一致,这会导致出现“补边”后的图像出现黑边,从而在图像呈现时导致用户体验差。In this embodiment, the Hitchcock zoom video is shot under the condition that the terminal is getting closer and closer to the target subject. When the camera is not switched, the size of the target subject in the image collected later is larger than the target in the image collected before The size of the subject. However, the size of the target subject in different images in the Hitchcock zoom video is the same, so it is necessary to reduce the size of the post-acquisition image. After shrinking the image captured later, it is necessary to perform "edge filling" processing so that the size of the image after "edge filling" is consistent with the size of the first image collected by the terminal, which will lead to "edge filling" The resulting image has black borders, resulting in a poor user experience when the image is rendered.

例如,终端采集的第一个图像如图26中的a图所示,第二个图像如图26中的b图所示,对第二个图像进行缩小后得到的图像如图26中的c图所示,对图26中的c图进行“补边”后得到的图像如图26中的d图所示。For example, the first image collected by the terminal is shown in Figure a in Figure 26, the second image is shown in Figure b in Figure 26, and the image obtained after reducing the second image is shown in Figure 26 c As shown in the figure, the image obtained after "filling the edge" on the picture c in Figure 26 is shown in the picture d in Figure 26.

基于此,本实施例提供的技术方案的基本原理为:终端可以采用比采集在前的图像时所使用的摄像头的倍率更小的摄像头采集在后的图像,即通过切换成更小倍率的摄像头实现对目标主体的缩小,这样,不需要对采集后的图像进行“补边”,从而提高用户体验。Based on this, the basic principle of the technical solution provided by this embodiment is: the terminal can use a camera with a smaller magnification than the camera used to capture the previous image to capture the subsequent image, that is, by switching to a camera with a smaller magnification Realize the shrinking of the target subject, so that there is no need to "fill the edge" on the captured image, thereby improving user experience.

图25所示的方法可以包括以下步骤:The method shown in Figure 25 may include the following steps:

S400:终端确定由远及近地拍摄希区柯克变焦视频,并确定初始摄像头。S400: The terminal determines to shoot the Hitchcock zoom video from far to near, and determines an initial camera.

可选的,终端可以在用户的指示下,确定由远及近地拍摄希区柯克变焦视频。Optionally, the terminal may determine to shoot the Hitchcock zoom video from far to near under the instruction of the user.

例如,基于图11中的a图所示的用户界面,用户可以通过触摸操作点击“由远及近模式”402控件,响应于该触摸操作,终端突出显示“由远及近模式”402控件,同时开始启动以由远及近模式拍摄希区柯克变焦视频。For example, based on the user interface shown in Figure a in FIG. 11 , the user can click on the "Far to Near Mode" 402 control through a touch operation, and in response to the touch operation, the terminal highlights the "Far to Near Mode" 402 control, Simultaneously start booting to shoot Hitchcock zoom video in near and far mode.

需要说明的是,终端还可以以其他方式(如语音指令方式等)启动以由远及近模式拍摄希区柯克变焦视频,本申请实施例对此不进行具体限定。It should be noted that the terminal can also be activated in other ways (such as voice command mode) to shoot the Hitchcock zoom video in the far-to-near mode, which is not specifically limited in this embodiment of the present application.

由于在本实施例中,如果终端切换摄像头,则切换成更小倍率的摄像头,因此,初始摄像头的倍率通常不是终端中倍率最小的摄像头,通常可以预定义该摄像头是终端中倍率较大(如最大)的一个摄像头。Because in this embodiment, if the terminal switches the camera, it will switch to a camera with a smaller magnification. Therefore, the magnification of the initial camera is usually not the camera with the smallest magnification in the terminal. Usually, it can be predefined that the camera has a larger magnification in the terminal (such as maximum) of a camera.

S401:终端针对第一场景采集N+1个图像,N+1个图像中均包括目标主体。其中,在采集N+1个图像的过程中,该终端距离目标主体越来越近。N是大于等于1的整数。N+1个图像中的第一个图像由终端的第一摄像头采集得到,N+1个图像中的后N个图像中的部分或全部图像由终端的第二摄像头采集得到,第二摄像头的倍率小于第一摄像头的倍率。N+1个图像中后采集的N个图像中目标主体的大小小于或等于N+1个图像中采集的第一个图像中的目标主体的大小。S401: The terminal collects N+1 images for the first scene, and all of the N+1 images include a target subject. Wherein, during the process of collecting N+1 images, the terminal is getting closer to the target subject. N is an integer greater than or equal to 1. The first image of the N+1 images is collected by the first camera of the terminal, part or all of the images of the last N images of the N+1 images are collected by the second camera of the terminal, and the The magnification is smaller than that of the first camera. The size of the target subject in the N images acquired later in the N+1 images is smaller than or equal to the size of the target subject in the first image acquired in the N+1 images.

也就是说,在本实施例中,终端采集图像的过程中,由大倍率的摄像头切换成了小倍率的摄像头,这有助于使得在终端距离目标主体越来越近的场景中,在后采集的图像中的目标主体的大小小于或等于在前采集的图像中的目标主体的大小。That is to say, in this embodiment, the terminal switches from a high-magnification camera to a small-magnification camera during the process of capturing images, which helps to make the terminal get closer to the target subject in the scene where the The size of the target subject in the acquired image is smaller than or equal to the size of the target subject in the previously acquired image.

在一种实现方式中,该N+1个图像是连续采集的N+1个图像,即实时采集的N+1个图像。In an implementation manner, the N+1 images are N+1 images collected continuously, that is, N+1 images collected in real time.

可选的,N+1个图像中的后N个图像包括在前采集的N1个图像和在后采集的N2个图像,其中,N1个图像由第二摄像头采集得到,N2个图像由终端的第三摄像头采集得到;N1和N2均是大于等于1的整数。Optionally, the last N images of the N+1 images include N1 images collected before and N2 images collected later, where the N1 images are collected by the second camera, and the N2 images are obtained by the terminal's Collected by the third camera; both N1 and N2 are integers greater than or equal to 1.

可选的,针对第一场景采集N+1个图像,包括:获取N+1个图像中的第i个图像的拍摄倍率;其中,2≤i≤N,i是整数;如果第i个图像的拍摄倍率在第一拍摄倍率范围内,则基于第二摄像头针对第一场景采集N+1个图像中的第i+1个图像;如果第i个图像的拍摄倍率在第二拍摄倍率范围内,则基于终端的第三摄像头针对第一场景采集N+1个图像中的第i+1个图像。其中,第二摄像头的倍率是b,第三摄像头的倍率是c;b>c;第一拍摄倍率范围是大于等于b的范围;第二拍摄倍率范围是[c,b)。该可选的实现方式中相关内容的解释以及示例基于参考上文中的示例推理得到,此处不再赘述。Optionally, collecting N+1 images for the first scene includes: obtaining the shooting magnification of the i-th image in the N+1 images; where, 2≤i≤N, i is an integer; if the i-th image If the shooting magnification is within the first shooting magnification range, then based on the second camera, the i+1th image among the N+1 images is collected for the first scene; if the shooting magnification of the i-th image is within the second shooting magnification range , the i+1th image among the N+1 images is collected for the first scene based on the third camera of the terminal. Wherein, the magnification of the second camera is b, and the magnification of the third camera is c; b>c; the first shooting magnification range is greater than or equal to b; the second shooting magnification range is [c, b). Explanations and examples of relevant content in this optional implementation manner are obtained based on reasoning with reference to the examples above, and will not be repeated here.

可选的,第一个图像的拍摄倍率大于第二摄像头的倍率。也就是说,终端的初始拍摄倍率大于采集第二个图像时所采用的摄像头的倍率。例如,终端中包含5X摄像头和1X摄像头,采集第一个图像所使用的摄像头可以是5X摄像头,此时的拍摄倍率可以是大于5的范围,或者[1,5)。采集第二个图像所使用的摄像头是1X摄像头。Optionally, the shooting magnification of the first image is greater than the magnification of the second camera. That is to say, the initial shooting magnification of the terminal is greater than the magnification of the camera used when capturing the second image. For example, the terminal includes a 5X camera and a 1X camera, the camera used to capture the first image may be a 5X camera, and the shooting magnification at this time may be greater than 5, or [1, 5). The camera used to capture the second image is a 1X camera.

可选的,该方法还可以包括:在当前预览界面中,显示第一信息,第一信息用于指示停止拍摄希区柯克变焦视频。Optionally, the method may further include: displaying first information in the current preview interface, where the first information is used to indicate to stop shooting the Hitchcock zoom video.

例如,终端可以在当前使用的摄像头是该终端中最小倍率的摄像头时,在当前预览界面中,显示第一信息。对于用户来说,可以在获取到第一信息之后的一段时间内停止拍摄希区柯克变焦视频。For example, the terminal may display the first information on the current preview interface when the currently used camera is the camera with the smallest magnification in the terminal. For the user, it is possible to stop shooting the Hitchcock zoom video within a period of time after obtaining the first information.

在终端与目标主体之间的距离越来越近的情况下拍摄希区柯克变焦视频,若当前使用的摄像头是该终端中最小倍率的摄像头,则由于当前摄像头的倍率不能更小,因此终端不能再切换摄像头,此时,通过在当前预览界面上显示第一信息,有助于提示用户及时停止拍摄视频,否则终端后续采集的图像需要进行缩小和补边,从而降低播放希区柯克变焦视频时的用户体验。也就是说,本申请实施例提供了一种指导用户停止拍摄希区柯克变焦视频的方法,这有助于提高用户体验。When the distance between the terminal and the target subject is getting closer and closer to the Hitchcock zoom video, if the currently used camera is the camera with the smallest magnification in the terminal, since the magnification of the current camera cannot be smaller, the terminal The camera can no longer be switched. At this time, by displaying the first information on the current preview interface, it is helpful to prompt the user to stop shooting the video in time, otherwise the subsequent images collected by the terminal need to be reduced and filled, thereby reducing the playback of Hitchcock zoom User experience during video. That is to say, the embodiment of the present application provides a method for instructing the user to stop shooting the Hitchcock zoom video, which helps to improve the user experience.

可选的,该方法还可以包括:在当前预览界面中,显示第二信息,第二信息用于指示目标主体静止。可选的,该方法还可以包括:在当前预览界面中,显示第三信息,第三信息用于指示目标主体在当前预览图像的中央。可选的,针对第一场景采集N+1个图像,包括:在目标主体在当前预览图像的中央时,采集第一个图像。其具体实现方式和示例可以参考上文,此处不再赘述。Optionally, the method may further include: displaying second information in the current preview interface, where the second information is used to indicate that the target subject is still. Optionally, the method may further include: displaying third information in the current preview interface, where the third information is used to indicate that the target subject is in the center of the current preview image. Optionally, collecting N+1 images for the first scene includes: collecting the first image when the target subject is in the center of the current preview image. For the specific implementation manner and examples, reference may be made to the above, and details will not be repeated here.

在一种可能的设计中,终端的移动速度小于等于预设速度。由于终端中的摄像头的数量有限,而终端移动速度过快可能导致切换摄像头的速度过快,而当切换到最小倍率的摄像头时,不能再切换摄像头。在使用最小倍率的摄像头采集图像时,随着终端距离目标主体越来越近,在后采集的图像中的目标主体越来越大,可能导致在后采集的图像中的目标主体的大小大于上述N+1个图像中的第一个图像中目标主体的大小。在生成希区柯克变焦视频时,需要对这些图像进行缩小并补边,从而降低用户体验。基于此,提出该可能的设计。这样,有助于提高高希区柯克变焦视频的质量。In a possible design, the moving speed of the terminal is less than or equal to a preset speed. Since the number of cameras in the terminal is limited, the speed of switching the cameras may be too fast if the terminal moves too fast, and when switching to the camera with the minimum magnification, the camera cannot be switched any more. When using the minimum magnification camera to capture images, as the terminal gets closer to the target subject, the target subject in the later captured image will become larger and larger, which may cause the target subject in the later captured image to be larger than the above The size of the target subject in the first image of N+1 images. When generating a Hitchcock zoom video, these images need to be downscaled and edge filled, thereby degrading the user experience. Based on this, this possible design is proposed. In this way, it helps to improve the quality of high Hitchcock zoom videos.

S402:对于N+1个图像中后采集的N个图像,终端基于预设神经网络进行白平衡处理,得到N个优化图像。其中,预设神经网络用于保证时域相邻图像的白平衡一致性。S402: For the N images collected later among the N+1 images, the terminal performs white balance processing based on a preset neural network to obtain N optimized images. Among them, the preset neural network is used to ensure the white balance consistency of adjacent images in time domain.

S403:终端对N个优化图像进行放大并裁剪,得到N个目标图像。其中,该N个目标图像中的目标主体的大小与N+1个图像中采集的第一个图像中目标主体的大小一致。该N个目标图像中的目标主体的相对位置与第一个图像中目标主体的相对位置一致。该N个目标图像与第一个图像的大小一致。S403: The terminal enlarges and crops the N optimized images to obtain N target images. Wherein, the size of the target subject in the N target images is consistent with the size of the target subject in the first image collected in the N+1 images. The relative positions of the target subjects in the N target images are consistent with the relative positions of the target subjects in the first image. The N target images are the same size as the first image.

S404:终端基于该N个目标图像和第一个图像,生成希区柯克变焦视频。S404: The terminal generates a Hitchcock zoom video based on the N target images and the first image.

关于S402-S404的具体实现方式可以参考上述S302-S304的相关描述,此处不再赘述。For specific implementation manners of S402-S404, reference may be made to relevant descriptions of S302-S304 above, which will not be repeated here.

本申请实施例提供的拍摄视频的方法中,在终端距离目标主体越来越近的场景中,通过切换成更小倍率的摄像头,使得在后采集的图像中目标主体的大小小于或等于在前采集的图像中的目标主体的大小,从而基于所采集的图像得到希区柯克变焦视频。并且,对采集到的N+1个图像中的后N个图像进行了白平衡处理,以使得处理后的图像与所采集的N+1个图像中的第一个图像的白平衡一致。这样,可以使得获得的希区柯克变焦视频的白平衡效果更好,从而提高希区柯克变焦视频的质量,提高了用户体验。另外,在本申请实施例中,终端可以通过切换摄像头的方式,缩小后续采集的图像中的目标主体的大小,相比传统技术,不需要对采集的图像进行“补边”处理,因此,能够提高用户体验。In the method for shooting video provided in the embodiment of the present application, in the scene where the terminal is getting closer to the target subject, by switching to a camera with a smaller magnification, the size of the target subject in the later captured image is smaller than or equal to the previous The size of the target subject in the captured image, resulting in a Hitchcock zoom video based on the captured image. Moreover, white balance processing is performed on the last N images among the collected N+1 images, so that the white balance of the processed image is consistent with that of the first image among the collected N+1 images. In this way, the white balance effect of the obtained Hitchcock zoom video can be better, thereby improving the quality of the Hitchcock zoom video and improving user experience. In addition, in the embodiment of the present application, the terminal can reduce the size of the target subject in the subsequent captured image by switching the camera. Compared with the traditional technology, it does not need to perform "filling" processing on the captured image. Therefore, it can Improve user experience.

另外,本申请还提供的一种拍摄希区柯克变焦视频的方法,该方法可以应用于终端距离目标主体越来越近的场景中。该方法可以包括以下步骤:In addition, the present application also provides a method for shooting a Hitchcock zoom video, which can be applied to a scene where the terminal is getting closer to the target subject. The method may include the steps of:

步骤1:可以参考上述S400。Step 1: Refer to the above S400.

步骤2:终端针对第一场景实时采集N+1个图像,N+1个图像中均包括目标主体。其中,在采集N+1个图像的过程中,该终端距离目标主体越来越近。N是大于等于1的整数。N+1个图像中的第一个图像由终端的第一摄像头采集得到,N+1个图像中的后N个图像中的部分或全部图像由终端的第二摄像头采集得到,第二摄像头的倍率小于第一摄像头的倍率。Step 2: The terminal collects N+1 images in real time for the first scene, and the N+1 images all include the target subject. Wherein, during the process of collecting N+1 images, the terminal is getting closer to the target subject. N is an integer greater than or equal to 1. The first image of the N+1 images is collected by the first camera of the terminal, part or all of the images of the last N images of the N+1 images are collected by the second camera of the terminal, and the The magnification is smaller than that of the first camera.

在一些示例中,该步骤的具体实现方式可以参考上述S301的相关描述,此处不再赘述。In some examples, for the specific implementation manner of this step, reference may be made to the relevant description of S301 above, which will not be repeated here.

在另一些示例中,基于上述S301中确定采集图像所使用的摄像头的方案(如图19a所示)可知,采集N+1个图像中的第一个图像和第二个图像时所采用的摄像头相同。而本实施例中,在拍摄希区柯克变焦视频的过程中,终端距离目标主体越来越近,在不切换摄像头的情况下,在后采集的图像中的目标主体的大小大于在前采集的图像中的目标主体的大小。因此,采用如图19a所示的方法确定采集图像所使用的摄像头,会导致第二个图像中的目标主体的大小大于第一个图像中的目标主体的大小。In some other examples, based on the scheme of determining the camera used to capture the image in S301 above (as shown in Figure 19a), it can be known that the camera used when capturing the first image and the second image in the N+1 images same. However, in this embodiment, during the process of shooting the Hitchcock zoom video, the terminal is getting closer and closer to the target subject, and without switching the camera, the size of the target subject in the image captured later is larger than that captured earlier The size of the target subject in the image. Therefore, using the method shown in FIG. 19a to determine the camera used to capture the image will result in the size of the target subject in the second image being larger than the size of the target subject in the first image.

对此,在本申请实施例的一种解决方案中,终端采集第二个图像所使用的摄像头与采集第一个图像所使用的摄像头不同。并且,采集第二个图像所使用的摄像头的倍率小于采集第一个图像所使用的摄像头的倍率,这有助于实现第二个图像中的目标图像的大小小于第一个图像中的目标主体图像的大小。In this regard, in a solution of the embodiment of the present application, the camera used by the terminal to capture the second image is different from the camera used to capture the first image. Also, the magnification of the camera used to capture the second image is smaller than the magnification of the camera used to capture the first image, which helps to realize that the size of the target image in the second image is smaller than the target subject in the first image The size of the image.

步骤3:可以参考上述S402。Step 3: Refer to the above S402.

步骤4:终端对N个优化图像中满足第一条件的优化图像进行放大并裁剪,得到至少一个目标图像。其中,满足第一条件的优化图像是所包含的目标主体的大小小于第一个图像中的目标图像的大小的优化图像。该至少一个目标图像中的目标主体的大小与N+1个图像中采集的第一个图像中目标主体的大小一致。该至少一个目标图像中的目标主体的相对位置与第一个图像中目标主体的先对位置一致。该至少一个目标图像与第一个图像的大小一致。Step 4: The terminal enlarges and crops the optimized image satisfying the first condition among the N optimized images to obtain at least one target image. Wherein, the optimized image satisfying the first condition is an optimized image in which the size of the included target subject is smaller than the size of the target image in the first image. The size of the target subject in the at least one target image is consistent with the size of the target subject in the first image collected in the N+1 images. The relative position of the target subject in the at least one target image is consistent with the corresponding position of the target subject in the first image. The at least one target image is the same size as the first image.

关于满足第一条件的优化图像的处理方式可以参考S303中的相关描述,此处不再赘述。Regarding the processing manner of the optimized image satisfying the first condition, reference may be made to the relevant description in S303, which will not be repeated here.

步骤5:终端基于该至少一个目标图像和第一个图像,生成希区柯克变焦视频。Step 5: The terminal generates a Hitchcock zoom video based on the at least one target image and the first image.

例如,终端基于该至少一个目标图像和第一个图像和N个优化图像中不满足第一条件的图像,生成希区柯克变焦视频。For example, the terminal generates a Hitchcock zoom video based on the at least one target image, the first image, and an image that does not satisfy the first condition among the N optimized images.

由于本实施例提供的技术方案,可能导致在后采集的图像中的目标主体的大小大于、等于或小于第一个图像中的目标主体的大小。因此,本实施例区分了满足第一条件的优化图像和不满足第一条件的优化图像。对于不满足第一条件的优化图像,可以将其直接作为希区柯克变焦视频中的一个图像,而不需要执行放大裁剪。Due to the technical solution provided by this embodiment, the size of the target subject in the image collected later may be greater than, equal to or smaller than the size of the target subject in the first image. Therefore, this embodiment distinguishes optimized images satisfying the first condition from optimized images not satisfying the first condition. For an optimized image that does not satisfy the first condition, it can be directly used as an image in the Hitchcock zoom video without performing magnification and cropping.

步骤5的具体实现方式,也可以参考S304中的相关描述。For the specific implementation manner of step 5, reference may also be made to the relevant description in S304.

可选的,第N+1个图像中采集的第N+1个图像中目标主体的大小小于或等于第一个图像中目标主体的大小。Optionally, the size of the target subject in the N+1th image collected in the N+1th image is smaller than or equal to the size of the target subject in the first image.

可选的,第N+1个图像中目标主体的大小大于第一个图像中目标主体的大小,且第N+1个图像中目标主体的大小与第一个图像中目标主体的大小的差值小于或等于预设阈值。也就是说,当第N+1个图像中目标主体的大小大于第一个图像中目标主体的大小时,二者相差不能太大,以使得基于第N+1个图像生成希区柯克变焦视频时能够满足“希区柯克变焦视频的不同图像中目标主体的大小一致”。Optionally, the size of the target subject in the N+1th image is greater than the size of the target subject in the first image, and the difference between the size of the target subject in the N+1th image and the size of the target subject in the first image The value is less than or equal to the preset threshold. That is to say, when the size of the target subject in the N+1th image is larger than the size of the target subject in the first image, the difference between the two cannot be too large, so that the Hitchcock zoom can be generated based on the N+1th image The video can satisfy "the size of the target subject in different images of the Hitchcock zoom video is consistent".

需要说明的是,在终端距离目标主体越来越近的场景下获取希区柯克变焦视频,在实际实现中,实时采集图像的过程中,如果终端因靠近目标主体而导致所采集的图像中的目标主体变大的程度,大于终端因将当前摄像头切换成更小倍率的摄像头(或因不切换摄像头)而导致所采集的图像中的目标主体缩小的程度,那么,可能导致在后采集的图像中的目标主体的大小大于第一个图像中的目标主体的大小。It should be noted that the Hitchcock zoom video is obtained in the scene where the terminal is getting closer to the target subject. The degree to which the target subject becomes larger is greater than the degree to which the target subject in the captured image shrinks because the terminal switches the current camera to a camera with a smaller magnification (or does not switch the camera), then it may cause the The size of the target subject in the image is larger than the size of the target subject in the first image.

对此:To this:

在本申请实施例的一种解决方案中,如果终端当前采集的图像中的目标主体的大小与第一个图像中的目标主体的大小的差值大于预设阈值,且当前采集的图像中的目标主体的大小大于第一个图像中的目标主体的大小,则停止采集图像。相应的,终端采用在此之前采集的图像生成希区柯克变焦视频。In a solution of the embodiment of the present application, if the difference between the size of the target subject in the image currently collected by the terminal and the size of the target subject in the first image is greater than a preset threshold, and the target subject in the currently collected image If the size of the target subject is larger than the size of the target subject in the first image, stop acquiring images. Correspondingly, the terminal generates a Hitchcock zoom video by using the previously collected images.

由于希区柯克变焦视频的要求之一是不同图像中目标主体的大小一致,“终端当前采集的图像中的目标主体的大小与第一个图像中的目标主体的大小的差值大于预设阈值,且当前采集的图像中的目标主体的大小大于第一个图像中的目标主体的大小”,说明:基于终端当前采集的图像,不能满足希区柯克变焦视频中不同图像中目标主体的大小一致,因此,停止采集图像。Since one of Hitchcock's zoom video requirements is that the size of the target subject in different images is consistent, "The difference between the size of the target subject in the image currently captured by the terminal and the size of the target subject in the first image is greater than the preset threshold, and the size of the target subject in the currently captured image is greater than the size of the target subject in the first image", indicating that based on the currently collected image of the terminal, the target subject in different images in the Hitchcock zoom video cannot be satisfied. The size is consistent, therefore, the acquisition of images is stopped.

基于此,可选的,该方法还可以包括:针对第一场景采集第N+2个图像,第N+2个图像包括目标主体;采集N+2个图像时终端与目标主体之间的距离,小于采集N+1个图像时终端与目标主体之间的距离。该情况下,上述步骤4包括:在第N+2个图像中的目标主体的大小与第一个图像中的目标主体的大小的差值大于预设阈值,且第N+2个图像中的目标主体的大小大于第一个图像中的目标主体的大小时,基于该N个目标图像和第一个图像,生成希区柯克变焦视频。Based on this, optionally, the method may further include: collecting the N+2th image for the first scene, where the N+2th image includes the target subject; the distance between the terminal and the target subject when collecting the N+2 images , which is smaller than the distance between the terminal and the target subject when N+1 images are collected. In this case, the above step 4 includes: the difference between the size of the target subject in the N+2th image and the size of the target subject in the first image is greater than a preset threshold, and the size of the target subject in the N+2th image When the size of the target subject is larger than the size of the target subject in the first image, a Hitchcock zoom video is generated based on the N target images and the first image.

可选的,终端在基于上述方案停止采集图像时,可以输出第一信息,第一信息用于指示停止拍摄希区柯克变焦视频。也就是说,本申请实施例提供了一种指导用户停止拍摄希区柯克变焦视频的方法,这样,用户可以基于该图像停止移动终端,从而提高用户体验。Optionally, when the terminal stops capturing images based on the above solution, it may output first information, where the first information is used to indicate that the shooting of the Hitchcock zoom video is stopped. That is to say, the embodiment of the present application provides a method for instructing the user to stop shooting the Hitchcock zoom video, so that the user can stop the mobile terminal based on the image, thereby improving user experience.

本申请实施例对第一信息的具体实现方式不进行限定,例如第一信息可以以图像、文字、语音等方式输出。本实施例中,终端可以在基于上述方案,确定停止采集图像时,显示如图23a所示的当前预览界面,从而提示用户停止拍摄希区柯克变焦视频。The embodiment of the present application does not limit the specific implementation manner of the first information, for example, the first information may be output in the form of image, text, voice, and the like. In this embodiment, when determining to stop capturing images based on the above solution, the terminal may display the current preview interface as shown in FIG. 23a, thereby prompting the user to stop shooting the Hitchcock zoom video.

在本申请实施例的再一种解决方案中,N+1个图像由终端中的最小倍率的摄像头采集得到。在第N+1个图像中目标主体的大小大于第一个图像中目标主体的大小,且第N+1个图像中目标主体的大小与第一个图像中目标主体的大小的差值等于预设阈值时,输出第一信息,第一信息用于指示停止拍摄希区柯克变焦视频。In yet another solution of the embodiment of the present application, the N+1 images are collected by a camera with a minimum magnification in the terminal. The size of the target subject in the N+1th image is larger than the size of the target subject in the first image, and the difference between the size of the target subject in the N+1th image and the size of the target subject in the first image is equal to the preset When the threshold is set, first information is output, and the first information is used to instruct to stop shooting the Hitchcock zoom video.

一方面,由于N+1个图像由终端中的最小倍率的摄像头采集得到,因此,后续如果继续采集图像,则不能再切换摄像头。另一方面,希区柯克变焦视频的要求不同图像中目标主体的大小一致。而第N+1个图像中目标主体的大小大于第一个图像中目标主体的大小,且第N+1个图像中目标主体的大小与第一个图像中目标主体的大小的差值等于预设阈值时,说明第N+1个图像中目标主体的大小相比第一个图像中目标主体的大小的跳变程度,已达到获得希区柯克变焦视频的临界值,此时,如果继续采集图像,会因不能再切换摄像头而导致继续采集的图像中目标主体的大小相比第一个图像中目标主体的大小的跳变程度更大,从而导致不能获得希区柯克变焦视频。考虑到这一点,本申请实施例提供了上述停止拍摄希区柯克变焦视频的方法。On the one hand, since the N+1 images are collected by the camera with the smallest magnification in the terminal, if images continue to be collected subsequently, the camera cannot be switched. On the other hand, the Hitchcock zoom video requires that the size of the target subject be consistent across images. However, the size of the target subject in the N+1th image is larger than the size of the target subject in the first image, and the difference between the size of the target subject in the N+1th image and the size of the target subject in the first image is equal to the preset When the threshold is set, it means that the size of the target subject in the N+1th image has jumped compared to the size of the target subject in the first image, and has reached the critical value for obtaining the Hitchcock zoom video. At this time, if you continue When collecting images, the size of the target subject in the continued image collection will jump more than the size of the target subject in the first image because the camera can no longer be switched, resulting in the inability to obtain the Hitchcock zoom video. Considering this, the embodiment of the present application provides the above-mentioned method for stopping shooting a Hitchcock zoom video.

在本申请实施例的另一种解决方案中,S403中满足第一条件的优化图像可以替换为:所包含的目标主体的大小小于参考图像中的目标图像的大小的优化图像。该参考图像是N+1个图像中的“在该优化图像对应的图像之前,与该图像之间的距离最近,且所包含的目标主体的大小大于或等于第一个图像中所包含的目标主体的大小”的图像。In another solution of the embodiment of the present application, the optimized image satisfying the first condition in S403 may be replaced with an optimized image whose size of the included target subject is smaller than that of the target image in the reference image. The reference image is one of the N+1 images "before the image corresponding to the optimized image, the distance between it and the image is the shortest, and the size of the contained target subject is greater than or equal to the target contained in the first image subject size" image.

例如,以终端中包括0.6X、1X、2X、5X和10X摄像头为例,这几个摄像头对应的拍摄倍率范围分别为:[0.6,1),[1,2),[2,5),[5,10),大于等于10的范围。For example, taking the terminal including 0.6X, 1X, 2X, 5X, and 10X cameras as an example, the shooting magnification ranges corresponding to these cameras are: [0.6,1), [1,2), [2,5), [5,10), the range greater than or equal to 10.

采用10X摄像头采集第1个图像,该图像中目标主体的大小是d。A 10X camera is used to capture the first image, and the size of the target subject in this image is d.

采用5X摄像头采集第2个图像,该图像中目标主体的大小是0.8d。由此可知,第2个图像的拍摄倍率是:5/(0.8d/d)=6.25,6.25∈[5,10),因此采集第3个图像的摄像头是5X摄像头。Use the 5X camera to collect the second image, the size of the target subject in this image is 0.8d. It can be seen that the shooting magnification of the second image is: 5/(0.8d/d)=6.25, 6.25∈[5,10), so the camera that captures the third image is a 5X camera.

采用5X摄像头采集第3个图像,该图像中目标主体的大小是1.5d。由此可知,第3个图像的拍摄倍率是:5/(1.5d/d)=3.33,3.33∈[2,5),因此采集第4个图像的摄像头是2X摄像头。A 5X camera is used to capture the third image, and the size of the target subject in this image is 1.5d. It can be seen that the shooting magnification of the third image is: 5/(1.5d/d)=3.33, 3.33∈[2,5), so the camera that captures the fourth image is a 2X camera.

采用2X摄像头采集第4个图像,该图像中目标主体的大小是0.8d。由此可知,第4个图像的拍摄倍率是:2/(0.8d/d)=2.5,2.5∈[2,5),因此采集第5个图像的摄像头是2X摄像头。Use the 2X camera to collect the fourth image, the size of the target subject in this image is 0.8d. It can be seen that the shooting magnification of the fourth image is: 2/(0.8d/d)=2.5, 2.5∈[2,5), so the camera that captures the fifth image is a 2X camera.

……...

基于该示例,满足第一条件的优化图像是第2个图像对应的优化图像,以及第4个图像对应的优化图像。对于第4个图像的优化图像来说,对其进行放大裁剪时,参考图像是第3个图像。对于第2个图像的优化图像来说,对其进行放大裁剪时,参考图像是第1个图像。Based on this example, the optimized image that satisfies the first condition is the optimized image corresponding to the second image, and the optimized image corresponding to the fourth image. For the optimized image of the 4th image, when zooming in and cropping it, the reference image is the 3rd image. For the optimized image of the second image, when zooming in and cropping it, the reference image is the first image.

如图27所示,为本申请实施例提供的一种拍摄视频的方法的流程示意图。图27所示的方法应用于终端,终端包括至少两个摄像头,该至少两个摄像头的倍率不同。图27所示的方法可以包括以下步骤:As shown in FIG. 27 , it is a schematic flowchart of a method for shooting a video provided in the embodiment of the present application. The method shown in FIG. 27 is applied to a terminal, and the terminal includes at least two cameras, and the magnifications of the at least two cameras are different. The method shown in Figure 27 may include the following steps:

S500:终端通过至少两个摄像在第一时刻针对第一场景分别采集至少两个图像;其中,一个摄像头对应一个图像,且至少两个图像中均包含目标主体。S500: The terminal respectively collects at least two images for the first scene by using at least two cameras at a first moment; wherein, one camera corresponds to one image, and at least two images include a target subject.

也就是说,本申请实施例中,针对待拍摄视频所采集的图像是多个摄像头在同一时刻针对同一场景采集的图像。That is to say, in the embodiment of the present application, the images collected for the video to be shot are images collected by multiple cameras for the same scene at the same moment.

S501:终端基于视频的预设播放时长和预设播放帧率,确定至少两个图像中的第一图像和第二图像之间的待插入图像的帧数N;其中,第一图像是至少两个图像中的通过第一摄像头采集的图像,第一摄像头是至少两个摄像头中倍率最大的摄像头。第二图像是至少两个头图像中通过第二摄像头采集的图像,第二摄像头是至少两个摄像头中倍率最小的摄像头。N是大于等于1的整数。S501: Based on the preset playback duration and preset playback frame rate of the video, the terminal determines the number N of frames of the image to be inserted between the first image and the second image among the at least two images; wherein, the first image is at least two An image captured by the first camera in the images, where the first camera is the camera with the largest magnification among the at least two cameras. The second image is an image captured by the second camera among the at least two head images, and the second camera is a camera with the smallest magnification among the at least two cameras. N is an integer greater than or equal to 1.

这是在考虑到:基于不同摄像头在同一时刻针对同一场景采集的图像中,通过最大倍率的摄像头采集的图像中的目标主体的大小最大,而通过最小倍率的摄像头采集的图像中的目标主体的大小最小,而提出的技术方案。This is taking into account: in the images collected by different cameras for the same scene at the same time, the size of the target subject in the image collected by the camera with the largest magnification is the largest, while the size of the target subject in the image collected by the camera with the smallest magnification is the largest. The size is minimal while the technical solution presented.

S502:终端基于待插入图像的帧数N和该至少两个图像中的部分或全部图像,确定N个待插入图像。其中,该部分或全部图像至少包含第一图像和第二图像。S502: The terminal determines N images to be inserted based on the number N of frames of the image to be inserted and some or all of the images in the at least two images. Wherein, the part or all of the images at least include the first image and the second image.

具体实现时,终端先提取所采集的该部分或全部图像中的每个图像中的目标主体的大小,再基于相应图像中的目标主体的大小,确定相应待插入图像的像素的值。具体示例可以参考图28所示的示例。During specific implementation, the terminal first extracts the size of the target subject in each of the collected images, and then determines the value of the pixel corresponding to the image to be inserted based on the size of the target subject in the corresponding image. For a specific example, refer to the example shown in FIG. 28 .

终端基于该至少两个图像中的越多图像确定待插入图像,越有助于提高插帧的准确率,从而使得最终生成的视频中的图像更能反映真实场景,进而提高用户体验。The more images the terminal determines to be inserted based on the at least two images, the more it helps to improve the accuracy of frame interpolation, so that the images in the finally generated video can better reflect the real scene, thereby improving user experience.

S503:终端基于该至少两个图像和N个待插入图像,生成视频。其中,该视频的各图像中的目标主体的大小逐渐变大或逐渐变小。S503: The terminal generates a video based on the at least two images and the N images to be inserted. Wherein, the size of the target subject in each image of the video gradually becomes larger or smaller.

在一个示例中,终端中设置有10X摄像头,3X摄像头、1X摄像头和0.6X摄像头。In an example, a 10X camera, a 3X camera, a 1X camera and a 0.6X camera are set in the terminal.

执行S500时,终端在同一时刻基于这4个摄像头分别采集图像,得到图像1-4,如图28所示。其中,图28中的图a-d分别表示图像1-4。When executing S500, the terminal collects images based on the four cameras at the same time to obtain images 1-4, as shown in FIG. 28 . Among them, panels a-d in Fig. 28 represent images 1-4, respectively.

执行S501时,假设待拍摄视频的预设播放时长是n秒,n是大于等于1的整数,且预设播放帧率是24帧/秒,即每秒共播放24帧图像,则该视频总共需要的图像的个数是n*24。由此可以得到待拍摄视频中相邻两帧之间的缩放倍率是

Figure BDA0002707440760000321
以n=1为例,待拍摄视频中相邻两帧之间的缩放倍率为
Figure BDA0002707440760000322
When executing S501, assuming that the preset playback duration of the video to be shot is n seconds, n is an integer greater than or equal to 1, and the preset playback frame rate is 24 frames per second, that is, a total of 24 frames of images are played per second, then the video has a total of The number of images required is n*24. From this, it can be obtained that the zoom ratio between two adjacent frames in the video to be shot is
Figure BDA0002707440760000321
Taking n=1 as an example, the zoom ratio between two adjacent frames in the video to be shot is
Figure BDA0002707440760000322

执行S502时,终端可以执行以下步骤:When executing S502, the terminal may perform the following steps:

首先,终端确定参考图像,并基于参考图像和待拍摄视频中相邻两帧之间的缩放倍率确定待插入图像的拍摄倍率,待插入图像的个数是N。其中,该参考图像可以是最大倍率的摄像头采集的图像(即图像1),或最小倍率的摄像头采集的图像(即图像4)。以参考图像是图像4为例,N个待插入图像的拍摄倍率分别是:0.6*1.124=0.6744,0.6744*1.124=0.758,0.758*1.124=0.852,……First, the terminal determines the reference image, and determines the shooting magnification of the image to be inserted based on the reference image and the zoom ratio between two adjacent frames in the video to be shot, and the number of images to be inserted is N. Wherein, the reference image may be an image captured by a camera with a maximum magnification (ie, image 1 ), or an image captured by a camera with a minimum magnification (ie, image 4 ). Taking the reference image as image 4 as an example, the shooting magnifications of the N images to be inserted are: 0.6*1.124=0.6744, 0.6744*1.124=0.758, 0.758*1.124=0.852,...

其次,终端基于任一待插入帧图像的拍摄倍率,以及终端所采集的拍摄倍率大于该待插入帧图像的拍摄倍率和小于该待插入帧图像的拍摄倍率的两个图像中的像素的值,进行插帧,得到该待插入图像中的像素的值。以此类推,终端可以获得N个待插入图像。Secondly, the terminal is based on the shooting magnification of any frame image to be inserted, and the values of pixels in the two images collected by the terminal whose shooting magnification is greater than the shooting magnification of the frame image to be inserted and smaller than the shooting magnification of the frame image to be inserted, Perform frame interpolation to obtain the value of the pixel in the image to be inserted. By analogy, the terminal can obtain N images to be inserted.

可以理解的是,在进行插帧之前,终端需要对这两个图像进行目标主体检测,从而得到目标主体的大小。如图28中的e-h图示意出了目标主体检测的示意图,这些图中矩形框中的部分表示目标主体。并且,图28中示意了插帧的步骤。It can be understood that before performing frame interpolation, the terminal needs to perform target subject detection on the two images, so as to obtain the size of the target subject. The e-h diagrams in Figure 28 show the schematic diagrams of the target subject detection, and the parts in the rectangular boxes in these figures represent the target subjects. Moreover, the steps of frame insertion are shown in FIG. 28 .

可选的,这两个图像是拍摄倍率大于该待插入帧图像的拍摄倍率且与该待插入帧图像的拍摄倍率之差最小的图像,以及,拍摄倍率小于该待插入帧图像的拍摄倍率与该待插入帧图像的拍摄倍率之差最小的图像。Optionally, the two images are images whose shooting magnification is greater than the shooting magnification of the frame image to be inserted and has the smallest difference with the shooting magnification of the frame image to be inserted, and the shooting magnification is smaller than the shooting magnification and the shooting magnification of the frame image to be inserted The image with the smallest difference in shooting magnification of the frame image to be inserted.

例如,对于拍摄倍率在0.6-1之间的待插入图像,采用图像4和图像3进行插帧。对于拍摄倍率在1-3之间的待插入图像,采用图像3和图像2进行插帧。对于拍摄倍率在3-10之间的待插入图像,采用图像2和图像1进行插帧。For example, for images to be inserted with a shooting magnification between 0.6-1, image 4 and image 3 are used for frame interpolation. For images to be inserted with shooting magnifications between 1-3, use image 3 and image 2 for frame interpolation. For images to be inserted with shooting magnifications between 3-10, use image 2 and image 1 for frame interpolation.

最后,终端将待插入图像和图像1-4,按照所包含的目标主体的大小由大到小的顺序或由小到大的顺序,生成视频(或动态图)。图28中示意了生成视频的步骤。Finally, the terminal generates the video (or dynamic picture) according to the order of the size of the included target subjects from large to small or from small to large according to the images to be inserted and images 1-4. The steps for generating a video are illustrated in FIG. 28 .

传统技术中,通常采用同一摄像头采集不同物距下的图像,从而生成视频,该视频的各图像中的目标主体的大小逐渐变大或逐渐变小。这可能因不同时刻采集的图像时,终端的位置偏移(如左右偏移或上下偏移),或者背景中的动态对象的移动等,而导致不同图像中的背景差异较大,从而降低了视频的质量。本实施例提供的拍摄视频的方法,终端通过多个摄像头在同一时刻针对同一场景采集多帧图像,并基于该多帧图像进行插帧,从而生成该视频。这样,相比传统技术,有助于提高所生成的视频的质量。另外,有助于提升动图效果的趣味性,增强用户对终端的粘性。In the traditional technology, the same camera is usually used to collect images under different object distances to generate a video, and the size of the target subject in each image of the video gradually becomes larger or smaller. This may be due to the position deviation of the terminal (such as left and right or up and down) when the images are collected at different times, or the movement of dynamic objects in the background, etc., resulting in large differences in the background of different images, thereby reducing the the quality of the video. In the video shooting method provided in this embodiment, the terminal collects multiple frames of images for the same scene at the same time through multiple cameras, and performs frame interpolation based on the multiple frames of images, so as to generate the video. This helps to improve the quality of the generated video compared to conventional techniques. In addition, it helps to improve the fun of the animation effect and enhance the user's stickiness to the terminal.

上述主要从方法的角度对本申请实施例提供的方案进行了介绍。为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。The foregoing mainly introduces the solutions provided by the embodiments of the present application from the perspective of methods. In order to realize the above functions, it includes corresponding hardware structures and/or software modules for performing various functions. Those skilled in the art should easily realize that the present application can be implemented in the form of hardware or a combination of hardware and computer software in combination with the units and algorithm steps of each example described in the embodiments disclosed herein. Whether a certain function is executed by hardware or computer software drives hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.

本申请实施例可以根据上述方法示例对终端进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。The embodiment of the present application may divide the terminal into functional modules according to the above method example, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules. It should be noted that the division of modules in the embodiment of the present application is schematic, and is only a logical function division, and there may be other division methods in actual implementation.

如图29所示,为本申请实施例提供的一种终端的结构示意图。图29所示的终端220可以用于实现上述方法实施例中终端的功能,因此也能实现上述方法实施例所具备的有益效果。在本申请的实施例中,该终端可以是如图1所示的终端100。As shown in FIG. 29 , it is a schematic structural diagram of a terminal provided in the embodiment of the present application. The terminal 220 shown in FIG. 29 can be used to realize the functions of the terminal in the foregoing method embodiments, and thus also realize the beneficial effects of the foregoing method embodiments. In the embodiment of the present application, the terminal may be the terminal 100 shown in FIG. 1 .

如图29所示,终端220包括采集单元221和处理单元222。可选的,如图30所示,终端220还包括显示单元223。As shown in FIG. 29 , the terminal 220 includes a collection unit 221 and a processing unit 222 . Optionally, as shown in FIG. 30 , the terminal 220 further includes a display unit 223 .

在一些实施例中:In some embodiments:

采集单元221,用于针对第一场景实时采集N+1个图像,N+1个图像中均包括目标主体;其中,在采集N+1个图像的过程中,终端距离目标主体越来越远。N是大于等于1的整数。处理单元222,用于执行以下步骤:对于N+1个图像中后采集的N个图像,基于预设神经网络进行白平衡处理,得到N个优化图像;预设神经网络用于保证时域相邻图像的白平衡一致性。对N个优化图像进行放大并裁剪,得到N个目标图像;其中,N个目标图像中的目标主体的大小与N+1个图像中采集的第一个图像中目标主体的大小一致,N个目标图像中目标主体的相对位置,与第一个图像中目标主体的相对位置一致;N个目标图像与第一个图像的大小一致;基于N个目标图像和第一个图像生成希区柯克变焦视频。例如,结合图10,采集单元221用于执行S301,处理单元222用于执行S302-S304。The collection unit 221 is configured to collect N+1 images in real time for the first scene, and each of the N+1 images includes the target subject; wherein, during the process of collecting the N+1 images, the terminal is getting farther and farther away from the target subject . N is an integer greater than or equal to 1. The processing unit 222 is configured to perform the following steps: for the N images collected after the N+1 images, perform white balance processing based on a preset neural network to obtain N optimized images; the preset neural network is used to ensure that the time domain phase White balance consistency of adjacent images. Enlarge and crop the N optimized images to obtain N target images; wherein, the size of the target subject in the N target images is consistent with the size of the target subject in the first image collected in the N+1 images, and the N The relative position of the target subject in the target image is consistent with the relative position of the target subject in the first image; N target images are the same size as the first image; Hitchcock is generated based on the N target images and the first image Zoom video. For example, referring to FIG. 10 , the acquisition unit 221 is configured to execute S301, and the processing unit 222 is configured to execute S302-S304.

可选的,N+1个图像包括在前采集的N1+1个图像和在后采集的N2个图像,其中,N1+1个图像由终端的第一摄像头采集得到,N2个图像由终端的第二摄像头采集得到;N1和N2均是大于等于1的整数。Optionally, the N+1 images include N1+1 images collected before and N2 images collected later, where the N1+1 images are collected by the first camera of the terminal, and the N2 images are collected by the terminal's Collected by the second camera; both N1 and N2 are integers greater than or equal to 1.

可选的,采集单元221具体用于:获取N+1个图像中的第i个图像的拍摄倍率,其中,2≤i≤N,i是整数;如果第i个图像的拍摄倍率在第一拍摄倍率范围内,则基于第一摄像头针对第一场景采集N+1个图像中的第i+1个图像。如果第i个图像的拍摄倍率在第二拍摄倍率范围内,则基于第二摄像头针对第一场景采集N+1个图像中的第i+1个图像;其中,第一摄像头的倍率是a,第二摄像头的倍率是b;a<b;第一拍摄倍率范围是[a,b);第二拍摄倍率范围是大于等于b的范围。例如,结合图19b,采集单元221可以用于执行S301c-3。Optionally, the acquisition unit 221 is specifically configured to: acquire the shooting magnification of the i-th image among the N+1 images, where, 2≤i≤N, i is an integer; if the shooting magnification of the i-th image is at the first Within the shooting magnification range, the i+1th image among the N+1 images is collected based on the first camera for the first scene. If the shooting magnification of the i-th image is within the second shooting magnification range, the i+1th image in the N+1 images collected based on the second camera for the first scene; wherein, the magnification of the first camera is a, The magnification of the second camera is b; a<b; the first shooting magnification range is [a, b); the second shooting magnification range is a range greater than or equal to b. For example, referring to FIG. 19b, the collection unit 221 may be used to execute S301c-3.

可选的,第i个图像的拍摄倍率是基于第i个图像中目标主体的大小相对于第一个图像中目标主体的大小的缩放倍率,和采集第一个图像的摄像头的倍率确定的。Optionally, the shooting magnification of the i-th image is determined based on the scaling magnification of the size of the target subject in the i-th image relative to the size of the target subject in the first image, and the magnification of the camera that captures the first image.

可选的,第i个图像中的目标主体的大小通过以下至少一个特征来表征:第i个图像中的目标主体的宽度,第i个图像中的目标主体的高度,第i个图像中的目标主体的面积,或者,第i个图像中的目标主体的所占的像素点的数量。Optionally, the size of the target subject in the ith image is characterized by at least one of the following features: the width of the target subject in the ith image, the height of the target subject in the ith image, the The area of the target subject, or the number of pixels occupied by the target subject in the i-th image.

可选的,处理单元222还用于,采用实例分割算法从第i个图像中提取目标主体,以确定第i个图像中的目标主体的大小。Optionally, the processing unit 222 is further configured to extract the target subject from the i-th image by using an instance segmentation algorithm, so as to determine the size of the target subject in the i-th image.

可选的,显示单元223,用于在当前预览界面中,显示第一信息,第一信息用于指示停止拍摄希区柯克变焦视频。Optionally, the display unit 223 is configured to display first information in the current preview interface, and the first information is used to indicate to stop shooting the Hitchcock zoom video.

可选的,显示单元223,用于在当前预览界面中,显示第二信息,第二信息用于指示目标主体静止。Optionally, the display unit 223 is configured to display second information in the current preview interface, where the second information is used to indicate that the target subject is still.

可选的,显示单元223,用于在当前预览界面中,显示第三信息,第三信息用于指示目标主体在当前预览图像的中央。Optionally, the display unit 223 is configured to display third information in the current preview interface, and the third information is used to indicate that the target subject is in the center of the current preview image.

可选的,采集单元221具体用于,在目标主体在当前预览图像的中央时,采集第一个图像。Optionally, the acquisition unit 221 is specifically configured to acquire the first image when the target subject is in the center of the current preview image.

可选的,显示单元223,用于显示用户界面,用户界面中包含第一控件,第一控件用于指示由近及远拍摄希区柯克变焦视频;以及,接收针对第一控件的操作。采集单元221具体用于,响应于操作,针对第一场景实时采集N+1个图像。Optionally, the display unit 223 is configured to display a user interface, the user interface includes a first control, and the first control is used to indicate shooting a Hitchcock zoom video from near to far; and, receive an operation on the first control. The acquisition unit 221 is specifically configured to, in response to the operation, acquire N+1 images for the first scene in real time.

可选的,终端的移动速度小于等于预设速度。Optionally, the moving speed of the terminal is less than or equal to a preset speed.

可选的,预设神经网络用于结合历史网络层的特征图,对待处理图像的白平衡增益进行预测,以保证时域相邻图像的白平衡一致性;其中,历史网络层是预测在待处理图像之前且与待处理图像时域连续的图像的白平衡增益时所使用的网络层。Optionally, the preset neural network is used to predict the white balance gain of the image to be processed in combination with the feature map of the historical network layer, so as to ensure the white balance consistency of adjacent images in the temporal domain; The network layer used for the white balance gain of the image before processing the image and temporally continuous with the image to be processed.

可选的,预设神经网络基于预设约束条件训练得到;其中,预设约束条件包括:用于模拟时域连续的多个图像的白平衡增益预测值一致。Optionally, the preset neural network is trained based on preset constraint conditions; wherein, the preset constraint conditions include: the white balance gain prediction values for simulating multiple images continuous in time domain are consistent.

可选的,处理单元222在对于N+1个图像中后采集的N个图像,基于预设神经网络进行白平衡处理,得到N个优化图像的方面,具体用于:将N+1个图像中的第j个图像输入到预设神经网络,得到第j个图像的白平衡增益预测值;其中,2≤j≤N-1,j是整数。将第j个图像的白平衡增益预测值作用于第j个图像,得到第j个图像对应的优化图像;其中,N个优化图像包括第j个图像对应的优化图像。Optionally, the processing unit 222 performs white balance processing on the N images acquired after the N+1 images, based on a preset neural network, to obtain N optimized images, specifically for: converting the N+1 images The jth image in is input to the preset neural network to obtain the white balance gain prediction value of the jth image; where, 2≤j≤N-1, j is an integer. Applying the white balance gain prediction value of the jth image to the jth image to obtain an optimized image corresponding to the jth image; wherein, the N optimized images include the optimized image corresponding to the jth image.

在另一些实施例中:In other embodiments:

采集单元221,用于针对第一场景实时采集N+1个图像,N+1个图像中均包括目标主体;其中,在采集N+1个图像的过程中,终端距离目标主体越来越近;N是大于等于1的整数。N+1个图像中的第一个图像由终端的第一摄像头采集得到,N+1个图像中的后N个图像中的部分或全部图像由终端的第二摄像头采集得到,第二摄像头的倍率小于第一摄像头的倍率。N+1个图像中后采集的N个图像中目标主体的大小小于或等于N+1个图像中采集的第一个图像中的目标主体的大小。处理单元222,用于执行以下步骤:对于后采集的N个图像,基于预设神经网络进行白平衡处理,得到N个优化图像;预设神经网络用于保证时域相邻图像的白平衡一致性。对N个优化图像进行放大并裁剪,得到N个目标图像,N个目标图像中的目标主体的大小与N+1个图像中采集的第一个图像中目标主体的大小一致,该N个目标图像中目标主体的相对位置,与第一个图像中目标主体的相对位置一致。该N个目标图像与第一个图像的大小一致。基于该N个目标图像和第一个图像,生成希区柯克变焦视频。例如,结合图25,采集单元221可以用于执行S401,处理单元222可以用于执行S402-S404。The collection unit 221 is configured to collect N+1 images in real time for the first scene, and each of the N+1 images includes the target subject; wherein, during the process of collecting the N+1 images, the terminal is getting closer and closer to the target subject ; N is an integer greater than or equal to 1. The first image of the N+1 images is collected by the first camera of the terminal, part or all of the images of the last N images of the N+1 images are collected by the second camera of the terminal, and the The magnification is smaller than that of the first camera. The size of the target subject in the N images acquired later in the N+1 images is smaller than or equal to the size of the target subject in the first image acquired in the N+1 images. The processing unit 222 is configured to perform the following steps: for the N images collected later, perform white balance processing based on a preset neural network to obtain N optimized images; the preset neural network is used to ensure that the white balance of adjacent images in the time domain is consistent sex. Enlarge and crop the N optimized images to obtain N target images. The size of the target subject in the N target images is consistent with the size of the target subject in the first image collected in the N+1 images. The N target The relative position of the target subject in the image is consistent with the relative position of the target subject in the first image. The N target images are the same size as the first image. Based on the N target images and the first image, a Hitchcock zoom video is generated. For example, referring to FIG. 25, the collection unit 221 may be used to execute S401, and the processing unit 222 may be used to execute S402-S404.

可选的,后采集的N个图像包括在前采集的N1个图像和在后采集的N2个图像,其中,N1个图像由第二摄像头采集得到,N2个图像由终端的第三摄像头采集得到;N1和N2均是大于等于1的整数。Optionally, the N images collected later include N1 images collected before and N2 images collected later, where the N1 images are collected by the second camera, and the N2 images are collected by the third camera of the terminal ; Both N1 and N2 are integers greater than or equal to 1.

可选的,采集单元221在针对第一场景采集N+1个图像的方面,具体用于:获取N+1个图像中的第i个图像的拍摄倍率,其中,2≤i≤N,i是整数;如果第i个图像的拍摄倍率在第一拍摄倍率范围内,则基于第二摄像头针对第一场景采集N+1个图像中的第i+1个图像。如果第i个图像的拍摄倍率在第二拍摄倍率范围内,则基于第三摄像头针对第一场景采集N+1个图像中的第i+1个图像。其中,第二摄像头的倍率是b,第三摄像头的倍率是c;b>c;第一拍摄倍率范围是大于等于b的范围;第二拍摄倍率范围是[c,b)。Optionally, in terms of acquiring N+1 images for the first scene, the acquisition unit 221 is specifically configured to: acquire the shooting magnification of the i-th image in the N+1 images, where 2≤i≤N, i is an integer; if the shooting magnification of the i-th image is within the range of the first shooting magnification, the i+1-th image among the N+1 images of the first scene is collected based on the second camera. If the shooting magnification of the i-th image is within the second shooting magnification range, the i+1 th image of the N+1 images is collected for the first scene based on the third camera. Wherein, the magnification of the second camera is b, and the magnification of the third camera is c; b>c; the first shooting magnification range is greater than or equal to b; the second shooting magnification range is [c, b).

可选的,第i个图像的拍摄倍率是基于第i个图像中目标主体的大小相对于第一个图像中目标主体的大小的缩放倍率,和采集第一个图像的摄像头的倍率确定的。Optionally, the shooting magnification of the i-th image is determined based on the scaling magnification of the size of the target subject in the i-th image relative to the size of the target subject in the first image, and the magnification of the camera that captures the first image.

可选的,第i个图像中的目标主体的大小通过以下至少一个特征来表征:第i个图像中的目标主体的宽度,第i个图像中的目标主体的高度,第i个图像中的目标主体的面积,或者,第i个图像中的目标主体的所占的像素点的数量。Optionally, the size of the target subject in the ith image is characterized by at least one of the following features: the width of the target subject in the ith image, the height of the target subject in the ith image, the The area of the target subject, or the number of pixels occupied by the target subject in the i-th image.

可选的,处理单元222还用于,采用实例分割算法从第i个图像中提取目标主体,以确定第i个图像中的目标主体的大小。Optionally, the processing unit 222 is further configured to extract the target subject from the i-th image by using an instance segmentation algorithm, so as to determine the size of the target subject in the i-th image.

可选的,显示单元223,用于在当前预览界面中,显示第一信息,第一信息用于指示停止拍摄希区柯克变焦视频。Optionally, the display unit 223 is configured to display first information in the current preview interface, and the first information is used to indicate to stop shooting the Hitchcock zoom video.

可选的,显示单元223,用于在当前预览界面中,显示第二信息,第二信息用于指示目标主体静止。Optionally, the display unit 223 is configured to display second information in the current preview interface, where the second information is used to indicate that the target subject is still.

可选的,显示单元223,用于在当前预览界面中,显示第三信息,第三信息用于指示目标主体在当前预览图像的中央。Optionally, the display unit 223 is configured to display third information in the current preview interface, and the third information is used to indicate that the target subject is in the center of the current preview image.

可选的,采集单元221具体用于:在目标主体在当前预览图像的中央时,采集第一个图像。Optionally, the acquisition unit 221 is specifically configured to: acquire the first image when the target subject is in the center of the current preview image.

可选的,显示单元223,用于显示用户界面,用户界面中包含第二控件,第二控件用于指示由远及近拍摄希区柯克变焦视频;以及接收针对第二控件的操作。采集单元221具体用于,响应于操作,针对第一场景采集N+1个图像。Optionally, the display unit 223 is configured to display a user interface, the user interface includes a second control, and the second control is used to indicate shooting a Hitchcock zoom video from far to near; and receive an operation on the second control. The acquisition unit 221 is specifically configured to, in response to the operation, acquire N+1 images for the first scene.

可选的,终端的移动速度小于等于预设速度。Optionally, the moving speed of the terminal is less than or equal to a preset speed.

可选的,预设神经网络用于结合历史网络层的特征图,对待处理图像的白平衡增益进行预测,以保证时域相邻图像的白平衡一致性;其中,历史网络层是预测在待处理图像之前且与待处理图像时域连续的图像的白平衡增益时所使用的网络层。Optionally, the preset neural network is used to predict the white balance gain of the image to be processed in combination with the feature map of the historical network layer, so as to ensure the white balance consistency of adjacent images in the temporal domain; The network layer used for the white balance gain of the image before processing the image and temporally continuous with the image to be processed.

可选的,预设神经网络基于预设约束条件训练得到;其中,预设约束条件包括:用于模拟时域连续的多个图像的白平衡增益预测值一致。Optionally, the preset neural network is trained based on preset constraint conditions; wherein, the preset constraint conditions include: the white balance gain prediction values for simulating multiple images continuous in time domain are consistent.

可选的,对于N+1个图像中后采集的N个图像,基于预设神经网络进行白平衡处理,得到N个优化图像,包括:将N+1个图像中的第j个图像输入到预设神经网络,得到第j个图像的白平衡增益预测值;其中,2≤j≤N-1,j是整数。将第j个图像的白平衡增益预测值作用于第j个图像,得到第j个图像对应的优化图像;其中,N个优化图像包括第j个图像对应的优化图像。Optionally, for the N images collected later in the N+1 images, white balance processing is performed based on a preset neural network to obtain N optimized images, including: inputting the j-th image in the N+1 images to Preset the neural network to obtain the white balance gain prediction value of the jth image; where, 2≤j≤N-1, j is an integer. Applying the white balance gain prediction value of the jth image to the jth image to obtain an optimized image corresponding to the jth image; wherein, the N optimized images include the optimized image corresponding to the jth image.

在另一些实施例中:In other embodiments:

采集单元221包括第一摄像头和第二摄像头,第一摄像头的倍率与第二摄像头的倍率不同。采集单元221,用于通过第一摄像头和第二摄像头在第一时刻针对第一场景分别采集第一图像和第二图像;其中,第一图像和第二图像中均包含目标主体。处理单元222,用于执行以下步骤:基于视频的预设播放时长和预设播放帧率,确定第一图像和第二图像之间的待插入图像的帧数N;其中,N是大于等于1的整数。基于帧数N、第一图像和第二图像,确定N个待插入图像。基于第一图像、第二图像和待插入图像,生成视频;其中,该视频的各图像中目标主体的大小逐渐变大或逐渐变小。例如,结合图27,采集单元221可以用于执行S500,处理单元222可以用于执行S501-S503。The acquisition unit 221 includes a first camera and a second camera, and the magnification of the first camera is different from that of the second camera. The acquisition unit 221 is configured to respectively acquire a first image and a second image for the first scene at a first moment through the first camera and the second camera; wherein, both the first image and the second image contain a target subject. The processing unit 222 is configured to perform the following steps: determine the number N of frames of images to be inserted between the first image and the second image based on the preset playback duration and preset playback frame rate of the video; where N is greater than or equal to 1 an integer of . Based on the frame number N, the first image and the second image, N images to be inserted are determined. A video is generated based on the first image, the second image and the image to be inserted; wherein, the size of the target subject in each image of the video gradually becomes larger or smaller. For example, referring to FIG. 27, the collection unit 221 may be used to execute S500, and the processing unit 222 may be used to execute S501-S503.

可选的,采集单元221还包括第三摄像头,第三摄像头的倍率在第一摄像头与第二摄像头的倍率之间。采集单元221还用于,通过第三摄像头在第一时刻针对第一场景采集第三图像;其中,第三图像包含目标主体。处理单元222在基于帧数、第一图像中的目标主体的大小和第二图像中的目标主体的大小,确定N个待插入图像的方面,具体用于:基于帧数N、第一图像和第二图像,确定N个待插入图像的方面,具体用于:基于帧数N、第一图像、第二图像和第三图像,确定N个待插入图像。Optionally, the acquisition unit 221 further includes a third camera, and the magnification of the third camera is between those of the first camera and the second camera. The acquisition unit 221 is further configured to acquire a third image for the first scene at the first moment through the third camera; wherein, the third image includes the target subject. The processing unit 222 determines N images to be inserted based on the number of frames, the size of the target subject in the first image, and the size of the target subject in the second image, specifically for: based on the number of frames N, the size of the first image and The aspect of determining the N images to be inserted for the second image is specifically used for: determining the N images to be inserted based on the frame number N, the first image, the second image and the third image.

关于上述可选方式的具体描述可以参见前述的方法实施例,此处不再赘述。此外,上述提供的任一种终端220的解释以及有益效果的描述均可参考上述对应的方法实施例,不再赘述。For a specific description of the foregoing optional manners, reference may be made to the foregoing method embodiments, and details are not repeated here. In addition, for the explanations and descriptions of beneficial effects of any terminal 220 provided above, reference may be made to the corresponding method embodiments above, and details are not repeated here.

作为示例,结合图1,上述采集单元可以通过摄像头193实现。上述处理单元222的功能,均可以通过处理器110调用存储内部存储器121中的程度代码实现。As an example, with reference to FIG. 1 , the above acquisition unit may be implemented by a camera 193 . The above-mentioned functions of the processing unit 222 can all be implemented by the processor 110 calling the program code stored in the internal memory 121 .

本申请另一实施例还提供一种终端,包括:处理器、存储器和摄像头,摄像头用于采集图像,存储器用于存储计算机程序和指令,处理器用于调用计算机程序和指令,与摄像协同执行上述方法实施例所示的方法流程中该终端执行的相应步骤。Another embodiment of the present application also provides a terminal, including: a processor, a memory, and a camera, the camera is used to collect images, the memory is used to store computer programs and instructions, and the processor is used to call computer programs and instructions, and cooperate with the camera to execute the above-mentioned Corresponding steps performed by the terminal in the method flow shown in the method embodiment.

本申请另一实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当指令在终端执行上述方法实施例所示的方法流程中该终端执行的各个步骤。Another embodiment of the present application further provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are executed on a terminal, various steps performed by the terminal in the method flow shown in the above method embodiments are executed.

在一些实施例中,所公开的方法可以实施为以机器可读格式被编码在计算机可读存储介质上的或者被编码在其它非瞬时性介质或者制品上的计算机程序指令。In some embodiments, the disclosed methods can be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of manufacture.

应该理解,这里描述的布置仅仅是用于示例的目的。因而,本领域技术人员将理解,其它布置和其它元素(例如,机器、接口、功能、顺序、和功能组等等)能够被取而代之地使用,并且一些元素可以根据所期望的结果而一并省略。另外,所描述的元素中的许多是可以被实现为离散的或者分布式的组件的、或者以任何适当的组合和位置来结合其它组件实施的功能实体。It should be understood that the arrangements described herein are for example purposes only. Accordingly, those skilled in the art will appreciate that other arrangements and other elements (e.g., machines, interfaces, functions, sequences, and groups of functions, etc.) can be used instead, and some elements may be omitted altogether depending on the desired result. . In addition, many of the described elements are functional entities that may be implemented as discrete or distributed components, or implemented in conjunction with other components in any suitable combination and location.

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件程序实现时,可以全部或部分地以计算机程序产品的形式来实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机执行指令时,全部或部分地产生按照本申请实施例的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或者数据中心通过有线(例如同轴电缆、光纤、数字用户线(digitalsubscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可以用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质(例如,软盘、硬盘、磁带),光介质(例如,DVD)、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。In the above embodiments, all or part of them may be implemented by software, hardware, firmware or any combination thereof. When implemented using a software program, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When computer-executed instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. A computer can be a general purpose computer, special purpose computer, computer network, or other programmable device. Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, e.g. Coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (such as infrared, wireless, microwave, etc.) transmission to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that can be accessed by a computer, or may contain one or more data storage devices such as servers and data centers that can be integrated with the medium. Available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, solid state disk (solid state disk, SSD)) and the like.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the protection scope of the claims.

Claims (65)

1. A method for shooting video, which is applied to a terminal and comprises the following steps:
acquiring N +1 images in real time aiming at a first scene, wherein the N +1 images comprise target main bodies; wherein, in the process of collecting the N +1 images, the terminal is farther and farther away from the target main body; n is an integer of 1 or more;
carrying out white balance processing on the later acquired N images in the N +1 images based on a preset neural network to obtain N optimized images; the preset neural network is used for predicting the white balance gain of the image to be processed to ensure the white balance consistency of adjacent images in a time domain, and the image to be processed is an image in the adjacent images in the time domain;
amplifying and cutting the N optimized images to obtain N target images; wherein the size of the target subject in the N target images is consistent with the size of the target subject in a first image acquired in the N +1 images, and the relative position of the target subject in the N target images is consistent with the relative position of the target subject in the first image; the N target images are consistent with the first image in size;
generating a Hirschk zoom video based on the N target images and the first image.
2. The method of claim 1,
the N +1 images comprise N1+1 images acquired in the front and N2 images acquired in the back, wherein the N1+1 images are acquired by a first camera of the terminal, and the N2 images are acquired by a second camera of the terminal; and both the N1 and the N2 are integers which are more than or equal to 1.
3. The method of claim 1 or 2, wherein the acquiring N +1 images in real-time for a first scene comprises:
acquiring the shooting magnification of the ith image in the N +1 images; wherein i is not less than 2 and not more than N, and i is an integer;
acquiring an i +1 th image in the N +1 images aiming at the first scene based on a first camera of the terminal if the shooting magnification of the i image is in a first shooting magnification range;
if the shooting magnification of the ith image is within a second shooting magnification range, acquiring an (i + 1) th image in the (N + 1) th images aiming at the first scene based on a second camera of the terminal;
wherein the multiplying power of the first camera is a, and the multiplying power of the second camera is b; a is less than b; the first photographing magnification range is [ a, b); the second shooting magnification range is a range of b or more.
4. The method of claim 3,
the shooting magnification of the ith image is determined based on the scaling magnification of the size of the target subject in the ith image relative to the size of the target subject in the first image and the magnification of a camera which acquires the first image.
5. The method of claim 4, wherein the size of the target subject in the ith image is characterized by at least one of:
the width of the target subject in the ith image,
the height of the target subject in the ith image,
the area of the target subject in the ith image, or,
the number of pixel points occupied by the target subject in the ith image.
6. The method according to claim 4 or 5, characterized in that the method further comprises:
extracting the target subject from the ith image using an example segmentation algorithm to determine a size of the target subject in the ith image.
7. The method of any of claims 1 to 6, further comprising:
and displaying first information in the current preview interface, wherein the first information is used for indicating that the shooting of the Hockey zoom video is stopped.
8. The method of any one of claims 1 to 7, further comprising:
and displaying second information in the current preview interface, wherein the second information is used for indicating that the target main body is static.
9. The method according to any one of claims 1 to 8, further comprising:
and displaying third information in the current preview interface, wherein the third information is used for indicating that the target main body is in the center of the current preview image.
10. The method of any of claims 1 to 9, wherein the acquiring N +1 images in real-time for a first scene comprises:
the first image is acquired when the target subject is in the center of the current preview image.
11. The method of any one of claims 1 to 10, further comprising:
displaying a user interface, wherein the user interface comprises a first control used for indicating that a Cock zoom video in a Hirsch area is shot from near to far;
the acquiring N +1 images in real time for a first scene includes:
receiving an operation for the first control, and acquiring the N +1 images for the first scene in real time in response to the operation.
12. The method according to any one of claims 1 to 11, wherein the moving speed of the terminal is equal to or less than a preset speed.
13. The method of any one of claims 1 to 12,
the preset neural network is used for predicting the white balance gain of the image to be processed by combining the characteristic diagram of the historical network layer so as to ensure the white balance consistency of the adjacent images in the time domain; wherein the historical network layer is a network layer used in predicting a white balance gain of an image preceding and temporally continuous with the image to be processed.
14. The method of claim 13,
the preset neural network is obtained by training based on preset constraint conditions; wherein the preset constraint condition comprises: the predicted values of the white balance gains for a plurality of images which are continuous in an analog time domain are consistent.
15. The method according to any one of claims 1 to 14, wherein the performing white balance processing on N later-acquired images of the N +1 images based on a preset neural network to obtain N optimized images comprises:
inputting a jth image in the N +1 images into the preset neural network to obtain a white balance gain predicted value of the jth image; wherein j is more than or equal to 2 and less than or equal to N-1, and j is an integer;
applying the white balance gain predicted value of the jth image to obtain an optimized image corresponding to the jth image; wherein the N optimized images comprise the optimized image corresponding to the jth image.
16. A method for shooting video, which is applied to a terminal and comprises the following steps:
acquiring N +1 images aiming at a first scene, wherein the N +1 images comprise target main bodies; in the process of acquiring the N +1 images, the terminal is closer to the target main body; n is an integer of 1 or more; a first image in the N +1 images is acquired by a first camera of the terminal, and part or all of the last N images in the N +1 images are acquired by a second camera of the terminal, wherein the multiplying power of the second camera is smaller than that of the first camera; the size of the target subject in later acquired N images of the N +1 images is smaller than or equal to the size of the target subject in a first image acquired in the N +1 images;
performing white balance processing on the N images based on a preset neural network to obtain N optimized images; the preset neural network is used for predicting the white balance gain of an image to be processed to ensure the white balance consistency of adjacent images in a time domain, and the image to be processed is an image in the adjacent images in the time domain;
amplifying and cutting the N optimized images to obtain N target images; wherein the size of the target subject in the N target images is consistent with the size of the target subject in the first image, and the relative position of the target subject in the N target images is consistent with the relative position of the target subject in the first image; the N target images are consistent with the first image in size;
generating a Hirschk zoom video based on the N target images and the first image.
17. The method according to claim 16, wherein the N images comprise N1 images acquired before and N2 images acquired after, wherein the N1 images are acquired by the second camera and the N2 images are acquired by a third camera of the terminal; and both the N1 and the N2 are integers which are more than or equal to 1.
18. The method of claim 16 or 17, wherein acquiring N +1 images for a first scene comprises:
acquiring the shooting magnification of the ith image in the N +1 images; wherein i is not less than 2 and not more than N, and i is an integer;
acquiring an i +1 th image of the N +1 images for the first scene based on the second camera if the shooting magnification of the i image is within a first shooting magnification range;
if the shooting magnification of the ith image is within a second shooting magnification range, acquiring an (i + 1) th image in the (N + 1) th images aiming at the first scene based on a third camera of the terminal;
wherein the magnification of the second camera is b, and the magnification of the third camera is c; b is more than c; the first shooting magnification range is a range greater than or equal to b; the second photographing magnification range is [ c, b).
19. The method of claim 18,
the shooting magnification of the ith image is determined based on the zoom magnification of the size of the target subject in the ith image relative to the size of the target subject in the first image, and the magnification of a camera that captures the first image.
20. The method of claim 19, wherein the size of the target subject in the ith image is characterized by at least one of:
the width of the target subject in the ith image,
the height of the target subject in the ith image,
the area of the target subject in the ith image, or,
the number of pixel points occupied by the target subject in the ith image.
21. The method according to claim 19 or 20, further comprising:
extracting the target subject from the ith image using an example segmentation algorithm to determine a size of the target subject in the ith image.
22. The method of any one of claims 16 to 21, further comprising:
and displaying first information in the current preview interface, wherein the first information is used for indicating that the shooting of the Hockey zoom video is stopped.
23. The method of any one of claims 16 to 22, further comprising:
and displaying second information in the current preview interface, wherein the second information is used for indicating that the target main body is static.
24. The method of any one of claims 16 to 23, further comprising:
and displaying third information in the current preview interface, wherein the third information is used for indicating that the target main body is in the center of the current preview image.
25. The method of any of claims 16 to 24, wherein acquiring N +1 images for a first scene comprises:
the first image is acquired when the target subject is in the center of the current preview image.
26. The method of any one of claims 16 to 25, further comprising:
displaying a user interface, wherein the user interface comprises a second control used for indicating that a Cock zoom video in a Hirsch area is shot from far to near;
the acquiring N +1 images for a first scene includes:
receiving an operation on the second control, and acquiring the N +1 images for the first scene in response to the operation.
27. The method according to any one of claims 16 to 26, wherein the moving speed of the terminal is equal to or less than a preset speed.
28. The method according to any one of claims 16 to 27,
the preset neural network is used for predicting the white balance gain of the image to be processed by combining the characteristic diagram of the historical network layer so as to ensure the white balance consistency of the adjacent images in the time domain; wherein the historical network layer is a network layer used in predicting a white balance gain of an image preceding and temporally continuous with the image to be processed.
29. The method of claim 28,
the preset neural network is obtained by training based on preset constraint conditions; wherein the preset constraint condition comprises: the predicted values of the white balance gains for a plurality of images which are continuous in an analog time domain are consistent.
30. The method according to any one of claims 16 to 29, wherein the performing white balance processing on N later-acquired images of the N +1 images based on a preset neural network to obtain N optimized images comprises:
inputting a jth image in the N +1 images into the preset neural network to obtain a white balance gain predicted value of the jth image; wherein j is more than or equal to 2 and less than or equal to N-1, and j is an integer;
applying the white balance gain predicted value of the jth image to obtain an optimized image corresponding to the jth image; wherein the N optimized images comprise the optimized image corresponding to the jth image.
31. A method for shooting videos is applied to a terminal, the terminal comprises a first camera and a second camera, the magnification of the first camera is different from that of the second camera, and the method comprises the following steps:
respectively acquiring a first image and a second image for a first scene at a first time through the first camera and the second camera; wherein the first image and the second image both contain a target subject;
determining the number N of frames of the images to be inserted between the first image and the second image based on the preset playing duration and the preset playing frame rate of the video; wherein N is an integer of 1 or more;
determining N images to be inserted based on the frame number N, the first image and the second image;
generating the video based on the first image, the second image and the N images to be inserted; wherein the size of the target subject in each image of the video gradually becomes larger or smaller.
32. The method of claim 31, wherein the terminal further comprises a third camera having a magnification between the magnifications of the first camera and the second camera, the method further comprising:
acquiring, by the third camera, a third image for the first scene at the first time; wherein the third image contains the target subject;
the determining N images to be inserted based on the frame number, the first image, and the second image includes:
and determining N images to be inserted based on the frame number, the first image, the second image and the third image.
33. A terminal, characterized in that the terminal comprises:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring N +1 images in real time aiming at a first scene, and the N +1 images comprise target main bodies; wherein, in the process of collecting the N +1 images, the terminal is farther and farther away from the target main body; n is an integer of 1 or more;
a processing unit for performing the steps of:
carrying out white balance processing on the later acquired N images in the N +1 images based on a preset neural network to obtain N optimized images; the preset neural network is used for predicting the white balance gain of the image to be processed to ensure the white balance consistency of adjacent images in a time domain, and the image to be processed is an image in the adjacent images in the time domain;
amplifying and cutting the N optimized images to obtain N target images; wherein the size of the target subject in the N target images is consistent with the size of the target subject in a first image acquired in the N +1 images, and the relative position of the target subject in the N target images is consistent with the relative position of the target subject in the first image; the N target images are consistent with the first image in size;
generating a Hirschk zoom video based on the N target images and the first image.
34. The terminal of claim 33,
the N +1 images comprise N1+1 images acquired in the front and N2 images acquired in the back, wherein the N1+1 images are acquired by a first camera of the terminal, and the N2 images are acquired by a second camera of the terminal; and both the N1 and the N2 are integers which are more than or equal to 1.
35. The terminal according to claim 33 or 34, wherein the acquisition unit is specifically configured to:
acquiring the shooting magnification of the ith image in the N +1 images; wherein i is not less than 2 and not more than N, i is an integer;
acquiring an i +1 th image in the N +1 images aiming at the first scene based on a first camera of the terminal if the shooting magnification of the i image is in a first shooting magnification range;
if the shooting magnification of the ith image is within a second shooting magnification range, acquiring an (i + 1) th image in the (N + 1) th images aiming at the first scene based on a second camera of the terminal;
wherein the multiplying power of the first camera is a, and the multiplying power of the second camera is b; a is less than b; the first photographing magnification range is [ a, b); the second shooting magnification range is a range of b or more.
36. The terminal of claim 35,
the shooting magnification of the ith image is determined based on the zoom magnification of the size of the target subject in the ith image relative to the size of the target subject in the first image, and the magnification of a camera that captures the first image.
37. The terminal of claim 36, wherein the size of the target subject in the ith image is characterized by at least one of:
the width of the target subject in the ith image,
the height of the target subject in the ith image,
the area of the target subject in the ith image, or,
the number of pixel points occupied by the target subject in the ith image.
38. The terminal according to claim 36 or 37,
the processing unit is further configured to extract the target subject from the ith image using an instance segmentation algorithm to determine a size of the target subject in the ith image.
39. The terminal according to any of claims 33 to 38, characterized in that the terminal further comprises:
and the display unit is used for displaying first information in the current preview interface, wherein the first information is used for indicating that the shooting of the Hirschhorn zoom video is stopped.
40. The terminal according to any of claims 33 to 39, wherein the terminal further comprises:
and the display unit is used for displaying second information in the current preview interface, wherein the second information is used for indicating that the target main body is static.
41. The terminal according to any of claims 33 to 40, characterized in that the terminal further comprises:
and the display unit is used for displaying third information in the current preview interface, wherein the third information is used for indicating that the target main body is in the center of the current preview image.
42. A terminal according to any of claims 33 to 41,
the acquisition unit is specifically configured to acquire the first image when the target subject is in the center of the current preview image.
43. The terminal according to any of claims 33 to 42, characterized in that the terminal further comprises:
the display unit is used for displaying a user interface, the user interface comprises a first control, and the first control is used for indicating that a Cock zoom video in a Hirsch area is shot from near to far; and receiving an operation directed to the first control;
the acquiring unit is specifically configured to acquire, in response to the operation, the N +1 images for the first scene.
44. A terminal as claimed in any one of claims 33 to 43, wherein the speed of movement of the terminal is less than or equal to a predetermined speed.
45. The terminal according to any of claims 33 to 44,
the preset neural network is used for predicting the white balance gain of the image to be processed by combining the characteristic diagram of the historical network layer so as to ensure the white balance consistency of the adjacent images in the time domain; wherein the historical network layer is a network layer used in predicting a white balance gain of an image preceding and temporally continuous with the image to be processed.
46. The terminal of claim 45,
the preset neural network is obtained by training based on preset constraint conditions; wherein the preset constraint condition comprises: the predicted values of the white balance gains for a plurality of images which are continuous in an analog time domain are consistent.
47. The terminal according to any one of claims 33 to 46, wherein the processing unit is configured to, in the respect of performing white balance processing on the N images acquired later in the N +1 images based on a preset neural network to obtain N optimized images, specifically:
inputting a jth image in the N +1 images into the preset neural network to obtain a white balance gain predicted value of the jth image; wherein j is more than or equal to 2 and less than or equal to N-1, and j is an integer;
applying the white balance gain predicted value of the jth image to obtain an optimized image corresponding to the jth image; wherein the N optimized images comprise the optimized image corresponding to the jth image.
48. A terminal, characterized in that the terminal comprises:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring N +1 images aiming at a first scene, and the N +1 images comprise target bodies; wherein, in the process of acquiring the N +1 images, the terminal is closer to the target main body; n is an integer of 1 or more; a first image in the N +1 images is acquired by a first camera of the terminal, and part or all of the last N images in the N +1 images are acquired by a second camera of the terminal, wherein the multiplying power of the second camera is smaller than that of the first camera; the size of the target subject in later-acquired N images of the N +1 images is smaller than or equal to the size of the target subject in a first image acquired in the N +1 images;
a processing unit for performing the steps of:
performing white balance processing on the N images based on a preset neural network to obtain N optimized images; the preset neural network is used for predicting the white balance gain of an image to be processed to ensure the white balance consistency of adjacent images in a time domain, and the image to be processed is an image in the adjacent images in the time domain;
amplifying and cutting the N optimized images to obtain N target images; wherein the size of the target subject in the N target images is consistent with the size of the target subject in the first image, and the relative position of the target subject in the N target images is consistent with the relative position of the target subject in the first image; the N target images are consistent with the first image in size;
generating a Hirschk zoom video based on the N target images and the first image.
49. The terminal of claim 48, wherein the N images comprise N1 images captured in front and N2 images captured in back, wherein the N1 images are captured by the second camera and the N2 images are captured by a third camera of the terminal; and both the N1 and the N2 are integers which are more than or equal to 1.
50. The terminal of claim 48 or 49, wherein the acquisition unit is specifically configured to:
acquiring the shooting magnification of the ith image in the N +1 images; wherein i is not less than 2 and not more than N, and i is an integer;
acquiring an i +1 th image of the N +1 images for the first scene based on the second camera if the shooting magnification of the i image is within a first shooting magnification range;
acquiring an i +1 th image in the N +1 images for the first scene based on a third camera of the terminal if the shooting magnification of the i image is within a second shooting magnification range;
wherein the magnification of the second camera is b, and the magnification of the third camera is c; b is more than c; the first shooting magnification range is a range greater than or equal to b; the second photographing magnification range is [ c, b).
51. The terminal of claim 50,
the shooting magnification of the ith image is determined based on the zoom magnification of the size of the target subject in the ith image relative to the size of the target subject in the first image, and the magnification of a camera that captures the first image.
52. The terminal of claim 51, wherein the size of the target subject in the ith image is characterized by at least one of:
the width of the target subject in the ith image,
the height of the target subject in the ith image,
the area of the target subject in the ith image, or,
the number of pixel points occupied by the target subject in the ith image.
53. The terminal according to claim 51 or 52,
the processing unit is further configured to extract the target subject from the ith image using an instance segmentation algorithm to determine a size of the target subject in the ith image.
54. The terminal according to any of claims 48 to 53, wherein the terminal further comprises:
and the display unit is used for displaying first information in the current preview interface, wherein the first information is used for indicating that the shooting of the Hirschhorn zoom video is stopped.
55. The terminal according to any of the claims 48 to 54, characterized in that the terminal further comprises:
and the display unit is used for displaying second information in the current preview interface, and the second information is used for indicating that the target main body is static.
56. The terminal according to any of claims 48 to 55, characterized in that the terminal further comprises:
and the display unit is used for displaying third information in the current preview interface, wherein the third information is used for indicating that the target main body is in the center of the current preview image.
57. A terminal as claimed in any one of claims 48 to 56,
the acquisition unit is specifically configured to: the first image is acquired when the target subject is in the center of the current preview image.
58. A terminal as claimed in any of claims 48 to 57, further comprising:
the display unit is used for displaying a user interface, the user interface comprises a second control, and the second control is used for indicating that the Koch zoom video is shot from far to near; and receiving an operation directed to the second control;
the acquisition unit is specifically configured to, in response to the operation, acquire the N +1 images for the first scene.
59. A terminal as claimed in any one of claims 48 to 58, wherein the speed of movement of the terminal is less than or equal to a predetermined speed.
60. The terminal according to any of the claims 48 to 59,
the preset neural network is used for predicting the white balance gain of the image to be processed by combining the characteristic diagram of the historical network layer so as to ensure the white balance consistency of the adjacent images in the time domain; wherein the historical network layer is a network layer used in predicting a white balance gain of an image preceding and temporally continuous with the image to be processed.
61. The terminal according to claim 60,
the preset neural network is obtained by training based on preset constraint conditions; wherein the preset constraint condition comprises: the predicted values of the white balance gains for a plurality of images which are continuous in an analog time domain are consistent.
62. The terminal according to any one of claims 48 to 61, wherein the performing white balance processing on the N later-collected images in the N +1 images based on a preset neural network to obtain N optimized images comprises:
inputting a jth image in the N +1 images into the preset neural network to obtain a white balance gain predicted value of the jth image; wherein j is not less than 2 and not more than N-1, j is an integer;
applying the white balance gain predicted value of the jth image to obtain an optimized image corresponding to the jth image; wherein the N optimized images comprise an optimized image corresponding to the jth image.
63. A terminal is characterized by comprising an acquisition unit and a processing unit, wherein the acquisition unit comprises a first camera and a second camera, and the multiplying power of the first camera is different from that of the second camera;
the acquisition unit is used for respectively acquiring a first image and a second image aiming at a first scene at a first time through the first camera and the second camera; wherein the first image and the second image both contain a target subject;
the processing unit is used for executing the following steps:
determining the number N of frames of the images to be inserted between the first image and the second image based on the preset playing duration and the preset playing frame rate of the video; wherein N is an integer of 1 or more;
determining N images to be inserted based on the frame number N, the first image and the second image;
generating the video based on the first image, the second image and the N images to be inserted; wherein the size of the target subject in each image of the video gradually becomes larger or smaller.
64. The terminal of claim 63, wherein the capture unit further comprises a third camera having a magnification between the magnifications of the first camera and the second camera;
the acquisition unit is further configured to acquire, by the third camera, a third image for the first scene at the first time; wherein the third image includes the target subject;
the processing unit, in the aspect of determining N images to be inserted based on the frame number, the first image, and the second image, is specifically configured to:
and determining N images to be inserted based on the frame number, the first image, the second image and the third image.
65. A terminal, comprising: a processor, a memory for storing computer programs and instructions, and a camera, the processor for invoking the computer programs and instructions to perform the method of any of claims 1-32 in cooperation with the camera.
CN202011043999.XA 2020-05-30 2020-09-28 Method and device for shooting video Active CN113747085B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/094695 WO2021244295A1 (en) 2020-05-30 2021-05-19 Method and device for recording video

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2020104805363 2020-05-30
CN202010480536 2020-05-30

Publications (2)

Publication Number Publication Date
CN113747085A CN113747085A (en) 2021-12-03
CN113747085B true CN113747085B (en) 2023-01-06

Family

ID=78728055

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202011044018.3A Active CN113747050B (en) 2020-05-30 2020-09-28 Shooting method and equipment
CN202011043999.XA Active CN113747085B (en) 2020-05-30 2020-09-28 Method and device for shooting video

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202011044018.3A Active CN113747050B (en) 2020-05-30 2020-09-28 Shooting method and equipment

Country Status (2)

Country Link
CN (2) CN113747050B (en)
WO (2) WO2022062318A1 (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002338B (en) * 2021-12-10 2023-06-02 荣耀终端有限公司 Method and device for controlling shooting parameters
CN116546316B (en) * 2022-01-25 2023-12-08 荣耀终端有限公司 Method for switching cameras and electronic equipment
CN114500852B (en) * 2022-02-25 2024-04-19 维沃移动通信有限公司 Photographing method, photographing device, electronic device and readable storage medium
CN118474535A (en) * 2022-02-28 2024-08-09 荣耀终端有限公司 Multi-camera strategy scheduling method and related equipment
WO2023220868A1 (en) * 2022-05-16 2023-11-23 北京小米移动软件有限公司 Image processing method and apparatus, terminal, and storage medium
CN116051368B (en) * 2022-06-29 2023-10-20 荣耀终端有限公司 Image processing methods and related equipment
CN116055871B (en) * 2022-08-31 2023-10-20 荣耀终端有限公司 Video processing methods and related equipment
CN115965942B (en) * 2023-03-03 2023-06-23 安徽蔚来智驾科技有限公司 Position estimation method, vehicle control method, device, medium and vehicle
CN117596497B (en) * 2023-09-28 2024-11-22 书行科技(北京)有限公司 Image rendering method, device, electronic device and computer-readable storage medium
CN117459830B (en) * 2023-12-19 2024-04-05 北京搜狐互联网信息服务有限公司 A method and system for automatic zooming of a mobile device
CN118574005B (en) * 2024-08-01 2024-12-24 荣耀终端有限公司 Shooting method, shooting device, storage medium and program product
CN119788967B (en) * 2025-03-13 2025-06-13 深圳市博坦智能有限公司 Aerial photography push-track zoom method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011223174A (en) * 2010-04-06 2011-11-04 Canon Inc Imaging device and method for controlling the same
CN109379537A (en) * 2018-12-30 2019-02-22 北京旷视科技有限公司 Slide Zoom effect implementation method, device, electronic equipment and computer readable storage medium
CN110262737A (en) * 2019-06-25 2019-09-20 维沃移动通信有限公司 A kind of processing method and terminal of video data
CN110651466A (en) * 2018-05-31 2020-01-03 深圳市大疆创新科技有限公司 Shooting control method and device for movable platform
CN111083380A (en) * 2019-12-31 2020-04-28 维沃移动通信有限公司 A video processing method, electronic device and storage medium

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007086269A (en) * 2005-09-21 2007-04-05 Hitachi Kokusai Electric Inc Camera device and focal length adjustment method of zoom lens optical system of camera device
CN104717427B (en) * 2015-03-06 2018-06-08 广东欧珀移动通信有限公司 A kind of automatic zooming method, device and mobile terminal
JP6512897B2 (en) * 2015-03-30 2019-05-15 キヤノン株式会社 Zoom control device, control method of zoom control device
CN106412547B (en) * 2016-08-29 2019-01-22 厦门美图之家科技有限公司 A kind of image white balance method based on convolutional neural networks, device and calculate equipment
KR20180056182A (en) * 2016-11-18 2018-05-28 엘지전자 주식회사 Mobile terminal and method for controlling the same
US10321069B2 (en) * 2017-04-25 2019-06-11 International Business Machines Corporation System and method for photographic effects
CN108234879B (en) * 2018-02-02 2021-01-26 成都西纬科技有限公司 Method and device for acquiring sliding zoom video
CN110557550B (en) * 2018-05-31 2020-10-30 杭州海康威视数字技术股份有限公司 Focusing method, device and computer readable storage medium
US10791310B2 (en) * 2018-10-02 2020-09-29 Intel Corporation Method and system of deep learning-based automatic white balancing
CN109361865B (en) * 2018-11-21 2020-08-04 维沃移动通信(杭州)有限公司 Shooting method and terminal
CN110785993A (en) * 2018-11-30 2020-02-11 深圳市大疆创新科技有限公司 Control method and device of shooting equipment, equipment and storage medium
CN110198413B (en) * 2019-06-25 2021-01-08 维沃移动通信有限公司 Video shooting method, video shooting device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011223174A (en) * 2010-04-06 2011-11-04 Canon Inc Imaging device and method for controlling the same
CN110651466A (en) * 2018-05-31 2020-01-03 深圳市大疆创新科技有限公司 Shooting control method and device for movable platform
CN109379537A (en) * 2018-12-30 2019-02-22 北京旷视科技有限公司 Slide Zoom effect implementation method, device, electronic equipment and computer readable storage medium
CN110262737A (en) * 2019-06-25 2019-09-20 维沃移动通信有限公司 A kind of processing method and terminal of video data
CN111083380A (en) * 2019-12-31 2020-04-28 维沃移动通信有限公司 A video processing method, electronic device and storage medium

Also Published As

Publication number Publication date
CN113747085A (en) 2021-12-03
WO2022062318A1 (en) 2022-03-31
WO2021244295A1 (en) 2021-12-09
CN113747050B (en) 2023-04-18
CN113747050A (en) 2021-12-03

Similar Documents

Publication Publication Date Title
CN113747085B (en) Method and device for shooting video
CN113132620B (en) Image shooting method and related device
CN115484380B (en) Shooting method, graphical user interface and electronic equipment
JP2023511581A (en) Long focus imaging method and electronic device
CN113497881B (en) Image processing method and device
CN113986070B (en) A quick viewing method and electronic device for an application card
CN113556466B (en) Focusing method and electronic equipment
CN115794287A (en) A display method, electronic device and computer storage medium
CN115131222A (en) An image processing method and related equipment
CN113452969B (en) Image processing method and device
CN117119285B (en) A method of shooting
US12192616B2 (en) Photographing method and apparatus
CN115883957B (en) A method of recommending shooting modes
US20230014272A1 (en) Image processing method and apparatus
CN115643485B (en) Photography methods and electronic equipment
US20240107092A1 (en) Video playing method and apparatus
WO2022228010A1 (en) Method for generating cover, and electronic device
WO2023160224A9 (en) Photographing method and related device
CN115883958A (en) Portrait shooting method
CN117177064A (en) Shooting method and related equipment
CN116709018B (en) Zoom bar segmentation method and electronic equipment
CN120224015A (en) Zooming method and device with multiple cameras
CN117857915A (en) Photographing method, photographing device and electronic 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