Video shooting method and device, storage medium and electronic equipment

文档序号:1675833 发布日期:2019-12-31 浏览:13次 中文

阅读说明:本技术 视频拍摄方法、装置、存储介质及电子设备 (Video shooting method and device, storage medium and electronic equipment ) 是由 姚坤 于 2019-08-06 设计创作,主要内容包括:本申请实施例公开了一种视频拍摄方法、装置、存储介质及电子设备,其中,本申请实施例通过第一摄像头和第二摄像头对目标场景进行拍摄,获取第一视频流和第二视频流,其中,第一摄像头与第二摄像头的焦距不同;获取第一视频流中的第一图像,以及第二视频流中与第一图像对应的第二图像;对第二图像进行畸变矫正处理,得到第三图像;对第三图像和第一图像进行对齐处理,将对齐处理后的第一图像和第三图像合并处理,得到第四图像;对多帧第四图像进行视频编码处理,生成三维视频,实现三维视频的录制。(The embodiment of the application discloses a video shooting method, a video shooting device, a storage medium and electronic equipment, wherein a first camera and a second camera are used for shooting a target scene to obtain a first video stream and a second video stream, wherein the focal lengths of the first camera and the second camera are different; acquiring a first image in a first video stream and a second image corresponding to the first image in a second video stream; carrying out distortion correction processing on the second image to obtain a third image; aligning the third image and the first image, and combining the aligned first image and the aligned third image to obtain a fourth image; and carrying out video coding processing on the multi-frame fourth image to generate a three-dimensional video, thereby realizing the recording of the three-dimensional video.)

1. A video shooting method is applied to an electronic device, the electronic device comprises a first camera and a second camera, and the method comprises the following steps:

shooting a target scene through the first camera and the second camera to obtain a first video stream and a second video stream, wherein the focal lengths of the first camera and the second camera are different;

acquiring a first image in a first video stream and a second image corresponding to the first image in a second video stream;

carrying out distortion correction processing on the second image to obtain a third image;

aligning the third image and the first image, and combining the aligned first image and the aligned third image to obtain a fourth image;

and carrying out video coding processing on the plurality of frames of the fourth image to generate a three-dimensional video.

2. The video capture method of claim 1, wherein said obtaining a first image in a first video stream and a second image in a second video stream corresponding to the first image comprises:

acquiring a first image in a first video stream;

acquiring a timestamp of the first image;

and acquiring an image with the shooting time closest to the first image from the second video stream as a second image corresponding to the first image according to the time stamp.

3. The video capture method of claim 1, wherein said performing distortion correction processing on said second image to obtain a third image comprises:

acquiring calibration parameters of the second camera;

and carrying out distortion correction processing on the second image according to the calibration parameters.

4. The video capture method of claim 1, wherein said aligning the third image with the first image comprises:

detecting characteristic points of the first image and the third image to obtain matched characteristic point pairs;

calculating a homography matrix according to the matching characteristic point pairs;

mapping pixel points on the third image to the first image according to the homography matrix so as to align the third image with the first image.

5. The video capture method of claim 1, wherein capturing the target scene with the first camera and the second camera further comprises, prior to acquiring the first video stream and the second video stream:

when the shooting mode is detected to be switched to the three-dimensional video shooting mode, acquiring a preview image of the target scene through the first camera; starting the first camera;

and according to the preview image, determining a target camera from the wide-angle camera and the telephoto camera, and taking the target camera as the second camera.

6. The video capture method of claim 5, wherein prior to capturing the target scene with the first camera and the second camera, further comprising:

and initializing a video recording interface according to preset parameters.

7. The video shooting method of any one of claims 1 to 6, wherein the electronic device further comprises a display screen, and after the shooting of the target scene by the first camera and the second camera and the acquisition of the first video stream and the second video stream, further comprises:

previewing a video recording on the display screen based on the first video stream.

8. A video shooting device is applied to an electronic device, the electronic device comprises a first camera and a second camera, and the video shooting device comprises:

the image shooting module is used for shooting a target scene through the first camera and the second camera to obtain a first video stream and a second video stream, wherein the focal lengths of the first camera and the second camera are different;

