WO2018032702A1 - 一种图像处理方法及装置 - Google Patents

一种图像处理方法及装置 Download PDF

Info

Publication number
WO2018032702A1
WO2018032702A1 PCT/CN2016/113503 CN2016113503W WO2018032702A1 WO 2018032702 A1 WO2018032702 A1 WO 2018032702A1 CN 2016113503 W CN2016113503 W CN 2016113503W WO 2018032702 A1 WO2018032702 A1 WO 2018032702A1
Authority
WO
WIPO (PCT)
Prior art keywords
foreground
image
pixel
frame
captured 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.)
Ceased
Application number
PCT/CN2016/113503
Other languages
English (en)
French (fr)
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.)
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Original Assignee
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Shiyuan Electronics Thecnology Co Ltd filed Critical Guangzhou Shiyuan Electronics Thecnology Co Ltd
Publication of WO2018032702A1 publication Critical patent/WO2018032702A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation

Definitions

  • the present invention relates to the field of information processing, and in particular to an image processing method and apparatus.
  • the present invention provides an image processing method and apparatus, which can save storage space of an electronic device and eliminate the trouble of manual post-editing.
  • the invention provides an image processing method, comprising:
  • a rectangular image having the smallest area of the foreground is taken from the captured image, and a final output image is generated based on the rectangular image.
  • the image processing method provided by the present invention captures image information with a foreground frame when photographing, divides the foreground of the image by using the captured image information, obtains an output image according to a rectangular image having the smallest area including the foreground, automatically removes the background, and only saves the image.
  • the content that the user is interested in saves the storage space of the electronic device, and also eliminates the trouble of manual editing.
  • segmenting the foreground of the captured image according to the partial image framed by the foreground frame in the captured image includes:
  • the partial image framed in the captured image by the foreground frame is an initial seed region
  • any of the neighboring pixels is a foreground pixel, updating the current seed region to the set of the foreground pixel and the original seed region;
  • the current seed region is segmented as the foreground of the captured image.
  • the partial image selected by the foreground frame is used as a seed region, and the probability algorithm is used as a criterion for regional growth.
  • the algorithm is simple and the calculation amount is low, and can also be implemented on an ordinary electronic camera device such as a mobile phone or a camera. It is suitable for occasions where the background is unchanged, which can meet the basic requirements of foreground segmentation, and can minimize the calculation amount of the algorithm and improve the operability.
  • the determining, by the preset probability algorithm, whether the neighboring pixel of the edge pixel of the current seed region is a foreground pixel specifically includes:
  • the neighboring pixel is a foreground pixel whose probability density value p(x) is greater than or equal to a preset threshold, the neighboring pixel is a foreground pixel;
  • the neighboring pixel is not a foreground pixel.
  • the Gaussian model is the most simple continuous distribution probability density function, and the Gaussian model is used as the criterion for the regional growth method to further reduce the computational complexity of the algorithm.
  • the characteristic value is a brightness value.
  • the brightness value is better for segmenting the foreground.
  • the rectangular image having the smallest area of the foreground is taken from the captured image, and the final output image is generated according to the rectangular image, which specifically includes:
  • the capturing a rectangular image having the smallest area of the foreground from the captured image, and generating a final output image according to the rectangular image includes:
  • a rectangular image having the smallest area including the foreground is taken from the captured image, and the rectangular image is taken as the final output image.
  • the rectangular image with the smallest area of the foreground can be directly taken out from the captured image as an output image, which is fast and effective; and the screenshot frame with adjustable size and position can also be output, which is complicated in the foreground and may be inaccurately segmented.
  • the user adjust the output image to improve the user experience.
  • the present invention also provides an image processing apparatus, including:
  • a foreground box calling module configured to display a preset foreground frame on a shooting interface of the camera device
  • An image acquisition module configured to locate a photographic subject according to the foreground frame, and capture an image
  • a foreground segmentation module configured to segment a foreground of the captured image according to the partial image framed by the foreground frame in the captured image
  • an output module configured to intercept a rectangular image having the smallest area of the foreground from the captured image, and generate a final output image according to the rectangular image.
  • the foreground segmentation module includes:
  • An initializing unit configured to use the partial image framed in the captured image by the foreground frame as an initial seed region
  • a foreground determining unit configured to determine, according to a preset probability algorithm, whether a neighboring pixel of an edge pixel of a current seed region is a foreground pixel
  • a seed area updating unit configured to update a current seed area to a set of the foreground pixel and the original seed area if any of the neighboring pixels is a foreground pixel;
  • a dividing unit configured to divide the current seed region as a foreground of the captured image if all of the neighboring pixels are not foreground pixels.
  • the foreground determining unit includes:
  • a parameter calculation unit configured to calculate a mean value ⁇ of the feature values of all pixels in the current seed region and a variance ⁇ 2 , wherein x i is a feature value of the i-th pixel of the seed region;
  • a probability calculation unit configured to calculate a probability density value p(x) of a neighboring pixel of the edge pixel of the seed region as a foreground pixel; wherein x is a feature value of the neighboring pixel;
  • a foreground confirmation unit configured to: if the probability density value p(x) of the neighboring pixel is a foreground pixel is greater than or equal to a preset threshold, the neighboring pixel is a foreground pixel;
  • the foreground negation unit is configured to: if the probability density value p(x) of the neighboring pixel is a foreground pixel is less than a preset threshold, the neighboring pixel is not a foreground pixel.
  • the characteristic value is a brightness value.
  • the output module includes:
  • a screenshot frame display unit configured to capture a rectangular image having the smallest area of the foreground from the captured image, and display a screenshot frame corresponding to the rectangular image on the captured image; wherein the screenshot frame includes a handle for the user to adjust the size and position of the screenshot frame;
  • An adjusting unit configured to receive a movement operation of the control point by the user, and adjust a size and a position of the screenshot frame according to the moving operation;
  • An image output unit configured to receive confirmation information that the user completes the image processing, and the image captured by the screenshot frame is the final output image
  • the output module includes: a rectangular image output unit for extracting a rectangular image having the smallest area of the foreground from the captured image, and using the rectangular image as a final output image.
  • FIG. 2 is a schematic diagram of an image of an image processing method provided by the present invention.
  • Fig. 3 is a structural diagram of an image processing apparatus provided by the present invention.
  • FIG. 1 is a flowchart of an image processing method provided by the present invention, including:
  • the frame of the area c in the figure is a preset foreground frame.
  • the foreground frame positions the subject and captures the image. It is assumed that the area a in the figure is the captured image, and the area b is the foreground of the captured image.
  • the area b can be gradually segmented, and the rectangular image containing the smallest area of the area b is extracted from the area a. (as shown by the dotted frame selection area in Fig. 2), and the final output image is generated based on the rectangular image.
  • the image processing method provided by the present invention captures image information with a foreground frame when photographing, divides the foreground of the image by using the captured image information, obtains an output image according to a rectangular image having the smallest area including the foreground, automatically removes the background, and only saves the image.
  • the content that the user is interested in saves the storage space of the electronic device, and also eliminates the trouble of manual editing.
  • step S3 “the foreground of the captured image is segmented according to the partial image framed by the foreground frame in the captured image”, the foreground of the captured image may be segmented by using different front background segmentation methods.
  • a region growing method can be employed, using different region growing criteria, and various embodiments can be used to segment the foreground of the captured image.
  • step S3 specifically includes:
  • the partial image framed in the captured image by the foreground frame is an initial seed region
  • any of the neighboring pixels is a foreground pixel, updating the current seed region to the set of the foreground pixel and the original seed region;
  • the current seed region is segmented as the foreground of the captured image.
  • the partial image selected by the foreground frame is used as the seed region, and the probability algorithm is used as the criterion for the region growth.
  • the algorithm is simple and the calculation amount is low, and can also be implemented on an ordinary electronic camera device such as a mobile phone or a camera. It is suitable for occasions where the background is unchanged, which can meet the basic requirements of foreground segmentation, and can minimize the calculation amount of the algorithm and improve the operability.
  • a representative pixel in the foreground image selected as the seed pixel may also be used as the seed pixel, and other region growth criteria (such as the feature value of the neighborhood pixel and the feature value of the seed pixel) Whether the difference is less than a certain threshold) splits the foreground. It is selected according to the actual application scenario.
  • the determining, by the preset probability algorithm, whether the neighboring pixel of the edge pixel of the current seed region is a foreground pixel further comprising:
  • the neighboring pixel is a foreground pixel whose probability density value p(x) is greater than or equal to a preset threshold, the neighboring pixel is a foreground pixel;
  • the neighboring pixel is not a foreground pixel.
  • the Gaussian model is used as the criterion for the regional growth method, and the Gaussian model is the easiest to further reduce the computational complexity of the algorithm.
  • the calculation may be performed on the 4-neighbor pixel or the 8-neighbor pixel.
  • the use of 4 neighborhood pixels can further reduce the amount of calculation, which is suitable for images with obvious foreground and background boundaries; the use of 8 neighborhood pixels is more accurate.
  • the characteristic value is a brightness value.
  • the brightness value is better for segmenting the foreground.
  • step S4 “cutting a rectangular image containing the smallest area of the foreground from the captured image and generating a final output image according to the rectangular image” also has various embodiments;
  • the rectangular image having the smallest area of the foreground may be intercepted from the captured image, and the rectangular image is used as the final output image, which is quick and easy to segment.
  • step S4 specifically includes:
  • the image captured by the screenshot box is the final output image.
  • the user can adjust the output image and improve the user experience in the case where the foreground is complicated and the segmentation may be inaccurate.
  • FIG. 3 is a structural diagram of an image processing apparatus provided by the present invention, including:
  • the foreground frame calls the module 1 for displaying a preset foreground frame on the shooting interface of the imaging device;
  • An image acquisition module 2 configured to locate a photographic subject according to the foreground frame, and capture an image
  • the foreground segmentation module 3 is configured to segment a foreground of the captured image according to the partial image framed by the foreground frame in the captured image;
  • An output module 4 configured to capture, from the captured image, a rectangular image having the smallest area of the foreground, and according to the The rectangular image produces the final output image.
  • the foreground segmentation module 3 includes:
  • An initializing unit configured to use the partial image framed in the captured image by the foreground frame as an initial seed region
  • a foreground determining unit configured to determine, according to a preset probability algorithm, whether a neighboring pixel of an edge pixel of a current seed region is a foreground pixel
  • a seed area updating unit configured to update a current seed area to a set of the foreground pixel and the original seed area if any of the neighboring pixels is a foreground pixel;
  • a dividing unit configured to divide the current seed region as a foreground of the captured image if all of the neighboring pixels are not foreground pixels.
  • the foreground determining unit includes:
  • a parameter calculation unit configured to calculate a mean value ⁇ of the feature values of all pixels in the current seed region and a variance ⁇ 2 , wherein x i is a feature value of the i-th pixel of the seed region;
  • a probability calculation unit configured to calculate a probability density value p(x) of a neighboring pixel of the edge pixel of the seed region as a foreground pixel; wherein x is a feature value of the neighboring pixel;
  • a foreground confirmation unit configured to: if the probability density value p(x) of the neighboring pixel is a foreground pixel is greater than or equal to a preset threshold, the neighboring pixel is a foreground pixel;
  • the foreground negation unit is configured to: if the probability density value p(x) of the neighboring pixel is a foreground pixel is less than a preset threshold, the neighboring pixel is not a foreground pixel.
  • the characteristic value is a brightness value.
  • the output module 4 includes:
  • a screenshot frame display unit configured to capture a rectangular image having the smallest area of the foreground from the captured image, and display a screenshot frame corresponding to the rectangular image on the captured image; wherein the screenshot frame includes a handle for the user to adjust the size and position of the screenshot frame;
  • An adjusting unit configured to receive a movement operation of the control point by the user, and adjust a size and a position of the screenshot frame according to the moving operation;
  • An image output unit configured to receive confirmation information that the user completes the image processing, and the image captured by the screenshot frame is the final output image
  • the output module includes: a rectangular image output unit for extracting a rectangular image having the smallest area of the foreground from the captured image, and using the rectangular image as a final output image.
  • the image processing method and device provided by the invention capture image information by foreground frame when photographing, segment the foreground of the image by using the captured image information, obtain an output image according to the rectangular image with the smallest area of the foreground, and automatically remove the background, only The content that is of interest to the user is saved, which saves the storage space of the electronic device and eliminates the trouble of manual editing.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Studio Devices (AREA)
  • Image Analysis (AREA)

