Movatterモバイル変換


[0]ホーム

URL:


CN108769521A - Photographing method, mobile terminal and computer readable storage medium - Google Patents

Photographing method, mobile terminal and computer readable storage medium
Download PDF

Info

Publication number
CN108769521A
CN108769521ACN201810570646.1ACN201810570646ACN108769521ACN 108769521 ACN108769521 ACN 108769521ACN 201810570646 ACN201810570646 ACN 201810570646ACN 108769521 ACN108769521 ACN 108769521A
Authority
CN
China
Prior art keywords
image
preview
foreground object
foreground
original image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810570646.1A
Other languages
Chinese (zh)
Other versions
CN108769521B (en
Inventor
王宇鹭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp LtdfiledCriticalGuangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201810570646.1ApriorityCriticalpatent/CN108769521B/en
Publication of CN108769521ApublicationCriticalpatent/CN108769521A/en
Application grantedgrantedCritical
Publication of CN108769521BpublicationCriticalpatent/CN108769521B/en
Expired - Fee Relatedlegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本申请适用于图像处理技术领域,提供了一种拍照方法、移动终端及计算机可读存储介质,所述拍照方法包括:获取所述摄像头采集的预览画面,识别所述预览画面的特征信息,并基于所述特征信息对所述预览画面进行图像处理,所述预览画面的特征信息包括所述预览画面的背景标签,在接收到拍照的指令后,获取所述摄像头采集的原始图像,基于所述原始图像之前预设帧的预览画面的特征信息,对所述原始图像进行图像处理获得照片,通过本申请可以降低拍照时的内存消耗。

The present application is applicable to the field of image processing technology, and provides a photographing method, a mobile terminal and a computer-readable storage medium. The photographing method comprises: obtaining a preview picture captured by the camera, identifying feature information of the preview picture, and performing image processing on the preview picture based on the feature information, wherein the feature information of the preview picture comprises a background label of the preview picture. After receiving a photographing instruction, an original image captured by the camera is obtained, and based on the feature information of a preview picture of a preset frame before the original image, image processing is performed on the original image to obtain a photograph. The present application can reduce memory consumption when photographing.

Description

Translated fromChinese
一种拍照方法、移动终端及计算机可读存储介质A photographing method, mobile terminal and computer-readable storage medium

技术领域technical field

本申请属于图像处理技术领域,尤其涉及一种拍照方法、移动终端及计算机可读存储介质。The present application belongs to the technical field of image processing, and in particular relates to a photographing method, a mobile terminal and a computer-readable storage medium.

背景技术Background technique

随着智能移动终端的发展,人们对于手机等移动终端上拍照的使用越来越频繁。现有的大部分移动终端的拍照功能支持图像处理,例如,针对人脸的滤镜功能、磨皮功能、美白功能等。With the development of smart mobile terminals, people use mobile phones and other mobile terminals to take pictures more and more frequently. The photographing functions of most existing mobile terminals support image processing, for example, filter functions, skin smoothing functions, whitening functions, etc. for human faces.

目前,在预览显示和拍照时,均对摄像头采集的预览画面进行检测和相应的图像处理,从而使得预览画面和拍照照片呈现相同的效果。然而,这种拍照方式消耗的内存较大。At present, when displaying a preview and taking a photo, detection and corresponding image processing are performed on the preview image captured by the camera, so that the preview image and the photo taken have the same effect. However, this way of taking pictures consumes a lot of memory.

发明内容Contents of the invention

有鉴于此,本申请实施例提供了一种拍照方法、移动终端及计算机可读存储介质,以解决目前的拍照方式消耗内存较大的问题。In view of this, the embodiments of the present application provide a photographing method, a mobile terminal, and a computer-readable storage medium, so as to solve the problem that the current photographing method consumes a large amount of memory.

本申请实施例的第一方面提供了一种拍照方法,包括:The first aspect of the embodiments of the present application provides a method for taking pictures, including:

获取所述摄像头采集的预览画面;Obtaining a preview image captured by the camera;

识别所述预览画面的特征信息,并基于所述特征信息对所述预览画面进行图像处理,所述预览画面的特征信息包括所述预览画面的背景标签;Identifying feature information of the preview picture, and performing image processing on the preview picture based on the feature information, the feature information of the preview picture includes a background tag of the preview picture;

在接收到拍照的指令后,获取所述摄像头采集的原始图像;After receiving the instruction to take pictures, obtain the original image collected by the camera;

基于所述原始图像之前预设帧的预览画面的特征信息,对所述原始图像进行图像处理获得照片。Image processing is performed on the original image to obtain a photo based on feature information of a preview frame of a preset frame before the original image.

本申请实施例的第二方面提供了一种移动终端,包括:The second aspect of the embodiments of the present application provides a mobile terminal, including:

预览画面获取模块,用于获取所述摄像头采集的预览画面;A preview image acquisition module, configured to acquire a preview image captured by the camera;

预览画面处理模块,用于识别所述预览画面的特征信息,并基于所述特征信息对所述预览画面进行图像处理,所述预览画面的特征信息包括所述预览画面的背景标签;A preview image processing module, configured to identify feature information of the preview image, and perform image processing on the preview image based on the feature information, where the feature information of the preview image includes a background tag of the preview image;

特征信息获取模块,用于在接收到拍照的指令后,获取所述摄像头采集的原始图像;A feature information acquisition module, configured to acquire the original image collected by the camera after receiving the instruction to take pictures;

拍照处理模块,用于基于所述原始图像之前预设帧的预览画面的特征信息,对所述原始图像进行图像处理获得照片。The photographing processing module is configured to perform image processing on the original image to obtain a photo based on the feature information of the preview frame of the preset frame before the original image.

本申请实施例的第三方面提供了一种移动终端,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现本申请实施例第一方面提供的所述方法的步骤。The third aspect of the embodiments of the present application provides a mobile terminal, including a memory, a processor, and a computer program stored in the memory and operable on the processor, when the processor executes the computer program The steps of the method provided in the first aspect of the embodiment of the present application are implemented.

本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被一个或多个处理器执行时实现本申请实施例第一方面提供的所述方法的步骤。The fourth aspect of the embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by one or more processors, the first embodiment of the present application is implemented. The steps of the method provided in the aspect.

本申请实施例的第五方面提供了一种计算机程序产品,所述计算机程序产品包括计算机程序,所述计算机程序被一个或多个处理器执行时实现本申请实施例第一方面提供的所述方法的步骤。The fifth aspect of the embodiment of the present application provides a computer program product, the computer program product includes a computer program, and when the computer program is executed by one or more processors, it implements the described method steps.

本申请实施例首先获取所述摄像头采集的预览画面,识别所述预览画面的特征信息,并基于所述特征信息对所述预览画面进行图像处理,所述预览画面的特征信息包括所述预览画面的背景标签,在接收到拍照的指令后,获取所述摄像头采集的原始图像,基于所述原始图像之前预设帧的预览画面的特征信息,对所述原始图像进行图像处理获得照片,由于本申请中拍照时无需对拍照采集的原始图像进行背景标签的识别,而是采用原始图像之前预设帧的预览画面的背景标签对原始图像进行图像处理,不仅能够降低拍照时的内存,还能够保证拍照获得的照片与预览时用户看到的预览画面呈现同样的效果。In the embodiment of the present application, firstly, the preview image collected by the camera is obtained, the characteristic information of the preview image is identified, and image processing is performed on the preview image based on the characteristic information, and the characteristic information of the preview image includes the preview image After receiving the instruction to take pictures, obtain the original image collected by the camera, and based on the feature information of the preview frame of the preset frame before the original image, perform image processing on the original image to obtain a photo. When taking pictures in the application, it is not necessary to identify the background label of the original image collected by taking pictures, but to use the background label of the preview frame of the preset frame before the original image to process the original image, which can not only reduce the memory when taking pictures, but also ensure The photo obtained by taking a photo has the same effect as the preview screen that the user sees during the preview.

附图说明Description of drawings

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

图1是本申请实施例提供的一种拍照方法的实现流程示意图;Fig. 1 is a schematic diagram of the implementation flow of a photographing method provided by an embodiment of the present application;

图2是本申请实施例提供的另一种拍照方法的实现流程示意图;FIG. 2 is a schematic diagram of an implementation flow of another photographing method provided in an embodiment of the present application;

图3是本申请实施例提供的另一种拍照方法的实现流程示意图;FIG. 3 is a schematic diagram of an implementation flow of another photographing method provided in an embodiment of the present application;

图4是本申请实施例提供的一种移动终端的示意框图;FIG. 4 is a schematic block diagram of a mobile terminal provided by an embodiment of the present application;

图5是本申请实施例提供的另一种移动终端的示意框图。Fig. 5 is a schematic block diagram of another mobile terminal provided by an embodiment of the present application.

具体实施方式Detailed ways

以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, specific details such as specific system structures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.

应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and/or components, but does not exclude one or more other features. , whole, step, operation, element, component and/or the presence or addition of a collection thereof.

还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should also be understood that the terminology used in the specification of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. As used in this specification and the appended claims, the singular forms "a", "an" and "the" are intended to include plural referents unless the context clearly dictates otherwise.

还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should also be further understood that the term "and/or" used in the description of the present application and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations .

如在本说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。As used in this specification and the appended claims, the term "if" may be construed as "when" or "once" or "in response to determining" or "in response to detecting" depending on the context . Similarly, the phrase "if determined" or "if [the described condition or event] is detected" may be construed, depending on the context, to mean "once determined" or "in response to the determination" or "once detected [the described condition or event] ]” or “in response to detection of [described condition or event]”.

为了说明本申请所述的技术方案,下面通过具体实施例来进行说明。In order to illustrate the technical solutions described in this application, specific examples are used below to illustrate.

图1是本申请实施例提供的一种拍照方法的实现流程示意图,应用于移动终端,如图所示该方法可以包括以下步骤:Fig. 1 is a schematic diagram of the implementation flow of a photographing method provided by an embodiment of the present application, which is applied to a mobile terminal. As shown in the figure, the method may include the following steps:

步骤S101,获取所述摄像头采集的预览画面。Step S101, acquiring a preview image captured by the camera.

在本申请实施例中,当用户需要拍照时,通常会启动移动终端的摄像头,摄像头会实时采集预览画面,同时移动终端的屏幕上会显示摄像头实时采集的预览画面。In the embodiment of the present application, when the user needs to take a photo, the camera of the mobile terminal is usually activated, and the camera will collect a preview image in real time, and the preview image collected by the camera in real time will be displayed on the screen of the mobile terminal.

步骤S102,识别所述预览画面的特征信息,并基于所述特征信息对所述预览画面进行图像处理,所述预览画面的特征信息包括所述预览画面的背景标签。Step S102, identifying characteristic information of the preview image, and performing image processing on the preview image based on the characteristic information, where the characteristic information of the preview image includes a background tag of the preview image.

在本申请实施例中,所述预览画面的特征信息包括所述预览画面的背景标签,识别所述预览画面的特征信息为通过场景识别模型识别所述预览画面的场景,根据所述预览画面的场景获得所述预览画面的背景标签,所述场景识别模型可以是卷积神经网络模型。所述预览画面的背景标签用于对所述待处理图像进行相关的图像处理。In this embodiment of the present application, the characteristic information of the preview image includes the background label of the preview image, and the characteristic information identifying the preview image is to identify the scene of the preview image through a scene recognition model. The scene obtains the background label of the preview image, and the scene recognition model may be a convolutional neural network model. The background tag of the preview screen is used to perform related image processing on the image to be processed.

作为举例,所述背景标签为夜景标签,可以对所述预览画面进行降噪处理,在对所述预览画面进行降噪处理后,在对降噪处理后的预览画面进行图像增强处理,所述背景标签为夕阳标签,可以对所述预览画面进行提升图像亮度的处理。As an example, the background tag is a night scene tag, noise reduction processing can be performed on the preview image, and after noise reduction processing is performed on the preview image, image enhancement processing is performed on the preview image after noise reduction processing, the The background tag is a sunset tag, and the preview image can be processed to enhance image brightness.

作为本申请又一实施例,在识别所述预览画面的特征信息之前,还包括:As yet another embodiment of the present application, before identifying the feature information of the preview screen, it further includes:

对所述摄像头采集的预览画面进行压缩处理。Compressing the preview image captured by the camera.

相应的,所述识别所述预览画面的特征信息包括:Correspondingly, the feature information identifying the preview image includes:

识别压缩处理后的预览画面的特征信息。The feature information of the compressed preview image is identified.

在本申请实施例中,如果对所述摄像头采集的预览画面进行场景识别,由于摄像头采集的预览画面比较大,那么场景识别的时间就会增加,同时内存占有率也会增加,为了降低内存占有率,同时降低场景识别的时间,可以对所述预览画面进行压缩处理,识别压缩处理后的预览画面的特征信息。In the embodiment of the present application, if the scene recognition is performed on the preview picture collected by the camera, since the preview picture collected by the camera is relatively large, the time for scene recognition will increase, and the memory occupancy rate will also increase at the same time. In order to reduce the memory occupancy rate, and at the same time reduce the scene recognition time, the preview image can be compressed, and the characteristic information of the compressed preview image can be identified.

在实际应用中,摄像头是以预设的时间间隔在采集预览画面,为了进一步降低内存占有率,可以不针对每一帧采集的预览画面均进行场景识别,而是每隔几帧预览画面,才进行一次场景识别,例如,第1帧预览画面进行场景识别获得第1帧的背景标签,第1至5帧预览画面均基于第1帧的背景标签进行图像处理,也可以认为,第2至5帧预览画面的背景标签就是第1帧的背景标签,第6帧预览画面进行场景识别获得第6帧的背景标签,第6至10帧预览画面均基于第6帧的背景标签进行图像处理,也可以认为,第7至10帧预览画面的背景标签就是第6帧的背景标签,第11帧预览画面进行场景识别获得第11帧的背景标签,……。需要说明的是,如果未接收到拍照指令,则上述步骤持续进行,即摄像头每采集一帧预览画面,就需要基于每帧预览画面的特征信息对当前帧预览画面进行图像处理,只是有些帧的预览画面的特征信息是识别本身的特征信息,有些帧的预览画面的特征信息是之前帧预览画面的特征信息。In practical applications, the camera captures the preview images at preset time intervals. In order to further reduce the memory occupation rate, it is not necessary to perform scene recognition on the preview images collected for each frame, but to preview the images every few frames. Perform scene recognition once. For example, perform scene recognition on the first frame preview screen to obtain the background label of the first frame, and perform image processing on the first to fifth frame preview screens based on the background label of the first frame. It can also be considered that the second to fifth The background label of the frame preview screen is the background label of the first frame, and the scene recognition of the sixth frame preview screen is used to obtain the background label of the sixth frame. The image processing of the sixth to tenth frame preview pictures is based on the background label of the sixth frame. It can be considered that the background label of the 7th to 10th frame preview image is the background label of the 6th frame, and the scene recognition is performed on the 11th frame preview image to obtain the background label of the 11th frame,  … . It should be noted that if the camera instruction is not received, the above steps will continue, that is, each time the camera captures a preview frame, it needs to perform image processing on the preview frame of the current frame based on the feature information of the preview frame of each frame. The characteristic information of the preview image is the characteristic information for identifying itself, and the characteristic information of the preview image of some frames is the characteristic information of the preview image of the previous frame.

步骤S103,在接收到拍照的指令后,获取所述摄像头采集的原始图像。Step S103, after receiving the instruction to take pictures, acquire the original image captured by the camera.

步骤S104,基于所述原始图像之前预设帧的预览画面的特征信息,对所述原始图像进行图像处理获得照片。Step S104, based on the feature information of the preview frame of the preset frame before the original image, perform image processing on the original image to obtain a photo.

在本申请实施例中,接收到拍照的指令后,获取所述摄像头采集的原始图像,而不是对当前的预览画面进行截屏。因为,虽然对当前的预览画面进行截屏能够降低内存占有率,同时获得与预览画面相同效果的照片,然而,截屏获得的照片的分辨率太低,无法满足人们对日常拍照高分辨率的要求。在获得所述摄像头采集的原始图像后,无需识别所述原始图像的背景标签,而是基于所述原始图像之前预设帧的预览画面的背景标签对所述原始图像进行图像处理获得照片,例如,原始图像是摄像头采集的第120帧画面,那么可以基于第116帧预览画面的背景标签对所述原始图像进行图像处理获得照片,也可以基于第119帧预览画面的背景标签对所述原始图像进行图像处理获得照片。In the embodiment of the present application, after receiving an instruction to take a picture, the original image captured by the camera is acquired instead of taking a screenshot of the current preview image. Because, although taking a screenshot of the current preview screen can reduce the memory occupation rate and obtain a photo with the same effect as the preview screen, the resolution of the photo obtained by the screen capture is too low to meet people's requirements for high-resolution daily photos. After obtaining the original image collected by the camera, it is not necessary to identify the background label of the original image, but to perform image processing on the original image based on the background label of the preview frame of the preset frame before the original image to obtain a photo, for example , the original image is the 120th frame captured by the camera, then image processing can be performed on the original image based on the background label of the 116th frame preview picture to obtain a photo, and the original image can also be processed based on the background label of the 119th frame preview picture Perform image processing to obtain photos.

由于本申请实施例中拍照时无需对拍照采集的原始图像进行背景标签的识别,而是采用原始图像之前预设帧的预览画面的背景标签对原始图像进行图像处理,不仅能够降低拍照时的内存,还能够保证拍照获得的照片与预览时用户看到的预览画面呈现同样的效果。Since in the embodiment of the present application, it is not necessary to identify the background label of the original image collected when taking pictures, but to use the background label of the preview frame of the preset frame before the original image to perform image processing on the original image, it can not only reduce the memory when taking pictures , it can also ensure that the photo obtained by taking a photo has the same effect as the preview screen that the user sees during the preview.

图2是本申请实施例提供的另一种拍照方法的流程示意图,如图所示该方法可以包括以下步骤:Fig. 2 is a schematic flow chart of another photographing method provided by the embodiment of the present application. As shown in the figure, the method may include the following steps:

步骤S201,获取所述摄像头采集的预览画面。Step S201, acquiring a preview image captured by the camera.

步骤S202,对所述预览画面进行场景识别获得所述预览画面的背景标签。Step S202, performing scene recognition on the preview image to obtain a background label of the preview image.

步骤S201至步骤S202的内容和与步骤S101至步骤S102的内容一致,具体可参照步骤S101至步骤S102的描述,在此不再赘述。The contents of step S201 to step S202 are consistent with the contents of step S101 to step S102, for details, please refer to the description of step S101 to step S102, which will not be repeated here.

步骤S203,检测所述预览画面中是否存在前景目标,若所述预览画面中存在前景目标,则获取所述前景目标的前景标签。Step S203, detecting whether there is a foreground object in the preview image, and if there is a foreground object in the preview image, acquiring the foreground label of the foreground object.

在本申请实施例中,为了获得较好的拍照效果,不仅可以基于所述原始图像之前预设帧的预览画面的背景标签,对所述原始图像进行图像处理获得照片,还可以基于所述原始图像中的前景目标的前景标签对所述原始图像的前景目标进行图像处理,为了使得用户在预览阶段就能够看到拍照效果,可以基于所述预览画面中前景目标的前景标签对所述预览画面中的前景目标进行图像处理,然而,这就需要在预览画面中存在前景目标时才能够实现,所以需要检测所述预览画面中是否存在前景目标,若所述预览画面中存在前景目标,则获取所述前景目标的前景标签。可以通过目标识别模型识别所述预览画面中是否存在前景目标,当存在前景目标时,可以在预览画面中显示检测框,同时生成前景标签,检测框中为识别到的前景目标,实际应用中,也可以不显示检测框,仅输出前景标签。In the embodiment of the present application, in order to obtain a better photographing effect, not only can the original image be processed to obtain a photo based on the background label of the preview frame of the preset frame before the original image, but also based on the original The foreground label of the foreground object in the image performs image processing on the foreground object of the original image. In order to enable the user to see the photographing effect in the preview stage, the preview image can be processed based on the foreground label of the foreground object in the preview image. image processing of the foreground object in the preview image, however, this can only be achieved when there is a foreground object in the preview image, so it is necessary to detect whether there is a foreground object in the preview image, and if there is a foreground object in the preview image, then obtain The foreground label for the foreground object. Whether there is a foreground target in the preview screen can be identified through the target recognition model. When there is a foreground target, a detection frame can be displayed in the preview screen, and a foreground label can be generated at the same time. The detected foreground target is identified in the detection frame. In practical applications, It is also possible to not display the detection frame and only output the foreground label.

如果所述预览画面中存在前景目标,则所述预览画面的特征信息包括所述预览画面的背景标签、所述预览画面中前景目标的前景标签。If there is a foreground object in the preview image, the feature information of the preview image includes a background label of the preview image and a foreground label of the foreground object in the preview image.

步骤S204,基于所述预览画面的背景标签对所述预览画面进行全局处理。Step S204, performing global processing on the preview image based on the background tag of the preview image.

该步骤可参照步骤S102中的描述,在此不再赘述。For this step, reference may be made to the description in step S102, which will not be repeated here.

步骤S205,基于所述预览画面中前景目标的前景标签对所述预览画面中的前景目标进行局部处理。Step S205, performing local processing on the foreground objects in the preview image based on the foreground labels of the foreground objects in the preview image.

在本申请实施例中,当前景标签为人脸标签时,可以对人脸进行美颜相关的处理,当前景标签为美食标签时,可以对美食进行提升色彩鲜艳度的处理,其它前景标签不再举例,实际应用中,可以根据不同的前景标签设置不同的前景目标图像处理方式。In the embodiment of the present application, when the foreground tag is a human face tag, beauty-related processing can be performed on the human face; when the foreground tag is a gourmet tag, the food can be processed to enhance the color vividness, and other foreground tags are no longer For example, in practical applications, different foreground object image processing methods can be set according to different foreground labels.

步骤S206,在接收到拍照的指令后,获取所述摄像头采集的原始图像。Step S206, after receiving the instruction to take pictures, acquire the original image captured by the camera.

步骤S207,基于所述原始图像前一帧的预览画面的背景标签对所述原始图像进行全局处理。Step S207, performing global processing on the original image based on the background label of the preview frame of the previous frame of the original image.

步骤S208,检测所述原始图像中是否存在前景目标;若所述原始图像中存在前景目标,则获取所述原始图像中前景目标的前景标签和所述前景目标的位置信息。Step S208, detecting whether there is a foreground object in the original image; if there is a foreground object in the original image, acquiring the foreground label of the foreground object in the original image and the position information of the foreground object.

步骤S209,基于所述原始图像中前景目标的前景标签和所述前景目标的位置信息,对所述原始图像中的前景目标进行局部处理。Step S209, based on the foreground label of the foreground object in the original image and the position information of the foreground object, perform local processing on the foreground object in the original image.

在本申请实施例中,在接收到拍照指令后,获取所述摄像头采集的原始图像,对所述原始图像的图像处理过程与所述原始图像前一帧预览画面的图像处理过程一致,只是是基于所述原始图像前一帧的预览画面的背景标签对所述原始图像进行全局处理,基于所述原始图像中前景目标的前景标签和所述前景目标的位置信息,对所述原始图像中的前景目标进行局部处理。In the embodiment of the present application, after receiving the photographing instruction, the original image collected by the camera is obtained, and the image processing process of the original image is consistent with the image processing process of the preview frame of the previous frame of the original image, except that The original image is globally processed based on the background label of the preview picture of the previous frame of the original image, and the foreground object in the original image is processed based on the foreground label of the foreground object in the original image and the position information of the foreground object. Foreground objects are processed locally.

本申请实施例中,对预览画面进行处理时,基于预览画面的背景标签和前景目标的前景标签,对预览画面进行图像处理,拍照时,为了降低内存使用率,同时获得与预览画面相同的图像效果,采用拍照的原始图像前一帧的预览画面的背景标签和原始图像的前景目标的前景标签对原始图像进行图像处理。In the embodiment of the present application, when processing the preview screen, image processing is performed on the preview screen based on the background label of the preview screen and the foreground label of the foreground object. When taking pictures, in order to reduce memory usage, the same image as the preview screen is obtained at the same time effect, image processing is performed on the original image by using the background label of the preview frame of the previous frame of the photographed original image and the foreground label of the foreground object of the original image.

图3是本申请实施例提供的另一种拍照方法的流程示意图,如图所示该方法是在图2所示实施例的基础上,描述了在对所述原始图像中的前景目标进行局部处理时,如何将前景目标从原始图像中分割出来,可以包括以下步骤:Fig. 3 is a schematic flowchart of another photographing method provided by the embodiment of the present application. As shown in the figure, the method is based on the embodiment shown in Fig. During processing, how to segment the foreground target from the original image may include the following steps:

步骤S301,在获取原始图像中前景目标的位置信息之后,获取所述原始图像中所述检测框内的图像。Step S301, after acquiring the position information of the foreground object in the original image, acquire the image within the detection frame in the original image.

在本申请实施例中,若需要对所述原始图像中的前景目标进行局部处理,需要将所属前景目标从原始图像中分割出来,在图2所示实施例的基础上,已经能够获得所述前景目标的检测框,由于检测框内的图像大部分为前景目标图像,所以,可以基于所述检测框内的图像分割所述前景目标。In the embodiment of the present application, if the foreground object in the original image needs to be locally processed, the foreground object to which it belongs needs to be segmented from the original image. On the basis of the embodiment shown in FIG. 2, the For the detection frame of the foreground object, since most of the images in the detection frame are images of the foreground object, the foreground object can be segmented based on the images in the detection frame.

步骤S302,基于所述检测框内的图像的灰度梯度,识别所述检测框内的图像中前景目标的边界,获得前景目标轮廓线。Step S302, based on the gray gradient of the image in the detection frame, identify the boundary of the foreground object in the image in the detection frame, and obtain the contour line of the foreground object.

在本申请实施例中,前景目标的边界是区分前景目标和背景图像的重要依据,而通常,前景目标边界点的周围灰度值变化率较高,因此,可以通过图像的灰度梯度来识别前景目标的边界,获得前景目标轮廓线。然而,前景目标轮廓线也会存在一个问题是:图像中实际上是边界,然而由于梯度变化不明显可能就不会生成轮廓线;或者,实际上不是边界,由于在前景目标内部的灰度值变化较明显而在前景目标内部生成轮廓线。所以,此时生成的前景目标轮廓线并非是真正的前景目标轮廓线。In the embodiment of this application, the boundary of the foreground object is an important basis for distinguishing the foreground object from the background image, and generally, the gray value change rate around the boundary point of the foreground object is relatively high, so it can be identified by the gray gradient of the image The boundary of the foreground object, and the contour line of the foreground object is obtained. However, there is also a problem with the foreground object contour line: the image is actually a boundary, but the contour line may not be generated due to the gradient change is not obvious; or, it is not actually a boundary, due to the gray value inside the foreground object Changes are more pronounced and contour lines are generated inside foreground objects. Therefore, the foreground object contour line generated at this time is not the real foreground object contour line.

步骤S303,获取灰度阈值序列,并通过所述灰度阈值序列中的每个灰度阈值对所述检测框内的图像进行二值化处理,获得灰度前景目标图像序列。Step S303, acquiring a sequence of grayscale thresholds, and performing binarization processing on the image in the detection frame by each grayscale threshold in the sequence of grayscale thresholds, to obtain a sequence of grayscale foreground target images.

在本申请实施例中,首先对所述检测框内的图像进行灰度处理,获得灰度图像,然后获取灰度阈值序列,通过灰度阈值序列中的每个灰度阈值对所述检测框内的图像进行二值化处理,就可以获得灰度前景目标图像序列,这些灰度前景目标图像序列中,会存在一个灰度前景目标图像,这个灰度前景目标图像能大致的表示前景目标区域。In the embodiment of the present application, firstly, grayscale processing is performed on the image in the detection frame to obtain a grayscale image, and then a sequence of grayscale threshold values is obtained, and each grayscale threshold value in the sequence of grayscale threshold values is used to evaluate the detection frame Binarize the images in the image to obtain a grayscale foreground target image sequence. In these grayscale foreground target image sequences, there will be a grayscale foreground target image. This grayscale foreground target image can roughly represent the foreground target area .

在灰度阈值序列中,若阈值设置的合适,可以得到所述前景目标区域。然而,实际应用中,很难精确的选取到合适的阈值将前景目标和背景图像分割开,即使选取到合适的阈值,背景图像中难免会存在与前景目标中的像素点的灰度值相同的像素点。In the gray threshold sequence, if the threshold is set properly, the foreground target area can be obtained. However, in practical applications, it is difficult to accurately select an appropriate threshold to separate the foreground object from the background image. Even if an appropriate threshold is selected, there will inevitably be pixels in the background image that have the same gray value pixel.

通过步骤S302和步骤S303的分析可知,实际上,二值化的方法和灰度梯度的方法均会存在一定的缺陷,获得的结果并不是非常精确地结果。为了能够获得精确的结果,本申请实施例将二值化的方法和灰度梯度的方法结合在一起获得前景目标,例如步骤S304至步骤S305描述的内容。Through the analysis of step S302 and step S303, it can be seen that, in fact, both the binarization method and the grayscale gradient method have certain defects, and the obtained results are not very accurate. In order to obtain accurate results, the embodiment of the present application combines the binarization method and the gray gradient method to obtain the foreground object, such as the content described in steps S304 to S305.

步骤S304,从所述灰度前景目标图像序列中获取与所述前景目标轮廓线匹配度最高的灰度前景目标图像。Step S304, acquiring the grayscale foreground object image with the highest matching degree with the foreground object contour line from the grayscale foreground object image sequence.

在本申请实施例中,灰度前景目标图像序列中,会有一幅灰度前景目标图像中前景目标的区域范围最接近前景目标真实的区域范围,如何从灰度前景目标图像序列中获得最接近前景目标真实的区域范围的图像就可以从所述灰度前景目标图像序列中获取与所述前景目标轮廓线匹配度最高的灰度前景目标图像。匹配度可以通过二值化方法和灰度梯度方法分别获得的前景目标的区域的重合度作为匹配度。每一个灰度前景目标图像序列中的目标区域可以暂时看作前景目标区域,灰度梯度方法获得的前景目标轮廓线内的区域也可以暂时看作前景目标区域,找到与灰度梯度方法获得的前景目标区域重合度最高的灰度前景目标图像。这个灰度前景目标图像中的前景目标区域相对来说能够比较真实的表示前景目标区域,但是也不是完全精确的前景目标区域。In the embodiment of the present application, in the grayscale foreground object image sequence, there will be a grayscale foreground object image in which the area range of the foreground object is closest to the real area range of the foreground object, how to obtain the closest range from the grayscale foreground object image sequence The image of the real area range of the foreground object can obtain the grayscale foreground object image with the highest matching degree with the contour line of the foreground object from the grayscale foreground object image sequence. The matching degree can be regarded as the matching degree by the coincidence degree of the area of the foreground target obtained by the binarization method and the gray gradient method respectively. The target area in each gray-scale foreground target image sequence can be temporarily regarded as the foreground target area, and the area within the foreground target contour line obtained by the gray-scale gradient method can also be temporarily regarded as the foreground target area. The grayscale foreground target image with the highest overlapping degree of the foreground target area. The foreground object area in the gray-scale foreground object image can represent the foreground object area relatively speaking, but it is not a completely accurate foreground object area.

步骤S305,将与所述前景目标轮廓线的匹配度最高的灰度前景目标图像与所述前景目标轮廓线融合生成连续的前景目标区域,在所述原始图像中所述前景目标区域内的图像为前景目标。Step S305, merging the grayscale foreground object image with the highest matching degree with the foreground object contour line with the foreground object contour line to generate a continuous foreground object area, the image in the foreground object area in the original image for the future target.

在本申请实施例中,实际上无论获得的匹配度最高的灰度前景目标图像中的前景目标区域,还是灰度梯度方法获得的前景目标轮廓线表示的前景目标区域都无法精确的描述前景目标区域,然而,可以将与所述前景目标轮廓线的匹配度最高的灰度前景目标图像与所述前景目标轮廓线融合生成连续的前景目标区域,通过二值化图像摒弃掉灰度梯度获得的前景目标轮廓线中不精确的部分,通过灰度梯度方法获得的前景目标轮廓线摒弃掉灰度前景目标图像中不精确的部分,融合后获得连续的前景目标区域,融合后获得的前景目标区域并不是真正的前景目标图像,因为是通过二值化后的灰度图像和轮廓线融合的,所以,获得的前景目标区域表示的是前景目标在所述原始图像中的坐标。在原始图像中的前景目标区域内的图像才是前景目标。In the embodiment of the present application, neither the foreground object region in the grayscale foreground object image obtained with the highest matching degree nor the foreground object area represented by the foreground object contour line obtained by the gray gradient method can accurately describe the foreground object However, the grayscale foreground object image with the highest matching degree with the foreground object contour line can be fused with the foreground object contour line to generate a continuous foreground object area, which is obtained by discarding the gray gradient of the binarized image The imprecise part of the foreground target contour line, the foreground target contour line obtained by the gray gradient method discards the inaccurate part of the gray scale foreground target image, and the continuous foreground target area is obtained after fusion, and the foreground target area obtained after fusion It is not a real foreground target image, because it is fused with the binarized grayscale image and the contour line, so the obtained foreground target area represents the coordinates of the foreground target in the original image. The image within the foreground object area in the original image is the foreground object.

应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the sequence numbers of the steps in the above embodiments do not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiment of the present application.

图4是本申请一实施例提供的移动终端的示意框图,为了便于说明,仅示出与本申请实施例相关的部分。FIG. 4 is a schematic block diagram of a mobile terminal provided by an embodiment of the present application. For ease of description, only parts related to the embodiment of the present application are shown.

该移动终端4可以是内置于手机、平板电脑、笔记本等移动终端内的软件单元、硬件单元或者软硬结合的单元,也可以作为独立的挂件集成到所述手机、平板电脑、笔记本等移动终端中。The mobile terminal 4 can be a software unit, a hardware unit, or a combination of software and hardware built in mobile terminals such as mobile phones, tablet computers, and notebooks, and can also be integrated into mobile terminals such as mobile phones, tablet computers, and notebooks as an independent pendant. middle.

所述移动终端4包括:Described mobile terminal 4 comprises:

预览画面获取模块41,用于获取所述摄像头采集的预览画面;A preview image acquiring module 41, configured to acquire the preview image collected by the camera;

预览画面处理模块42,用于识别所述预览画面的特征信息,并基于所述特征信息对所述预览画面进行图像处理,所述预览画面的特征信息包括所述预览画面的背景标签;A preview image processing module 42, configured to identify feature information of the preview image, and perform image processing on the preview image based on the feature information, where the feature information of the preview image includes a background tag of the preview image;

特征信息获取模块43,用于在接收到拍照的指令后,获取所述摄像头采集的原始图像;The feature information acquisition module 43 is used to acquire the original image collected by the camera after receiving the instruction of taking pictures;

拍照处理模块44,用于基于所述原始图像之前预设帧的预览画面的特征信息,对所述原始图像进行图像处理获得照片。The photographing processing module 44 is configured to perform image processing on the original image to obtain a photo based on the feature information of the preview frame of the preset frame before the original image.

可选的,所述预览画面处理模块42包括:Optionally, the preview image processing module 42 includes:

第一背景标签识别单元421,用于对所述预览画面进行场景识别获得所述预览画面的背景标签;The first background label identification unit 421 is configured to perform scene identification on the preview picture to obtain the background label of the preview picture;

第一前景标签识别单元422,用于检测所述预览画面中是否存在前景目标,若所述预览画面中存在前景目标,则获取所述前景目标的前景标签;The first foreground tag identification unit 422 is configured to detect whether there is a foreground object in the preview image, and if there is a foreground object in the preview image, then obtain the foreground tag of the foreground object;

将所述预览画面的背景标签和所述预览画面中前景目标的前景标签作为所述预览画面的特征信息;Using the background label of the preview picture and the foreground label of the foreground object in the preview picture as the feature information of the preview picture;

相应的,所述预览画面的特征信息还包括:所述预览画面中前景目标的前景标签。Correspondingly, the feature information of the preview picture further includes: a foreground label of the foreground object in the preview picture.

可选的,所述预览画面处理模块42还包括:Optionally, the preview image processing module 42 also includes:

第一全局处理单元423,用于基于所述预览画面的背景标签对所述预览画面进行全局处理;The first global processing unit 423 is configured to perform global processing on the preview image based on the background tag of the preview image;

第一局部处理单元424,用于基于所述预览画面中前景目标的前景标签对所述预览画面中的前景目标进行局部处理。The first partial processing unit 424 is configured to perform local processing on the foreground object in the preview image based on the foreground label of the foreground object in the preview image.

可选的,所述拍照处理模块44包括:Optionally, the photographing processing module 44 includes:

第二全局处理单元441,用于基于所述原始图像前一帧的预览画面的背景标签对所述原始图像进行全局处理;The second global processing unit 441 is configured to perform global processing on the original image based on the background label of the preview frame of the previous frame of the original image;

第二前景标签识别单元442,用于检测所述原始图像中是否存在前景目标;若所述原始图像中存在前景目标,则获取所述原始图像中前景目标的前景标签和所述前景目标的位置信息;The second foreground label recognition unit 442 is used to detect whether there is a foreground object in the original image; if there is a foreground object in the original image, then obtain the foreground label of the foreground object in the original image and the position of the foreground object information;

第二局部处理单元443,用于基于所述原始图像中前景目标的前景标签和所述前景目标的位置信息,对所述原始图像中的前景目标进行局部处理。The second local processing unit 443 is configured to perform local processing on the foreground object in the original image based on the foreground label of the foreground object in the original image and the position information of the foreground object.

可选的,所述前景目标的位置信息为所述前景目标对应的检测框的位置信息,Optionally, the position information of the foreground object is the position information of the detection frame corresponding to the foreground object,

所述拍照处理模块44还包括:The photographing processing module 44 also includes:

检测框图像获取单元,用于在获取所述原始图像中前景目标的位置信息之后,获取所述原始图像中所述检测框内的图像;A detection frame image acquisition unit, configured to obtain an image within the detection frame in the original image after obtaining the position information of the foreground object in the original image;

目标轮廓线获取单元,用于基于所述检测框内的图像的灰度梯度,识别所述检测框内的图像中前景目标的边界,获得前景目标轮廓线;A target contour acquisition unit, configured to identify the boundary of the foreground target in the image in the detection frame based on the gray gradient of the image in the detection frame, and obtain the foreground target contour;

目标图像序列获取单元,用于获取灰度阈值序列,并通过所述灰度阈值序列中的每个灰度阈值对所述检测框内的图像进行二值化处理,获得灰度前景目标图像序列;A target image sequence acquisition unit, configured to acquire a grayscale threshold sequence, and perform binarization on the image in the detection frame through each grayscale threshold in the grayscale threshold sequence to obtain a grayscale foreground target image sequence ;

融合单元,用于基于所述灰度前景目标图像序列和所述前景目标轮廓线确定前景目标区域,在所述原始图像中所述前景目标区域内的图像为前景目标。A fusion unit, configured to determine a foreground object area based on the grayscale foreground object image sequence and the foreground object contour line, and the image in the foreground object area in the original image is a foreground object.

可选的,所述融合单元包括:Optionally, the fusion unit includes:

目标图像获取子单元,用于从所述灰度前景目标图像序列中获取与所述前景目标轮廓线匹配度最高的灰度前景目标图像;a target image acquisition subunit, configured to acquire the gray-scale foreground target image with the highest matching degree with the foreground target contour line from the sequence of gray-scale foreground target images;

融合子单元,用于将与所述前景目标轮廓线的匹配度最高的灰度前景目标图像与所述前景目标轮廓线融合生成连续的前景目标区域。The fusion subunit is configured to fuse the grayscale foreground object image with the highest matching degree to the foreground object contour line with the foreground object contour line to generate a continuous foreground object area.

可选的,所述移动终端4还包括:Optionally, the mobile terminal 4 also includes:

压缩模块45,用于在识别所述预览画面的特征信息之前,对所述摄像头采集的预览画面进行压缩处理;A compression module 45, configured to compress the preview image collected by the camera before identifying the feature information of the preview image;

相应的,所述预览画面处理模块还用于:Correspondingly, the preview image processing module is also used for:

识别压缩处理后的预览画面的特征信息。The feature information of the compressed preview image is identified.

所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述移动终端的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述装置中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used for illustration. In practical applications, the above-mentioned functions can be assigned to different functional units, Completion of modules means that the internal structure of the mobile terminal is divided into different functional units or modules, so as to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated into one processing unit, or each unit can exist separately physically, or two or more units can be integrated into one unit, and the above-mentioned integrated units can either adopt hardware It can also be implemented in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the present application. For the specific working process of the units and modules in the above device, reference may be made to the corresponding process in the foregoing method embodiments, and details are not repeated here.

图5是本申请又一实施例提供的移动终端的示意框图。如图5所示,该实施例的移动终端5包括:一个或多个处理器50、存储器51以及存储在所述存储器51中并可在所述处理器50上运行的计算机程序52。所述处理器50执行所述计算机程序52时实现上述各个拍照方法实施例中的步骤,例如图1所示的步骤S101至S104。或者,所述处理器50执行所述计算机程序52时实现上述移动终端实施例中各模块/单元的功能,例如图4所示模块41至44的功能。Fig. 5 is a schematic block diagram of a mobile terminal provided by another embodiment of the present application. As shown in FIG. 5 , the mobile terminal 5 of this embodiment includes: one or more processors 50 , a memory 51 , and a computer program 52 stored in the memory 51 and operable on the processor 50 . When the processor 50 executes the computer program 52, it implements the steps in the above embodiments of the photographing method, for example, steps S101 to S104 shown in FIG. 1 . Alternatively, when the processor 50 executes the computer program 52, functions of modules/units in the above mobile terminal embodiments are implemented, for example, functions of the modules 41 to 44 shown in FIG. 4 .

示例性的,所述计算机程序52可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器51中,并由所述处理器50执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序52在所述移动终端5中的执行过程。例如,所述计算机程序52可以被分割成预览画面获取模块、预览画面处理模块、特征信息获取模块、拍照处理模块。Exemplarily, the computer program 52 can be divided into one or more modules/units, and the one or more modules/units are stored in the memory 51 and executed by the processor 50 to complete this application. The one or more modules/units may be a series of computer program instruction segments capable of accomplishing specific functions, and the instruction segments are used to describe the execution process of the computer program 52 in the mobile terminal 5 . For example, the computer program 52 may be divided into a preview image acquisition module, a preview image processing module, a characteristic information acquisition module, and a photographing processing module.

所述预览画面获取模块,用于获取所述摄像头采集的预览画面;The preview image acquisition module is used to acquire the preview image captured by the camera;

所述预览画面处理模块,用于识别所述预览画面的特征信息,并基于所述特征信息对所述预览画面进行图像处理,所述预览画面的特征信息包括所述预览画面的背景标签;The preview image processing module is configured to identify feature information of the preview image, and perform image processing on the preview image based on the feature information, the feature information of the preview image includes a background tag of the preview image;

所述特征信息获取模块,用于在接收到拍照的指令后,获取所述摄像头采集的原始图像;The characteristic information acquisition module is used to acquire the original image collected by the camera after receiving the instruction of taking pictures;

所述拍照处理模块,用于基于所述原始图像之前预设帧的预览画面的特征信息,对所述原始图像进行图像处理获得照片。The photographing processing module is configured to perform image processing on the original image to obtain a photo based on feature information of a preview frame of a preset frame before the original image.

其它模块或者单元可参照图4所示的实施例中的描述,在此不再赘述。For other modules or units, reference may be made to the description in the embodiment shown in FIG. 4 , and details are not repeated here.

所述移动终端包括但不仅限于处理器50、存储器51。本领域技术人员可以理解,图5仅仅是移动终端5的一个示例,并不构成对移动终端5的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述移动终端还可以包括输入设备、输出设备、网络接入设备、总线等。The mobile terminal includes but not limited to a processor 50 and a memory 51 . Those skilled in the art can understand that FIG. 5 is only an example of the mobile terminal 5, and does not constitute a limitation to the mobile terminal 5. It may include more or less components than those shown in the illustration, or combine certain components, or have different Components, for example, the mobile terminal may also include an input device, an output device, a network access device, a bus, and the like.

所述处理器50可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The processor 50 may be a central processing unit (Central Processing Unit, CPU), and may also be other general-purpose processors, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), Off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.