the image acquisition module is used for acquiring a first image in a first video stream and a second image corresponding to the first image in a second video stream;

the image correction module is used for carrying out distortion correction processing on the second image to obtain a third image;

the alignment and combination module is used for performing alignment processing on the third image and the first image, and combining the aligned first image and the aligned third image to obtain a fourth image;

and the video coding module is used for carrying out video coding processing on the fourth image to generate a three-dimensional video.

9. A storage medium having stored thereon a computer program, characterized in that, when the computer program runs on a computer, it causes the computer to execute the video capturing method according to any one of claims 1 to 8.

10. An electronic device comprising a processor and a memory, the memory storing a computer program, wherein the processor is configured to execute the video capture method of any of claims 1 to 7 by invoking the computer program.

11. An electronic device, comprising:

the first camera is used for shooting a target scene to obtain a first video stream;

a second camera for shooting the target scene to obtain a second video stream, the second camera having a different focal length from the first camera;

a processor, the treater respectively with first camera, second camera electric connection, the treater is used for:

acquiring a first image in a first video stream and a second image corresponding to the first image in a second video stream;

carrying out distortion correction processing on the second image to obtain a third image;

and carrying out alignment processing on the third image and the first image, and combining the aligned first image and the aligned third image to obtain a fourth image.

Technical Field

The present application relates to the field of image processing technologies, and in particular, to a video shooting method and apparatus, a storage medium, and an electronic device.

Background

Video recording means that image frames are continuously captured and recorded, and the images are arranged according to a time sequence to obtain a video. At present, video recording becomes an important way for people to record and share life, and compared with photographing, video recording can record life more vividly. However, most of video recordings provided by related electronic devices are ordinary video recordings, and no three-dimensional video recording scheme is provided.

Disclosure of Invention

The embodiment of the application provides a video shooting method, a video shooting device, a storage medium and electronic equipment, which can record three-dimensional videos.

In a first aspect, an embodiment of the present application provides a video shooting method, where the method is applied to an electronic device, where the electronic device includes a first camera and a second camera, and the method includes:

shooting a target scene through the first camera and the second camera to obtain a first video stream and a second video stream, wherein the focal lengths of the first camera and the second camera are different;

acquiring a first image in a first video stream and a second image corresponding to the first image in a second video stream;

carrying out distortion correction processing on the second image to obtain a third image;

aligning the third image and the first image, and combining the aligned first image and the aligned third image to obtain a fourth image;

and carrying out video coding processing on the fourth image to generate a three-dimensional video.

In a second aspect, an embodiment of the present application provides a video shooting apparatus, where the apparatus is applied to an electronic device, where the electronic device includes a first camera and a second camera, and the apparatus includes:

the image shooting module is used for shooting a target scene through the first camera and the second camera to obtain a first video stream and a second video stream, wherein the focal lengths of the first camera and the second camera are different;

the image acquisition module is used for acquiring a first image in a first video stream and a second image corresponding to the first image in a second video stream;

the image correction module is used for carrying out distortion correction processing on the second image to obtain a third image;

the alignment and combination module is used for performing alignment processing on the third image and the first image, and combining the aligned first image and the aligned third image to obtain a fourth image;

and the video coding module is used for carrying out video coding processing on the fourth image to generate a three-dimensional video.

In a third aspect, embodiments of the present application provide a storage medium having a computer program stored thereon, which, when run on a computer, causes the computer to execute a video shooting method as provided in any of the embodiments of the present application.

In a fourth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, where the memory has a computer program, and the processor is configured to execute the video shooting method according to any embodiment of the present application by calling the computer program.

In a fifth aspect, an embodiment of the present application provides an electronic device, including:

the first camera is used for shooting a target scene to obtain a first video stream;

a second camera for shooting the target scene to obtain a second video stream, the second camera having a different focal length from the first camera;

a processor, the treater respectively with first camera, second camera electric connection, the treater is used for:

acquiring a first image in a first video stream and a second image corresponding to the first image in a second video stream;