Abstract

本发明提供一种图像处理方法,包括:在摄像设备的拍摄界面上显示预先设定的前景框;根据所述前景框定位拍摄对象,并拍摄图像;根据所述前景框在所拍摄图像中框选的局部图像,分割出所拍摄图像的前景;从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并根据所述矩形图像生成最终输出的图像。相应地,本发明还提供一种图像处理装置。本发明提供的图像处理方法及装置,在拍照时以前景框捕捉图像信息,利用捕捉到的图像信息分割图像的前景,根据包含前景的面积最小的矩形图像获得输出图像,自动去除了背景,只保存了用户感兴趣的内容,节约了电子设备的存储空间,也免去了人工后期编辑的代价。

Description

一种图像处理方法及装置 技术领域
本发明涉及信息处理领域,具体地,涉及一种图像处理方法及装置。
背景技术
随着电子技术的发展,大量的电子设备中添加了拍照功能。而在拍照过程中,很多时候人们只想保存感兴趣的内容,比如在参加一些讨论会议时,主持人通过投影仪分享演示文稿,人们希望记录会议内容因此需要拍摄演示文稿会后整理,但对于演示文稿的背景并不感兴趣。由于现有技术中去除背景只能采用人工后期编辑的方式,不能在拍摄过程中自动完成去除背景,因此造成需要保存一些多余的信息,浪费电子设备的存储空间;后期需要人工编辑也较为麻烦。
发明内容
为了克服现有技术的缺陷,本发明提供一种图像处理方法及装置,其能节约电子设备的存储空间,免去人工后期编辑的麻烦。
本发明提供一种图像处理方法,包括:
在摄像设备的拍摄界面上显示预先设定的前景框;
根据所述前景框定位拍摄对象,并拍摄图像;
根据所述前景框在所拍摄图像中框选的局部图像,分割出所拍摄图像的前景;
从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并根据所述矩形图像生成最终输出的图像。
实施本发明,具有如下有益效果:
本发明提供的图像处理方法,在拍照时以前景框捕捉图像信息,利用捕捉到的图像信息分割图像的前景,根据包含前景的面积最小的矩形图像获得输出图像,自动去除了背景,只保存了用户感兴趣的内容,节约了电子设备的存储空间,也免去了人工后期编辑的麻烦。
进一步地,所述根据所述前景框在所拍摄图像中框选的局部图像,分割出所拍摄图像的前景,具体包括:
以所述前景框在所拍摄图像中框选的局部图像为初始的种子区域;
按预设的概率算法判断当前的种子区域的边缘像素的邻域像素是否为前景像素;
若任一邻域像素为前景像素,则将当前的种子区域更新为所述前景像素与原种子区域的集合;
若所有邻域像素均不是前景像素,则分割当前的种子区域作为所述已拍摄图像的前景。
在进一步方案中,采用前景框框选的局部图像为种子区域,结合概率算法作为区域生长的判断准则,算法简单、计算量低,在普通的电子摄像设备,比如手机、相机上也可实现。适用于背景单一不变的场合,能满足前景分割的基本要求,又能最大程度地降低算法计算量,提高可操作性。
进一步地,所述按预设的概率算法判断当前的种子区域的边缘像素的邻域像素是否为前景像素,具体包括:
计算当前的种子区域内的所有像素的特征值的均值μ以及方差σ2,其中,
Figure PCTCN2016113503-appb-000001
Figure PCTCN2016113503-appb-000002
xi为所述种子区域的第i个像素的特征值;
计算所述种子区域的边缘像素的邻域像素为前景像素的概率密度值p(x);其中,
Figure PCTCN2016113503-appb-000003
x为所述邻域像素的特征值;
若所述邻域像素为前景像素的概率密度值p(x)大于或等于预设的阈值,则所述邻域像素为前景像素;
若所述邻域像素为前景像素的概率密度值p(x)小于预设的阈值,则所述邻域像素不是前景像素。
在进一步方案中,由于一般图像的特征值都是连续分布,高斯模型是最为简便的连续分布概率密度函数,以高斯模型作为区域生长法的判断准则,进一步降低算法计算量。
优选地,所述特征值为亮度值。
对于在会议、讲座等场合拍摄主讲人分享的演示文稿,由于演示文稿亮度较高,背景较暗,因此以亮度值为特征值能更好地分割前景。
进一步地,所述从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并根据所述矩形图像生成最终输出的图像,具体包括:
从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并显示与所述矩形图像对应的截图框在所述已拍摄图像上;其中,所述截图框包含用于供用户调节所述截图框的尺寸和位置的控点;
接收用户对所述控点的移动操作,并根据所述移动操作调节所述截图框的尺寸和位置;
接收用户对图像处理完成的确认信息,以所述截图框截取的图像为最终输出的图像;
或者,所述从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并根据所述矩形图像生成最终输出的图像,包括:
从所拍摄图像中截取包含所述前景的面积最小的矩形图像,将所述矩形图像作为最终输出的图像。
在进一步方案中,可以直接从所拍摄图像中截取包含前景的面积最小的矩形图像作为输出图像,快捷有效;也可以输出可调整尺寸和位置的截图框,在前景复杂,可能分割不准确的情况下,让用户可以调整输出图像,提高用户体验。
相应地,本发明还提供一种图像处理装置,包括:
前景框调用模块,用于在摄像设备的拍摄界面上显示预先设定的前景框;
图像获取模块,用于根据所述前景框定位拍摄对象,并拍摄图像;
前景分割模块,用于根据所述前景框在所拍摄图像中框选的局部图像,分割出所拍摄图像的前景;
输出模块,用于从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并根据所述矩形图像生成最终输出的图像。
进一步地,所述前景分割模块包括:
初始化单元,用于以所述前景框在所拍摄图像中框选的局部图像为初始的种子区域;
前景判断单元,用于按预设的概率算法判断当前的种子区域的边缘像素的邻域像素是否为前景像素;
种子区域更新单元,用于若任一邻域像素为前景像素,则将当前的种子区域更新为所述前景像素与原种子区域的集合;
分割单元,用于若所有邻域像素均不是前景像素,则分割当前的种子区域作为所述已拍摄图像的前景。
进一步地,所述前景判断单元包括:
参数计算单元,用于计算当前的种子区域内的所有像素的特征值的均值μ以及方差σ2,其中,
Figure PCTCN2016113503-appb-000004
xi为所述种子区域的第i个像素的特征值;
概率计算单元,用于计算所述种子区域的边缘像素的邻域像素为前景像素的概率密度值p(x);其中,
Figure PCTCN2016113503-appb-000005
x为所述邻域像素的特征值;
前景确认单元,用于若所述邻域像素为前景像素的概率密度值p(x)大于或等于预设的阈值,则所述邻域像素为前景像素;
前景否定单元,用于若所述邻域像素为前景像素的概率密度值p(x)小于预设的阈值,则所述邻域像素不是前景像素。
优选地,所述特征值为亮度值。
进一步地,所述输出模块包括:
截图框显示单元,用于从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并显示与所述矩形图像对应的截图框在所述已拍摄图像上;其中,所述截图框包含用于供用户调节所述截图框的尺寸和位置的控点;
调节单元,用于接收用户对所述控点的移动操作,并根据所述移动操作调节所述截图框的尺寸和位置;
图像输出单元,用于接收用户对图像处理完成的确认信息,以所述截图框截取的图像为最终输出的图像;
或者,所述输出模块包括:矩形图像输出单元,用于从所拍摄图像中截取包含所述前景的面积最小的矩形图像,将所述矩形图像作为最终输出的图像。
附图说明
图1是本发明提供的图像处理方法的流程图;
图2是本发明提供的图像处理方法的图像示意图;
图3是本发明提供的图像处理装置的结构图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
参见图1,是本发明提供的图像处理方法的流程图,包括:
S1、在摄像设备的拍摄界面上显示预先设定的前景框;
S2、根据所述前景框定位拍摄对象,并拍摄图像;
S3、根据所述前景框在所拍摄图像中框选的局部图像,分割出所拍摄图像的前景;
S4、从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并根据所述矩形图像生 成最终输出的图像。
参见图2,是本发明提供的图像处理方法的图像分割示意图,图中区域c的外框为预先设定的前景框,用户在使用拍摄设备时,可以通过移动拍摄设备或者移动前景框,使前景框定位拍摄对象,拍摄图像。假设图中区域a为所拍摄图像,区域b为所拍摄图像的前景,根据区域c中的局部图像,可以逐步将区域b分割出来,再从区域a中截取包含区域b的面积最小的矩形图像(如图2中虚线框选区域所示),并根据所述矩形图像生成最终输出的图像。
本发明提供的图像处理方法,在拍照时以前景框捕捉图像信息,利用捕捉到的图像信息分割图像的前景,根据包含前景的面积最小的矩形图像获得输出图像,自动去除了背景,只保存了用户感兴趣的内容,节约了电子设备的存储空间,也免去了人工后期编辑的麻烦。
具体实施时,步骤S3“根据所述前景框在所拍摄图像中框选的局部图像,分割出所拍摄图像的前景”中,可采用不同的前背景分割方法分割出所拍摄图像的前景。典型地,可采用区域生长法,利用不同的区域生长准则,还可以有多种实施方式分割出所拍摄图像的前景。优选地,步骤S3具体包括:
以所述前景框在所拍摄图像中框选的局部图像为初始的种子区域;
按预设的概率算法判断当前的种子区域的边缘像素的邻域像素是否为前景像素;
若任一邻域像素为前景像素,则将当前的种子区域更新为所述前景像素与原种子区域的集合;
若所有邻域像素均不是前景像素,则分割当前的种子区域作为所述已拍摄图像的前景。
上述实施方式,采用前景框框选的局部图像为种子区域,结合概率算法作为区域生长的判断准则,算法简单、计算量低,在普通的电子摄像设备,比如手机、相机上也可实现。适用于背景单一不变的场合,能满足前景分割的基本要求,又能最大程度地降低算法计算量,提高可操作性。
在其他实施方式中,也可采用前景框框选的局部图像中的某个具有代表性的像素作为种子像素,以其他的区域生长准则(比如邻域像素的特征值与种子像素的特征值之间的差值是否小于某一阈值)分割前景。具体视实际应用场景选用。
进一步地,在优选实施方式中,所述按预设的概率算法判断当前的种子区域的边缘像素的邻域像素是否为前景像素,进一步包括:
计算当前的种子区域内的所有像素的特征值的均值μ以及方差σ2,其中,
Figure PCTCN2016113503-appb-000006
Figure PCTCN2016113503-appb-000007
xi为所述种子区域的第i个像素的特征值;
计算所述种子区域的边缘像素的邻域像素为前景像素的概率密度值p(x);其中,
Figure PCTCN2016113503-appb-000008
x为所述邻域像素的特征值;
若所述邻域像素为前景像素的概率密度值p(x)大于或等于预设的阈值,则所述邻域像素为前景像素;
若所述邻域像素为前景像素的概率密度值p(x)小于预设的阈值,则所述邻域像素不是前景像素。
在进一步方案中,以高斯模型作为区域生长法的判断准则,高斯模型最为简便,进一步降低算法计算量。在计算种子区域的边缘像素的邻域像素是否为前景像素时,可以对4邻域像素进行计算,也可以对8邻域像素进行计算。采用4邻域像素能进一步减小计算量,适用于前景和背景界限比较明显的图像;采用8邻域像素则比较精准。
优选地,所述特征值为亮度值。
对于在会议、讲座等场合拍摄主讲人分享的演示文稿,由于演示文稿亮度较高,背景较暗,因此以亮度值为特征值能更好地分割前景。
具体实施时,步骤S4“从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并根据所述矩形图像生成最终输出的图像”也有多种实施方式;
在其中一种实施方式中,可以从所拍摄图像中截取包含所述前景的面积最小的矩形图像,将所述矩形图像作为最终输出的图像,这种方式分割快捷简便。
在另一种实施方式中,步骤S4具体包括:
从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并显示与所述矩形图像对应的截图框在所述已拍摄图像上;其中,所述截图框包含用于供用户调节所述截图框的尺寸和位置的控点;接收用户对所述控点的移动操作,并根据所述移动操作调节所述截图框的尺寸和位置;接收用户对图像处理完成的确认信息,以所述截图框截取的图像为最终输出的图像。
通过输出可调整尺寸和位置的截图框,在前景复杂,可能分割不准确的情况下,让用户可以调整输出图像,提高用户体验。
参见图3,是本发明提供的图像处理装置的结构图,包括:
前景框调用模块1,用于在摄像设备的拍摄界面上显示预先设定的前景框;
图像获取模块2,用于根据所述前景框定位拍摄对象,并拍摄图像;
前景分割模块3,用于根据所述前景框在所拍摄图像中框选的局部图像,分割出所拍摄图像的前景;
输出模块4,用于从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并根据所 述矩形图像生成最终输出的图像。
进一步地,所述前景分割模块3包括:
初始化单元,用于以所述前景框在所拍摄图像中框选的局部图像为初始的种子区域;
前景判断单元,用于按预设的概率算法判断当前的种子区域的边缘像素的邻域像素是否为前景像素;
种子区域更新单元,用于若任一邻域像素为前景像素,则将当前的种子区域更新为所述前景像素与原种子区域的集合;
分割单元,用于若所有邻域像素均不是前景像素,则分割当前的种子区域作为所述已拍摄图像的前景。
进一步地,所述前景判断单元包括:
参数计算单元,用于计算当前的种子区域内的所有像素的特征值的均值μ以及方差σ2,其中,
Figure PCTCN2016113503-appb-000009
xi为所述种子区域的第i个像素的特征值;
概率计算单元,用于计算所述种子区域的边缘像素的邻域像素为前景像素的概率密度值p(x);其中,
Figure PCTCN2016113503-appb-000010
x为所述邻域像素的特征值;
前景确认单元,用于若所述邻域像素为前景像素的概率密度值p(x)大于或等于预设的阈值,则所述邻域像素为前景像素;
前景否定单元,用于若所述邻域像素为前景像素的概率密度值p(x)小于预设的阈值,则所述邻域像素不是前景像素。
优选地,所述特征值为亮度值。
进一步地,所述输出模块4包括:
截图框显示单元,用于从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并显示与所述矩形图像对应的截图框在所述已拍摄图像上;其中,所述截图框包含用于供用户调节所述截图框的尺寸和位置的控点;
调节单元,用于接收用户对所述控点的移动操作,并根据所述移动操作调节所述截图框的尺寸和位置;
图像输出单元,用于接收用户对图像处理完成的确认信息,以所述截图框截取的图像为最终输出的图像;
或者,所述输出模块包括:矩形图像输出单元,用于从所拍摄图像中截取包含所述前景的面积最小的矩形图像,将所述矩形图像作为最终输出的图像。
本发明提供的图像处理方法及装置,在拍照时以前景框捕捉图像信息,利用捕捉到的图像信息分割图像的前景,根据包含前景的面积最小的矩形图像获得输出图像,自动去除了背景,只保存了用户感兴趣的内容,节约了电子设备的存储空间,也免去了人工后期编辑的麻烦。
以上是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和变形,这些改进和变形也视为本发明的保护范围。

