WO2018166289A1 - Image generation method and device - Google Patents

Image generation method and device Download PDF

Info

Publication number
WO2018166289A1
WO2018166289A1 PCT/CN2018/072287 CN2018072287W WO2018166289A1 WO 2018166289 A1 WO2018166289 A1 WO 2018166289A1 CN 2018072287 W CN2018072287 W CN 2018072287W WO 2018166289 A1 WO2018166289 A1 WO 2018166289A1
Authority
WO
WIPO (PCT)
Prior art keywords
pixel
value
image
energy function
values
Prior art date
Application number
PCT/CN2018/072287
Other languages
French (fr)
Chinese (zh)
Inventor
李川
Original Assignee
北京京东尚科信息技术有限公司
北京京东世纪贸易有限公司
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 北京京东尚科信息技术有限公司, 北京京东世纪贸易有限公司 filed Critical 北京京东尚科信息技术有限公司
Publication of WO2018166289A1 publication Critical patent/WO2018166289A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T5/70

Abstract

An image generation method and device. A specific embodiment of the method comprises: acquiring a set of pixel values of pixel points of an image to be processed and a set of label values associated with the image, the label values being used to identify classes to which the pixel points belong; and establishing an energy function according to the set of pixel values and the set of label values, the energy function being used to characterize the consistency between the label values and the pixel values; selecting a label value from the set of label values to be assigned to each pixel point of the image, so that the value of the energy function is minimized; classifying the each pixel point of the image according to the label value assigned to the each pixel point of the image, and modifying the pixel values of pixel points belonging to the same class to the same value to generate a processed image. The embodiment achieves image segmentation processing, and can effectively suppress the influence of image noise on the image segmentation result.

Description