所述存储器51可以是所述移动终端5的内部存储单元,例如移动终端5的硬盘或内存。所述存储器51也可以是所述移动终端5的外部存储设备,例如所述移动终端5上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器51还可以既包括所述移动终端5的内部存储单元也包括外部存储设备。所述存储器51用于存储所述计算机程序以及所述移动终端所需的其他程序和数据。所述存储器51还可以用于暂时地存储已经输出或者将要输出的数据。The memory 51 may be an internal storage unit of the mobile terminal 5 , such as a hard disk or memory of the mobile terminal 5 . The memory 51 can also be an external storage device of the mobile terminal 5, such as a plug-in hard disk equipped on the mobile terminal 5, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, flash memory card (Flash Card), etc. Further, the memory 51 may also include both an internal storage unit of the mobile terminal 5 and an external storage device. The memory 51 is used to store the computer program and other programs and data required by the mobile terminal. The memory 51 can also be used to temporarily store data that has been output or will be output.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the descriptions of each embodiment have their own emphases, and for parts that are not detailed or recorded in a certain embodiment, refer to the relevant descriptions of other embodiments.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.

在本申请所提供的实施例中,应该理解到,所揭露的移动终端和方法,可以通过其它的方式实现。例如,以上所描述的移动终端实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed mobile terminal and method can be implemented in other ways. For example, the mobile terminal embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components May be combined or may be integrated into another system, or some features may be omitted, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括是电载波信号和电信信号。If the integrated module/unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments in the present application can also be completed by instructing related hardware through computer programs. The computer programs can be stored in a computer-readable storage medium, and the computer When the program is executed by the processor, the steps in the above-mentioned various method embodiments can be realized. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM, Read-Only Memory) , Random Access Memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, computer-readable media Excluding electrical carrier signals and telecommunication signals.