Claims (10)

  1. 一种图像处理方法,其特征在于,包括:
    在摄像设备的拍摄界面上显示预先设定的前景框;
    根据所述前景框定位拍摄对象,并拍摄图像;
    根据所述前景框在所拍摄图像中框选的局部图像,分割出所拍摄图像的前景;
    从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并根据所述矩形图像生成最终输出的图像。
  2. 如权利要求1所述的图像处理方法,其特征在于,所述根据所述前景框在所拍摄图像中框选的局部图像,分割出所拍摄图像的前景,具体包括:
    以所述前景框在所拍摄图像中框选的局部图像为初始的种子区域;
    按预设的概率算法判断当前的种子区域的边缘像素的邻域像素是否为前景像素;
    若任一邻域像素为前景像素,则将当前的种子区域更新为所述前景像素与原种子区域的集合;
    若所有邻域像素均不是前景像素,则分割当前的种子区域作为所述已拍摄图像的前景。
  3. 如权利要求2所述的图像处理方法,其特征在于,所述按预设的概率算法判断当前的种子区域的边缘像素的邻域像素是否为前景像素,具体包括:
    计算当前的种子区域内的所有像素的特征值的均值μ以及方差σ2,其中,
    Figure PCTCN2016113503-appb-100001
    Figure PCTCN2016113503-appb-100002
    xi为所述种子区域的第i个像素的特征值;
    计算所述种子区域的边缘像素的邻域像素为前景像素的概率密度值p(x);其中,
    Figure PCTCN2016113503-appb-100003
    x为所述邻域像素的特征值;
    若所述邻域像素为前景像素的概率密度值p(x)大于或等于预设的阈值,则所述邻域像素为前景像素;
    若所述邻域像素为前景像素的概率密度值p(x)小于预设的阈值,则所述邻域像素不是前景像素。
  4. 如权利要求3所述的图像处理方法,其特征在于,所述特征值为亮度值。
  5. 如权利要求1至4任一项所述的图像处理方法,其特征在于,所述从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并根据所述矩形图像生成最终输出的图像,具体包括:
    从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并显示与所述矩形图像对应的截图框在所述已拍摄图像上;其中,所述截图框包含用于供用户调节所述截图框的尺寸和位置的控点;
    接收用户对所述控点的移动操作,并根据所述移动操作调节所述截图框的尺寸和位置;
    接收用户对图像处理完成的确认信息,以所述截图框截取的图像为最终输出的图像;
    或者,所述从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并根据所述矩形图像生成最终输出的图像,包括:
    从所拍摄图像中截取包含所述前景的面积最小的矩形图像,将所述矩形图像作为最终输出的图像。
  6. 一种图像处理装置,其特征在于,包括:
    前景框调用模块,用于在摄像设备的拍摄界面上显示预先设定的前景框;
    图像获取模块,用于根据所述前景框定位拍摄对象,并拍摄图像;
    前景分割模块,用于根据所述前景框在所拍摄图像中框选的局部图像,分割出所拍摄图像的前景;
    输出模块,用于从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并根据所述矩形图像生成最终输出的图像。
  7. 如权利要求6所述的图像处理装置,其特征在于,所述前景分割模块包括:
    初始化单元,用于以所述前景框在所拍摄图像中框选的局部图像为初始的种子区域;
    前景判断单元,用于按预设的概率算法判断当前的种子区域的边缘像素的邻域像素是否为前景像素;
    种子区域更新单元,用于若任一邻域像素为前景像素,则将当前的种子区域更新为所述前景像素与原种子区域的集合;
    分割单元,用于若所有邻域像素均不是前景像素,则分割当前的种子区域作为所述已拍摄图像的前景。
  8. 如权利要求7所述的图像处理装置,其特征在于,所述前景判断单元包括:
    参数计算单元,用于计算当前的种子区域内的所有像素的特征值的均值μ以及方差σ2,其中,
    Figure PCTCN2016113503-appb-100004
    xi为所述种子区域的第i个像素的特征值;
    概率计算单元,用于计算所述种子区域的边缘像素的邻域像素为前景像素的概率密度值p(x);其中,
    Figure PCTCN2016113503-appb-100005
    x为所述邻域像素的特征值;
    前景确认单元,用于若所述邻域像素为前景像素的概率密度值p(x)大于或等于预设的阈值,则所述邻域像素为前景像素;
    前景否定单元,用于若所述邻域像素为前景像素的概率密度值p(x)小于预设的阈值,则所述邻域像素不是前景像素。
  9. 如权利要求8所述的图像处理装置,其特征在于,所述特征值为亮度值。
  10. 如权利要求6至9任一项所述的图像处理装置,其特征在于,所述输出模块包括:
    截图框显示单元,用于从所拍摄图像中截取包含所述前景的面积最小的矩形图像,并显示与所述矩形图像对应的截图框在所述已拍摄图像上;其中,所述截图框包含用于供用户调节所述截图框的尺寸和位置的控点;
    调节单元,用于接收用户对所述控点的移动操作,并根据所述移动操作调节所述截图框的尺寸和位置;
    图像输出单元,用于接收用户对图像处理完成的确认信息,以所述截图框截取的图像为最终输出的图像;
    或者,所述输出模块包括:
    矩形图像输出单元,用于从所拍摄图像中截取包含所述前景的面积最小的矩形图像,将所述矩形图像作为最终输出的图像。
