HK1251751B - Method and device for blurring preview picture and equipment - Google Patents
Method and device for blurring preview picture and equipment Download PDFInfo
- Publication number
- HK1251751B HK1251751B HK18111054.0A HK18111054A HK1251751B HK 1251751 B HK1251751 B HK 1251751B HK 18111054 A HK18111054 A HK 18111054A HK 1251751 B HK1251751 B HK 1251751B
- Authority
- HK
- Hong Kong
- Prior art keywords
- portrait
- area
- image
- information
- preview
- Prior art date
Links
Description
技术领域Technical Field
本申请涉及图像处理技术领域,特别涉及一种预览画面虚化处理方法、装置及设备。The present application relates to the field of image processing technology, and in particular to a method, device and equipment for processing blurring of a preview image.
背景技术Background Art
通常,为了突出拍摄的主体,使得拍摄图像的焦点聚集在拍摄的主体上,可对拍摄画面中的背景区域进行即时虚化处理。Typically, in order to highlight a subject being photographed and focus the captured image on the subject, the background area in the captured image may be instantly blurred.
目前,对拍摄画面的背景区域进行即时虚化处理时,通常是在显示图像传感器采集的帧画面过程中计算帧画面的景深信息,然后根据计算的景深信息对属于背景区域的部分进行虚化处理。然而,发明人发现,通过上述方式对拍摄画面进行虚化处理时,不仅需要较长时间计算拍摄画面的景深信息,而且当拍摄画面的主体出现晃动时,拍摄画面的景深信息来不及更新,从而容易出现部分主体会被虚化,进而影响整体的虚化效果,降低用户体验。Currently, when blurring the background area of a captured image, the depth of field information of the frame captured by the image sensor is typically calculated while the frame is being displayed. The background area is then blurred based on the calculated depth of field information. However, the inventors have discovered that blurring the captured image using this method not only takes a long time to calculate the depth of field information, but also, when the subject in the captured image shakes, the depth of field information is not updated in time, which can easily cause part of the subject to be blurred, thereby affecting the overall blur effect and reducing the user experience.
发明内容Summary of the Invention
本申请旨在至少在一定程度上解决上述的技术缺陷之一。The present application aims to solve at least one of the above technical deficiencies to a certain extent.
为此,本申请的第一个目的在于提出一种预览画面虚化处理方法,该方法不仅提高了预览画面的虚化处理速度,节省了时间,而且还保证了拍摄主体不会因晃动而被虚化,从而提高了预览画面的虚化效果,提升了用户满意度。To this end, the first purpose of this application is to propose a preview screen blur processing method, which not only improves the blur processing speed of the preview screen and saves time, but also ensures that the shooting subject will not be blurred due to shaking, thereby improving the blur effect of the preview screen and improving user satisfaction.
本申请的第二个目的在于提出一种预览画面虚化处理装置。The second objective of this application is to provide a preview image blur processing device.
本申请的第三个目的在于提出一种终端设备。The third objective of this application is to provide a terminal device.
本申请的第四个目的在于提出一种计算机可读存储介质。The fourth object of this application is to provide a computer-readable storage medium.
为了实现上述目的,本申请第一方面实施例的预览画面虚化处理方法,包括:对当前第一预览画面进行人像识别,确定所述第一预览画面中的第一人像信息,其中所述第一人像信息包括第一人像的面积;根据所述第一人像信息,确定待保护的目标区域;在预览画面切换时,对第二预览画面中除所述目标区域外的其它区域进行虚化处理。In order to achieve the above-mentioned purpose, the preview screen blur processing method of the first aspect embodiment of the present application includes: performing portrait recognition on the current first preview screen, determining the first portrait information in the first preview screen, wherein the first portrait information includes the area of the first portrait; determining the target area to be protected based on the first portrait information; when the preview screen is switched, blurring the other areas in the second preview screen except the target area.
为了实现上述目的,本申请第二方面实施例的预览画面虚化处理装置,包括:第一确定模块,用于对当前第一预览画面进行人像识别,确定所述第一预览画面中的第一人像信息,其中所述第一人像信息包括第一人像的面积;第二确定模块,用于根据所述第一人像信息,确定待保护的目标区域;虚化处理模块,用于在预览画面切换时,对第二预览画面中除所述目标区域外的其它区域进行虚化处理。In order to achieve the above-mentioned purpose, the preview screen blur processing device of the second aspect embodiment of the present application includes: a first determination module, which is used to perform portrait recognition on the current first preview screen and determine the first portrait information in the first preview screen, wherein the first portrait information includes the area of the first portrait; a second determination module, which is used to determine the target area to be protected based on the first portrait information; and a blur processing module, which is used to blur other areas in the second preview screen except the target area when the preview screen is switched.
为了实现上述目的,本申请第三方面实施例的终端设备,包括:存储器、处理器及摄像模组;所述摄像模组,用于采集当前场景下的图像;所述存储器,用于存储可执行程序代码;所述处理器,用于读取所述存储器中存储的可执行程序代码来运行与所述可执行程序代码对应的程序,以用于实现第一方面实施例所述的预览画面虚化处理方法。In order to achieve the above-mentioned purpose, the terminal device of the third aspect embodiment of the present application includes: a memory, a processor and a camera module; the camera module is used to capture images in the current scene; the memory is used to store executable program code; the processor is used to read the executable program code stored in the memory to run the program corresponding to the executable program code, so as to implement the preview screen blur processing method described in the first aspect embodiment.
为了实现上述目的,本申请第四方面实施例的计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现第一方面实施例所述的预览画面虚化处理方法。In order to achieve the above-mentioned purpose, the computer-readable storage medium of the fourth embodiment of the present application stores a computer program thereon, which, when executed by a processor, implements the preview image blurring processing method described in the first embodiment.
本申请公开的技术方案,具有如下有益效果:The technical solution disclosed in this application has the following beneficial effects:
通过对当前第一预览画面进行人像识别,以确定出第一预览画面中的第一人像,然后根据确定的第一人像信息,确定出待保护的目标区域,以在预览画面进行切换时,对第二预览画面中除目标区域外的其他区域进行虚化处理。由此,实现了对预览画面进行虚化处理时,不仅提高了预览画面的虚化处理速度,节省了时间,而且还保证了拍摄主体不会因晃动而被虚化,从而提高了预览画面的虚化效果,提升了用户满意度。By performing portrait recognition on the current first preview image, the first person portrait in the first preview image is determined. Then, based on the determined first person portrait information, a target area to be protected is determined. When the preview image is switched, the remaining area in the second preview image, excluding the target area, is blurred. This achieves a faster blurring process for the preview image, saving time, while also ensuring that the subject is not blurred due to shaking, thereby improving the blurring effect of the preview image and enhancing user satisfaction.
本申请附加的方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本申请的实践了解到。Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through practice of the present application.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
本申请上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中,The above and/or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
图1是根据本申请一个实施例的预览画面虚化处理方法的流程图;FIG1 is a flowchart of a method for processing blurring a preview image according to an embodiment of the present application;
图2是根据本申请一个实施例的对当前第一预览画面进行人像识别的流程图;FIG2 is a flowchart of performing portrait recognition on the current first preview image according to one embodiment of the present application;
图3是根据本申请另一个实施例的预览画面虚化处理方法的流程图;FIG3 is a flowchart of a method for processing preview image blur according to another embodiment of the present application;
图4是根据本申请一个实施例的预览画面虚化处理装置的结构示意图;FIG4 is a schematic structural diagram of a preview image blur processing device according to an embodiment of the present application;
图5是根据本申请一个实施例的终端设备的结构示意图;FIG5 is a schematic structural diagram of a terminal device according to an embodiment of the present application;
图6是根据本申请一个实施例的图像处理电路的结构示意图。FIG6 is a schematic structural diagram of an image processing circuit according to an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
下面详细描述本申请的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,旨在用于解释本申请,而不能理解为对本申请的限制。The following describes in detail embodiments of the present application, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
为了解决相关技术中,对预览画面的背景区域进行虚化处理时,不仅需要花费较长时间计算拍摄画面的景深信息,而且还存在当拍摄画面中的主体出现晃动时,拍摄画面的景深信息来不及更新,从而容易出现部分主体被虚化,进而影响拍摄画面的整体虚化效果,降低了用户体验的问题,提出一种预览画面虚化处理方法。In order to solve the problem in the related art that when blurring the background area of the preview screen, it not only takes a long time to calculate the depth of field information of the shooting screen, but also when the subject in the shooting screen shakes, the depth of field information of the shooting screen cannot be updated in time, so that part of the subject is easily blurred, which in turn affects the overall blurring effect of the shooting screen and reduces the user experience, a preview screen blurring processing method is proposed.
本申请提供的预览画面虚化处理方法,通过对当前第一预览画面进行人像识别,以确定第一预览画面中的第一人像信息,其中第一人像信息包括第一人像的面积,并根据确定的第一人像信息,确定出待保护的目标区域,然后在预览画面切换时,对第二预览画面中除了目标区域外的其他区域进行虚化处理。由此,实现了对预览画面进行虚化处理时,不仅提高了预览画面的虚化处理速度,节省了时间,而且还保证了拍摄主体不会因晃动而被虚化,从而提高了预览画面的虚化效果,提升了用户满意度。The preview image blurring method provided in this application performs portrait recognition on the current first preview image to determine the first person portrait information in the first preview image, where the first person portrait information includes the area of the first person portrait. Based on the determined first person portrait information, a target area to be protected is determined. Then, when the preview image switches, the remaining area in the second preview image, excluding the target area, is blurred. This method not only improves the blurring speed of the preview image, saving time, but also ensures that the subject is not blurred due to shaking, thereby improving the blurring effect of the preview image and enhancing user satisfaction.
下面参考附图描述本申请实施例的虚化图像获取方法。The blurred image acquisition method according to an embodiment of the present application is described below with reference to the accompanying drawings.
图1是根据本申请一个实施例的预览画面虚化处理方法的流程图。FIG1 is a flowchart of a method for processing blurring a preview image according to an embodiment of the present application.
如图1所示,本申请的预览画面虚化处理方法可以包括以下步骤:As shown in FIG1 , the preview image blur processing method of the present application may include the following steps:
步骤101,对当前第一预览画面进行人像识别,确定第一预览画面中的第一人像信息,其中第一人像信息包括第一人像的面积.Step 101, performing portrait recognition on the current first preview screen, determining the first portrait information in the first preview screen, wherein the first portrait information includes the area of the first portrait.
具体的,本申请实施例提供的预览画面虚化处理方法,可以由本申请提供的预览画面虚化处理装置执行,上述装置配置于终端设备中,以实现对预览画面进行虚化控制。Specifically, the preview image blurring processing method provided in the embodiment of the present application can be executed by the preview image blurring processing device provided in the present application. The above device is configured in the terminal device to realize blurring control of the preview image.
其中,本实施例中,终端设备可以是任意具有拍照功能的硬件设备,比如智能手机、相机、个人计算机(personal computer,简称为PC)等等,本申请对此不作具体限定。In this embodiment, the terminal device can be any hardware device with a camera function, such as a smart phone, a camera, a personal computer (PC), etc., and this application does not make any specific restrictions on this.
可选的,本实施例中终端设备还可以是具有双摄像头的硬件设备,其中,双摄像头是指具有两个后置摄像头。Optionally, in this embodiment, the terminal device may also be a hardware device with dual cameras, where the dual cameras refer to a device with two rear cameras.
需要说明的是,在本实施例中,两个后置摄像头的设置方式可以为,但不限于以下方式:It should be noted that, in this embodiment, the two rear cameras may be arranged in the following manners, but are not limited to:
方式一:沿水平方向设置。Method 1: Set in the horizontal direction.
方式二:沿竖直方向设置。Method 2: Set in the vertical direction.
其中,水平方向是指与终端设备短边平行的方向,竖直方向是指与终端设备长边平行的方向。The horizontal direction refers to the direction parallel to the short side of the terminal device, and the vertical direction refers to the direction parallel to the long side of the terminal device.
在具体执行步骤101时,本实施例可通过图2所示的步骤,对当前第一预览画面进行人像识别。When specifically executing step 101 , this embodiment can perform portrait recognition on the current first preview image through the steps shown in FIG. 2 .
需要说明的是,所谓人像识别,也叫做人像对焦技术,是一种在数码相机领域中应用较广泛的技术。人像识别技术的原理通过识别画面中的眼睛、嘴等特征信息,锁定画面中的人像位置,并自动将人像作为拍摄的主体,设置准确的焦距和曝光量。当脸部识别功能开始工作的时候,摄像头就会自动根据画面中人像的位置和照度进行设置,确保人像的清晰和曝光准确。此外,当画面中有多个人物时,脸部识别功能也能够准确工作,挑选最主要的对象。It's important to note that portrait recognition, also known as portrait focus technology, is a widely used technology in digital cameras. Portrait recognition technology works by identifying features such as eyes and mouths in the frame, locking onto the subject's position, and automatically focusing on the subject, setting the correct focus and exposure. When facial recognition is activated, the camera automatically adjusts the focus based on the subject's position and illumination, ensuring clarity and accurate exposure. Furthermore, facial recognition can accurately identify the primary subject even when multiple people are in the frame.
具体的,对预览画面进行人像识别可以包括以下步骤:Specifically, performing portrait recognition on the preview image may include the following steps:
步骤201,确定第一预览画面中人脸区域对应的深度信息。Step 201: Determine depth information corresponding to a face region in a first preview image.
具体实现时,可先通过任意形式的人脸识别技术,对第一预览画面中的人脸进行识别。比如,可以先捕捉第一预览画面中包含的人眼,然后根据捕捉到的人脸确定人脸区域,然后再根据终端所具备的摄像头数量采取不同的方式,获取人脸区域对应的深度信息。In a specific implementation, the face in the first preview image can be identified using any form of facial recognition technology. For example, the eyes in the first preview image can be captured, and then the facial region can be determined based on the captured face. Then, different methods can be used based on the number of cameras on the terminal to obtain the depth information corresponding to the facial region.
举例说明,若终端为单摄像头设备,则可通过超声波雷达对第一预览画面进行扫描,以得到人脸区域对应的深度信息。For example, if the terminal is a single-camera device, the first preview image can be scanned by an ultrasonic radar to obtain depth information corresponding to the face area.
若终端为双摄像头设备,则可根据三角测距原理,并依据上述双摄像头之间关于同一对象的差异性,计算得到该对象的深度信息,也就是该对象距离双摄像头所在平面的距离。If the terminal is a dual-camera device, the depth information of the object, that is, the distance from the object to the plane where the dual cameras are located, can be calculated based on the principle of triangulation and the differences between the dual cameras regarding the same object.
步骤202,根据深度信息,确定第一预览画面中包括的人像轮廓。Step 202: Determine the outline of the portrait included in the first preview image based on the depth information.
具体的,在实际应用中,终端拍摄的画面中通常包括前景区域和后景区域,并且前景区域和后景区域的深度变化比较明显。因此,本实施例在获取到人脸区域对应的深度信息之后,可根据深度信息确定出第一预览画面中包括的人像轮廓。Specifically, in actual applications, the images captured by the terminal typically include a foreground area and a background area, and the depth of the foreground and background areas varies significantly. Therefore, after obtaining the depth information corresponding to the face area, this embodiment can determine the outline of the portrait included in the first preview image based on the depth information.
步骤203,判断人像轮廓对应的深度变换值是否大于阈值,若大于则执行步骤204,否则执行步骤205。Step 203 , determining whether the depth transformation value corresponding to the portrait outline is greater than a threshold, if so, executing step 204 , otherwise executing step 205 .
其中,阈值可以根据第一预览画面中人像的拍摄情况进行适应性设置,本申请对此不作具体限定。The threshold value may be adaptively set according to the shooting conditions of the portrait in the first preview image, and this application does not impose any specific limitation on this.
具体的,在获取到第一预览画面中的人像轮廓之后,还可将人脸轮廓的深度变化值与阈值比对,以确定人脸轮廓是否获取准确。若人脸轮廓的深度变化值大于阈值,则说明步骤202确定的人像轮廓符合要求,若小于阈值,则说明步骤202确定的人像轮廓不符合要求,则需要对上述人像轮廓进行修正,以使得最终确定的人像轮廓更准确。Specifically, after obtaining the portrait outline in the first preview image, the depth change value of the facial outline can be compared with a threshold value to determine whether the facial outline is accurately obtained. If the depth change value of the facial outline is greater than the threshold value, it means that the portrait outline determined in step 202 meets the requirements. If it is less than the threshold value, it means that the portrait outline determined in step 202 does not meet the requirements, and the portrait outline needs to be corrected to make the final portrait outline more accurate.
步骤204,将确定的人像轮廓作为人像识别结果。Step 204: Use the determined portrait outline as a portrait recognition result.
步骤205,根据人像轮廓中各像素点与相邻像素点的颜色信息,对人像轮廓进行修正。Step 205 : Correcting the portrait outline according to the color information of each pixel and adjacent pixels in the portrait outline.
具体的,获取人像轮廓中的像素点与相邻像素点的颜色信息,然后比对人像轮廓分割的相邻像素点间的颜色变化是否明显,若不明显,则表示当前确定的人像轮廓不准确。因此则可以将人像轮廓向外扩展或者向内收缩,直到人像轮廓分割的相邻像素点间的颜色相差明显时,则可将当前的人像轮廓作为最终的人像识别结果。Specifically, the color information of the pixels in the portrait outline and the adjacent pixels is obtained. The color variation between the adjacent pixels in the portrait outline segmentation is then compared to see if it is significant. If not, the currently determined portrait outline is inaccurate. Therefore, the portrait outline can be expanded or contracted until the color difference between the adjacent pixels in the portrait outline segmentation is significant. The current portrait outline can then be used as the final portrait recognition result.
进而,根据确定的人像轮廓即可确定出第一预览画面中第一人像的信息。Then, information of the first portrait in the first preview image can be determined according to the determined portrait outline.
其中,第一人像可以处于第一预览画面中的任意一个区域,本申请对此不作具体限定。The first person portrait may be located in any area of the first preview screen, and this application does not impose any specific limitation on this.
具体实现时,本实施例中第一预览画面中的人像数量可能为一个,也可以为多个。比如,两个、三个、五个等等,本申请对此不作具体限定。In specific implementation, in this embodiment, the number of portraits in the first preview screen may be one or more, for example, two, three, five, etc., which is not specifically limited in this application.
相应的,在通过预览画面虚化处理装置对第一预览画面进行人像识别时,确定的第一人像可以为一个,也可以为多个。Accordingly, when the preview image blurring processing device performs portrait recognition on the first preview image, the determined first portraits may be one or more.
在本实施例一种可能的实现形式中,当识别出第一预览画面中的人像包含不需要进行保护的人像时,用户可手动选择的第一人像,即用户可在终端显示界面中勾画轨迹,以选择第一人像。In a possible implementation of this embodiment, when it is identified that the portraits in the first preview screen include a portrait that does not need to be protected, the user can manually select the first portrait, that is, the user can draw a trajectory in the terminal display interface to select the first portrait.
然后,预览画面虚化处理装置根据用户的勾画轨迹,确定出第一人像的面积信息。Then, the preview image blurring processing device determines the area information of the first portrait according to the user's drawing trajectory.
其中,用户在终端的显示界面上勾画轨迹可以是闭合曲线,也可以是非闭合曲线,本申请对此不作具体限定。The trajectory drawn by the user on the display interface of the terminal may be a closed curve or a non-closed curve, and this application does not make any specific restrictions on this.
或者,还可以根据终端预先拍摄的图像,确定第一人像。即先利用终端设备对第一人物进行拍照并进行存储,然后在拍摄具有背景虚化效果的图像时,终端设备自动根据预先拍摄的上述第一人物的图像,从预览界面中识别到的人像中找到与上述第一人物相似的人像,并将找到的人像作为第一人像。Alternatively, the first person portrait may be determined based on an image pre-captured by the terminal. That is, the first person is first photographed and stored using the terminal device. Then, when capturing an image with a blurred background, the terminal device automatically searches for a portrait similar to the first person from among the portraits recognized in the preview interface based on the pre-captured image of the first person, and uses the found portrait as the first person portrait.
步骤102,根据第一人像信息,确定待保护的目标区域。Step 102: Determine a target area to be protected based on the first portrait information.
具体的,在实际拍摄背景虚化图像时,拍摄主体可能会出现晃动,或者拍摄者在按下拍摄键时手会出现抖动,从而导致拍摄画面中拍摄主体被虚化的情况。为了避免上述情况的发生,本申请可根据确定的第一人像信息,对预览画面中包含第一人像的区域进行确定,并将上述包含第一人像的区域作为待保护的目标区域。Specifically, when actually shooting an image with a blurred background, the subject may shake, or the photographer's hand may shake when pressing the capture button, resulting in the subject being blurred in the captured image. To avoid the above situation, this application can determine the area containing the first person portrait in the preview image based on the determined first person portrait information, and use the area containing the first person portrait as the target area to be protected.
具体实现时,本实施例可通过以下方式,确定待保护的目标区域,举例说明如下:In specific implementation, this embodiment can determine the target area to be protected by the following methods, as illustrated below:
第一种实现方式:The first implementation method:
将第一人像的面积扩大预设的倍数,确定目标区域的面积。The area of the first portrait is enlarged by a preset multiple to determine the area of the target area.
其中,本实施例中人像面积的预设扩大倍数,可以是终端默认的,也可以是用户根据实际需要适应性设定的,本申请对此不作限定。Among them, the preset magnification factor of the portrait area in this embodiment can be the terminal default, or can be adaptively set by the user according to actual needs, and this application does not limit this.
具体的,本申请通过将第一预览画面中的第一人像面积进行放大,以使后续采集的帧画面中第一人像始终处于放大的区域内,从而保证了后续对预览画面进行背景虚化处理时,不会对拍摄画面中的人像进行虚化,从而保证了人像的完整性。Specifically, the present application enlarges the area of the first portrait in the first preview screen so that the first portrait in the subsequently captured frame screen is always within the enlarged area, thereby ensuring that when the background of the preview screen is subsequently blurred, the portrait in the captured screen will not be blurred, thereby ensuring the integrity of the portrait.
第二种实现方式:The second implementation method:
根据第一人像信息与人像模版库中预设人像模版的匹配度,确定出目标区域的面积。The area of the target region is determined according to the matching degree between the first portrait information and the preset portrait template in the portrait template library.
其中,本实施例中人像模版库可以是根据大量的人像图像样本训练得到的,本申请对此不做限定。In this embodiment, the portrait template library can be obtained by training based on a large number of portrait image samples, and this application does not limit this.
上述人像模版库中,用于定义不同属性与人像模版及最大面积的对应关系。The portrait template library is used to define the corresponding relationship between different attributes, portrait templates and maximum areas.
具体实现时,本实施例可通过将识别的第一人像与人像模版库进行匹配,以确定出第一人像的属性,然后根据第一人像的属性确定目标区域的面积。In specific implementation, this embodiment can determine the attributes of the first portrait by matching the recognized first portrait with the portrait template library, and then determine the area of the target region according to the attributes of the first portrait.
其中,第一人像的属性信息可以是,但不限于:年龄、性别等等,本申请对此不作具体限定。The attribute information of the first person portrait may include, but is not limited to, age, gender, etc., and this application does not impose any specific limitation on this.
举例说明,若将识别的第一人像与人像模版库进行匹配,确定出第一人像的属性为小孩,则可在属性与目标区域面积映射表中,查找与小孩对应的目标区域的面积信息。For example, if the first recognized portrait is matched with the portrait template library and the attribute of the first portrait is determined to be a child, the area information of the target area corresponding to the child can be found in the attribute and target area mapping table.
可以理解的是,本申请通过将识别的人像与人像模版库进行匹配,确定待保护的目标区域,可以节省预览画面虚化处理的时间,进一步提升用户体验。It can be understood that this application can save time in blurring the preview image and further improve the user experience by matching the recognized portrait with the portrait template library to determine the target area to be protected.
步骤103,在预览画面切换时,对第二预览画面中除目标区域外的其它区域进行虚化处理。Step 103 : When the preview screen is switched, blurring is performed on the other areas except the target area in the second preview screen.
具体的,当第一预览画面切换成第二预览画面时,预览画面虚化处理装置可根据确定的待保护的目标区域,对第二预览画面中除了待保护的目标区域之外的其他区域进行虚化处理,从而保证了预览画面中的人像不被虚化,提升预览画面的虚化处理效果。Specifically, when the first preview screen switches to the second preview screen, the preview screen blur processing device can blur the other areas in the second preview screen except the target area to be protected according to the determined target area to be protected, thereby ensuring that the portrait in the preview screen is not blurred and improving the blur processing effect of the preview screen.
需要说明的是,在实际拍摄过程中,用户并非是对每帧预览图像都进行虚化处理操作。若本实施例中预览图像虚化处理装置,对每帧预览图像都按照上述方式进行虚化处理时,很容易造成终端设备的处理负担过大。It should be noted that in the actual shooting process, the user does not perform the blur processing operation on each preview image frame. If the preview image blur processing device in this embodiment performs the blur processing on each preview image frame in the above manner, it is easy to cause an excessive processing burden on the terminal device.
因此,为了减轻终端设备的处理负担,本申请在对预览画面中除了目标区域外的其他区域进行虚化处理之前,还可以执行以下操作:Therefore, in order to reduce the processing burden of the terminal device, the present application may further perform the following operations before blurring other areas of the preview image except the target area:
操作一:Operation 1:
获取人像边缘保护指令;Get portrait edge protection instructions;
具体的,当需要对预览图像虚化装置中的某个预览画面进行虚化处理时,用户可通过预览图像虚化处理装置提供多种方式,输入人像边缘保护指令。Specifically, when a preview image in the preview image blurring device needs to be blurred, the user can input a portrait edge protection instruction through a variety of methods provided by the preview image blurring device.
其中,人像边缘保护指令的输入方式可以是通过手动按压方式输入人像边缘保护指令;或者,还可以利用语音输入的方式输入人像边缘保护指令;又或者,通过手动滑动方式输入人像边缘保护指令等等,本申请对此不作限定。Among them, the input method of the portrait edge protection instruction can be to input the portrait edge protection instruction by manual pressing; or, the portrait edge protection instruction can be input by voice input; or, the portrait edge protection instruction can be input by manual sliding, etc., which is not limited in this application.
操作二:Operation 2:
确定拍摄终端的抖动幅度大于第一阈值。Determine whether the shaking amplitude of the shooting terminal is greater than a first threshold.
其中,第一阈值可根据拍摄终端实际拍摄情况进行适应性设置,本申请不作具体限定。Among them, the first threshold can be adaptively set according to the actual shooting situation of the shooting terminal, and this application does not make any specific limitation.
具体的,在实际拍照过程中,通常会因为外界因素导致拍摄终端出现抖动,并且上述抖动会造成拍摄画面中的拍摄主体与终端出现相对位移差。因此为了保证在拍摄终端出现抖动,且抖动大于第一阈值时,能够拍摄到画面清晰,且拍摄主体不被虚化的画面,本申请可根据确定的待保护的目标区域,对第二预览画面中除了待保护的目标区域之外的其他区域进行虚化处理操作,以得到第一人像突出,背景部分被虚化的图像。Specifically, during the actual photo-taking process, the camera terminal will often experience jitter due to external factors, and this jitter will cause a relative displacement difference between the subject and the terminal in the captured image. Therefore, in order to ensure that a clear image is captured without blurring the subject when the camera terminal experiences jitter, and the jitter is greater than a first threshold, the present application can perform a blurring operation on the other areas of the second preview image, excluding the target area to be protected, based on the determined target area to be protected, to obtain an image in which the first person's portrait is prominent and the background is blurred.
本申请实施例的预览画面虚化处理方法,通过对当前第一预览画面进行人像识别,以确定出第一预览画面中的第一人像,然后根据确定的第一人像信息,确定出待保护的目标区域,以在预览画面进行切换时,对第二预览画面中除目标区域外的其他区域进行虚化处理。由此,实现了对预览画面进行虚化处理时,不仅节省了预览画面的虚化处理时间,而且还保证了拍摄主体不会因晃动而被误虚化,从而提高了预览画面的虚化效果,提高了用户满意度。The preview image blurring method of the embodiment of the present application performs portrait recognition on the current first preview image to determine the first person portrait in the first preview image. Then, based on the determined first person portrait information, a target area to be protected is determined. When the preview image is switched, the remaining area in the second preview image, excluding the target area, is blurred. This method not only saves blurring time when blurring the preview image, but also ensures that the subject is not mistakenly blurred due to shaking, thereby improving the blurring effect of the preview image and enhancing user satisfaction.
通过上述分析可知,通过对第一预览画面进行人像识别,确定出第一人像信息,并确定待保护的目标区域,然后在预览画面切换时,对第二预览画面中除目标区域外的其他区域进行虚化处理。具体实现时,由于本申请中根据第一人像信息确定待保护的目标区域时,可通过以下两种方式实现,第一种实现方式为将第一人像信息与人像模版库进行匹配,确定待保护的目标区域;第二种实现方式为对第一人像的面积扩大预设倍数,确定待保护的目标区域。其中若本实施例采取第一种实现方式,来确定待保护的目标区域时,则需要先建立人像模版库,然后再根据建立的人像模版库与第一人像信息进行匹配,来确定待保护的目标区域。下面结合图3,对本实施例中建立人像模版库的过程进行详细说明。From the above analysis, it can be seen that by performing portrait recognition on the first preview screen, the first portrait information is determined, and the target area to be protected is determined. Then, when the preview screen is switched, the other areas in the second preview screen except the target area are blurred. In specific implementation, since the target area to be protected is determined based on the first portrait information in this application, it can be implemented in the following two ways. The first implementation method is to match the first portrait information with the portrait template library to determine the target area to be protected; the second implementation method is to expand the area of the first portrait by a preset multiple to determine the target area to be protected. Among them, if this embodiment adopts the first implementation method to determine the target area to be protected, it is necessary to first establish a portrait template library, and then match the first portrait information based on the established portrait template library to determine the target area to be protected. The process of establishing a portrait template library in this embodiment is described in detail below in conjunction with Figure 3.
图3是本申请的另一个预览画面虚化处理方法的流程图。FIG3 is a flowchart of another preview image blurring processing method of the present application.
如图3所示,本申请的预览画面虚化处理方法可以包括以下步骤:As shown in FIG3 , the preview image blur processing method of the present application may include the following steps:
步骤301,获取人像图像样本集,样本集中包括各种人像位姿图。Step 301: Obtain a portrait image sample set, where the sample set includes various portrait pose graphs.
其中,各种人像位姿图可以理解为,人像的不同表情,或者人像姿态等等。Among them, various portrait pose diagrams can be understood as different expressions of the portrait, or portrait postures, etc.
具体实现时,本实施例中人像图像样本集可是在终端出厂时,预先配置的,或者也可以是从服务器侧获取的,本实施例对此不做限定。In specific implementation, the portrait image sample set in this embodiment may be pre-configured when the terminal leaves the factory, or may be obtained from the server side, which is not limited in this embodiment.
需要说明的是,为了保证后续建立的人像模版库更具备说服性,本实施例可获取的人像图像样本集,可以是几万张、十几万张、甚至百万级本申请对此不作具体限定。It should be noted that, in order to ensure that the portrait template library subsequently established is more persuasive, the portrait image sample set that can be obtained in this embodiment can be tens of thousands, hundreds of thousands, or even millions of images. This application does not make any specific restrictions on this.
步骤302,对人像图像样本集进行训练,确定不同属性的用户对应的人像模版及人像最大面积,并建立人像模版库。Step 302 : training the portrait image sample set, determining the portrait templates and the maximum portrait area corresponding to users with different attributes, and establishing a portrait template library.
具体的,在获取到人像图像样本集之后,本申请可先对获取的人像图像样本进行分析,以确定人像图像集中每个人像图像的属性信息,然后根据人像图像样本集的属性信息进行训练,得到不同属性的人像图像所对应的人像模版及人像最大面积。然后,根据人像图像样本与人像模版及人像最大面积的对应关系,建议人像模版库。Specifically, after obtaining a sample set of portrait images, the present application may first analyze the obtained sample images to determine the attribute information of each portrait image in the sample set. Training may then be performed based on the attribute information of the sample set to obtain portrait templates and maximum portrait areas corresponding to portrait images with different attributes. Subsequently, based on the correspondence between the portrait image samples, the portrait templates, and the maximum portrait area, a portrait template library may be recommended.
步骤303,对当前第一预览画面进行人像识别,确定第一预览画面中的第一人像信息,其中第一人像信息包括第一人像的面积。Step 303 : Perform portrait recognition on the current first preview image to determine first portrait information in the first preview image, wherein the first portrait information includes the area of the first portrait.
步骤304,根据第一人像信息与人像模版库中各预设人像模版的匹配度,确定第一人像的属性。Step 304 : Determine the attributes of the first portrait based on the matching degree between the first portrait information and each preset portrait template in the portrait template library.
具体的,确定出第一预览画面中第一人像信息之后,可将确定的第一人像信息与人像模版库中的各人像模版进行匹配,并将匹配度最高的人像模版对应的属性信息,作为第一人像属性。Specifically, after determining the first portrait information in the first preview image, the determined first portrait information can be matched with each portrait template in the portrait template library, and the attribute information corresponding to the portrait template with the highest matching degree is used as the first portrait attribute.
具体实现时,可先获取人像模版库,其中人像模版库中包括人像属性与人像模版及人像最大面积的对应关系。然后,将第一人像与获取的人像模版库的各人像模版进行匹配,确定出与第一人像匹配度最高的人像模版,并将人像模版对应的人像属性,确定为第一人像的属性。In a specific implementation, a portrait template library can be obtained, wherein the portrait template library includes a correspondence between portrait attributes, portrait templates, and the maximum area of the portrait. Then, the first portrait is matched with each portrait template in the obtained portrait template library to determine the portrait template with the highest matching degree with the first portrait, and the portrait attributes corresponding to the portrait template are determined as the attributes of the first portrait.
进一步的,为了提高人像模版库的准确性,本申请实施例中,还可以根据终端实际拍摄的图像,对人像模版库进行周期性更新。Furthermore, in order to improve the accuracy of the portrait template library, in an embodiment of the present application, the portrait template library can also be periodically updated based on the images actually captured by the terminal.
举例来说,不同用户使用的终端,经常拍摄的对象可能不同,且不同的目标对象的人像特征不同,比如有的拍摄对象在拍摄时,头部动作小,有的拍摄对象在拍摄时头部动作大,或者,有的拍摄对象在拍摄时,习惯向左侧头,有的拍摄对象在拍摄时习惯向右侧头等等。For example, different users may frequently photograph different objects using terminals, and different target objects may have different portrait features. For example, some subjects may have small head movements when photographing, while some subjects may have large head movements when photographing; or, some subjects may tend to turn their heads to the left when photographing, while some subjects may tend to turn their heads to the right, and so on.
从而终端设备在实际使用时,可以根据预设时间段内采集的人像的图像,对人像模版库进行更新。从而使得各终端利用更新后的人像模版库,确定的目标区域更加准确和可靠。Therefore, when the terminal device is actually used, the portrait template library can be updated according to the portrait images collected within the preset time period, so that each terminal can use the updated portrait template library to determine the target area more accurately and reliably.
比如,若终端设备A在预设时间段内采集的人像图像中,人像习惯向左倾斜,且初始人像模版库中,人像最大面积=人像面积+a+b,其中,a表示沿人像左侧延伸的面积,b表示沿人像右侧延伸的面积;那么终端设备A根据采集的人像图像,将人像模版库进行更新后,确定的人像最大面积可能为:人像面积+a+b+c,其中,c为根据采集的人像图像中,人像习惯确定的沿人像左侧增加的面积。For example, if the portrait image captured by terminal device A within a preset time period shows that the portrait is accustomed to tilting to the left, and in the initial portrait template library, the maximum area of the portrait = portrait area + a + b, where a represents the area extending along the left side of the portrait, and b represents the area extending along the right side of the portrait; then after terminal device A updates the portrait template library based on the captured portrait image, the determined maximum area of the portrait may be: portrait area + a + b + c, where c is the area added along the left side of the portrait determined based on the portrait habit in the captured portrait image.
其中,预设时间段可以根据实际情况进行设置,比如一周、一个月等等,本申请对此不做限定。Among them, the preset time period can be set according to actual conditions, such as one week, one month, etc., and this application does not limit this.
本实施例中初始人像模版库中包括不同属性的用户对应的人像模版及人像最大面积的模版库。In this embodiment, the initial portrait template library includes portrait templates corresponding to users with different attributes and a template library of portraits with the largest area.
也就是说,本申请通过对初始人像模版库进行不定期的更新,可以使得更新后的人像模版在后续确定人像属性时,能够进一步增加识别准确度,降低识别失败率,从而进一步提升了用户体验。That is to say, by updating the initial portrait template library from time to time, the updated portrait template can further increase the recognition accuracy and reduce the recognition failure rate when determining portrait attributes in the subsequent process, thereby further improving the user experience.
步骤305,根据第一人像的属性,确定目标区域的面积。Step 305: Determine the area of the target region according to the attributes of the first portrait.
具体的,由于人像模版库中存储着人像属性与人像模版及人像最大面积的对应关系,因此本申请在确定出第一人像的属性之后,可直接根据上述人像属性在人像属性与人像模版及人像最大面积的对应关系中,查询并确定出第一人像的目标区域面积。Specifically, since the portrait template library stores the correspondence between portrait attributes, portrait templates, and the maximum area of portraits, after determining the attributes of the first portrait, the present application can directly query and determine the target area of the first portrait based on the correspondence between the portrait attributes, portrait templates, and the maximum area of the portrait.
步骤306,在预览画面切换时,获取人像边缘保护指令。Step 306: When the preview screen is switched, obtain a portrait edge protection instruction.
具体的,为了减轻终端设备对预览画面的虚化处理负担,本实施例在对需要进行虚化处理的预览画面进行虚化处理之前,可先接收用户通过预览图像虚化处理装置提供的多种输入方式,输入人像边缘保护指令。Specifically, in order to reduce the burden of blurring the preview screen on the terminal device, this embodiment can first receive multiple input methods provided by the user through the preview image blurring processing device to input the portrait edge protection instruction before blurring the preview screen that needs to be blurred.
其中,人像边缘保护指令的输入方式可以是通过手动按压方式输入人像边缘保护指令;或者,还可以利用语音输入的方式输入人像边缘保护指令;又或者,通过手动滑动方式输入人像边缘保护指令等等,本申请对此不作限定。Among them, the input method of the portrait edge protection instruction can be to input the portrait edge protection instruction by manual pressing; or, the portrait edge protection instruction can be input by voice input; or, the portrait edge protection instruction can be input by manual sliding, etc., which is not limited in this application.
步骤307,根据获取人像边缘保护指令,根据其他区域与目标区域的距离,对其他区域进行不同程度的虚化处理。Step 307 : Based on the obtained portrait edge protection instruction, blurring is performed on other areas to varying degrees according to the distance between the other areas and the target area.
具体的,在获取到用户输入的人像边缘保护指令之后,预览图像虚化处理装置可根据人像边缘保护指令,对预览图像进行人像区域保护的背景虚化处理。Specifically, after obtaining the portrait edge protection instruction input by the user, the preview image blur processing device can perform background blur processing for protecting the portrait area on the preview image according to the portrait edge protection instruction.
进一步的,为了使得虚化处理后的预览图像能够突出主体,且与背景部分的过度更平缓自然,本申请可对预览画面其他区域进行虚化处理时,可根据虚化程度由低到高的顺序,对预览画面进行虚化处理。Furthermore, in order to make the preview image after blurring highlight the subject and make the transition with the background smoother and more natural, the present application can blur other areas of the preview screen in order of blurring degree from low to high.
其中,本申请通过采用虚化程度由低到高的顺序的方式对预览画面的背景区域进行虚化处理,可以使得保护区域与虚化区域的过渡更加平滑,进而使得呈现在拍摄预览界面上的图像更加自然。Among them, the present application blurs the background area of the preview screen in order of blur degree from low to high, which can make the transition between the protection area and the blurred area smoother, thereby making the image presented on the shooting preview interface more natural.
本申请实施例的虚化图像获取方法,通过先获取不同的人像图像样本集进行训练,以建立人像模版库,其中人像模版库中包括人像属性与人像模版及人像最大面积的对应关系,进而在对第一预览画面进行人像识别,确定出第一预览画面中第一人像信息之后,可将第一人像信息与人像模版库中各人像模版进行匹配,以得到第一人像的属性,然后根据第一人像的属性确定出目标区域的面积,然后在预览画面切换时,能够根据确定的目标区域及人像边缘保护指令,对预览画面中除了目标区域之外的其他区域进行不同程度的虚化处理。由此,实现了对预览画面进行虚化处理时,不仅提高了预览画面的虚化处理速度,节省了时间,而且还保证了拍摄主体不会因晃动而被虚化,从而提高了预览画面的虚化效果,提升了用户满意度。The blurred image acquisition method of the embodiment of the present application first obtains different portrait image sample sets for training to establish a portrait template library, wherein the portrait template library includes a correspondence between portrait attributes, portrait templates, and the maximum area of the portrait. Then, after performing portrait recognition on the first preview screen and determining the first portrait information in the first preview screen, the first portrait information can be matched with each portrait template in the portrait template library to obtain the attributes of the first portrait. Then, based on the attributes of the first portrait, the area of the target area can be determined. Then, when the preview screen is switched, the areas other than the target area in the preview screen can be blurred to varying degrees based on the determined target area and the portrait edge protection instruction. In this way, when blurring the preview screen, not only the blurring processing speed of the preview screen is improved, saving time, but also ensuring that the subject will not be blurred due to shaking, thereby improving the blurring effect of the preview screen and enhancing user satisfaction.
为了实现上述实施例,本发明还提出了一种预览画面虚化处理装置。In order to implement the above embodiment, the present invention further proposes a preview image blur processing device.
图4是本发明一个实施例的预览画面虚化处理装置的结构示意图。FIG4 is a schematic structural diagram of a preview image blurring processing apparatus according to an embodiment of the present invention.
如图4所示,本申请的预览画面虚化处理装置包括:第一确定模块11、第二确定模块12以及虚化处理模块13。As shown in FIG4 , the preview image blurring processing apparatus of the present application includes: a first determination module 11 , a second determination module 12 and a blurring processing module 13 .
其中,第一确定模块11用于对当前第一预览画面进行人像识别,确定所述第一预览画面中的第一人像信息,其中所述第一人像信息包括第一人像的面积;The first determining module 11 is configured to perform portrait recognition on the current first preview image and determine first portrait information in the first preview image, wherein the first portrait information includes an area of the first portrait;
第二确定模块12用于根据所述第一人像信息,确定待保护的目标区域;The second determining module 12 is used to determine the target area to be protected based on the first portrait information;
虚化处理模块13用于在预览画面切换时,对第二预览画面中除所述目标区域外的其它区域进行虚化处理。The blur processing module 13 is configured to perform blur processing on other areas except the target area in the second preview image when the preview image is switched.
需要说明的是,前述对预览画面虚化处理方法实施例的解释说明也适用于该实施例的预览画面虚化处理装置,其实现原理类似,此处不再赘述。It should be noted that the above explanation of the embodiment of the preview image blur processing method is also applicable to the preview image blur processing device of this embodiment. The implementation principles are similar and will not be repeated here.
本实施例提供的预览画面虚化处理装置中,通过对当前第一预览画面进行人像识别,以确定出第一预览画面中的第一人像,然后根据确定的第一人像信息,确定出待保护的目标区域,以在预览画面进行切换时,对第二预览画面中除目标区域外的其他区域进行虚化处理。由此,实现了对预览画面进行虚化处理时,不仅节省了预览画面的虚化处理时间,而且还保证了拍摄主体不会因晃动而被误虚化,从而提高了预览画面的虚化效果,提高了用户满意度。In the preview image blurring device provided in this embodiment, portrait recognition is performed on the current first preview image to determine the first portrait in the first preview image. Based on the determined first portrait information, a target area to be protected is then determined. When the preview image is switched, the remaining area in the second preview image, excluding the target area, is blurred. This not only saves blurring time when blurring the preview image, but also ensures that the subject is not mistakenly blurred due to shaking, thereby improving the blurring effect of the preview image and enhancing user satisfaction.
为了实现上述实施例,本发明还提出一种终端设备。In order to implement the above embodiment, the present invention also provides a terminal device.
图5是本发明一个实施例的终端设备的结构示意图。FIG5 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
参见图5,本申请终端设备包括存储器21、处理器22及摄像模组23;5 , the terminal device of the present application includes a memory 21 , a processor 22 , and a camera module 23 ;
所述摄像模组23用于采集当前场景下的图像;The camera module 23 is used to capture images of the current scene;
所述存储器21用于存储可执行程序代码;The memory 21 is used to store executable program codes;
所述处理器22用于读取所述存储器21中存储的可执行程序代码来运行与所述可执行程序代码对应的程序,以用于实现第一方面实施例所述的预览画面虚化处理方法。其中预览画面虚化处理方法包括:对当前第一预览画面进行人像识别,确定所述第一预览画面中的第一人像信息,其中所述第一人像信息包括第一人像的面积;根据所述第一人像信息,确定待保护的目标区域;在预览画面切换时,对第二预览画面中除所述目标区域外的其它区域进行虚化处理。The processor 22 is configured to read the executable program code stored in the memory 21 and run a program corresponding to the executable program code to implement the preview image blurring processing method described in the first embodiment. The preview image blurring processing method includes: performing portrait recognition on the current first preview image to determine first portrait information in the first preview image, wherein the first portrait information includes the area of the first portrait; determining a target area to be protected based on the first portrait information; and blurring the remaining areas in the second preview image except the target area when the preview image is switched.
其中,本实施例中终端设备可以是任意具有拍照功能的硬件设备,比如智能手机、相机、个人计算机(personal computer,简称为PC)等等,本申请对此不作具体限定。Among them, in this embodiment, the terminal device can be any hardware device with a camera function, such as a smart phone, a camera, a personal computer (PC), etc., and this application does not make any specific restrictions on this.
可选的,本实施例中终端设备还可以是具备双摄像头的硬件设备,其中,双摄像头是指具有两个后置摄像头,并可选的还包括前置摄像头。Optionally, the terminal device in this embodiment may also be a hardware device with dual cameras, wherein the dual cameras refer to having two rear cameras and optionally also including a front camera.
需要说明的是,前述对预览画面虚化处理方法实施例的解释说明也适用于该实施例的终端设备,其实现原理类似,此处不再赘述。It should be noted that the above explanation of the embodiment of the preview image blur processing method is also applicable to the terminal device of this embodiment. The implementation principle is similar and will not be repeated here.
进一步地,本申请终端设备,还可以包括图像处理电路24。Furthermore, the terminal device of the present application may also include an image processing circuit 24 .
其中,存储器21用于存储处理器22的可执行指令;The memory 21 is used to store executable instructions of the processor 22;
处理器22用于调用存储器21中的程序代码,并根据图像处理电路24输出的虚化处理后的画面,以实现第一方面实施例的预览画面虚化处理方法。The processor 22 is used to call the program code in the memory 21 and implement the preview image blurring processing method of the first embodiment according to the blurred image output by the image processing circuit 24.
具体的,图像处理电路24可以利用硬件和/或软件组件实现,可包括定义ISP(Image Signal Processing,图像信号处理)管线的各种处理单元。Specifically, the image processing circuit 24 may be implemented using hardware and/or software components, and may include various processing units that define an ISP (Image Signal Processing) pipeline.
图6是本发明一个实施例中图像处理电路的示意图。如图6所示,为便于说明,仅示出与本发明实施例相关的图像处理技术的各个方面。Figure 6 is a schematic diagram of an image processing circuit according to an embodiment of the present invention. As shown in Figure 6, for ease of explanation, only various aspects of image processing technology related to the embodiment of the present invention are shown.
如图6所示,图像处理电路24包括成像设备1140、ISP处理器1150和控制逻辑器1160。成像设备1140可包括具有一个或多个透镜1141、图像传感器1142的照相机和结构光投射器1143。结构光投射器1143将结构光投影至被测物。其中,该结构光图案可为激光条纹、格雷码、正弦条纹、或者,随机排列的散斑图案等。图像传感器1142捕捉投影至被测物形成的结构光图像,并将结构光图像发送至ISP处理器1150,由ISP处理器1150对结构光图像进行解调获取被测物的深度信息。同时,图像传感器1142也可以捕捉被测物的色彩信息。当然,也可以由两个图像传感器1142分别捕捉被测物的结构光图像和色彩信息。As shown in Figure 6, the image processing circuit 24 includes an imaging device 1140, an ISP processor 1150 and a control logic unit 1160. The imaging device 1140 may include a camera having one or more lenses 1141, an image sensor 1142 and a structured light projector 1143. The structured light projector 1143 projects structured light onto the object under test. The structured light pattern may be laser stripes, Gray code, sinusoidal stripes, or a randomly arranged speckle pattern. The image sensor 1142 captures the structured light image projected onto the object under test, and sends the structured light image to the ISP processor 1150, which demodulates the structured light image to obtain the depth information of the object under test. At the same time, the image sensor 1142 can also capture the color information of the object under test. Of course, two image sensors 1142 can also capture the structured light image and color information of the object under test respectively.
其中,以散斑结构光为例,ISP处理器1150对结构光图像进行解调,具体包括,从该结构光图像中采集被测物的散斑图像,将被测物的散斑图像与参考散斑图像按照预定算法进行图像数据计算,获取被测物上散斑图像的各个散斑点相对于参考散斑图像中的参考散斑点的移动距离。利用三角法转换计算得到散斑图像的各个散斑点的深度值,并根据该深度值得到被测物的深度信息。Taking speckle structured light as an example, the ISP processor 1150 demodulates the structured light image. Specifically, it collects a speckle image of the object under test from the structured light image, performs image data calculation on the speckle image of the object under test and a reference speckle image according to a predetermined algorithm, and obtains the movement distance of each speckle in the speckle image on the object under test relative to the reference speckle in the reference speckle image. It then uses trigonometric calculation to obtain the depth value of each speckle in the speckle image, and uses this depth value to obtain the depth information of the object under test.
当然,还可以通过双目视觉的方法或基于飞行时差TOF的方法来获取该深度图像信息等,在此不做限定,只要能够获取或通过计算得到被测物的深度信息的方法都属于本实施方式包含的范围。Of course, the depth image information can also be obtained through binocular vision methods or time-of-flight TOF-based methods, etc., which are not limited here. As long as the method can obtain or calculate the depth information of the object being measured, it falls within the scope of this embodiment.
在ISP处理器1150接收到图像传感器1142捕捉到的被测物的色彩信息之后,可被测物的色彩信息对应的图像数据进行处理。ISP处理器1150对图像数据进行分析以获取可用于确定和/或成像设备1140的一个或多个控制参数的图像统计信息。图像传感器1142可包括色彩滤镜阵列(如Bayer滤镜),图像传感器1142可获取用图像传感器1142的每个成像像素捕捉的光强度和波长信息,并提供可由ISP处理器1150处理的一组原始图像数据。After the ISP processor 1150 receives the color information of the object under test captured by the image sensor 1142, it processes the image data corresponding to the color information of the object under test. The ISP processor 1150 analyzes the image data to obtain image statistics that can be used to determine and/or adjust one or more control parameters of the imaging device 1140. The image sensor 1142 may include a color filter array (e.g., a Bayer filter). The image sensor 1142 can obtain light intensity and wavelength information captured by each imaging pixel of the image sensor 1142 and provide a set of raw image data that can be processed by the ISP processor 1150.
ISP处理器1150按多种格式逐个像素地处理原始图像数据。例如,每个图像像素可具有8、10、12或14比特的位深度,ISP处理器1150可对原始图像数据进行一个或多个图像处理操作、收集关于图像数据的图像统计信息。其中,图像处理操作可按相同或不同的位深度精度进行。The ISP processor 1150 processes raw image data on a pixel-by-pixel basis in various formats. For example, each image pixel may have a bit depth of 8, 10, 12, or 14 bits. The ISP processor 1150 may perform one or more image processing operations on the raw image data and collect image statistics about the image data. The image processing operations may be performed at the same or different bit depths of precision.
ISP处理器1150还可从图像存储器1170接收像素数据。图像存储器1170可为存储器装置的一部分、存储设备、或电子设备内的独立的专用存储器,并可包括DMA(DirectMemory Access,直接直接存储器存取)特征。The ISP processor 1150 may also receive pixel data from an image memory 1170. The image memory 1170 may be a portion of a memory device, a storage device, or a separate dedicated memory within the electronic device and may include a DMA (Direct Memory Access) feature.
当接收到原始图像数据时,ISP处理器1150可进行一个或多个图像处理操作。Upon receiving raw image data, the ISP processor 1150 may perform one or more image processing operations.
在ISP处理器1150获取到被测物的色彩信息和深度信息后,可对其进行融合,得到三维图像。其中,可通过外观轮廓提取方法或轮廓特征提取方法中的至少一种提取相应的被测物的特征。例如通过主动形状模型法ASM、主动外观模型法AAM、主成分分析法PCA、离散余弦变换法DCT等方法,提取被测物的特征,在此不做限定。再将分别从深度信息中提取到被测物的特征以及从色彩信息中提取到被测物的特征进行配准和特征融合处理。这里指的融合处理可以是将深度信息以及色彩信息中提取出的特征直接组合,也可以是将不同图像中相同的特征进行权重设定后组合,也可以有其他融合方式,最终根据融合后的特征,生成三维图像。After the ISP processor 1150 obtains the color information and depth information of the object to be measured, it can be fused to obtain a three-dimensional image. Among them, the features of the corresponding object to be measured can be extracted by at least one of the appearance contour extraction method or the contour feature extraction method. For example, the features of the object to be measured are extracted by active shape model method ASM, active appearance model method AAM, principal component analysis method PCA, discrete cosine transform method DCT and other methods, which are not limited here. Then, the features of the object to be measured extracted from the depth information and the features of the object to be measured extracted from the color information are aligned and feature fused. The fusion processing referred to here can be a direct combination of features extracted from the depth information and color information, or a combination of the same features in different images after weighting, or other fusion methods. Finally, a three-dimensional image is generated based on the fused features.
三维图像的图像数据可发送给图像存储器1170,以便在被显示之前进行另外的处理。ISP处理器1150从图像存储器1170接收处理数据,并对所述处理数据进行原始域中以及RGB和YCbCr颜色空间中的图像数据处理。三维图像的图像数据可输出给显示器1180,以供用户观看和/或由图形引擎或GPU(Graphics Processing Unit,图形处理器)进一步处理。此外,ISP处理器1150的输出还可发送给图像存储器1170,且显示器1180可从图像存储器1170读取图像数据。在一个实施例中,图像存储器1170可被配置为实现一个或多个帧缓冲器。此外,ISP处理器1150的输出可发送给编码器/解码器1190,以便编码/解码图像数据。编码的图像数据可被保存,并在显示于显示器1180设备上之前解压缩。编码器/解码器1190可由CPU或GPU或协处理器实现。Image data for the 3D image may be sent to image memory 1170 for further processing before being displayed. The ISP processor 1150 receives processed data from image memory 1170 and processes the processed data in the raw domain and in RGB and YCbCr color spaces. The image data for the 3D image may be output to a display 1180 for viewing by a user and/or further processing by a graphics engine or GPU (Graphics Processing Unit). Furthermore, the output of the ISP processor 1150 may be sent to image memory 1170, and the display 1180 may read the image data from the image memory 1170. In one embodiment, the image memory 1170 may be configured to implement one or more frame buffers. Furthermore, the output of the ISP processor 1150 may be sent to an encoder/decoder 1190 for encoding/decoding the image data. The encoded image data may be stored and decompressed before being displayed on the display 1180 device. The encoder/decoder 1190 may be implemented by a CPU, a GPU, or a coprocessor.
ISP处理器1150确定的图像统计信息可发送给控制逻辑器1160单元。控制逻辑器1160可包括执行一个或多个例程(如固件)的处理器和/或微控制器,一个或多个例程可根据接收的图像统计信息,确定成像设备1140的控制参数。The image statistics determined by the ISP processor 1150 may be sent to a control logic unit 1160. The control logic 1160 may include a processor and/or microcontroller that executes one or more routines (e.g., firmware) that may determine control parameters for the imaging device 1140 based on the received image statistics.
本实施例提供的终端设备中,通过对当前第一预览画面进行人像识别,以确定出第一预览画面中的第一人像,然后根据确定的第一人像信息,确定出待保护的目标区域,以在预览画面进行切换时,对第二预览画面中除目标区域外的其他区域进行虚化处理。由此,实现了对预览画面进行虚化处理时,不仅节省了预览画面的虚化处理时间,而且还保证了拍摄主体不会因晃动而被误虚化,从而提高了预览画面的虚化效果,提高了用户满意度。In the terminal device provided in this embodiment, portrait recognition is performed on the current first preview screen to determine the first portrait in the first preview screen. Based on the determined first portrait information, a target area to be protected is then determined. When the preview screen switches, the remaining area in the second preview screen, excluding the target area, is blurred. This not only saves blurring time when blurring the preview screen, but also ensures that the subject is not accidentally blurred due to shaking, thereby improving the blurring effect of the preview screen and increasing user satisfaction.
为了实现上述实施例,本发明还提出了一种计算机可读存储介质。In order to implement the above embodiments, the present invention also provides a computer-readable storage medium.
该计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现第一方面实施例的预览画面虚化处理方法。其中预览画面虚化处理方法包括:对当前第一预览画面进行人像识别,确定所述第一预览画面中的第一人像信息,其中所述第一人像信息包括第一人像的面积;根据所述第一人像信息,确定待保护的目标区域;在预览画面切换时,对第二预览画面中除所述目标区域外的其它区域进行虚化处理。The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the preview image blurring processing method of the first embodiment. The preview image blurring processing method includes: performing portrait recognition on a current first preview image to determine first portrait information in the first preview image, wherein the first portrait information includes the area of the first portrait; determining a target area to be protected based on the first portrait information; and, when the preview image switches, blurring the remaining area in the second preview image, excluding the target area.
在本发明中,除非另有明确的规定和限定,术语“设置”、“连接”等术语应做广义理解,例如,可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,可以是两个元件内部的连通或两个元件的相互作用关系,除非另有明确的限定。对于本领域的普通技术人员而言,可以根据具体情况理解上述术语在本发明中的具体含义。In the present invention, unless otherwise specified or limited, terms such as "disposed" and "connected" should be understood in a broad sense. For example, they can refer to mechanical or electrical connections; direct or indirect connections through an intermediate medium; and internal communication between two components or interaction between two components, unless otherwise specified. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on specific circumstances.
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本发明的至少一个实施例或示例中。In the description of this specification, reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention.
此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the quantity of the technical features indicated. Thus, features defined as "first" or "second" may explicitly or implicitly include at least one of these features.
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本发明的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本发明的实施例所属技术领域的技术人员所理解。Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention pertain.
应当理解,本发明的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。Those skilled in the art will understand that all or part of the steps in the method of the above embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.
上述提到的存储介质可以是只读存储器,磁盘或光盘等。尽管上面已经示出和描述了本发明的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本发明的限制,本领域的普通技术人员在本发明的范围内可以对上述实施例进行变化、修改、替换和变型。The storage medium mentioned above may be a read-only memory, a magnetic disk, or an optical disk, etc. Although the embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and are not to be construed as limiting the present invention. Persons skilled in the art may make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| HK18111054.0A HK1251751B (en) | 2018-08-28 | Method and device for blurring preview picture and equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| HK18111054.0A HK1251751B (en) | 2018-08-28 | Method and device for blurring preview picture and equipment |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| HK1251751A1 HK1251751A1 (en) | 2019-02-01 |
| HK1251751B true HK1251751B (en) | 2021-01-15 |
Family
ID=
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN107948517B (en) | Preview image blur processing method, device and device | |
| US11106938B2 (en) | Image processing apparatus, image processing method, and storage medium for lighting processing on image using model data | |
| CN107948519B (en) | Image processing method, device and equipment | |
| JP4748244B2 (en) | Image selection apparatus, image selection method, and program | |
| CN108111749B (en) | Image processing method and device | |
| CN109068058B (en) | Shooting control method, device and electronic device in super night scene mode | |
| CN107945105B (en) | Background blur processing method, device and equipment | |
| JP4752941B2 (en) | Image composition apparatus and program | |
| CN108024054A (en) | Image processing method, device and equipment | |
| CN107800965B (en) | Image processing method, image processing device, computer-readable storage medium and computer equipment | |
| CN108846807A (en) | Light efficiency processing method, device, terminal and computer readable storage medium | |
| CN112261292B (en) | Image acquisition method, terminal, chip and storage medium | |
| CN102006485B (en) | Image processing apparatus and image processing method | |
| CN102244728A (en) | Apparatus and method for subject tracking, and recording medium storing program thereof | |
| CN108052883B (en) | User photographing method, device and device | |
| CN107820018A (en) | User photographing method, device and equipment | |
| CN107820019B (en) | Virtual image acquisition method, device and device | |
| CN104935805B (en) | Image processing apparatus, image processing method and recording medium | |
| CN103973962B (en) | Image processing method and image acquisition device | |
| CN110365897A (en) | Image correction method and device, electronic equipment and computer readable storage medium | |
| CN103516951A (en) | Image creating device and image creating method | |
| HK1251751B (en) | Method and device for blurring preview picture and equipment | |
| CN110545384A (en) | Focusing method and apparatus, electronic device, computer-readable storage medium | |
| TW201642008A (en) | Image capturing device and dynamic focus method thereof | |
| HK1251751A1 (en) | Method and device for blurring preview picture and equipment |