以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still implement the foregoing embodiments Modifications to the technical solutions described in the examples, or equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the application, and should be included in the Within the protection scope of this application.

Claims (10)

Translated fromChinese
1.一种拍照方法,其特征在于,应用于移动终端,所述拍照方法包括:1. A method for taking pictures, characterized in that being applied to a mobile terminal, the method for taking pictures comprises:获取所述摄像头采集的预览画面;Obtain a preview image captured by the camera;识别所述预览画面的特征信息,并基于所述特征信息对所述预览画面进行图像处理,所述预览画面的特征信息包括所述预览画面的背景标签;Identifying feature information of the preview picture, and performing image processing on the preview picture based on the feature information, the feature information of the preview picture includes a background tag of the preview picture;在接收到拍照的指令后,获取所述摄像头采集的原始图像;After receiving the instruction to take pictures, obtain the original image collected by the camera;基于所述原始图像之前预设帧的预览画面的特征信息,对所述原始图像进行图像处理获得照片。Image processing is performed on the original image to obtain a photo based on feature information of a preview frame of a preset frame before the original image.2.如权利要求1所述的拍照方法,其特征在于,所述识别所述预览画面的特征信息包括:2. The photographing method according to claim 1, wherein the characteristic information for identifying the preview image comprises:对所述预览画面进行场景识别获得所述预览画面的背景标签;Performing scene recognition on the preview image to obtain the background label of the preview image;检测所述预览画面中是否存在前景目标,若所述预览画面中存在前景目标,则获取所述前景目标的前景标签;Detecting whether there is a foreground object in the preview image, if there is a foreground object in the preview image, then obtaining the foreground label of the foreground object;将所述预览画面的背景标签和所述预览画面中前景目标的前景标签作为所述预览画面的特征信息;Using the background label of the preview picture and the foreground label of the foreground object in the preview picture as the feature information of the preview picture;相应的,所述预览画面的特征信息还包括:所述预览画面中前景目标的前景标签。Correspondingly, the feature information of the preview picture further includes: a foreground label of the foreground object in the preview picture.3.如权利要求2所述的拍照方法,其特征在于,所述基于所述特征信息对所述预览画面进行图像处理包括:3. The photographing method according to claim 2, wherein said performing image processing on said preview image based on said characteristic information comprises:基于所述预览画面的背景标签对所述预览画面进行全局处理;performing global processing on the preview image based on the background tag of the preview image;基于所述预览画面中前景目标的前景标签对所述预览画面中的前景目标进行局部处理。The foreground object in the preview image is locally processed based on the foreground label of the foreground object in the preview image.4.如权利要求3所述的拍照方法,其特征在于,所述基于所述原始图像之前预设帧的预览画面的特征信息,对所述原始图像进行图像处理获得照片包括:4. The photographing method according to claim 3, characterized in that, performing image processing on the original image to obtain a photo based on the feature information of the preview frame of the preset frame before the original image comprises:基于所述原始图像前一帧的预览画面的背景标签对所述原始图像进行全局处理;performing global processing on the original image based on the background label of the preview frame of the previous frame of the original image;检测所述原始图像中是否存在前景目标;Detecting whether there is a foreground target in the original image;若所述原始图像中存在前景目标,则获取所述原始图像中前景目标的前景标签和所述前景目标的位置信息;If there is a foreground object in the original image, obtaining the foreground label of the foreground object in the original image and the position information of the foreground object;基于所述原始图像中前景目标的前景标签和所述前景目标的位置信息,对所述原始图像中的前景目标进行局部处理。Local processing is performed on the foreground object in the original image based on the foreground label of the foreground object in the original image and the position information of the foreground object.5.如权利要求4所述的拍照方法,其特征在于,所述前景目标的位置信息为所述前景目标对应的检测框的位置信息,5. The photographing method according to claim 4, wherein the position information of the foreground object is the position information of the detection frame corresponding to the foreground object,在获取所述原始图像中前景目标的位置信息之后,还包括:After obtaining the position information of the foreground target in the original image, it also includes:获取所述原始图像中所述检测框内的图像;acquiring images within the detection frame in the original image;基于所述检测框内的图像的灰度梯度,识别所述检测框内的图像中前景目标的边界,获得前景目标轮廓线;Based on the gray gradient of the image in the detection frame, identify the boundary of the foreground object in the image in the detection frame, and obtain the contour line of the foreground object;获取灰度阈值序列,并通过所述灰度阈值序列中的每个灰度阈值对所述检测框内的图像进行二值化处理,获得灰度前景目标图像序列;Obtaining a sequence of grayscale thresholds, and performing binarization processing on images in the detection frame through each grayscale threshold in the sequence of grayscale thresholds, to obtain a sequence of grayscale foreground target images;基于所述灰度前景目标图像序列和所述前景目标轮廓线确定前景目标区域,在所述原始图像中所述前景目标区域内的图像为前景目标。A foreground object area is determined based on the grayscale foreground object image sequence and the foreground object contour line, and images in the foreground object area in the original image are foreground objects.6.如权利要求5所述的拍照方法,其特征在于,所述基于所述灰度前景目标图像序列和所述前景目标轮廓线确定前景目标区域包括:6. The photographing method according to claim 5, wherein said determining the foreground target area based on said grayscale foreground target image sequence and said foreground target contour line comprises:从所述灰度前景目标图像序列中获取与所述前景目标轮廓线匹配度最高的灰度前景目标图像;Obtaining the grayscale foreground object image with the highest matching degree with the foreground object contour line from the grayscale foreground object image sequence;将与所述前景目标轮廓线的匹配度最高的灰度前景目标图像与所述前景目标轮廓线融合生成连续的前景目标区域。The grayscale foreground object image with the highest matching degree to the foreground object contour line is fused with the foreground object contour line to generate a continuous foreground object area.7.如权利要求1至6任一项所述的拍照方法,其特征在于,在识别所述预览画面的特征信息之前,还包括:7. The photographing method according to any one of claims 1 to 6, characterized in that, before identifying the characteristic information of the preview image, further comprising:对所述摄像头采集的预览画面进行压缩处理;Compressing the preview image collected by the camera;相应的,所述识别所述预览画面的特征信息包括:Correspondingly, the feature information identifying the preview image includes:识别压缩处理后的预览画面的特征信息。The feature information of the compressed preview image is identified.8.一种移动终端,其特征在于,包括:8. A mobile terminal, characterized in that it comprises:预览画面获取模块,用于获取所述摄像头采集的预览画面;A preview image acquisition module, configured to acquire a preview image captured by the camera;预览画面处理模块,用于识别所述预览画面的特征信息,并基于所述特征信息对所述预览画面进行图像处理,所述预览画面的特征信息包括所述预览画面的背景标签;A preview image processing module, configured to identify feature information of the preview image, and perform image processing on the preview image based on the feature information, where the feature information of the preview image includes a background tag of the preview image;特征信息获取模块,用于在接收到拍照的指令后,获取所述摄像头采集的原始图像;A feature information acquisition module, configured to acquire the original image collected by the camera after receiving the instruction to take pictures;拍照处理模块,用于基于所述原始图像之前预设帧的预览画面的特征信息,对所述原始图像进行图像处理获得照片。The photographing processing module is configured to perform image processing on the original image to obtain a photo based on the feature information of the preview frame of the preset frame before the original image.9.一种移动终端,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至7任一项所述方法的步骤。9. A mobile terminal, comprising a memory, a processor, and a computer program stored in the memory and operable on the processor, characterized in that, when the processor executes the computer program, the computer program according to claim The step of any one of 1 to 7.10.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序被一个或多个处理器执行时实现如权利要求1至7任一项所述方法的步骤。10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, and when the computer program is executed by one or more processors, the computer program according to any one of claims 1 to 7 is implemented. steps of the method described above.
CN201810570646.1A2018-06-052018-06-05Photographing method, mobile terminal and computer readable storage mediumExpired - Fee RelatedCN108769521B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201810570646.1ACN108769521B (en)2018-06-052018-06-05Photographing method, mobile terminal and computer readable storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201810570646.1ACN108769521B (en)2018-06-052018-06-05Photographing method, mobile terminal and computer readable storage medium