图像生成方法和装置Image generation method and device
相关申请的交叉引用Cross-reference to related applications
本申请要求于2017年3月15日提交的中国专利申请号为“201710152538.8”的优先权,其全部内容作为整体并入本申请中。The present application claims the priority of the Japanese Patent Application Serial No. JP-A---------
技术领域Technical field
本申请涉及计算机技术领域,具体涉及计算机图像处理技术领域,尤其涉及图像生成方法和装置。The present application relates to the field of computer technologies, and in particular, to the field of computer image processing technologies, and in particular, to an image generation method and apparatus.
背景技术Background technique
图像分割是把图像划分为有意义的若干区域的图像处理技术,分割技术在辅助医学诊断及运动分析、结构分析等领域都有着重要的研究价值和广泛的应用发展前景。图像分割是图像分析的第一步,图像分割接下来的任务,如特征提取、目标识别等的好坏,都取决于图像分割的质量如何。例如在医学上,随着影像医学技术在医学中的作用越来越大,图像分割在医学应用中具有特殊的重要意义,分割技术使得人们能够获得有效的医学图像信息。分割后的图像广泛应用于病变部位诊断、术前方案制定、术后监测等各个重要的环节。Image segmentation is an image processing technique that divides images into meaningful regions. Segmentation technology has important research value and broad application prospects in the fields of auxiliary medical diagnosis, motion analysis and structural analysis. Image segmentation is the first step in image analysis. The next tasks of image segmentation, such as feature extraction and target recognition, depend on the quality of image segmentation. For example, in medicine, with the increasing role of imaging medical technology in medicine, image segmentation has a special significance in medical applications, and segmentation technology enables people to obtain effective medical image information. The segmented images are widely used in various important aspects such as diagnosis of lesions, preoperative planning, and postoperative monitoring.
目前被广泛应用的图像分割方法主要包括基于区域和基于边缘的两种方式。其中阈值法的缺点是对于目标与背景或目标之间灰度差异不明显的情况,或者目标与背景的灰度值范围有较大重叠的图像,则难以得到精确的分割结果,并且阈值法对噪声很敏感。基于边缘的分割方法利用物体边界的像素值不连续性完成对图像分割,当图像中存在噪声时,往往容易产生虚假边缘,从而影响分割效果。Currently widely used image segmentation methods mainly include region-based and edge-based approaches. The disadvantage of the threshold method is that if the gray level difference between the target and the background or the target is not obvious, or the image with a large overlap between the target and the background gray value range, it is difficult to obtain an accurate segmentation result, and the threshold method is The noise is very sensitive. The edge-based segmentation method uses the pixel value discontinuity of the object boundary to complete the image segmentation. When there is noise in the image, the false edge is often generated, which affects the segmentation effect.
总体而言,上述的图像分割方法仅从单点图像的像素值出发,忽略了图像局部平滑的先验,对图像噪声敏感。In general, the above image segmentation method only starts from the pixel value of the single-point image, ignoring the a priori of the image local smoothing, and is sensitive to image noise.
发明内容Summary of the invention
本申请的目的在于提出一种改进的图像生成方法和装置,来解决以上背景技术部分提到的技术问题。The purpose of the present application is to propose an improved image generating method and apparatus to solve the technical problems mentioned in the background section above.
第一方面,本申请实施例提供了一种图像生成方法,该方法包括:获取待处理的图像的像素点的像素值集合和与图像相关联的标签值集合,其中,标签值用于标识像素点所属的类别;根据标签值集合和像素值集合,建立能量函数,其中,能量函数用于表征标签值与像素值的一致性;对于图像的每个像素点,从标签值集合选择标签值进行分配,以使得能量函数的值最小;根据图像的每个像素点所分配的标签值,将图像的每个像素点分类,并将属于同一类的像素点的像素值修改为同一值,以生成处理后的图像。In a first aspect, an embodiment of the present application provides an image generating method, which includes: acquiring a pixel value set of a pixel point of an image to be processed and a label value set associated with the image, wherein the label value is used to identify the pixel The category to which the point belongs; an energy function is established according to the set of tag values and the set of pixel values, wherein the energy function is used to characterize the consistency of the tag value and the pixel value; for each pixel of the image, the tag value is selected from the set of tag values. Allocating, so that the value of the energy function is minimized; each pixel of the image is classified according to the label value assigned to each pixel of the image, and the pixel values of the pixels belonging to the same class are modified to the same value to generate The processed image.
在一些实施例中,能量函数包括数据能量函数和光滑能量函数,其中,数据能量函数用于表征像素点的像素值与该像素点所分配的标签值的一致性,光滑能量函数用于表征像素点的像素值与该像素点相邻的像素点所分配的标签值的一致性。In some embodiments, the energy function includes a data energy function and a smooth energy function, wherein the data energy function is used to characterize the pixel value of the pixel point and the label value assigned by the pixel point, and the smooth energy function is used to characterize the pixel The pixel value of the point is consistent with the tag value assigned by the pixel adjacent to the pixel.
在一些实施例中,在获取待处理的图像的像素点的像素值集合之后,该方法还包括:将像素值集合中的每个像素值进行归一化处理得到归一化的像素值,并使用每个归一化的像素值替换像素值集合中的每个像素值。In some embodiments, after acquiring the set of pixel values of the pixel points of the image to be processed, the method further comprises: normalizing each pixel value in the set of pixel values to obtain a normalized pixel value, and Each pixel value in the set of pixel values is replaced with each normalized pixel value.
在一些实施例中,在获取待处理的图像的像素点的像素值集合之后,该方法还包括:将像素值集合中的每个像素值进行归一化处理得到归一化的像素值,并使用每个归一化的像素值替换像素值集合中的每个像素值。In some embodiments, after acquiring the set of pixel values of the pixel points of the image to be processed, the method further comprises: normalizing each pixel value in the set of pixel values to obtain a normalized pixel value, and Each pixel value in the set of pixel values is replaced with each normalized pixel value.
在一些实施例中,为每个像素点分配标签值,以使得能量函数的值最小,包括:采用渐非凸渐凹化过程的子图匹配算法求解能量函数的值最小时每个像素点应分配的标签值。In some embodiments, each pixel point is assigned a tag value such that the value of the energy function is minimized, including: a sub-graph matching algorithm using a progressively non-convex-concave process to solve the energy function with a minimum value per pixel point The assigned tag value.
第二方面,本申请实施例提供了一种图像生成装置,该装置包括:获取单元,用于获取待处理的图像的像素点的像素值集合和与图像相关联的标签值集合,其中,标签值用于标识像素点所属的类别;建立单元,用于根据标签值集合和像素值集合,建立能量函数,其中,能 量函数用于表征标签值与像素值的一致性;分配单元,用于对于图像的每个像素点,从标签值集合选择标签值进行分配,以使得能量函数的值最小;生成单元,用于根据图像的每个像素点所分配的标签值,将图像的每个像素点分类,并将属于同一类的像素点的像素值修改为同一值,以生成处理后的图像。In a second aspect, an embodiment of the present application provides an image generating apparatus, where the apparatus includes: an acquiring unit, configured to acquire a pixel value set of a pixel of an image to be processed, and a label value set associated with the image, where the label The value is used to identify the category to which the pixel belongs; the establishing unit is configured to establish an energy function according to the set of label values and the set of pixel values, wherein the energy function is used to characterize the consistency of the label value and the pixel value; the allocation unit is configured to Each pixel of the image is selected from a set of tag values to be assigned to minimize the value of the energy function; a generating unit for each pixel of the image based on the tag value assigned to each pixel of the image Classify and modify the pixel values of pixels belonging to the same class to the same value to generate a processed image.
在一些实施例中,能量函数包括数据能量函数和光滑能量函数,其中,数据能量函数用于表征像素点的像素值与该像素点所分配的标签值的一致性,光滑能量函数用于表征像素点的像素值与该像素点相邻的像素点所分配的标签值的一致性。In some embodiments, the energy function includes a data energy function and a smooth energy function, wherein the data energy function is used to characterize the pixel value of the pixel point and the label value assigned by the pixel point, and the smooth energy function is used to characterize the pixel The pixel value of the point is consistent with the tag value assigned by the pixel adjacent to the pixel.
在一些实施例中,该装置还包括:归一化单元,用于在获取待处理的图像的像素点的像素值集合之后,将像素值集合中的每个像素值进行归一化处理得到归一化的像素值,并使用每个归一化的像素值替换像素值集合中的每个像素值。In some embodiments, the apparatus further includes: a normalization unit, configured to normalize each pixel value in the set of pixel values after obtaining the set of pixel values of the pixel points of the image to be processed The pixel values are normalized and each pixel value in the set of pixel values is replaced with each normalized pixel value.
在一些实施例中,该装置还包括:接收单元,用于在获取待处理的图像的像素点的像素值集合之前,接收用户通过终端输入的标签数量,并根据标签数量确定标签值集合。In some embodiments, the apparatus further includes: a receiving unit, configured to receive a number of tags input by the user through the terminal, and determine a set of tag values according to the number of tags, before acquiring the set of pixel values of the pixel points of the image to be processed.
在一些实施例中,分配单元进一步用于:采用渐非凸渐凹化过程的子图匹配算法求解能量函数的值最小时每个像素点应分配的标签值。In some embodiments, the allocating unit is further configured to: use a subgraph matching algorithm that uses a progressively non-convex augmentation process to solve for a tag value that should be assigned to each pixel point when the value of the energy function is minimum.
第三方面,本申请实施例提供了一种设备,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现如第一方面中任一实施例的方法。In a third aspect, an embodiment of the present application provides an apparatus, including: one or more processors; a storage device, configured to store one or more programs, when one or more programs are executed by one or more processors, One or more processors are caused to implement the method of any of the first aspects.
第四方面,本申请实施例提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如第一方面中任一实施例的方法。In a fourth aspect, an embodiment of the present application provides a computer readable storage medium having stored thereon a computer program, the program being executed by a processor to implement the method of any one of the first aspects.
本申请实施例提供的图像生成方法和装置,通过建立能量函数使得待处理的图像的像素点的像素值和与该图像相关联的标签值相关联,为该图像的每个像素点分配标签值以使得能量函数的值最小,按照标签值将该图像的每个像素点分类后,再修改每个类别的像素点的像素值,得到处理后的图像。由于能量函数的值反应了标签值与像素值的 一致性,因此能量函数的值最小时,标签值与像素值一致性最高,处理后的图像更平滑,从而消除因图像噪声引起的错误分割问题。An image generating method and apparatus provided by an embodiment of the present application associates a pixel value of a pixel of an image to be processed with a label value associated with the image by establishing an energy function, and assigns a label value to each pixel of the image. In order to minimize the value of the energy function, each pixel of the image is classified according to the label value, and then the pixel value of the pixel of each category is modified to obtain a processed image. Since the value of the energy function reflects the consistency of the label value and the pixel value, when the value of the energy function is the smallest, the label value has the highest consistency with the pixel value, and the processed image is smoother, thereby eliminating the problem of error segmentation caused by image noise. .
附图说明DRAWINGS
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:Other features, objects, and advantages of the present application will become more apparent from the detailed description of the accompanying drawings.
图1是本申请可以应用于其中的示例性系统架构图;1 is an exemplary system architecture diagram to which the present application can be applied;
图2是根据本申请的图像生成方法的一个实施例的流程图;2 is a flow chart of one embodiment of an image generating method according to the present application;
图3是本申请的图像的像素点的邻接关系图;3 is a diagram showing an adjacency relationship of pixel points of an image of the present application;
图4a、4b是根据本申请的图像生成方法的一个应用场景的示意图;4a, 4b are schematic diagrams showing an application scenario of an image generating method according to the present application;
图5是根据本申请的图像生成装置的一个实施例的结构示意图;FIG. 5 is a schematic structural diagram of an embodiment of an image generating apparatus according to the present application; FIG.
图6是适于用来实现本申请实施例的终端设备或服务器的计算机系统的结构示意图。FIG. 6 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server of an embodiment of the present application.
具体实施方式detailed description
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the invention, rather than the invention. It is also to be noted that, for the convenience of description, only the parts related to the related invention are shown in the drawings.
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings.
图1示出了可以应用本申请的图像生成方法或图像生成装置的实施例的示例性系统架构100。FIG. 1 illustrates an exemplary system architecture 100 in which an embodiment of an image generation method or image generation device of the present application may be applied.
如图1所示,系统架构100可以包括终端设备101、102、103,网络104和服务器105。网络104用以在终端设备101、102、103和服务器105之间提供通信链路的介质。网络104可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in FIG. 1, system architecture 100 can include terminal devices 101, 102, 103, network 104, and server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various types of connections, such as wired, wireless communication links, fiber optic cables, and the like.
用户可以使用终端设备101、102、103通过网络104与服务器105交互,以接收或发送消息等。终端设备101、102、103上可以安装有 各种通讯客户端应用,例如图像浏览器应用、购物类应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等。The user can interact with the server 105 over the network 104 using the terminal devices 101, 102, 103 to receive or transmit messages and the like. Various communication client applications, such as an image browser application, a shopping application, a search application, an instant communication tool, a mailbox client, a social platform software, and the like, may be installed on the terminal devices 101, 102, and 103.
终端设备101、102、103可以是具有显示屏并且支持图像浏览的各种电子设备,包括但不限于智能手机、平板电脑、电子书阅读器、MP3播放器(Moving Picture Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)、MP4(Moving Picture Experts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器、膝上型便携计算机和台式计算机等等。The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting image browsing, including but not limited to smart phones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, dynamic The video specialist compresses the standard audio layer 3), MP4 (Moving Picture Experts Group Audio Layer IV) player, laptop portable computer and desktop computer, and the like.
服务器105可以是提供各种服务的服务器,例如对终端设备101、102、103上显示的图像提供支持的后台图像服务器。后台图像服务器可以对接收到的图像处理请求等数据进行分析等处理,并将处理结果(例如分割后新生成的图像)反馈给终端设备。The server 105 may be a server that provides various services, such as a background image server that provides support for images displayed on the terminal devices 101, 102, 103. The background image server may perform processing such as analyzing the received image processing request and the like, and feed back the processing result (for example, the newly generated image after the segmentation) to the terminal device.
需要说明的是,本申请实施例所提供的图像生成方法一般由服务器105执行,相应地,图像生成装置一般设置于服务器105中。也可以不需要服务器105,而直接由终端设备101、102、103执行本申请实施例所提供的图像生成方法。It should be noted that the image generating method provided by the embodiment of the present application is generally executed by the server 105. Accordingly, the image generating device is generally disposed in the server 105. The image generating method provided by the embodiment of the present application may be directly executed by the terminal device 101, 102, and 103.
应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the number of terminal devices, networks, and servers in Figure 1 is merely illustrative. Depending on the implementation needs, there can be any number of terminal devices, networks, and servers.
继续参考图2,示出了根据本申请的图像生成方法的一个实施例的流程200。该图像生成方法,包括以下步骤:With continued reference to FIG. 2, a flow 200 of one embodiment of an image generation method in accordance with the present application is illustrated. The image generating method comprises the following steps:
步骤201,获取待处理的图像的像素点的像素值集合和与图像相关联的标签值集合。Step 201: Acquire a set of pixel values of pixel points of an image to be processed and a set of tag values associated with the image.
在本实施例中,图像生成方法运行于其上的电子设备(例如图1所示的服务器)可以通过有线连接方式或者无线连接方式从用户利用其进行图像浏览的终端接收待处理的图像。并从该待处理的图像中获取待处理的图像的像素点的像素值集合。与图像相关联的标签值集合可以是预设的标签值集合。其中,标签值用于标识像素点所属的类别。像素点所属的类别的数量可以是固定值,例如,只分成两类,前景和背景。如果图像的像素点的像素值取值在0-255之间,则可将标签值集合设置为{0,255}。当一个像素点被分配到标签值0时,则该像素 点的被划分为背景。当一个像素点被分配到标签值255时,则该像素点的被划分为前景。可以通过设定标签值集合的大小,确定分割后的图像包含几个类别。In the present embodiment, the electronic device (for example, the server shown in FIG. 1) on which the image generating method runs can receive the image to be processed from the terminal with which the user performs image browsing by means of a wired connection or a wireless connection. And acquiring, from the image to be processed, a set of pixel values of pixels of the image to be processed. The set of tag values associated with the image may be a preset set of tag values. The tag value is used to identify the category to which the pixel belongs. The number of categories to which a pixel belongs can be a fixed value, for example, divided into only two categories, foreground and background. If the pixel value of the pixel of the image is between 0 and 255, the set of tag values can be set to {0, 255}. When a pixel is assigned to a tag value of 0, then the pixel is divided into a background. When a pixel is assigned to the tag value 255, then the pixel is divided into foreground. The size of the set of tag values can be determined to determine that the segmented image contains several categories.
在本实施例的一些可选的实现方式中,在获取待处理的图像的像素点的像素值集合之后,该方法还包括:将像素值集合中的每个像素值进行归一化处理得到归一化的像素值,并使用每个归一化的像素值替换像素值集合中的每个像素值。例如,如果图像的像素点的像素值取值在0-255之间,归一化处理后得到的像素值在0-1之间,此时标签值集合可以设置为{0,1}。当一个像素点被分配到标签值0时,则该像素点的被划分为背景。当一个像素点被分配到标签值1时,则该像素点的被划分为前景。In some optional implementation manners of the embodiment, after acquiring the pixel value set of the pixel of the image to be processed, the method further includes: normalizing each pixel value in the pixel value set to obtain a return The pixel values are normalized and each pixel value in the set of pixel values is replaced with each normalized pixel value. For example, if the pixel value of the pixel of the image is between 0 and 255, the pixel value obtained after the normalization process is between 0-1, and the set of tag values can be set to {0, 1}. When a pixel is assigned to a tag value of 0, then the pixel is divided into a background. When a pixel is assigned to a tag value of 1, the pixel is divided into foreground.
在本实施例的一些可选的实现方式中,在获取待处理的图像的像素点的像素值集合之前,该方法还包括:接收用户通过终端输入的标签数量,并根据标签数量确定标签值集合。例如,如果用户输入的标签数量为2,则可确定标签集合为{0,1}。如果用户输入的标签数量为3,则可确定标签集合为{0,1,2}。In some optional implementation manners of the embodiment, before acquiring the pixel value set of the pixel of the image to be processed, the method further includes: receiving the number of labels input by the user through the terminal, and determining the label value set according to the label quantity. . For example, if the number of labels entered by the user is 2, then the label set can be determined to be {0, 1}. If the number of labels entered by the user is 3, it can be determined that the label set is {0, 1, 2}.
步骤202,根据标签值集合和像素值集合,建立能量函数。Step 202: Establish an energy function according to the set of tag values and the set of pixel values.
在本实施例中,基于步骤201获取的标签值集合和像素值集合,建立能量函数。该能量函数用于表征标签值与像素值的一致性。能量函数是计算机视觉领域中的一种目标函数,其刻画的是图像的不一致性,是图像像素间的一种相互作用形成的能量。In this embodiment, an energy function is established based on the set of tag values and the set of pixel values obtained in step 201. This energy function is used to characterize the consistency of the tag value with the pixel value. The energy function is an objective function in the field of computer vision. It depicts the inconsistency of the image and is the energy formed by an interaction between the pixels of the image.
图像分割问题可以表达成像素标签(pixel-labeling)问题,即为图像中的每一个像素一个标签值。在图像分割中通过不同标签来区分图像中的前景和背景。The image segmentation problem can be expressed as a pixel-labeling problem, which is a tag value for each pixel in the image. The foreground and background in the image are distinguished by different labels in image segmentation.
定义:P={p 1,p 2,p 3,..,p n},其中,P是由n个像素组成的集合。 Definition: P = {p 1 , p 2 , p 3 , .., p n }, where P is a set of n pixels.
定义:L={l 1,l 2,l 3,..,l k},其中,L由k个标签组成的集合。在图像分割中,标签值表示像素点所属的类别像素标签问题就是将标签集合中的某一个标签值l i赋予像素集合中的每个元素p i。那么像素标签问题就是建立集合P和集合L之间的一个映射:F={f 1,f 2,f 3,..,f n} Definition: L = {l 1 , l 2 , l 3 , .., l k }, where L is a set of k labels. In image segmentation, the tag value indicates that the class pixel tag problem to which the pixel points belong is to assign a tag value l i in the tag set to each element p i in the pixel set. Then the pixel label problem is to establish a mapping between the set P and the set L: F = {f 1 , f 2 , f 3 , .., f n }
整个集合L n上完整映射用F表示。图像分割问题即转化为求解F 的过程。像素标签问题可以通过能量函数进行求解。 The complete mapping on the entire set L n is denoted by F. The image segmentation problem is transformed into the process of solving F. Pixel label problems can be solved by an energy function.
在本实施例的一些可选的实现方式中,能量函数包括数据能量函数和光滑能量函数,其中,数据能量函数用于表征像素点的像素值与该像素点所分配的标签值的一致性,光滑能量函数用于表征像素点的像素值与该像素点相邻的像素点所分配的标签值的一致性。In some optional implementations of this embodiment, the energy function includes a data energy function and a smooth energy function, wherein the data energy function is used to characterize the consistency of the pixel value of the pixel with the label value assigned by the pixel, The smooth energy function is used to characterize the consistency of the pixel value of the pixel point with the label value assigned by the pixel point adjacent to the pixel point.
本申请的能量函数如下式所示:The energy function of this application is as follows:
E(f)=E data(f)+λE prior(f)              (公式1) E(f)=E data (f)+λE prior (f) (Equation 1)
其中E data(f)称之为数据能量函数,它是数据约束条件。在图像分割中,假设观测到一幅图像,我们需要对图像中的每个像素赋予一个标签值,以确定像素点所属的分割类别。在以全局最小能量为最优解时,当标签值能更好的吻合像素点的灰度值时,数据能量更小。当标签值不能吻合强度值时,惩罚更大,即数据能量更大。 Where E data (f) is called the data energy function, which is the data constraint. In image segmentation, assuming that an image is observed, we need to assign a label value to each pixel in the image to determine the segmentation category to which the pixel belongs. When the global minimum energy is the optimal solution, the data energy is smaller when the label value can better match the gray value of the pixel. When the tag value does not match the intensity value, the penalty is greater, ie the data energy is greater.
如果我们只以数据能量作为限制条件,实际结果可能显得噪声很多,图像不够平滑。然而视觉问题不是随机的,像素标签值存在一定关系,因此我们引入先验知识作为能量函数的约束条件。If we only use the data energy as a constraint, the actual result may appear to be much noisy and the image is not smooth enough. However, the visual problem is not random, and the pixel label value has a certain relationship, so we introduce the prior knowledge as the constraint of the energy function.
E prior(f)称为光滑能量函数,它对应于先验知识的约束条件。在实际图像中,图像总是趋于局部光滑,即像素点总是和邻域内的像素点保持相对一致。在视觉任务中,如以最小化能量作为最优解,则如果像素点对应的标签值和邻域内的标签值一致性较好,则光滑能量函数的值较小,反之则较大。 E prior (f) is called the smooth energy function, which corresponds to the constraints of prior knowledge. In an actual image, the image tends to be locally smooth, that is, the pixel points are always relatively consistent with the pixels in the neighborhood. In the visual task, if the minimum energy is used as the optimal solution, if the label value corresponding to the pixel point and the label value in the neighborhood are in good agreement, the value of the smooth energy function is small, and vice versa.
参数λ控制数据和先验知识之间的关系。λ值越大,则先验的权重越大,先验知识在最优解中所起的作用就越大。如在图像分割中,如果先验以标准邻域(MRF(Markov Random Filed,马尔科夫随机场)邻域)为其邻域系统,λ值越大则分割结果就会更加平滑。The parameter λ controls the relationship between the data and the prior knowledge. The larger the value of λ, the greater the weight of the prior, and the greater the role of prior knowledge in the optimal solution. For example, in image segmentation, if the a priori uses a standard neighborhood (MRF (Markov Random Filed) neighborhood) as its neighborhood system, the larger the λ value, the smoother the segmentation result.
数据能量函数E data(f)惩罚标签值与像素实际强度不一致性。一致性越好,数据能量越小。其数学表达式如式: The data energy function E data (f) penalizes the label value and the actual intensity of the pixel. The better the consistency, the smaller the data energy. Its mathematical expression is as follows:
E data(f)=∑ p∈PD p(f p)                 (公式2) E data (f)=∑ p∈P D p (f p ) (Equation 2)
D p(f p)描述像素点p取得标签f p时的数据能量。在视觉任务中通常认为D p(f p)是相互独立的,一般情况下D p(f p)为非负数。数据能量是能量函数中重要的约束条件,它反映了总体标签值与实际数据的吻合度。 D p (f p ) describes the data energy when the pixel p obtains the label f p . In the visual task, D p (f p ) is generally considered to be independent of each other. In general, D p (f p ) is non-negative. Data energy is an important constraint in the energy function, which reflects the agreement between the overall tag value and the actual data.
在实际的图像分割问题中,背景和前景往往具有不同的强度,因 此本发明采用如下的数据能量形式约束标签值与观测数据的一致性:In the actual image segmentation problem, the background and foreground tend to have different intensities, so the present invention uses the following data energy form to constrain the consistency of the tag value with the observed data:
Figure PCTCN2018072287-appb-000001
Figure PCTCN2018072287-appb-000001
其中k为标签值,I p为点p的像素值,max(I)为图像的最大观测值(即,像素点的实际像素值)。从数据能量函数的形式可以看出当图像的像素点的像素值较大时,如果将该像素点的标签赋值为0,即标识该像素点的类别为背景,此时则具有较大的数据能量,反之亦然。当使得数据能量取得最小值时,图像所取得的效果与阈值法一致。 Where k is the tag value, I p is the pixel value of point p, and max(I) is the maximum observed value of the image (ie, the actual pixel value of the pixel). It can be seen from the form of the data energy function that when the pixel value of the pixel of the image is large, if the label of the pixel is assigned a value of 0, that is, the category identifying the pixel is the background, then the data has larger data. Energy and vice versa. When the data energy is minimized, the effect achieved by the image is consistent with the threshold method.
光滑能量函数用于表征该像素点标签值与其邻域内标签值的不一致性。光滑能量函数是像素点与邻接点的相互作用的结果。由于图像总是局部平滑的,光滑能量就是用于约束平滑先验。定义像素点p的邻接点集合用N P表示。在本申请中N P满足以下两个条件: The smooth energy function is used to characterize the inconsistency of the pixel point tag value with the tag value in its neighborhood. The smooth energy function is the result of the interaction of pixel points with adjacent points. Since the image is always locally smooth, smooth energy is used to constrain the smooth prior. The set of adjacent points defining the pixel point p is denoted by N P . In this application, N P satisfies the following two conditions:
1)
Figure PCTCN2018072287-appb-000002
1)
Figure PCTCN2018072287-appb-000002
2)如果p∈Nq,则q∈Np。2) If p∈Nq, then q∈Np.
即定义图为无向图,邻域关系时对称的。That is, the definition map is an undirected graph, and the neighborhood relationship is symmetric.
光滑能量的数学表达式如下式所示:The mathematical expression of smooth energy is shown below:
E smooth(f)=∑ {p,q}∈NVpq(fp,fq)            (公式4) E smooth (f)=∑ {p,q} ∈N Vpq(fp,fq) (Equation 4)
其中N为图像的邻域系统,当N为标准的一阶马尔可夫随机场(Markov Random Field)时,邻接关系如图3所示:Where N is the neighborhood system of the image. When N is a standard first-order Markov Random Field, the adjacency is shown in Figure 3:
标准邻域N P={t,l,b,r};N q={x,z} Standard neighborhood N P ={t,l,b,r};N q ={x,z}
在本申请中定义光滑能量的形式如下式所示:The form of the smooth energy defined in this application is as follows:
Figure PCTCN2018072287-appb-000003
Figure PCTCN2018072287-appb-000003
||I p-I q|| 2为邻域像素差值的平方,用于描述邻域内像素点的距离。从光滑能量函数的形式可以看出当邻域像素取相同标签时,光滑能量函数的值为0,这满足图像的平滑先验。当邻域内像素取不同标签值时,图像将赋予一定的光滑能量,其大小取决于邻域像素的距离。当图像邻域内差值越大,其获得的能量越小;距离越小则能量越大。分析光滑能量函数,可以看出为了使得全局光滑能量最小,图像总是趋于局部平滑,即邻域内为同一标签,并且在图像邻域内像素值发生突变的地方产生标签变化。光滑能量最小化与传统的基于边缘的方法具有一定的相似性。 ||I p -I q || 2 is the square of the neighborhood pixel difference and is used to describe the distance of the pixel in the neighborhood. From the form of the smooth energy function, it can be seen that when the neighborhood pixels take the same label, the value of the smooth energy function is 0, which satisfies the smooth prior of the image. When the pixels in the neighborhood take different label values, the image will be given a certain smooth energy, the size of which depends on the distance of the neighboring pixels. When the difference in the neighborhood of the image is larger, the energy obtained is smaller; the smaller the distance, the larger the energy. By analyzing the smooth energy function, it can be seen that in order to minimize the global smoothing energy, the image tends to be locally smooth, that is, the same label in the neighborhood, and the label change occurs in the region where the pixel value is abrupt in the neighborhood of the image. Smooth energy minimization has some similarities with traditional edge-based methods.
通过最小化数据能量与光滑能量,将使得图像产生平滑的分割结果,并且与观测数据具有较强的一致性。由于光滑能量的引入,分割结果能够有效抑制噪声点的影响。因为噪声点往往是孤立的,为了保持邻域内标签的一致性,其往往会取得与邻域相同的标签,从而达到消除噪声点的目的。By minimizing the data energy and the smooth energy, the image will be smoothed and have strong consistency with the observed data. Due to the introduction of smooth energy, the segmentation result can effectively suppress the influence of noise points. Because the noise points are often isolated, in order to maintain the consistency of the labels in the neighborhood, they often obtain the same labels as the neighborhoods, thereby achieving the purpose of eliminating noise points.
光滑能量还可以采用其它的形式,如下式所示::Smooth energy can also take other forms, as shown in the following equation:
Figure PCTCN2018072287-appb-000004
Figure PCTCN2018072287-appb-000004
其中cons为一固定常数,其与像素值无关。Where cons is a fixed constant, which is independent of the pixel value.
步骤203,对于图像的每个像素点,从标签值集合选择标签值进行分配,以使得能量函数的值最小。Step 203: For each pixel of the image, select a tag value from the set of tag values for allocation to minimize the value of the energy function.
在本实施例中,能量函数的求解是最优化问题中的组合最优化问题,即在离散状态下求极值的问题。把某种离散对象按某个确定的约束条件进行安排,当已知合乎这种约束条件的特定安排存在时,寻求这种特定安排在某个优化准则下的极大解或极小解的间题。能量函数还有很多的替代求解方法,包括条件迭代模式(Iteration Condition Model,ICM),置信度传播算法(Belief Propagation,BP)和图割算法(Graph Cuts,GC)。In the present embodiment, the solution of the energy function is a combinatorial optimization problem in the optimization problem, that is, the problem of finding the extremum in the discrete state. Arranging a discrete object according to a certain constraint, and when a specific arrangement known to be in conformity exists, seeks the specific arrangement between the maximal or minimal solution under an optimization criterion question. There are many alternative solutions for the energy function, including the Iteration Condition Model (ICM), the Belief Propagation (BP), and the Graph Cuts (GC).
在本实施例的一些可选的实现方式中,从标签值集合选择标签值进行分配,以使得能量函数的值最小,包括:采用渐非凸渐凹化过程的子图匹配算法求解能量函数的值最小时每个像素点应分配的标签值。In some optional implementations of this embodiment, selecting a tag value from the set of tag values for allocation to minimize the value of the energy function includes: using a sub-graph matching algorithm that uses a progressively non-convex-concave process to solve the energy function The value of the tag that should be assigned to each pixel at the lowest value.
设一幅二维图像像素点为N个,每个点标签值有K种可能。那么求解能量函数E(f)=E data(f)+λE prior(f)是一个组合优化问题。每个像素点有K个取值,通过穷举每种组和求得最优解的方法复杂度为O(N K),对于视觉任务中这个复杂度显然不可实现的。这是数学中的非确定性多项式问题,实际任务中需要对问题进行近似,从而得出能量函数的解。 Let there be N pixels in a two-dimensional image, and there are K possibilities for each point tag value. Then solving the energy function E(f)=E data (f)+λE prior (f) is a combinatorial optimization problem. There are K values for each pixel, and the complexity of each method by exhausting each group and finding the optimal solution is O(N K ), which is obviously unachievable for visual tasks. This is a non-deterministic polynomial problem in mathematics. In the actual task, the problem needs to be approximated to obtain the solution of the energy function.
本申请采用渐非凸渐凹化过程的子图匹配算法求解能量函数的最小值。其核心思想是将离散的组合最优化问题松弛到连续域内求解,在连续域内对目标函数进行一个由凸到凹的松弛过程,并在松弛的过程中求解到能量函数的最小值。其具体步骤如下:In the present application, the subgraph matching algorithm of the progressively non-convex augmentation process is used to solve the minimum value of the energy function. The core idea is to relax the discrete combination optimization problem to solve in the continuous domain, perform a convex to concave relaxation process on the objective function in the continuous domain, and solve the minimum value of the energy function in the relaxation process. The specific steps are as follows:
(1)将能量函数改写为矩阵形式:(1) Rewrite the energy function into a matrix form:
E=1/2x TQx+Dx                   (公式7) E=1/2x T Qx+Dx (Equation 7)
其中Q∈R nk*nk,D∈R 1*nk,x∈{0,1} nk,n为图像总像素数,k为标签值的个数。矩阵Q,D分别满足Q(ia,jb)=V ab(i,j),D(ia)=D(a,i),如果像素a取标签值i,则x(ia)=1。 Where Q∈R nk*nk , D∈R 1 *nk , x∈{0,1} nk , n is the total number of pixels in the image, and k is the number of label values. The matrices Q, D satisfy Q(ia, jb) = V ab (i, j), D (ia) = D (a, i), respectively, and if the pixel a takes the label value i, then x (ia) = 1.
(2)对能量函数进行松弛,将离散的x向量放松到连续域内求解,并对能量函数进行凸松弛和凹松弛。(2) Relaxing the energy function, relaxing the discrete x-vectors into the continuous domain, and performing convex and concave relaxation on the energy function.
Figure PCTCN2018072287-appb-000005
Figure PCTCN2018072287-appb-000005
(3)初始化
Figure PCTCN2018072287-appb-000006
初始化组合系数γ=-1
(3) Initialization
Figure PCTCN2018072287-appb-000006
Initial combination coefficient γ=-1
(4)求取能量函数下降方向d;(4) Calculate the direction d of the energy function;
下降方向d=y-x,其中
Figure PCTCN2018072287-appb-000007
Down direction d=yx, where
Figure PCTCN2018072287-appb-000007
(5)求取步长α;(5) Find the step size α;
在这一步中确定当前点沿下降方向的移动步长α,
Figure PCTCN2018072287-appb-000008
Figure PCTCN2018072287-appb-000009
In this step, the moving step α of the current point in the descending direction is determined,
Figure PCTCN2018072287-appb-000008
Figure PCTCN2018072287-appb-000009
(6)更新待求向量x;(6) updating the vector to be sought x;
Figure PCTCN2018072287-appb-000010
Figure PCTCN2018072287-appb-000010
如果更新后的
Figure PCTCN2018072287-appb-000011
满足条件:
If updated
Figure PCTCN2018072287-appb-000011
To meet the conditions:
Figure PCTCN2018072287-appb-000012
Figure PCTCN2018072287-appb-000012
其中ε是一个很小的常数,则证明x已经收敛,转向步骤(7),否则转向步骤(4)。Where ε is a small constant, then it is proved that x has converged, turn to step (7), otherwise go to step (4).
(7)更新组合系数γ:(7) Update the combination coefficient γ:
Figure PCTCN2018072287-appb-000013
Figure PCTCN2018072287-appb-000013
如果γ>1,停止循环。输出x。If γ>1, stop the cycle. Output x.
(8)将输出x转换为离散的标签值。(8) Convert the output x to a discrete tag value.
将向量x转换为n*k的矩阵,导出最优标签值集合f *=argmax k(x)。 The vector x is converted to a matrix of n*k, and the optimal set of tag values f * = argmax k (x) is derived.
到此通过求解能量函数的最小值,就得到了每个像素点的标签值,根据标签值即得到了图像的分割结果。At this point, by solving the minimum value of the energy function, the label value of each pixel is obtained, and the segmentation result of the image is obtained according to the label value.
步骤204,根据图像的每个像素点所分配的标签值,将图像的每个像素点分类,并将属于同一类的像素点的像素值修改为同一值,以生成处理后的图像。Step 204: classify each pixel of the image according to the label value assigned to each pixel of the image, and modify the pixel values of the pixels belonging to the same class to the same value to generate the processed image.
在本实施例中,基于步骤203得到的标签值将图像的每个像素点 分类。标签值可以与最终生成的图像的像素点的像素值成正比。例如,将标签值为0的像素点归类为背景,将标签值为1的像素点归类为前景。将属于背景的像素点的像素值都修改为0,将属于前景的像素点的像素值都修改为255,即用黑白两种颜色区分不同类别的像素点。对于每种类别的像素点的像素值只要能达到肉眼容易识别即可,不限定为0或255。同理,如果标签的数目为3,将像素点分为三类,用三种不同的像素值区分这三类像素点。最终生成的处理分的图像为按类别分割后的结果。In the present embodiment, each pixel of the image is classified based on the tag value obtained in step 203. The tag value can be proportional to the pixel value of the pixel of the resulting image. For example, a pixel with a label value of 0 is classified as a background, and a pixel with a label value of 1 is classified as a foreground. The pixel values of the pixels belonging to the background are all changed to 0, and the pixel values of the pixels belonging to the foreground are all changed to 255, that is, the black and white colors are used to distinguish the pixels of different categories. The pixel value of each type of pixel is not limited to 0 or 255 as long as it can be easily recognized by the naked eye. Similarly, if the number of tags is 3, the pixels are divided into three categories, and the three types of pixels are distinguished by three different pixel values. The image of the finally generated processing score is the result of division by category.
继续参见图4a、4b,图4a、4b是根据本实施例的图像生成方法的应用场景的一个示意图,其中图4a为原始噪声图像,图4b为分割处理后的图像。在图4a、4b的应用场景中,用户通过终端将原始噪声图像4a发送给服务器,用户输入期望的分割类别数目为3,服务器接收到图4a后获取图像的每个像素点的像素值并获取对应的标签值,将图像的像素点分配了适当的标签值以使得生成的图4b的能量函数值最小。将生成的图4b返回给用户的终端。4a, 4b, which are schematic diagrams of an application scenario of the image generating method according to the present embodiment, wherein FIG. 4a is an original noise image, and FIG. 4b is an image after segmentation processing. In the application scenario of FIG. 4a, 4b, the user sends the original noise image 4a to the server through the terminal, and the number of the desired segmentation categories input by the user is 3, and the server obtains the pixel value of each pixel of the image after receiving the image in FIG. 4a and acquires For the corresponding tag value, the pixel points of the image are assigned an appropriate tag value to minimize the generated energy function value of Figure 4b. The generated Figure 4b is returned to the user's terminal.
本申请的上述实施例提供的方法利用图像局部平滑的先验知识,为图像建立能量函数,通过求解能量函数的最小值达到图像分割的目的。由于先验平滑的引入,当图像中存在孤立噪声点时,其能根据邻居像素的像素值,自动的将像素点归类,因此能够有效处理有噪声图像的分割问题,消除因噪声引起的错误分割问题。The method provided by the above embodiment of the present application utilizes prior knowledge of image local smoothing to establish an energy function for the image, and achieves the purpose of image segmentation by solving the minimum value of the energy function. Due to the introduction of a priori smoothing, when there are isolated noise points in the image, it can automatically classify the pixels according to the pixel values of the neighboring pixels, so it can effectively deal with the segmentation problem of noisy images and eliminate errors caused by noise. Split the problem.
进一步参考图5,作为对上述各图所示方法的实现,本申请提供了一种图像生成装置的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。With reference to FIG. 5, as an implementation of the method shown in the above figures, the present application provides an embodiment of an image generating apparatus, and the apparatus embodiment corresponds to the method embodiment shown in FIG. Used in a variety of electronic devices.
如图5所示,本实施例的图像生成装置500包括:获取单元501、建立单元502、分配单元503和生成单元504。其中,获取单元501用于获取待处理的图像的像素点的像素值集合和与所述图像相关联的标签值集合,其中,标签值用于标识像素点所属的类别;建立单元502用于根据所述标签值集合和所述像素值集合,建立能量函数,其中,所述能量函数用于表征标签值与像素值的一致性;分配单元503用于对于所述图像的每个像素点,从所述标签值集合选择标签值进行分配, 以使得所述能量函数的值最小;生成单元504用于根据所述图像的每个像素点所分配的标签值,将所述图像的每个像素点分类,并将属于同一类的像素点的像素值修改为同一值,以生成处理后的图像。As shown in FIG. 5, the image generating apparatus 500 of the present embodiment includes an obtaining unit 501, an establishing unit 502, an allocating unit 503, and a generating unit 504. The acquiring unit 501 is configured to acquire a pixel value set of a pixel point of the image to be processed and a label value set associated with the image, where the label value is used to identify a category to which the pixel point belongs; the establishing unit 502 is configured to The set of tag values and the set of pixel values establish an energy function, wherein the energy function is used to characterize the consistency of the tag value with the pixel value; the allocating unit 503 is configured to: for each pixel of the image, The set of tag values selects a tag value for allocation to minimize a value of the energy function; the generating unit 504 is configured to: each pixel of the image according to a tag value assigned to each pixel of the image Classify and modify the pixel values of pixels belonging to the same class to the same value to generate a processed image.
在本实施例中,图像生成装置500的获取单元501、建立单元502、分配单元503和生成单元504的具体处理可以参考图2对应实施例中的步骤201、步骤202、步骤203、步骤204。In this embodiment, the specific processing of the obtaining unit 501, the establishing unit 502, the allocating unit 503, and the generating unit 504 of the image generating apparatus 500 may refer to step 201, step 202, step 203, and step 204 in the corresponding embodiment of FIG.
在本实施例的一些可选的实现方式中,能量函数包括数据能量函数和光滑能量函数,其中,数据能量函数用于表征像素点的像素值与该像素点所分配的标签值的一致性,光滑能量函数用于表征像素点的像素值与该像素点相邻的像素点所分配的标签值的一致性。In some optional implementations of this embodiment, the energy function includes a data energy function and a smooth energy function, wherein the data energy function is used to characterize the consistency of the pixel value of the pixel with the label value assigned by the pixel, The smooth energy function is used to characterize the consistency of the pixel value of the pixel point with the label value assigned by the pixel point adjacent to the pixel point.
在本实施例的一些可选的实现方式中,装置500还包括:归一化单元,用于在获取待处理的图像的像素点的像素值集合之后,将像素值集合中的每个像素值进行归一化处理得到归一化的像素值,并使用每个归一化的像素值替换像素值集合中的每个像素值。In some optional implementation manners of the embodiment, the apparatus 500 further includes: a normalization unit, configured to: after acquiring the pixel value set of the pixel point of the image to be processed, each pixel value in the pixel value set Normalization is performed to obtain normalized pixel values, and each pixel value in the set of pixel values is replaced with each normalized pixel value.
在本实施例的一些可选的实现方式中,装置500还包括:接收单元,用于在获取待处理的图像的像素点的像素值集合之前,接收用户通过终端输入的标签数量,并根据标签数量确定标签值集合。In some optional implementation manners of the embodiment, the apparatus 500 further includes: a receiving unit, configured to receive, by the terminal, the number of labels input by the user before acquiring the pixel value set of the pixel of the image to be processed, and according to the label The quantity determines the set of tag values.
在本实施例的一些可选的实现方式中,分配单元503进一步用于:采用渐非凸渐凹化过程的子图匹配算法求解能量函数的值最小时每个像素点应分配的标签值。In some optional implementation manners of the embodiment, the allocating unit 503 is further configured to: use a sub-graph matching algorithm that uses a progressively non-convex-concave process to solve a tag value that should be allocated for each pixel point when the value of the energy function is minimum.
下面参考图6,其示出了适于用来实现本申请实施例的终端设备/服务器的计算机系统600的结构示意图。图6示出的终端设备/服务器仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。Referring now to Figure 6, a block diagram of a computer system 600 suitable for implementing the terminal device/server of an embodiment of the present application is shown. The terminal device/server shown in FIG. 6 is merely an example, and should not impose any limitation on the function and scope of use of the embodiments of the present application.
如图6所示,计算机系统600包括中央处理单元(CPU)601,其可以根据存储在只读存储器(ROM)602中的程序或者从存储部分608加载到随机访问存储器(RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有系统600操作所需的各种程序和数据。CPU 601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。As shown in FIG. 6, computer system 600 includes a central processing unit (CPU) 601 that can be loaded into a program in random access memory (RAM) 603 according to a program stored in read only memory (ROM) 602 or from storage portion 608. And perform various appropriate actions and processes. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also coupled to bus 604.
以下部件连接至I/O接口605:包括键盘、鼠标等的输入部分606;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分607;包括硬盘等的存储部分608;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分609。通信部分609经由诸如因特网的网络执行通信处理。驱动器610也根据需要连接至I/O接口605。可拆卸介质611,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器610上,以便于从其上读出的计算机程序根据需要被安装入存储部分608。The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), and the like, and a storage portion 608 including a hard disk or the like. And a communication portion 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the Internet. Driver 610 is also coupled to I/O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory or the like, is mounted on the drive 610 as needed so that a computer program read therefrom is installed into the storage portion 608 as needed.
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分609从网络上被下载和安装,和/或从可拆卸介质611被安装。在该计算机程序被中央处理单元(CPU)601执行时,执行本申请的方法中限定的上述功能。需要说明的是,本申请所述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本申请中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本申请中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可 读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。In particular, the processes described above with reference to the flowcharts may be implemented as a computer software program in accordance with an embodiment of the present disclosure. For example, an embodiment of the present disclosure includes a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for executing the method illustrated in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via communication portion 609, and/or installed from removable media 611. When the computer program is executed by the central processing unit (CPU) 601, the above-described functions defined in the method of the present application are performed. It should be noted that the computer readable medium described herein may be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain or store a program, which can be used by or in connection with an instruction execution system, apparatus or device. In the present application, a computer readable signal medium may include a data signal that is propagated in the baseband or as part of a carrier, carrying computer readable program code. Such propagated data signals can take a variety of forms including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the foregoing. The computer readable signal medium can also be any computer readable medium other than a computer readable storage medium, which can transmit, propagate, or transport a program for use by or in connection with the instruction execution system, apparatus, or device. . Program code embodied on a computer readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
附图中的流程图和框图,图示了按照本申请各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality and operation of possible implementations of systems, methods and computer program products in accordance with various embodiments of the present application. In this regard, each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the logic functions for implementing the specified. Executable instructions. It should also be noted that in some alternative implementations, the functions noted in the blocks may also occur in a different order than that illustrated in the drawings. For example, two successively represented blocks may in fact be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts, can be implemented in a dedicated hardware-based system that performs the specified function or operation. Or it can be implemented by a combination of dedicated hardware and computer instructions.
描述于本申请实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括获取单元、建立单元、分配单元和生成单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,获取单元还可以被描述为“获取待处理的图像的像素点的像素值集合和与所述图像相关联的标签值集合的单元”。The units involved in the embodiments of the present application may be implemented by software or by hardware. The described unit may also be provided in the processor, for example, as a processor including an acquisition unit, an establishment unit, an allocation unit, and a generation unit. Wherein, the names of the units do not constitute a limitation on the unit itself in some cases. For example, the obtaining unit may also be described as “acquiring a set of pixel values of pixels of an image to be processed and associating with the image. The unit of the label value collection."
作为另一方面,本申请还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的装置中所包含的;也可以是单独存在,而未装配入该装置中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该装置执行时,使得该装置:获取待处理的图像的像素点的像素值集合和与图像相关联的标签值集合,其中,标签值用于标识像素点所属的类别;根据标签值集合和像素值集合,建立能量函数,其中,能量函数用于表征标签值与像素值的一致性;对于图像的每个像素点,从标签值集合选择标签值进行分配,以使得能量函数的值最小;根据图像的每个像素点所分配的标签值, 将图像的每个像素点分类,并将属于同一类的像素点的像素值修改为同一值,以生成处理后的图像。In another aspect, the present application also provides a computer readable medium, which may be included in the apparatus described in the above embodiments, or may be separately present and not incorporated into the apparatus. The computer readable medium carries one or more programs, when the one or more programs are executed by the device, causing the device to: obtain a set of pixel values of pixels of the image to be processed and a tag value associated with the image a set, wherein the tag value is used to identify a category to which the pixel point belongs; an energy function is established according to the set of tag values and the set of pixel values, wherein the energy function is used to characterize the consistency of the tag value and the pixel value; for each pixel of the image Point, select a tag value from the set of tag values for assignment to minimize the value of the energy function; classify each pixel of the image according to the tag value assigned to each pixel of the image, and place pixels belonging to the same class The pixel values are modified to the same value to generate a processed image.
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离所述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is only a preferred embodiment of the present application and a description of the principles of the applied technology. It should be understood by those skilled in the art that the scope of the invention referred to in the present application is not limited to the specific combination of the above technical features, and should also be covered by the above technical features without departing from the inventive concept. Other technical solutions formed by any combination of their equivalent features. For example, the above features are combined with the technical features disclosed in the present application, but are not limited to the technical features having similar functions.