PCT/CN2016/113503 2016-08-18 2016-12-30 一种图像处理方法及装置 Ceased WO2018032702A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610687861.0 2016-08-18
CN201610687861.0A CN106373139A (zh) 2016-08-18 2016-08-18 一种图像处理方法及装置

Publications (1)

Publication Number Publication Date
WO2018032702A1 true WO2018032702A1 (zh) 2018-02-22

Family

ID=57879494

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/113503 Ceased WO2018032702A1 (zh) 2016-08-18 2016-12-30 一种图像处理方法及装置

Country Status (2)

Country Link
CN (1) CN106373139A (zh)
WO (1) WO2018032702A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112862780A (zh) * 2021-02-05 2021-05-28 宁波方太厨具有限公司 油烟浓度的识别方法、系统、电子设备和存储介质

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108062761A (zh) * 2017-12-25 2018-05-22 北京奇虎科技有限公司 基于自适应跟踪框的图像分割方法、装置及计算设备
CN108122238A (zh) * 2018-01-30 2018-06-05 百度在线网络技术(北京)有限公司 图像处理方法、装置、设备及计算机可读存储介质
WO2020075483A1 (ja) * 2018-10-09 2020-04-16 インターマン株式会社 携帯型カレンダーおよびノート
CN112399065A (zh) * 2019-08-12 2021-02-23 青岛海信移动通信技术股份有限公司 一种调整焦距的方法和设备
CN112669328B (zh) * 2020-12-25 2023-04-07 人和未来生物科技(长沙)有限公司 一种医学图像分割方法
CN113163088A (zh) * 2021-04-19 2021-07-23 北京市园林科学研究院 植物根系测定方法及植物根系测定装置
CN114329221A (zh) * 2021-12-31 2022-04-12 钻技(上海)信息科技有限公司 一种商品搜索方法、设备及存储介质
CN116935022A (zh) * 2022-03-31 2023-10-24 中移雄安信息通信科技有限公司 手写文字识别方法、装置、电子设备和计算机程序产品

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101458814A (zh) * 2007-12-13 2009-06-17 东软集团股份有限公司 一种用于从图像中分割对象感兴趣区域的方法和装置
CN104933068A (zh) * 2014-03-19 2015-09-23 阿里巴巴集团控股有限公司 一种信息搜索的方法和装置
WO2015181179A1 (en) * 2014-05-28 2015-12-03 Thomson Licensing Method and apparatus for object tracking and segmentation via background tracking
CN105513050A (zh) * 2015-11-25 2016-04-20 北京邮电大学世纪学院 一种目标图像提取方法及装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102456213A (zh) * 2010-10-20 2012-05-16 上海无戒空间信息技术有限公司 照片处理方法
CN102103752B (zh) * 2010-11-26 2012-07-04 浙江工业大学 一种人机交互中多色标块检测方法
CN103209291A (zh) * 2012-01-17 2013-07-17 百度在线网络技术(北京)有限公司 一种用于控制自动拍摄图像的方法、装置和设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101458814A (zh) * 2007-12-13 2009-06-17 东软集团股份有限公司 一种用于从图像中分割对象感兴趣区域的方法和装置
CN104933068A (zh) * 2014-03-19 2015-09-23 阿里巴巴集团控股有限公司 一种信息搜索的方法和装置
WO2015181179A1 (en) * 2014-05-28 2015-12-03 Thomson Licensing Method and apparatus for object tracking and segmentation via background tracking
CN105513050A (zh) * 2015-11-25 2016-04-20 北京邮电大学世纪学院 一种目标图像提取方法及装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112862780A (zh) * 2021-02-05 2021-05-28 宁波方太厨具有限公司 油烟浓度的识别方法、系统、电子设备和存储介质