carrying out distortion correction processing on the second image to obtain a third image;

and carrying out alignment processing on the third image and the first image, and combining the aligned first image and the aligned third image to obtain a fourth image.

According to the embodiment of the application, the target scene is shot through the plurality of cameras of the electronic equipment, the obtained images are subjected to synthesis processing, and the recording of the three-dimensional video is achieved.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.

Fig. 1 is a schematic flowchart of a first video shooting method according to an embodiment of the present disclosure.

Fig. 2 is a schematic view of a video recording flow of a video shooting method according to an embodiment of the present application.

Fig. 3 is a playing picture of a three-dimensional video obtained by the video shooting method according to the embodiment of the present application.

Fig. 4 is a schematic view of video preview during three-dimensional video recording in the video shooting method according to the embodiment of the present application.

Fig. 5 is a schematic structural diagram of a video capture device according to an embodiment of the present application.

Fig. 6 is a schematic structural diagram of a first electronic device according to an embodiment of the present application.

Fig. 7 is a second structural schematic diagram of an electronic device according to an embodiment of the present application.

Detailed Description

The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without inventive step, are within the scope of the present application.

Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.

The embodiment of the application provides a video shooting method, and an execution main body of the video shooting method can be the video shooting device provided by the embodiment of the application or an electronic device integrated with the video shooting device. The electronic device may be a smart phone, a tablet computer, a palm computer, a notebook computer, or a desktop computer.

Referring to fig. 1, fig. 1 is a first flowchart illustrating a video shooting method according to an embodiment of the present disclosure. The specific flow of the video shooting method provided by the embodiment of the application can be as follows:

101. shooting a target scene through a first camera and a second camera to obtain a first video stream and a second video stream, wherein the focal lengths of the first camera and the second camera are different.

The embodiment of the application can be applied to electronic equipment, and by taking a smart phone as an example, a plurality of cameras, such as a first camera and one or more other second cameras with different focal lengths from the first camera, can be arranged on the back face of the smart phone. Wherein, first camera can be standard camera lens, and first camera can regard as electronic equipment's main camera. The first camera is a lens with a focal length between 40 and 55 millimeters. The picture observed from the first camera is very close to the picture seen by human eyes, and the image shot by the first camera is relatively 'real'.

The second camera can regard as electronic equipment's supplementary camera, and the second camera can include wide-angle camera, and wide-angle camera's focal length is shorter than the focal length of first camera, can be ordinary wide-angle camera, and for example the focal length is 38-24 millimeters, and the visual angle is 60-84 degrees. The wide-angle lens can shoot a picture with a short distance and a large scene, and the shot picture is much larger than that seen by human eyes; the picture of the wide-angle lens emphasizes the foreground and highlights the far-near contrast, namely, near objects in the picture are larger, far objects are smaller, and the wide-angle lens has a strong perspective effect. The second camera may further include a tele camera having a longer focal length than the first camera. The telephoto lens can photograph a distant object, and can effectively blur the main body with the background protruded.

It should be noted that the second camera is not limited to this, and the second camera may also include an ultra-wide angle camera, for example, with a focal length of 20-13 mm and a viewing angle of 94-118 degrees. The second camera may also include a depth camera. It is to be understood that the second camera may be one or more of a wide camera, a tele camera, and a depth camera.

When the electronic equipment enters a 3D video (three-dimensional video) shooting mode, starting a first camera and a second camera and simultaneously carrying out video recording on a target scene, wherein the first camera shoots the target scene and outputs a first video stream; and the second camera shoots the target scene and outputs a second video stream.

102. A first image in a first video stream and a second image corresponding to the first image in a second video stream are obtained.

Referring to fig. 2, fig. 2 is a schematic image flow diagram of a video shooting method according to an embodiment of the present disclosure. In a 3D video recording mode, the first camera and the second camera can continuously shoot a target scene to respectively obtain a first video stream and a second video stream. The first video stream and the second video stream are both formed by continuous multi-frame images, and because the first camera and the second camera are respectively positioned at different positions of a backboard of the electronic equipment and have a certain distance on a horizontal line or a vertical line, a target scene can be shot from different angles, and in addition, the focal lengths of the first camera and the second camera are different, the shot target scene also has different visual angles.