Claims (12)

  1. 一种图像生成方法,其特征在于,所述方法包括:An image generating method, the method comprising:
    获取待处理的图像的像素点的像素值集合和与所述图像相关联的标签值集合,其中,标签值用于标识像素点所属的类别;Obtaining a set of pixel values of pixels of the image to be processed and a set of tag values associated with the image, wherein the tag value is used to identify a category to which the pixel points belong;
    根据所述标签值集合和所述像素值集合,建立能量函数,其中,所述能量函数用于表征标签值与像素值的一致性;Establishing an energy function according to the set of tag values and the set of pixel values, wherein the energy function is used to characterize the consistency of the tag value and the pixel value;
    对于所述图像的每个像素点,从所述标签值集合选择标签值进行分配,以使得所述能量函数的值最小;For each pixel of the image, selecting a tag value from the set of tag values for allocation to minimize a value of the energy function;
    根据所述图像的每个像素点所分配的标签值,将所述图像的每个像素点分类,并将属于同一类的像素点的像素值修改为同一值,以生成处理后的图像。Each pixel of the image is classified according to a tag value assigned to each pixel of the image, and pixel values of pixels belonging to the same class are modified to the same value to generate a processed image.
  2. 根据权利要求1所述的方法,其特征在于,所述能量函数包括数据能量函数和光滑能量函数,其中,所述数据能量函数用于表征像素点的像素值与该像素点所分配的标签值的一致性,所述光滑能量函数用于表征像素点的像素值与该像素点相邻的像素点所分配的标签值的一致性。The method of claim 1 wherein said energy function comprises a data energy function and a smooth energy function, wherein said data energy function is used to characterize a pixel value of a pixel point and a label value assigned to the pixel point Consistency, the smooth energy function is used to characterize the consistency of the pixel value of the pixel point with the label value assigned by the pixel point adjacent to the pixel point.
  3. 根据权利要求1所述的方法,其特征在于,在获取待处理的图像的像素点的像素值集合之后,所述方法还包括:The method according to claim 1, wherein after acquiring the set of pixel values of the pixel points of the image to be processed, the method further comprises:
    将所述像素值集合中的每个像素值进行归一化处理得到归一化的像素值,并使用每个归一化的像素值替换所述像素值集合中的每个像素值。Each pixel value in the set of pixel values is normalized to obtain a normalized pixel value, and each pixel value in the set of pixel values is replaced with each normalized pixel value.
  4. 根据权利要求1所述的方法,其特征在于,在获取待处理的图像的像素点的像素值集合之前,所述方法还包括:The method according to claim 1, wherein the method further comprises: before acquiring a set of pixel values of pixels of the image to be processed, the method further comprising:
    接收用户通过终端输入的标签数量,并根据所述标签数量确定标签值集合。Receiving the number of tags input by the user through the terminal, and determining a set of tag values according to the number of tags.
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,所述从所述标签值集合选择标签值进行分配,以使得所述能量函数的值最小,包括:The method according to any one of claims 1 to 4, wherein the selecting a tag value from the set of tag values for allocation to minimize a value of the energy function comprises:
    采用渐非凸渐凹化过程的子图匹配算法求解能量函数的值最小时每个像素点应分配的标签值。The subgraph matching algorithm using the progressively non-convex-concave process is used to solve the label value that should be allocated for each pixel when the value of the energy function is minimum.
  6. 一种图像生成装置,其特征在于,所述装置包括:An image generating apparatus, the apparatus comprising:
    获取单元,用于获取待处理的图像的像素点的像素值集合和与所述图像相关联的标签值集合,其中,标签值用于标识像素点所属的类别;An acquiring unit, configured to obtain a pixel value set of a pixel of the image to be processed, and a label value set associated with the image, where the label value is used to identify a category to which the pixel point belongs;
    建立单元,用于根据所述标签值集合和所述像素值集合,建立能量函数,其中,所述能量函数用于表征标签值与像素值的一致性;Establishing a unit, configured to establish an energy function according to the set of label values and the set of pixel values, wherein the energy function is used to characterize consistency of the label value and the pixel value;
    分配单元,用于对于所述图像的每个像素点,从所述标签值集合选择标签值进行分配,以使得所述能量函数的值最小;An allocating unit, configured to, for each pixel of the image, select a tag value from the set of tag values for allocation to minimize a value of the energy function;
    生成单元,用于根据所述图像的每个像素点所分配的标签值,将所述图像的每个像素点分类,并将属于同一类的像素点的像素值修改为同一值,以生成处理后的图像。a generating unit, configured to classify each pixel of the image according to a label value assigned to each pixel of the image, and modify pixel values of pixels belonging to the same class to the same value to generate processing After the image.
  7. 根据权利要求6所述的装置,其特征在于,所述能量函数包括数据能量函数和光滑能量函数,其中,所述数据能量函数用于表征像素点的像素值与该像素点所分配的标签值的一致性,所述光滑能量函数用于表征像素点的像素值与该像素点相邻的像素点所分配的标签值的一致性。The apparatus according to claim 6, wherein said energy function comprises a data energy function and a smooth energy function, wherein said data energy function is used to characterize a pixel value of a pixel point and a label value assigned to the pixel point Consistency, the smooth energy function is used to characterize the consistency of the pixel value of the pixel point with the label value assigned by the pixel point adjacent to the pixel point.
  8. 根据权利要求6所述的装置,其特征在于,所述装置还包括:The device according to claim 6, wherein the device further comprises:
    归一化单元,用于在获取待处理的图像的像素点的像素值集合之后,将所述像素值集合中的每个像素值进行归一化处理得到归一化的像素值,并使用每个归一化的像素值替换所述像素值集合中的每个像素值。a normalization unit, configured to normalize each pixel value in the pixel value set to obtain a normalized pixel value after acquiring a pixel value set of a pixel point of the image to be processed, and use each The normalized pixel values replace each pixel value in the set of pixel values.
  9. 根据权利要求7所述的装置,其特征在于,所述装置还包括:The device according to claim 7, wherein the device further comprises:
    接收单元,用于在获取待处理的图像的像素点的像素值集合之前,接收用户通过终端输入的标签数量,并根据所述标签数量确定标签值集合。The receiving unit is configured to receive the number of tags input by the user through the terminal before acquiring the pixel value set of the pixel of the image to be processed, and determine the tag value set according to the number of the tags.
  10. 根据权利要求6-9中任一项所述的装置,其特征在于,所述分配单元进一步用于:The device according to any one of claims 6-9, wherein the allocating unit is further configured to:
    采用渐非凸渐凹化过程的子图匹配算法求解能量函数的值最小时每个像素点应分配的标签值。The subgraph matching algorithm using the progressively non-convex-concave process is used to solve the label value that should be allocated for each pixel when the value of the energy function is minimum.
  11. 一种设备,包括:A device that includes:
    一个或多个处理器;One or more processors;
    存储装置,用于存储一个或多个程序,a storage device for storing one or more programs,
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-5中任一所述的方法。The one or more programs are executed by the one or more processors such that the one or more processors implement the method of any of claims 1-5.
  12. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1-5中任一所述的方法。A computer readable storage medium having stored thereon a computer program, wherein the program, when executed by a processor, implements the method of any of claims 1-5.