Publications (2)

Publication NumberPublication Date
CN108769521Atrue CN108769521A (en)2018-11-06
CN108769521B CN108769521B (en)2021-02-02

Family

ID=63999004

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201810570646.1AExpired - Fee RelatedCN108769521B (en)2018-06-052018-06-05Photographing method, mobile terminal and computer readable storage medium

Country Status (1)

CountryLink
CN (1)CN108769521B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113572980A (en)*2020-04-282021-10-29华为技术有限公司 Photographing method, device, terminal device and storage medium
CN115484403A (en)*2022-08-082022-12-16荣耀终端有限公司Video recording method and related device
CN118175238A (en)*2024-05-142024-06-11威海凯思信息科技有限公司Image generation method and device based on AIGC

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20040008773A1 (en)*2002-06-142004-01-15Canon Kabushiki KaishaMultiple image processing and synthesis using background image extraction
CN103514446A (en)*2013-10-162014-01-15北京理工大学Outdoor scene recognition method fused with sensor information
CN106101547A (en)*2016-07-062016-11-09北京奇虎科技有限公司The processing method of a kind of view data, device and mobile terminal
CN107948617A (en)*2017-12-062018-04-20广东欧珀移动通信有限公司Image processing method, device, computer-readable recording medium and computer equipment
CN108024107A (en)*2017-12-062018-05-11广东欧珀移动通信有限公司Image processing method, device, electronic equipment and computer-readable recording medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20040008773A1 (en)*2002-06-142004-01-15Canon Kabushiki KaishaMultiple image processing and synthesis using background image extraction
CN103514446A (en)*2013-10-162014-01-15北京理工大学Outdoor scene recognition method fused with sensor information
CN106101547A (en)*2016-07-062016-11-09北京奇虎科技有限公司The processing method of a kind of view data, device and mobile terminal
CN107948617A (en)*2017-12-062018-04-20广东欧珀移动通信有限公司Image processing method, device, computer-readable recording medium and computer equipment
CN108024107A (en)*2017-12-062018-05-11广东欧珀移动通信有限公司Image processing method, device, electronic equipment and computer-readable recording medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113572980A (en)*2020-04-282021-10-29华为技术有限公司 Photographing method, device, terminal device and storage medium
CN113572980B (en)*2020-04-282022-10-11华为技术有限公司Photographing method and device, terminal equipment and storage medium
CN115484403A (en)*2022-08-082022-12-16荣耀终端有限公司Video recording method and related device
CN115484403B (en)*2022-08-082023-10-24荣耀终端有限公司 Video recording methods and related devices
CN118175238A (en)*2024-05-142024-06-11威海凯思信息科技有限公司Image generation method and device based on AIGC

