技术领域technical field
本发明涉及拍摄技术领域,尤其涉及一种图像处理方法及拍摄终端。The present invention relates to the technical field of photographing, in particular to an image processing method and a photographing terminal.
背景技术Background technique
拍摄者使用拍摄终端拍摄视频或照片等图像时,可选择横屏状态或竖屏状态进行拍摄,图1A为横屏状态拍摄到的图像,图1B为竖屏状态拍摄到的图像。由于横屏状态、竖屏状态下的摄像头构图内容存在明显差异,如果拍摄者在拍摄过程中对拍摄终端的拍摄姿态进行了一次切换,那么在拍摄完成后进行图像播放时,会发生播放方向和拍摄方向不一致的问题。When the photographer uses the shooting terminal to shoot images such as videos or photos, he can choose to shoot in the landscape or portrait state. Figure 1A shows the image captured in the landscape state, and Figure 1B shows the image captured in the portrait state. Due to the obvious difference in the composition content of the camera in the landscape state and the portrait state, if the photographer switches the shooting posture of the shooting terminal during the shooting process, when the image is played after the shooting is completed, the playback direction and The shooting direction is inconsistent.
例如,拍摄者开始采用横屏状态拍摄图像,若观看者采用竖屏状态播放该图像,此时播放方向和拍摄方向一致,观看者看到的图像如图1C所示;拍摄者后来切换成竖屏状态拍摄图像,若观看者采用竖屏状态播放该图像,此时播放方向和拍摄方向不一致,观看者发现姿态切换后的竖屏拍摄内容旋转了90度,如图1D所示,即看到的图像呈侧卧状。For example, the photographer starts to shoot images in landscape mode, and if the viewer plays the image in portrait mode, the playback direction is consistent with the shooting direction, and the image seen by the viewer is shown in Figure 1C; If the viewer uses the vertical screen state to shoot an image, if the viewer uses the vertical screen state to play the image, the playback direction is inconsistent with the shooting direction at this time, and the viewer finds that the vertical screen shooting content after the posture switch is rotated by 90 degrees, as shown in Figure 1D, that is, The image of is lying on its side.
又例如,拍摄者开始采用横屏状态拍摄图像,若观看者采用横屏状态播放该图像,此时播放方向和拍摄方向一致,观看者看到的图像如图1E所示;拍摄者后来切换成竖屏状态拍摄图像,若观看者采用横屏状态播放该图像,此时播放方向和拍摄方向不一致,观看者发现姿态切换后的竖屏拍摄内容旋转了90度,如图1F所示,即看到的图像呈侧卧状。For another example, the photographer starts to shoot images in landscape mode. If the viewer plays the image in landscape mode, the playback direction is consistent with the shooting direction. The image seen by the viewer is shown in Figure 1E; the photographer later switches to If the image is shot in the portrait state, if the viewer uses the landscape state to play the image, the playback direction is inconsistent with the shooting direction, and the viewer finds that the content of the portrait shot after the posture switch is rotated by 90 degrees, as shown in Figure 1F, that is, The image obtained is lying on its side.
如果图像的播放方向和拍摄方向不一致,即使观看者切换播放终端的姿态,所播放的图像依然呈侧卧状,因此不利于用户正常观看。If the playback direction of the image is not consistent with the shooting direction, even if the viewer switches the posture of the playback terminal, the played image is still lying on his side, which is not conducive to normal viewing by the user.
综上可知,现有技术在实际使用上显然存在不便与缺陷,所以有必要加以改进。In summary, there are obviously inconveniences and defects in the actual use of the prior art, so it is necessary to improve it.
发明内容Contents of the invention
针对上述的缺陷,本发明的目的在于提供一种图像处理方法及拍摄终端,其使得用户在播放终端观看图像时,无需旋转播放终端即可观看到与拍摄时观测方向一致的图像内容,从而便于用户正常观看。In view of the above-mentioned defects, the purpose of the present invention is to provide an image processing method and a shooting terminal, which enables the user to watch the image content consistent with the observation direction when shooting without rotating the playback terminal when viewing the image on the playback terminal, thereby facilitating Users watch normally.
为了实现上述目的,本发明提供一种图像处理方法,包括步骤有:In order to achieve the above object, the present invention provides a kind of image processing method, comprising steps:
图像获取步骤,通过后置摄像头获取当前目标图像,同时通过前置摄像头获取拍摄者的当前脸部图像;The image acquisition step is to obtain the current target image through the rear camera, and simultaneously obtain the current face image of the photographer through the front camera;
脸部检测步骤,检测所述当前脸部图像中拍摄者脸部的第一旋转角度;A face detection step, detecting the first rotation angle of the photographer's face in the current face image;
图像旋转步骤,根据所述拍摄者脸部的所述第一旋转角度,对所述当前目标图像进行相应的旋转处理;The image rotation step is to perform corresponding rotation processing on the current target image according to the first rotation angle of the photographer's face;
图像保存步骤,保存旋转处理后的所述当前目标图像。The image saving step is to save the current target image after rotation processing.
根据本发明所述的图像处理方法,所述图像旋转步骤之前还包括:According to the image processing method of the present invention, before the image rotation step, it also includes:
角度判断步骤,判断所述第一旋转角度是否达到预定的旋转角度阈值,若达到所述旋转角度阈值,则执行所述图像旋转步骤。The angle judging step is judging whether the first rotation angle reaches a predetermined rotation angle threshold, and if the rotation angle threshold is reached, the image rotation step is executed.
根据本发明所述的图像处理方法,所述图像保存步骤进一步包括:According to the image processing method of the present invention, the image saving step further includes:
对旋转处理后的所述当前目标图像进行补偿性图像处理;performing compensatory image processing on the rotated current target image;
保存补偿性图像处理后的所述当前目标图像。The current target image after compensatory image processing is saved.
根据本发明所述的图像处理方法,所述图像获取步骤之前还包括:According to the image processing method of the present invention, before the image acquisition step, it also includes:
原始图像获取步骤,通过所述前置摄像头获取所述拍摄者的原始脸部图像;The original image acquisition step is to acquire the original facial image of the photographer through the front camera;
所述脸部检测步骤进一步包括:The face detection step further includes:
根据人脸识别技术分析出所述当前脸部图像中所述拍摄者脸部;Analyzing the photographer's face in the current facial image according to face recognition technology;
计算所述拍摄者脸部与所述原始脸部图像的所述第一旋转角度;calculating the first rotation angle between the photographer's face and the original face image;
所述图像旋转步骤进一步包括:The image rotation step further includes:
根据所述第一旋转角度计算出所述当前目标图像的第二旋转角度,所述第二旋转角度与所述第一旋转角度的大小相等但方向相反;calculating a second rotation angle of the current target image according to the first rotation angle, where the second rotation angle is equal in magnitude to the first rotation angle but opposite in direction;
根据所述第二旋转角度对所述当前目标图像进行旋转处理。Rotate the current target image according to the second rotation angle.
根据本发明所述的图像处理方法,所述根据人脸识别技术分析出所述当前脸部图像中所述拍摄者脸部的步骤还包括:According to the image processing method of the present invention, the step of analyzing the photographer's face in the current facial image according to face recognition technology further includes:
当所述当前脸部图像存在多个人脸时,将尺寸最大的所述人脸判定为所述拍摄者脸部;和/或When there are multiple human faces in the current facial image, determining the human face with the largest size as the photographer's face; and/or
若所述拍摄者脸部占整个所述当前脸部图像的尺寸比例大于或者小于预定比例阈值时,忽略所述当前脸部图像,并执行所述图像获取步骤重新获取新的当前脸部图像。If the size ratio of the photographer's face to the entire current facial image is greater than or smaller than a predetermined ratio threshold, ignore the current facial image, and perform the image acquisition step to reacquire a new current facial image.
本发明还提供一种拍摄终端,包括有:The present invention also provides a shooting terminal, including:
图像获取模块,用于通过后置摄像头获取当前目标图像,同时通过前置摄像头获取拍摄者的当前脸部图像;The image acquisition module is used to obtain the current target image through the rear camera, and simultaneously obtain the current face image of the photographer through the front camera;
脸部检测模块,用于检测所述当前脸部图像中拍摄者脸部的第一旋转角度;A face detection module, configured to detect the first rotation angle of the photographer's face in the current face image;
图像旋转模块,用于根据所述拍摄者脸部的所述第一旋转角度,对所述当前目标图像进行相应的旋转处理;An image rotation module, configured to perform corresponding rotation processing on the current target image according to the first rotation angle of the photographer's face;
图像保存模块,用于保存旋转处理后的所述当前目标图像。An image saving module, configured to save the current target image after rotation processing.
根据本发明所述的拍摄终端,还包括:The shooting terminal according to the present invention also includes:
角度判断模块,用于判断所述第一旋转角度是否达到预定的旋转角度阈值,若达到所述旋转角度阈值,则交由所述图像旋转模块处理。The angle judging module is used to judge whether the first rotation angle reaches a predetermined rotation angle threshold, and if it reaches the rotation angle threshold, it will be handed over to the image rotation module for processing.
根据本发明所述的拍摄终端,所述图像保存模块进一步包括:According to the shooting terminal of the present invention, the image saving module further includes:
图像补偿子模块,用于对旋转处理后的所述当前目标图像进行补偿性图像处理;An image compensation sub-module, configured to perform compensatory image processing on the rotated current target image;
图像保存子模块,用于保存补偿性图像处理后的所述当前目标图像。The image saving sub-module is used to save the current target image after compensatory image processing.
根据本发明所述的拍摄终端,还包括:The shooting terminal according to the present invention also includes:
原始图像获取模块,用于通过所述前置摄像头获取所述拍摄者的原始脸部图像;An original image acquisition module, configured to acquire the original facial image of the photographer through the front camera;
所述脸部检测模块进一步包括:The face detection module further includes:
人脸识别子模块,用于根据人脸识别技术分析出所述当前脸部图像中所述拍摄者脸部;The face recognition sub-module is used to analyze the face of the photographer in the current face image according to the face recognition technology;
第一角度计算子模块,用于计算所述拍摄者脸部与所述原始脸部图像的所述第一旋转角度;The first angle calculation submodule is used to calculate the first rotation angle between the photographer's face and the original facial image;
所述图像旋转模块进一步包括:The image rotation module further includes:
第二角度计算子模块,用于根据所述第一旋转角度计算出所述当前目标图像的第二旋转角度,所述第二旋转角度与所述第一旋转角度的大小相等但方向相反;The second angle calculation submodule is configured to calculate a second rotation angle of the current target image according to the first rotation angle, the second rotation angle is equal to the first rotation angle but opposite in direction;
角度旋转子模块,用于根据所述第二旋转角度对所述当前目标图像进行旋转处理。The angle rotation sub-module is configured to perform rotation processing on the current target image according to the second rotation angle.
根据本发明所述的拍摄终端,所述人脸识别子模块还用于当所述当前脸部图像存在多个人脸时,将尺寸最大的所述人脸判定为所述拍摄者脸部;和/或用于若所述拍摄者脸部占整个所述当前脸部图像的尺寸比例大于或者小于预定比例阈值时,忽略所述当前脸部图像,并通知所述图像获取模块重新获取新的当前脸部图像。According to the photographing terminal of the present invention, the face recognition submodule is further configured to determine the face with the largest size as the face of the photographer when there are multiple faces in the current face image; and /or used to ignore the current facial image and notify the image acquisition module to re-acquire a new current facial image if the proportion of the photographer's face in the entire current facial image is greater than or smaller than a predetermined ratio threshold face image.
本发明拍摄终端在拍摄视频或照片等图像时,启动前置摄像头和后置摄像头同时工作,由前置摄像头获取拍摄者的脸部图像,再通过人脸识别技术检测出拍摄者脸部的旋转角度,并根据所述旋转角度对后置摄像头拍摄的目标图像进行旋转处理后保存,以实现图像的拍摄方向和播放方向的一致。借此,本发明使得用户在播放终端观看图像时,无需旋转播放终端即可观看到与拍摄时观测方向一致的图像内容,从而便于用户正常观看,提高了用户体验。When the shooting terminal of the present invention shoots images such as videos or photos, it starts the front camera and the rear camera to work simultaneously, and the front camera acquires the face image of the shooter, and then detects the rotation of the shooter's face through face recognition technology. Angle, and according to the rotation angle, the target image captured by the rear camera is rotated and stored, so as to achieve the consistency of the shooting direction and playback direction of the image. Thereby, the present invention allows the user to watch the image content consistent with the observation direction when shooting without rotating the playback terminal when viewing the image on the playback terminal, thereby facilitating normal viewing for the user and improving user experience.
附图说明Description of drawings
图1A是现有拍摄终端采用横屏拍摄图像的界面图;FIG. 1A is an interface diagram of an existing shooting terminal using a horizontal screen to shoot images;
图1B是现有拍摄终端采用竖屏拍摄图像的界面图;FIG. 1B is an interface diagram of an existing shooting terminal using a vertical screen to shoot images;
图1C是现有播放终端采用竖屏播放横屏拍摄图像的界面图;Fig. 1C is an interface diagram of an existing playback terminal using a vertical screen to play a horizontal screen shot image;
图1D是现有播放终端采用竖屏播放切换成竖屏拍摄图像的界面图;Fig. 1D is an interface diagram of an existing playback terminal switching from a vertical screen playback to a vertical screen shooting image;
图1E是现有播放终端采用横屏播放横屏拍摄图像的界面图;FIG. 1E is an interface diagram of an existing playback terminal using a horizontal screen to play images captured in a horizontal screen;
图1F是现有播放终端采用横屏播放切换成竖屏拍摄图像的界面图;FIG. 1F is an interface diagram of the existing playback terminal switching from horizontal screen playback to vertical screen shooting images;
图2是本发明拍摄终端的结构示意图;Fig. 2 is a schematic structural diagram of the shooting terminal of the present invention;
图3是本发明优选拍摄终端的结构示意图;Fig. 3 is a schematic structural diagram of a preferred shooting terminal of the present invention;
图4是本发明拍摄终端的旋转角度计算示意图;Fig. 4 is a schematic diagram of calculating the rotation angle of the shooting terminal of the present invention;
图5是本发明图像处理方法的流程图;Fig. 5 is a flowchart of the image processing method of the present invention;
图6是本发明优选图像处理方法的流程图。Fig. 6 is a flowchart of a preferred image processing method of the present invention.
具体实施方式Detailed ways
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.
图2是本发明拍摄终端的结构示意图,所述拍摄终端100可以是手机、摄像机、照相机、PDA(PersonalDigitalAssistant,个人数字助理)、平板电脑等,并且所述拍摄终端100包括有图像获取模块10、脸部检测模块20、图像旋转模块30以及图像保存模块40,其中:Fig. 2 is a structural schematic diagram of the shooting terminal of the present invention, the shooting terminal 100 may be a mobile phone, a video camera, a camera, a PDA (Personal Digital Assistant, a personal digital assistant), a tablet computer, etc., and the shooting terminal 100 includes an image acquisition module 10, Face detection module 20, image rotation module 30 and image preservation module 40, wherein:
所述图像获取模块10,用于通过后置摄像头获取当前目标图像,同时通过前置摄像头获取拍摄者的当前脸部图像。图像获取模块10用于前置摄像头和后置摄像头的驱动和管理。本发明拍摄终端100的前置摄像头和后置摄像头需能同时工作,所述后置摄像头工作在正常模式下,用于获取目标对象的图像,所述目标对象可以是人物、动物、植物、景物等,所述图像可以是视频、照片等;所述前置摄像头工作在低频模式下,可大大降低前置摄像头的功耗,用于获取包含拍摄者的当前脸部图像。所述前置摄像头拍摄到的当前脸部图像发给脸部检测模块20,所述后置摄像头得到的当前目标图像发给图像旋转模块30。The image acquisition module 10 is configured to acquire the current target image through the rear camera, and at the same time acquire the current facial image of the photographer through the front camera. The image acquisition module 10 is used for driving and managing the front camera and the rear camera. The front camera and the rear camera of the shooting terminal 100 of the present invention need to be able to work at the same time, and the rear camera works in a normal mode to obtain images of target objects, which can be people, animals, plants, and scenery etc., the image can be a video, a photo, etc.; the front camera works in a low-frequency mode, which can greatly reduce the power consumption of the front camera, and is used to obtain the current face image including the photographer. The current face image captured by the front camera is sent to the face detection module 20 , and the current target image obtained by the rear camera is sent to the image rotation module 30 .
所述脸部检测模块20,用于检测所述当前脸部图像中拍摄者脸部的第一旋转角度。所述第一旋转角度为拍摄者脸部相对于原始位置旋转的角度。这里需要先通过人脸识别技术检测出当前脸部图像中的拍摄者脸部,具体可通过眼睛、嘴巴和鼻子的定位及其相互的位置关系来确定是否有人脸。The face detection module 20 is configured to detect a first rotation angle of the photographer's face in the current face image. The first rotation angle is an angle at which the photographer's face is rotated relative to the original position. Here, it is necessary to first detect the face of the photographer in the current facial image through face recognition technology. Specifically, it can be determined whether there is a human face through the positioning of eyes, mouth and nose and their mutual positional relationship.
所述图像旋转模块30,用于根据拍摄者脸部的第一旋转角度,对当前目标图像进行相应的旋转处理。根据从脸部检测模块20得到的第一旋转角度,所述图像旋转模块30对后置摄像头送来的当前目标图像进行旋转处理,优选的是,根据第二旋转角度对当前目标图像进行旋转处理,第二旋转角度与第一旋转角度的大小相等但方向相反。The image rotation module 30 is configured to perform corresponding rotation processing on the current target image according to the first rotation angle of the photographer's face. According to the first rotation angle obtained from the face detection module 20, the image rotation module 30 rotates the current target image sent by the rear camera, preferably, rotates the current target image according to the second rotation angle , the second rotation angle is equal in size but opposite to the first rotation angle.
图像保存模块40,用于保存旋转处理后的当前目标图像。优选的是,图像保存模块40用于将旋转处理后的当前目标图像进行压缩处理,保存为最终的视频或者照片。由于保存的图像根据人脸方向进行了旋转,可保证保存后的图像在任何播放终端上播放图像方向都与用户录制时观测的方向保持一致。The image saving module 40 is configured to save the current target image after rotation processing. Preferably, the image saving module 40 is configured to compress the rotated current target image and save it as a final video or photo. Since the saved image is rotated according to the direction of the face, it can be guaranteed that the direction of the saved image played on any playback terminal is consistent with the direction observed by the user when recording.
图3是本发明优选拍摄终端的结构示意图,所述拍摄终端100包括有图像获取模块10、脸部检测模块20、图像旋转模块30、图像保存模块40和/或原始图像获取模块50,其中:3 is a schematic structural diagram of a preferred shooting terminal of the present invention, the shooting terminal 100 includes an image acquisition module 10, a face detection module 20, an image rotation module 30, an image storage module 40 and/or an original image acquisition module 50, wherein:
所述原始图像获取模块50,用于在拍摄视频或者照片等图像时,先通过前置摄像头获取拍摄者的原始脸部图像,所述原始脸部图像作为后续判断拍摄者的脸部旋转角度的参照物。The original image acquisition module 50 is used to obtain the original face image of the photographer through the front camera when taking images such as videos or photos, and the original face image is used as a basis for subsequent judgment of the photographer's face rotation angle. reference.
所述图像获取模块10,用于通过后置摄像头获取当前目标图像,同时通过前置摄像头获取拍摄者的当前脸部图像。本发明拍摄终端100的前置摄像头和后置摄像头需能同时工作,所述后置摄像头工作在正常模式下,用于获取目标对象的图像,所述图像可以是视频、照片等;所述前置摄像头工作在低频模式下,可大大降低前置摄像头的功耗,用于获取包含拍摄者的当前脸部图像。The image acquisition module 10 is configured to acquire the current target image through the rear camera, and at the same time acquire the current facial image of the photographer through the front camera. The front camera and the rear camera of the shooting terminal 100 of the present invention need to be able to work at the same time, and the rear camera works in a normal mode to obtain an image of a target object, and the image can be a video, a photo, etc.; The built-in camera works in low-frequency mode, which can greatly reduce the power consumption of the front camera, and is used to obtain the current face image including the photographer.
所述脸部检测模块20,用于检测当前脸部图像中拍摄者脸部的第一旋转角度。优选的是,脸部检测模块20进一步包括:The face detection module 20 is configured to detect the first rotation angle of the photographer's face in the current face image. Preferably, the face detection module 20 further includes:
人脸识别子模块21,用于根据人脸识别技术分析出当前脸部图像中拍摄者脸部。优选的是,人脸识别子模块21还用于当前脸部图像存在多个人脸时,将尺寸最大的人脸(即离拍摄终端100最近的人脸)判定为拍摄者脸部;和/或用于若拍摄者脸部占整个当前脸部图像的尺寸比例大于或者小于预定比例阈值时,认为该人脸离拍摄终端100距离过近或过远,因此忽略所述当前脸部图像,并通知图像获取模块10重新获取新的当前脸部图像。The face recognition sub-module 21 is used to analyze the face of the photographer in the current face image according to the face recognition technology. Preferably, the face recognition sub-module 21 is also used to determine the face with the largest size (that is, the face closest to the shooting terminal 100) as the face of the photographer when there are multiple faces in the current face image; and/or If the ratio of the photographer's face to the size of the entire current facial image is greater than or smaller than a predetermined ratio threshold, it is considered that the human face is too close or too far away from the shooting terminal 100, so the current facial image is ignored, and a notification is sent The image acquisition module 10 reacquires a new current face image.
第一角度计算子模块22,用于计算拍摄者脸部与原始脸部图像的第一旋转角度。优选的是,可通过两个眼球的中点与嘴部中心的连线和原始脸部图像垂直方向来获得拍摄者脸部旋转的第一旋转角度,如图4所示。The first angle calculation sub-module 22 is used to calculate the first rotation angle between the photographer's face and the original face image. Preferably, the first rotation angle of the photographer's face rotation can be obtained through the line connecting the midpoint of the two eyeballs and the center of the mouth and the vertical direction of the original face image, as shown in FIG. 4 .
例如拍摄者使用拍摄终端100拍摄视频时,所述脸部检测模块20的旋转角度检测流程优选包括:For example, when the photographer uses the shooting terminal 100 to shoot a video, the rotation angle detection process of the face detection module 20 preferably includes:
A1、启动前置摄像头。A1. Start the front camera.
A2、获取一帧拍摄者的脸部图像。A2. Obtain a frame of the face image of the photographer.
A3、分析脸部图像内容,进行人脸检测;得到拍摄者脸部相对于原始脸部图像的旋转角度。A3. Analyze the content of the face image, and perform face detection; obtain the rotation angle of the photographer's face relative to the original face image.
A4、修改拍摄者脸部的人脸方向变量(即第一旋转角度),人脸方向变量初始值为零。A4. Modify the face orientation variable (namely the first rotation angle) of the photographer's face, and the initial value of the face orientation variable is zero.
A5、等待1秒等预定间隔时间后,返回到所述步骤A2。A5. After waiting for a predetermined interval such as 1 second, return to the step A2.
所述图像旋转模块30,用于根据拍摄者脸部的第一旋转角度,对当前目标图像进行相应的旋转处理。优选的是,图像旋转模块30进一步包括:The image rotation module 30 is configured to perform corresponding rotation processing on the current target image according to the first rotation angle of the photographer's face. Preferably, the image rotation module 30 further includes:
第二角度计算子模块31,用于根据第一旋转角度计算出当前目标图像的第二旋转角度,第二旋转角度与第一旋转角度的大小相等但方向相反,其原因是前置摄像头和后置摄像头的方向相反。The second angle calculation sub-module 31 is used to calculate the second rotation angle of the current target image according to the first rotation angle. The second rotation angle is equal to the first rotation angle but opposite in direction. The reason is that the front camera and the rear set the camera in the opposite direction.
角度旋转子模块32,用于将目标图像进行第二旋转角度的旋转处理。The angle rotation sub-module 32 is configured to rotate the target image by a second rotation angle.
例如拍摄者使用拍摄终端100拍摄视频时,所述图像旋转模块30的视频图像旋转流程优选包括:For example, when the photographer uses the shooting terminal 100 to shoot a video, the video image rotation process of the image rotation module 30 preferably includes:
B1、启动后置摄像头。B1. Start the rear camera.
B2、获取一帧目标图像。B2. Obtain a frame of target image.
B3、读取拍摄者脸部的人脸方向变量,根据人脸方向变量计算所述目标图像旋转的第二旋转角度,并对所述目标图像进行旋转处理;由于前置摄像头和后置摄像头方向相反,因此人脸方向变量与目标图像旋转的角度数值上是相等,但方向相反,例如人脸顺时针旋转30,目标图像就要逆时针旋转30度。B3. Read the face orientation variable of the photographer's face, calculate the second rotation angle of the target image rotation according to the face orientation variable, and perform rotation processing on the target image; due to the orientation of the front camera and the rear camera On the contrary, the face orientation variable is numerically equal to the angle of rotation of the target image, but the direction is opposite. For example, if the face is rotated 30 degrees clockwise, the target image will be rotated 30 degrees counterclockwise.
B4、将处理后的目标图像通过预定格式保存为视频或者照片。B4. Save the processed target image as a video or photo in a predetermined format.
B5、返回到所述步骤B2。B5. Return to the step B2.
所述图像保存模块40,用于保存旋转处理后的当前目标图像。更好的是,图像保存模块40进一步包括:The image saving module 40 is configured to save the current target image after rotation processing. Preferably, the image preservation module 40 further includes:
图像补偿子模块41,用于对旋转处理后的目标图像进行补偿性图像处理。由于本发明需对所拍摄的图像进行技术处理,因此可能导致处理后的新图像内容尺寸比原来的要小,或者部分内容可能在处理中被剪掉(直接缩放处理可能搞导致图像失真),这样会导致目标图像时大时小,影响用户体验,因此需要图像补偿性处理。例如,旋转时对后置摄像头送来原始目标图像进行适度裁剪,裁剪后如果有空白区域可使用背景模板进行填充。The image compensation sub-module 41 is configured to perform compensatory image processing on the rotated target image. Since the present invention needs to perform technical processing on the captured image, the size of the processed new image content may be smaller than the original one, or part of the content may be cut off during the processing (direct scaling processing may cause image distortion), This will cause the target image to be large or small, affecting user experience, so image compensatory processing is required. For example, when rotating, the original target image sent by the rear camera is appropriately cropped, and if there is a blank area after cropping, it can be filled with a background template.
图像保存子模块42,用于保存补偿性图像处理后的目标图像。更好的是,将补偿性图像处理后的目标图像先送入预览窗口,用户确认才回保存所述目标图像,以保证用户看到的目标图像和保存的目标图像一致。The image saving sub-module 42 is used for saving the target image after compensatory image processing. More preferably, the target image after compensatory image processing is first sent to the preview window, and the target image is saved after confirmation by the user, so as to ensure that the target image seen by the user is consistent with the saved target image.
优选的是,所述拍摄终端100还包括:Preferably, the shooting terminal 100 also includes:
角度判断模块60,用于判断第一旋转角度是否达到预定的旋转角度阈值,若达到所述旋转角度阈值,则交由图像旋转模块30进行图像旋转处理,否则不进行图像旋转处理。考虑到拍摄者在使用拍摄终端100进行拍摄操作时,难免存在的一定身体摇晃,其必然导致拍摄者脸部发生轻微的角度旋转变化,若任何拍摄者脸部的角度旋转变化都要对目标图像进行旋转处理并不合理,因为频繁处理会占用拍摄终端100过多系统资源,而且基本没有实际效果,所以本实施例设置一个旋转角度阈值,例如45度,只有拍摄者脸部的旋转角度大于该旋转角度阈值才会触发图像旋转处理,否则忽略不处理。The angle judging module 60 is used for judging whether the first rotation angle reaches a predetermined rotation angle threshold. If the rotation angle threshold is reached, the image rotation module 30 will perform image rotation processing; otherwise, the image rotation processing will not be performed. Considering that when the photographer uses the shooting terminal 100 to perform shooting operations, there is inevitably a certain body shaking, which will inevitably lead to a slight angle rotation change on the photographer's face. If any angle rotation changes on the photographer's face, the target image It is unreasonable to perform rotation processing, because frequent processing will occupy too many system resources of the shooting terminal 100, and basically has no practical effect, so this embodiment sets a rotation angle threshold, such as 45 degrees, only when the rotation angle of the photographer's face is greater than this The rotation angle threshold will trigger image rotation processing, otherwise it will be ignored and not processed.
所以人脸角度的实时变化的,但不必实时旋转图像,可设个阈值,若达到阈值旋转图像。Therefore, the face angle changes in real time, but it is not necessary to rotate the image in real time. A threshold can be set, and if the threshold is reached, the image will be rotated.
图5是本发明图像处理方法的流程图,其可通过如图2或图3所示的拍摄终端100实现,包括步骤有:Fig. 5 is a flow chart of the image processing method of the present invention, which can be realized by the shooting terminal 100 as shown in Fig. 2 or Fig. 3, including steps:
步骤S501,图像获取步骤,通过后置摄像头获取当前目标图像,同时通过前置摄像头获取拍摄者的当前脸部图像。Step S501, the image acquisition step, acquires the current target image through the rear camera, and acquires the current facial image of the photographer through the front camera.
本发明拍摄终端100的前置摄像头和后置摄像头需能同时工作,所述后置摄像头工作在正常模式下,用于获取目标对象的图像,所述目标对象可以是人物、动物、植物、景物等,所述图像可以是视频、照片等;所述前置摄像头工作在低频模式下,可大大降低前置摄像头的功耗,用于获取包含拍摄者的当前脸部图像。The front camera and the rear camera of the shooting terminal 100 of the present invention need to be able to work at the same time, and the rear camera works in a normal mode to obtain images of target objects, which can be people, animals, plants, and scenery etc., the image can be a video, a photo, etc.; the front camera works in a low-frequency mode, which can greatly reduce the power consumption of the front camera, and is used to obtain the current face image including the photographer.
步骤S502,脸部检测步骤,检测所述当前脸部图像中拍摄者脸部的第一旋转角度。Step S502, face detection step, detecting the first rotation angle of the photographer's face in the current face image.
所述第一旋转角度为拍摄者脸部相对于原始位置旋转的角度。这里需要先通过人脸识别技术检测出当前脸部图像的拍摄者脸部,具体可通过眼睛、嘴巴和鼻子的定位及其相互的位置关系来确定是否有人脸。更好的是,通过两个眼球的中点与嘴部中心的连线和被检测图像垂直方向来获得拍摄者脸部旋转的第一旋转角度,如图4所示。The first rotation angle is an angle at which the photographer's face is rotated relative to the original position. Here, it is necessary to first detect the face of the photographer in the current facial image through face recognition technology. Specifically, it can be determined whether there is a human face through the positioning of eyes, mouth and nose and their mutual positional relationship. Even better, the first rotation angle of the photographer's face rotation is obtained through the line connecting the midpoints of the two eyeballs and the center of the mouth and the vertical direction of the detected image, as shown in FIG. 4 .
步骤S503,图像旋转步骤,根据拍摄者脸部的第一旋转角度,对所述当前目标图像进行相应的旋转处理。Step S503, the image rotation step, performs corresponding rotation processing on the current target image according to the first rotation angle of the photographer's face.
优选的是,将当前目标图像进行第二旋转角度的旋转处理,第二旋转角度与第一旋转角度的大小相等但方向相反。Preferably, the current target image is rotated by a second rotation angle, and the second rotation angle is equal to the first rotation angle but opposite in direction.
步骤S504,图像保存步骤,保存旋转处理后的当前目标图像。Step S504, the image saving step, saves the current target image after the rotation process.
本步骤优选的是,将旋转处理后的当前目标图像进行压缩处理,保存为最终的视频或者照片。由于保存的图像根据人脸方向进行旋转,可保证保存后的图像在任何播放终端上播放图像方向都与用户录制时观测的方向保持一致。In this step, preferably, the rotated current target image is compressed and saved as a final video or photo. Since the saved image is rotated according to the direction of the face, it can be guaranteed that the direction of the saved image played on any playback terminal is consistent with the direction observed by the user when recording.
本发明基于前后摄像头的图像处理,在拍摄视频或照片时,启动前后摄像头同时工作,通过前置摄像头获取拍摄者的脸部图像检测出拍摄者脸部方向,并根据用户脸部方向对后置摄像头拍摄的目标图像进行方向旋转后保存。用户在任意播放终端播放该图像时,都无需旋转播放终端即可看到与拍摄时观测方向一致的图像。The present invention is based on the image processing of the front and rear cameras. When taking videos or photos, the front and rear cameras are started to work simultaneously. The face image of the shooter is obtained by the front camera to detect the direction of the shooter's face, and the rear camera is adjusted according to the direction of the user's face. The target image captured by the camera is saved after being rotated in direction. When the user plays the image on any playback terminal, the user can see the image consistent with the observation direction when shooting without rotating the playback terminal.
图6是本发明优选图像处理方法的流程图,其可通过如图3所示的拍摄终端100实现,包括步骤有:Fig. 6 is a flow chart of the preferred image processing method of the present invention, which can be realized by the shooting terminal 100 as shown in Fig. 3, including steps:
步骤S601,开启拍摄/播放方向一致模式。In step S601, start the shooting/playing direction consistent mode.
考虑在特殊情形下,拍摄者有通过拍摄终端100来拍摄倒影图像、侧卧图像等特殊图像的需求,而使用本发明会导致无法拍摄到倒影图像、侧卧图像等。因此可以设置可选的拍摄/播放方向一致模式,启动该模式才执行本发明的图像旋转处理功能,不启动该模式则按照正常拍摄流程处理。Considering that in special circumstances, the photographer needs to capture special images such as reflection images and side lying images through the photography terminal 100, but using the present invention will result in failure to capture reflection images, side lying images and the like. Therefore, an optional shooting/playing direction consistent mode can be set, and the image rotation processing function of the present invention is executed only when this mode is activated, and the normal shooting process is followed when this mode is not activated.
步骤S602,开始拍摄图像,用户可通过按拍摄按钮来开始拍摄工作。Step S602, start to capture images, and the user can start the shooting work by pressing the capture button.
步骤S603,通过前置摄像头获取拍摄者的原始脸部图像。Step S603, acquiring the photographer's original face image through the front camera.
所述原始脸部图像用于后续判断拍摄者的脸部旋转角度的参照物。The original facial image is used as a reference for subsequent determination of the photographer's facial rotation angle.
步骤S604,通过后置摄像头获取当前目标图像,同时通过前置摄像头获取拍摄者的当前脸部图像。In step S604, the current target image is acquired through the rear camera, and the current facial image of the photographer is acquired through the front camera.
本发明拍摄终端100的前置摄像头和后置摄像头需能同时工作,所述后置摄像头工作在正常模式下,用于获取目标对象的图像,所述图像可以是视频、照片等;所述前置摄像头工作在低频模式下,可大大降低前置摄像头的功耗,用于获取包含拍摄者的脸部图像。The front camera and the rear camera of the shooting terminal 100 of the present invention need to be able to work at the same time, and the rear camera works in a normal mode to obtain an image of a target object, and the image can be a video, a photo, etc.; The built-in camera works in low-frequency mode, which can greatly reduce the power consumption of the front-facing camera, and is used to obtain images containing the face of the photographer.
步骤S605,根据人脸识别技术分析出当前脸部图像中拍摄者脸部。Step S605, analyze the photographer's face in the current facial image according to the face recognition technology.
本步骤优选还包括:当前脸部图像存在多个人脸时,将尺寸最大的人脸(即离拍摄终端100最近的人脸)判定为拍摄者脸部;和/或用于若拍摄者脸部占整个当前脸部图像的尺寸比例大于或者小于预定比例阈值时,认为该人脸离拍摄终端100距离过近或过远,因此忽略当前脸部图像,并返回到步骤S604以重新获取新的当前脸部图像。This step preferably also includes: when there are multiple faces in the current face image, determining the face with the largest size (that is, the face closest to the shooting terminal 100) as the face of the photographer; When the proportion of the size of the entire current face image is greater than or less than the predetermined ratio threshold, it is considered that the face is too close or too far away from the shooting terminal 100, so the current face image is ignored, and returns to step S604 to reacquire a new current face image. face image.
步骤S606,计算拍摄者脸部与原始脸部图像的第一旋转角度。Step S606, calculating a first rotation angle between the photographer's face and the original face image.
优选的是,可通过两个眼球的中点与嘴部中心的连线和原始脸部图像垂直方向来获得拍摄者脸部旋转的第一旋转角度,如图4所示。Preferably, the first rotation angle of the photographer's face rotation can be obtained through the line connecting the midpoint of the two eyeballs and the center of the mouth and the vertical direction of the original face image, as shown in FIG. 4 .
更好的是,所述步骤S606之后和步骤S607之前还可包括:More preferably, after step S606 and before step S607, the method may further include:
角度判断步骤,判断第一旋转角度是否达到预定的旋转角度阈值,若达到旋转角度阈值,则执行步骤S607,否则返回到步骤S604。The angle judging step is to judge whether the first rotation angle reaches a predetermined rotation angle threshold, and if it reaches the rotation angle threshold, execute step S607, otherwise return to step S604.
考虑到拍摄者在使用拍摄终端100进行拍摄操作时,难免存在的一定身体摇晃,其必然导致拍摄者脸部发生轻微的角度旋转变化,若任何拍摄者脸部的角度旋转变化都要对目标图像进行旋转处理并不合理,因为频繁处理会占用拍摄终端100过多系统资源,而且基本没有实际效果,所以本实施例设置一个旋转角度阈值,例如45度,只有拍摄者脸部的旋转角度大于该旋转角度阈值才会触发图像旋转处理,否则忽略不处理。Considering that when the photographer uses the shooting terminal 100 to perform shooting operations, there is inevitably a certain body shaking, which will inevitably lead to a slight angle rotation change on the photographer's face. If any angle rotation changes on the photographer's face, the target image It is unreasonable to perform rotation processing, because frequent processing will occupy too many system resources of the shooting terminal 100, and basically has no practical effect, so this embodiment sets a rotation angle threshold, such as 45 degrees, only when the rotation angle of the photographer's face is greater than this The rotation angle threshold will trigger image rotation processing, otherwise it will be ignored and not processed.
步骤S607,根据第一旋转角度计算出当前目标图像的第二旋转角度,所述第二旋转角度与第一旋转角度的大小相等但方向相反。Step S607, calculating a second rotation angle of the current target image according to the first rotation angle, where the second rotation angle is equal to the first rotation angle but opposite in direction.
因为前置摄像头和后置摄像头的方向相反,所以第二旋转角度与第一旋转角度的方向相反。Because the directions of the front camera and the rear camera are opposite, the direction of the second rotation angle is opposite to that of the first rotation angle.
步骤S608,将所述目标图像进行第二旋转角度的旋转处理。In step S608, the target image is rotated by a second rotation angle.
步骤S609,对旋转处理后的目标图像进行补偿性图像处理。Step S609, performing compensatory image processing on the rotated target image.
由于本发明需对所拍摄的图像进行技术处理,因此可能导致处理后的新图像内容尺寸比原来的要小,或者部分内容可能在处理中被剪掉(直接缩放处理可能搞导致图像失真),这样会导致目标图像时大时小,影响用户体验,因此需要图像补偿性处理。例如,旋转时对后置摄像头送来原始目标图像进行适度裁剪,裁剪后如果有空白区域可使用背景模板进行填充。Since the present invention needs to perform technical processing on the captured image, the size of the processed new image content may be smaller than the original one, or part of the content may be cut off during the processing (direct scaling processing may cause image distortion), This will cause the target image to be large or small, affecting user experience, so image compensatory processing is required. For example, when rotating, the original target image sent by the rear camera is appropriately cropped, and if there is a blank area after cropping, it can be filled with a background template.
步骤S610,保存补偿性图像处理后的目标图像。Step S610, saving the target image after compensatory image processing.
更好的是,将补偿性图像处理后的目标图像先送入预览窗口,用户确认才回保存所述目标图像,以保证用户看到的目标图像和保存的目标图像一致。More preferably, the target image after compensatory image processing is first sent to the preview window, and the target image is saved after confirmation by the user, so as to ensure that the target image seen by the user is consistent with the saved target image.
综上所述,本发明拍摄终端在拍摄视频或照片等图像时,启动前置摄像头和后置摄像头同时工作,由前置摄像头获取拍摄者的脸部图像,再通过人脸识别技术检测出拍摄者脸部的旋转角度,并根据所述旋转角度对后置摄像头拍摄的目标图像进行旋转处理后保存,以实现图像的拍摄方向和播放方向的一致。借此,本发明使得用户在播放终端观看图像时,无需旋转播放终端即可观看到与拍摄时观测方向一致的图像内容,从而便于用户正常观看,提高了用户体验。To sum up, when the shooting terminal of the present invention takes images such as videos or photos, it starts the front camera and the rear camera to work simultaneously, and the front camera acquires the face image of the shooter, and then detects the image taken by the face recognition technology. The rotation angle of the user's face, and according to the rotation angle, the target image captured by the rear camera is rotated and stored, so that the shooting direction of the image is consistent with the playback direction. Thereby, the present invention allows the user to watch the image content consistent with the observation direction when shooting without rotating the playback terminal when viewing the image on the playback terminal, thereby facilitating normal viewing for the user and improving user experience.
当然,本发明还可有其它多种实施例,在不背离本发明精神及其实质的情况下,熟悉本领域的技术人员当可根据本发明作出各种相应的改变和变形,但这些相应的改变和变形都应属于本发明所附的权利要求的保护范围。Certainly, the present invention also can have other multiple embodiments, without departing from the spirit and essence of the present invention, those skilled in the art can make various corresponding changes and deformations according to the present invention, but these corresponding Changes and deformations should belong to the scope of protection of the appended claims of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410014459.7ACN103795919B (en) | 2014-01-13 | 2014-01-13 | Image processing method and camera terminal |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410014459.7ACN103795919B (en) | 2014-01-13 | 2014-01-13 | Image processing method and camera terminal |
| Publication Number | Publication Date |
|---|---|
| CN103795919A CN103795919A (en) | 2014-05-14 |
| CN103795919Btrue CN103795919B (en) | 2015-11-25 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201410014459.7AActiveCN103795919B (en) | 2014-01-13 | 2014-01-13 | Image processing method and camera terminal |
| Country | Link |
|---|---|
| CN (1) | CN103795919B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104469119A (en)* | 2013-09-12 | 2015-03-25 | 联想(北京)有限公司 | Information processing method and electronic equipment |
| CN105955485A (en)* | 2016-05-12 | 2016-09-21 | 珠海市魅族科技有限公司 | Screen display method, screen display device and terminal |
| CN106911891A (en)* | 2017-02-15 | 2017-06-30 | 惠州Tcl移动通信有限公司 | The method and system that a kind of VR auxiliary is taken photo by plane |
| CN107181917B (en)* | 2017-04-25 | 2020-08-25 | 深圳市景阳科技股份有限公司 | Picture display method and device |
| CN107491685B (en)* | 2017-09-27 | 2020-06-26 | 维沃移动通信有限公司 | Face recognition method and mobile terminal |
| CN107832675A (en)* | 2017-10-16 | 2018-03-23 | 广东欧珀移动通信有限公司 | photographing processing method and related product |
| CN109635670A (en)* | 2018-11-21 | 2019-04-16 | 普联技术有限公司 | Face identification method, device, terminal device, mobile device and storage medium |
| CN110728234A (en)* | 2019-10-12 | 2020-01-24 | 爱驰汽车有限公司 | Driver face recognition method, system, device and medium |
| CN113468928B (en)* | 2020-03-31 | 2025-01-07 | 腾讯科技(深圳)有限公司 | Rotating background video recognition method, device, computer equipment and storage medium |
| CN113712536B (en)* | 2020-05-26 | 2023-12-26 | 李昀儒 | Unbalanced early warning method and wearing device based on gait analysis |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101969539A (en)* | 2010-09-30 | 2011-02-09 | 冠捷显示科技(厦门)有限公司 | Television automatic steering method based on user perspective |
| CN102760024A (en)* | 2011-04-26 | 2012-10-31 | 鸿富锦精密工业(深圳)有限公司 | Screen picture rotating method and system |
| CN103176693A (en)* | 2013-02-18 | 2013-06-26 | 联宝(合肥)电子科技有限公司 | Method and device for changing terminal screen picture direction automatically |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101969539A (en)* | 2010-09-30 | 2011-02-09 | 冠捷显示科技(厦门)有限公司 | Television automatic steering method based on user perspective |
| CN102760024A (en)* | 2011-04-26 | 2012-10-31 | 鸿富锦精密工业(深圳)有限公司 | Screen picture rotating method and system |
| CN103176693A (en)* | 2013-02-18 | 2013-06-26 | 联宝(合肥)电子科技有限公司 | Method and device for changing terminal screen picture direction automatically |
| Publication number | Publication date |
|---|---|
| CN103795919A (en) | 2014-05-14 |
| Publication | Publication Date | Title |
|---|---|---|
| CN103795919B (en) | Image processing method and camera terminal | |
| CN107580178B (en) | Image processing method and device | |
| CN105007431B (en) | A kind of picture shooting method and terminal based on a variety of photographed scenes | |
| CN104735355B (en) | The image capture method and device of a kind of intelligent terminal | |
| CN113840070B (en) | Shooting method, shooting device, electronic equipment and medium | |
| CN103095984B (en) | Electronic camera and camera control method | |
| CN102970441B (en) | Self-portrait method based on rear camera of mobile phone and mobile phone | |
| CN103841326B (en) | Video recording method and device | |
| CN102946514A (en) | Method and device for self-shooting of mobile terminal | |
| CN105827942A (en) | Rapid photographing method and electronic device | |
| CN205545654U (en) | Two camera devices and terminal equipment who uses thereof | |
| CN103384301A (en) | Method, device and mobile terminal for taking selfie with rear camera | |
| TW201024908A (en) | Panoramic image auto photographing method of digital photography device | |
| CN103780839B (en) | A kind of photographic method and photo terminal | |
| CN103179345A (en) | Digital photographing device and its control method | |
| CN102014248A (en) | Automatic focusing method and module and image capturing device using the same | |
| WO2015024367A1 (en) | Shot image processing method and apparatus | |
| CN104820567A (en) | Method, equipment and system for controlling photographing with stylus | |
| CN106210546B (en) | panoramic photo shooting system, panoramic photo shooting method and mobile terminal | |
| CN105827934B (en) | Image processing method for electronic equipment and electronic equipment | |
| CN103152524B (en) | Camera arrangement and continuous shooting method thereof | |
| CN105933614A (en) | Method and system for taking pictures and taking pictures | |
| CN105049719A (en) | Panoramic shooting method and mobile terminal | |
| CN107122697B (en) | Automatic photo acquisition method and device, and electronic device | |
| JP2009105559A (en) | Method of detecting and processing object to be recognized from taken image, and portable electronic device with camera |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| TR01 | Transfer of patent right | ||
| TR01 | Transfer of patent right | Effective date of registration:20250902 Address after:225000 Jiangsu Province Yangzhou City Yizheng City Economic Development Zone Mintai Avenue west side -3 Patentee after:Yangzhou Jiadi Electronic Information Technology Co.,Ltd. Country or region after:China Address before:518057 Shenzhen, Zhejiang Province, Nanshan District hi tech Industrial Park (North) dream Creek Road, No. 2, cool information port (Building 1) Patentee before:YULONG COMPUTER TELECOMMUNICATION SCIENTIFIC (SHENZHEN) Co.,Ltd. Country or region before:China |