PCT/CN2018/072287 2017-03-15 2018-01-11 Image generation method and device WO2018166289A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710152538.8A CN108629815B (en) 2017-03-15 2017-03-15 Image generation method and device
CN201710152538.8 2017-03-15

Publications (1)

Publication Number Publication Date
WO2018166289A1 true WO2018166289A1 (en) 2018-09-20

Family

ID=63522742

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/072287 WO2018166289A1 (en) 2017-03-15 2018-01-11 Image generation method and device

Country Status (2)

Country Link
CN (1) CN108629815B (en)
WO (1) WO2018166289A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109993756B (en) * 2019-04-09 2022-04-15 中康龙马(北京)医疗健康科技有限公司 General medical image segmentation method based on graph model and continuous stepwise optimization
CN110765935A (en) * 2019-10-22 2020-02-07 上海眼控科技股份有限公司 Image processing method, image processing device, computer equipment and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101777180A (en) * 2009-12-23 2010-07-14 中国科学院自动化研究所 Complex background real-time alternating method based on background modeling and energy minimization
CN102270343A (en) * 2011-07-27 2011-12-07 宁波大学 Image segmentation method based on Ising graph model
CN104166983A (en) * 2014-06-30 2014-11-26 中国传媒大学 Motion object real time extraction method of Vibe improvement algorithm based on combination of graph cut
EP2919192A2 (en) * 2014-03-12 2015-09-16 Fujifilm Corporation Image processing apparatus, and operation method and program therefor
CN106340024A (en) * 2016-08-30 2017-01-18 厦门美图之家科技有限公司 Image segmentation method and application and computing device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104463786B (en) * 2014-12-03 2017-06-16 中国科学院自动化研究所 A kind of mobile robot image split-joint method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101777180A (en) * 2009-12-23 2010-07-14 中国科学院自动化研究所 Complex background real-time alternating method based on background modeling and energy minimization
CN102270343A (en) * 2011-07-27 2011-12-07 宁波大学 Image segmentation method based on Ising graph model
EP2919192A2 (en) * 2014-03-12 2015-09-16 Fujifilm Corporation Image processing apparatus, and operation method and program therefor
CN104166983A (en) * 2014-06-30 2014-11-26 中国传媒大学 Motion object real time extraction method of Vibe improvement algorithm based on combination of graph cut
CN106340024A (en) * 2016-08-30 2017-01-18 厦门美图之家科技有限公司 Image segmentation method and application and computing device