It is understood that, in order to improve the efficiency of video composition, the first camera and the second camera may have the same data stream format, video bit rate, video resolution, video frame rate, and the like when performing video recording.

Since the video is composed of a continuous sequence of images, for each frame of image in the first video stream, it needs to be synthesized with the corresponding image in the second video stream. Therefore, according to the sequence of shooting time from first to last, aiming at each frame of first image in the first video stream, the second image corresponding to the first image in the second video stream is obtained.

The first image and the second image correspond to each other, that is, the shooting time of the first image is the same as or has the smallest time difference with the shooting time of the second image. That is, when a first image in a first video stream is synthesized with a second image in a second video stream, frame synchronization is ensured.

103. And carrying out distortion correction processing on the second image to obtain a third image.

In some embodiments, "subjecting the second image to distortion correction processing to obtain a third image" may include: acquiring calibration parameters of a second camera; and carrying out distortion correction processing on the second image according to the calibration parameters.

The second image may be captured by a wide-angle camera or a telephoto camera, and the captured target scene may have a certain distortion with respect to the main camera, so that the second image is subjected to distortion correction to have a better display effect in the composite image. And each camera has preset calibration parameters, and the distortion of the second image can be corrected by using the calibration parameters to obtain a third image. The calibration parameters include distortion coefficient, focal length, principal point, rotation matrix, translation amount and the like. For example, the distortion correction processing may be implemented using an initunorthortrectifymap (image undistorted and corrected) function and a remap (remapping) function in cooperation with the calibration parameters. The initUnderStretfyMap function is used for calculating distortion mapping of the second image, and the remap function applies the obtained distortion mapping to the second image to obtain a third image.

104. And carrying out alignment processing on the third image and the first image, and combining the aligned first image and the aligned third image to obtain a fourth image.

Due to the distortion correction, the third image may rotate and deform to some extent, and in addition, the first image and the third image are the same scene photographed from different angles, so that the first image and the third image need to be aligned, so that corresponding feature points in the first image and the third image have the same coordinates as much as possible. Since the first image is captured using the main camera and the captured picture is very close to the picture seen by human eyes, the third image is subjected to the alignment process with the first image as a reference in this embodiment.

After the alignment processing, the first image and the third image are merged, for example, the first image is on the left, the second image is on the right, and the first image and the second image are spliced; or the first image is on the right, the second image is on the left, and the first image and the second image are spliced. And obtaining a fourth image after image merging processing.

105. And carrying out video coding processing on the multiple frames of the fourth image to generate a three-dimensional video.

According to the above process, the images in the first video stream and the second video stream are continuously synthesized to obtain a plurality of continuous frames of fourth images, and the plurality of frames of fourth images are encoded to generate the three-dimensional video.

In some embodiments, after the video coding process is performed on the plurality of frames of the fourth image, and the three-dimensional video is generated, the method further includes: and adding a preset mark for the three-dimensional video and then storing.

In some embodiments, after capturing the target scene by the first camera and the second camera, and acquiring the first video stream and the second video stream, the method further comprises: coding the first video stream to generate a first video, adding a mark corresponding to the first camera to the first video and storing the mark; and coding the second video stream to generate a second video, and adding a mark corresponding to the second camera to the second video for storage. The user can select the first video, the second video or the three-dimensional video to play as required.

Referring to fig. 3, fig. 3 shows a playing image of a three-dimensional video obtained by the video shooting method according to the embodiment of the present application. The video content therein is merely an example. When playing three-dimensional video, the same scene that shoots through different cameras is split screen and is shown in the left and right sides of display screen, and the user can watch this video through VR (Virtual Reality) equipment, because first image and third image in the fourth image have the parallax relation when shooing, when correcting the split screen display after the alignment, can provide the left and right eye image that has the parallax relation for Virtual display, the user can watch the video that has stronger three-dimensional third dimension.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:检测设备、检测方法和摄像设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类