Also Published As

Publication number Publication date
CN106373139A (zh) 2017-02-01

Similar Documents

Publication Publication Date Title
WO2018032702A1 (zh) 一种图像处理方法及装置
US10284789B2 (en) Dynamic generation of image of a scene based on removal of undesired object present in the scene
US9692964B2 (en) Modification of post-viewing parameters for digital images using image region or feature information
CN107516319B (zh) 一种高精度简易交互式抠图方法、存储设备及终端
US20150117784A1 (en) Image foreground detection
US10165201B2 (en) Image processing method and apparatus and terminal device to obtain a group photo including photographer
DE102017126269B4 (de) Vorrichtung und Verfahren zur hinterleuchteten Gesichtserkennung
CN104539864B (zh) 记录图像的方法和装置
WO2016123893A1 (zh) 拍照的方法和装置以及终端
CN110324532A (zh) 一种图像虚化方法、装置、存储介质及电子设备
WO2016127478A1 (zh) 一种图像处理方法、装置和终端
CN110650288B (zh) 对焦控制方法和装置、电子设备、计算机可读存储介质
EP3707895B1 (en) Static video recognition
US10594930B2 (en) Image enhancement and repair using sample data from other images
US9179091B2 (en) Avoiding flash-exposed frames during video recording
CN105049695A (zh) 一种视频录制方法及装置
WO2019214574A1 (zh) 图像拍摄方法、装置及电子终端
KR20150126768A (ko) 이미지 합성 방법 및 그 전자 장치
CN107172354A (zh) 视频处理方法、装置、电子设备及存储介质
JPWO2019078310A1 (ja) 顔三次元形状推定装置、顔三次元形状推定方法、及び、顔三次元形状推定プログラム
CN111201773A (zh) 拍摄方法及装置、移动终端及计算机可读存储介质
CN105827993A (zh) 调整图像曝光度的方法及系统
US11238302B2 (en) Method and an apparatus for performing object illumination manipulation on an image
CN106791456A (zh) 一种拍照方法及电子设备
WO2025044439A1 (zh) 一种图像处理方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16913454

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 26/04/2019)

122 Ep: pct application non-entry in european phase

Ref document number: 16913454

Country of ref document: EP

Kind code of ref document: A1