Also Published As

Publication number Publication date
CN108629815A (en) 2018-10-09
CN108629815B (en) 2021-02-26

Similar Documents

Publication Publication Date Title
US10860888B2 (en) Detecting objects in images
WO2022077917A1 (en) Instance segmentation model sample screening method and apparatus, computer device and medium
WO2022199583A1 (en) Image processing method and apparatus, computer device, and storage medium
US8958630B1 (en) System and method for generating a classifier for semantically segmenting an image
US10586330B2 (en) Detection of outlier lesions based on extracted features from skin images
US20130070983A1 (en) Methods, apparatuses, and computer program products for controlling luminance of non-tissue objects within an image
WO2020062493A1 (en) Image processing method and apparatus
US20190347824A1 (en) Method and apparatus for positioning pupil, storage medium, electronic device
CN108230346B (en) Method and device for segmenting semantic features of image and electronic equipment
CN109344762B (en) Image processing method and device
US8781187B2 (en) Methods, apparatuses, and computer program products for identifying a region of interest within a mammogram image
CN109377508B (en) Image processing method and device
US9025868B2 (en) Method and system for image processing to determine a region of interest
JP7391267B2 (en) Medical image processing methods, devices, equipment, storage media and computer programs
JP2017527013A (en) Adaptive characterization as a service
CN113743607A (en) Training method of anomaly detection model, anomaly detection method and device
US9256780B1 (en) Facilitating dynamic computations for performing intelligent body segmentations for enhanced gesture recognition on computing devices
CN116109824A (en) Medical image and pixel-level label generation method and device based on diffusion model
WO2018166289A1 (en) Image generation method and device
WO2020056901A1 (en) Method and device for processing image
TW202011266A (en) Neural network system for image matching and location determination, method, and device
WO2022143366A1 (en) Image processing method and apparatus, electronic device, medium, and computer program product
Simone et al. On edge-aware path-based color spatial sampling for Retinex: from Termite Retinex to Light Energy-driven Termite Retinex
Prakash et al. Background region based face orientation prediction through HSV skin color model and K-means clustering
CN114926322B (en) Image generation method, device, electronic equipment and storage medium

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: 18767894

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 12.12.2019)

122 Ep: pct application non-entry in european phase

Ref document number: 18767894

Country of ref document: EP

Kind code of ref document: A1