Also Published As

Publication numberPublication date
CN108769521B (en)2021-02-02

Similar Documents

PublicationPublication DateTitle
CN108765278B (en)Image processing method, mobile terminal and computer readable storage medium
CN109005368B (en) A method for generating high dynamic range image, mobile terminal and storage medium
CN108776819A (en)Target identification method, mobile terminal and computer readable storage medium
CN107909569B (en)Screen-patterned detection method, screen-patterned detection device and electronic equipment
CN110796600B (en) An image super-resolution reconstruction method, an image super-resolution reconstruction device, and electronic equipment
CN110335216B (en)Image processing method, image processing apparatus, terminal device, and readable storage medium
CN109005367B (en)High dynamic range image generation method, mobile terminal and storage medium
WO2020029518A1 (en)Monitoring video processing method, device and computer readable medium
CN108776800B (en)Image processing method, mobile terminal and computer readable storage medium
CN110717452B (en)Image recognition method, device, terminal and computer readable storage medium
CN108805838B (en) Image processing method, mobile terminal and computer-readable storage medium
CN108564579A (en)A kind of distress in concrete detection method and detection device based on temporal and spatial correlations
CN107172354A (en)Method for processing video frequency, device, electronic equipment and storage medium
CN108230333A (en)Image processing method, device, computer program, storage medium and electronic equipment
CN108764139B (en) A face detection method, mobile terminal and computer-readable storage medium
CN108810407B (en) Image processing method, mobile terminal and computer-readable storage medium
CN108769521B (en)Photographing method, mobile terminal and computer readable storage medium
CN115631122A (en)Image optimization method and device for edge image algorithm
CN108171135A (en)Method for detecting human face, device and computer readable storage medium
CN116249015A (en) Camera occlusion detection method, device, camera equipment and storage medium
WO2019196240A1 (en)Photographing method, apparatus, computer device, and storage medium
CN108764040A (en)Image detection method, terminal and computer storage medium
CN112883783A (en)Video concentration method and device, terminal equipment and storage medium
CN110610178A (en) Image recognition method, device, terminal and computer-readable storage medium
CN118230249A (en)Intrusion object detection and identification method, device, equipment and storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
CF01Termination of patent right due to non-payment of annual fee

Granted publication date:20210202

CF01Termination of patent right due to non-payment of annual fee

[8]ページ先頭

©2009-2025 Movatter.jp