|
发布时间: 2019-03-16 |
图像处理和编码 |
|
|
收稿日期: 2018-06-14; 修回日期: 2018-08-24
基金项目: 国家自然科学基金项目(61622109);宁波市自然科学基金项目(2017A610112)
第一作者简介:
柴雄力, 1994年生, 男, 硕士研究生, 主要研究方向为立体图像优化。E-mail:747866472@qq.com;
姜求平, 男, 副教授, 主要研究方向为图像质量评价。E-mail:jqp910707@126.com; 蒋刚毅, 男, 教授, 主要研究方向为数字视频编码与通信、多视点视频信号处理、数字水印与信息隐藏。E-mail:jianggangyi@nbu.edu.cn.
中图法分类号: TN919.81
文献标识码: A
文章编号: 1006-8961(2019)03-0334-12
|
摘要
目的 近年来,随着数字摄影技术的飞速发展,图像增强技术越来越受到重视。图像构图作为图像增强中影响美学的重要因素,一直都是研究的热点。为此,从立体图像布局调整出发,提出一种基于Delaunay网格形变的立体图像内容重组方法。方法 首先将待重组的一对立体图像记为源图像,将用于重组规则确定的一幅图像记为参考图像;然后对源图像需要调整的目标、特征线和其他区域进行取点操作,建立Delaunay网格。将源图像的左图与参考图像进行模板匹配操作,得到源图像与参考图像在结构布局上的对应关系;最后利用网格形变的特性,移动和缩放目标对象,并对立体图像的深度进行自适应调整。结果 针对目标对象的移动、缩放和特征线调整几方面进行优化。当只涉及目标对象的移动或特征线调整时,立体图像视差保持不变;当目标对象缩放时,立体图像中目标对象的视差按照缩放比例变化而背景视差保持不变。实验结果表明,重组后的立体图像构图与参考图像一致且深度能自适应调整。与最新方法比较,本文方法在目标对象分割精度和图像语义保持方面具有优势。结论 根据网格形变相关理论,构建图像质量、布局匹配和视差适应3种能量项,实现了立体图像的内容重组。与现有需要提取和粘贴目标对象的重组方法不同,本文方法对目标对象的分割精度要求不高,不需要图像修复和混合技术,重组后的立体图像没有伪影和语义错误出现。用户可以通过参考图像来引导立体图像的布局调整,达到期望的图像增强效果。
关键词
立体图像编辑; 立体图像布局; Delaunay网格形变; 深度自适应; 优化
Abstract
Objective Image enhancement techniques have received increasing attention along with the rapid development of digital photography in recent years. Image enhancement aims to improve the visual quality of an image through tone mapping, denoising, and recomposition. In image aesthetic assessment, the main factors that influence aesthetics, namely, object relationships and geometric structure, are considered in recomposition. As a research hotspot, image recomposition utilizes photographic composition rules, such as the rule of thirds, visual balance, diagonal dominance, and object size, to capture aesthetically pleasing content. Nonphotographic experts can also acquire photographic images that conform to image aesthetics using image recomposition technology. Stereoscopic technologies have undergone a tremendous boom in recent years. Various stereoscopic services and applications are currently available which present great demands for the availability of 3D contents. A growing demand for stereoscopic image layout adjustment has been observed due to the separation of stereoscopic content production and display. However, the content modification of 3D images is difficult compared with the conventional 2D image modification. The former requires additional care due to the additional depth dimension. The misalignment between left and right images may result in uncomfortable 3D viewing and cause eye strain and headache. In consideration of the above factors, starting from stereoscopic image layout adjustment, this study proposes a stereoscopic image recomposition method based on Delaunay mesh deformation and depth adaptation. Method A pair of stereoscopic images to be recomposed is first recorded as source images, including left and right images, and a binary image used for rule determination is recorded as a reference image. Alpha matting is used to obtain a precise region with opacity value for each object in the left image and calculate the significance of stereoscopic images. We then detect feature points from the left image and use the Delaunay triangulation algorithm to generate meshes as follows. We employ an edge detection operator, such as Canny operator, and utilize a corner detection algorithm, such as Harris corner detection, to extract feature points in a target object. Hough transform is used to detect feature lines and select points in the left image to evenly sample feature points in the feature lines. Here, the location of the target object and the feature line are classified into three categories:intersect, above separate, and below separate. When intersecting with the feature line, the target object moves along with the feature line, and the rest of the situation can be considered separately. The left image boundary is evenly discretized to use all the points there as part of the feature points and sample the remaining area to gain feature points. The Delaunay triangulation mesh can be automatically generated based on the feature points. After the left image meshes are established, the meshes in the right image are mapped by disparity from the left image meshes, and the reference image meshes are also built similar to the operation of the left image. A template-matching operation is performed on the contents of the left and reference images to obtain the corresponding relationship between the source and reference images in the layout. In the optimization process, we construct energy terms from three aspects, namely, image quality, layout adjustment, and depth adaptation. Finally, the target object is moved and scaled based on the characteristics of mesh deformation, and the depth of the stereoscopic image is adaptively adjusted. The disparity change ratio of the target object is consistent with the size scaling. Result This study conducts an experimental design from two aspects of single object and multiple objects, which prove that the proposed method is applicable to all objects. When the movement of the target object or the adjustment of the feature line is involved, the disparity of the stereoscopic image is maintained. When the target object is scaled, the disparity of the target object in the stereoscopic image varies according to the scaling ratio, while the background disparity remains unchanged. Experimental results show that the stereoscopic image after recomposition is consistent with the layout of the reference image for the target object movement, scaling, and feature line adjustment and that the depth can be adjusted adaptively. The coefficients of different energy terms are also adjusted to prove that the new framework proposed in this study can achieve satisfactory stereoscopic content recomposition. Compared with the latest method, the optimization method used in this study has advantages in the segmentation accuracy of the target object and the preservation of image semantics. Conclusion In this study, image quality, layout matching, and disparity adaptive energy terms are constructed based on the theory of mesh deformation, and content recomposition of the stereoscopic image is achieved according to energy term optimization. Unlike the existing recomposition method that needs to extract and paste the target object, the proposed method does not require high accuracy in the segmentation of the target object. Image-inpainting and -blending techniques are not needed. The stereoscopic image after recomposition has no artifacts and semantic errors. The user can guide the layout adjustment of the stereoscopic image by using the reference image to achieve the image enhancement desired by the user. In the future, mesh deformation and cropping technologies can be combined to enhance the efficiency and flexibility of stereoscopic image recomposition.
Key words
stereoscopic image editing; stereoscopic image layout; Delaunay mesh deformation; depth adaptation; optimization
0 引言
随着立体图像显示技术的发展,立体图像内容的制作越来越受到关注。受拍摄技术和环境的影响,有时拍摄的图像并不令人满意,需要对拍摄内容进行修改。影响图像美感的因素有色彩、光线、线条和构图等,其中最重要的是构图[1],而图像内容重组就是通过改变图像构图来增强图像美感[2]。平面图像的构图规则主要包括三分法、视觉平衡、主题区域保留和目标对象的大小变化。相较于平面图像,立体图像左右的上下错位会导致观看时不舒适,目标对象大小与深度的不匹配会使感知目标对象发生形变,因此对立体图像内容重组时需同时考虑深度调整和构图调整。
在平面图像重组技术方面,Bhattacharya等人[3]提出了一种基于美学的图像增强方法,根据三分法和视觉平衡,使用裁剪(cropping)技术改变图像主体目标的大小和位置,从而获得更具视觉美感的图像。Liu等人[4]提出将三分法、对角线、视觉平衡和区域大小作为图像美学的评价分数,并以此为标准对图像进行裁剪,得到了符合美学的图像。Wang等人[5]提出了一种基于构图规则的图像美学优化方法,通过调整图像主体的位置、大小和背景区域划分对图像进行美化。Liang等人[6]提出一种基于人机交互的裁剪系统。此外基于学习方法的图像重组技术也不断被提出[7-9]。但是通过裁剪进行图像重组,不可避免地会导致内容丢失。基于目标进行提取和粘贴(pasting)也是图像重组的常用方法,即从输入图像中分割出一个或多个目标对象,然后根据布局需要粘贴到相应位置。但是,单纯的目标提取和粘贴可能无法保持分割目标对象与背景之间的语义连通性。为此,Zhang等人[10]提出基于目标对象相关性感知的图像重组方法,通过对图像语义进行相关性分析,增强了提取与粘贴后目标对象与背景语义的关联性。Chang等人[11]提出一种基于布局参考图像重组的方法,利用图匹配得到源图像与参考图像的布局关联信息,然后提取目标对象并粘贴到所需位置。Li等人[12]利用缝雕刻(seam carving)技术对图像不同区域增减像素,以此实现图像内容重组。图像形变(warping)同样是一种常用的图像重组技术。Wong等人[13]提出将目标对象与背景分离,在背景完成形变调整后再粘贴目标对象,实现较好的重组效果。Chang等人[14]提出基于布局参考的图像重组方法,利用图像的形变将目标对象移动到布局点位置。上述基于形变的图像重组方法在需要进行大跨度位置调整时,会出现较严重的背景失真情况。Jin等人[15]提出基于裁剪与形变的图像重组方法,结合裁剪快速和形变语义失真小的优点,得到较好的图像重组效果。
相比平面图像重组技术,立体图像的重组技术相对较少。Niu等人[16]提出利用美学规则裁剪和缩放立体图像,以此实现立体图像重组。但是,当目标对象分散且背景有重要信息时,裁剪会使重组后的图像失去部分重要信息。Tong等人[17]提出通过人机交互将平面图像粘贴到立体图像。1)通过人为操作设定平面图像的视差;2)使用泊松混合使平面视差与背景立体图像视差一致;3)通过形变的方式将平面图像粘贴到立体图像的合适位置,并利用泊松混合的方式对粘贴图像的边界进行混合处理。这种立体图像重组技术对视差的控制要求较高,若粘贴的图像视差不能与立体图像的视差在同一深度范围,立体感知就会出现错误。Luo等人[18]提出基于无缝克隆(cloning)的立体图像重组技术。1)将待克隆的立体图像与背景图像进行视差迭代,使两者的视差一致;2)利用网格形变使待克隆图像的大小符合相应的视差范围;3)利用泊松混合将待克隆图像与作背景的立体图像结合在一起,消除两者边界颜色差异。Islam等人[19]提出基于目标提取和粘贴的立体图像重组技术。1)将图像分为目标层和背景层;2)根据美学规则对目标层和背景层分别调整,再组合到一起得到重组后的立体图像。由于提取目标层后在背景层会出现空洞,因此该方法的效果依赖于修复技术。同时该方法对目标层的提取要求严格,如果提取效果不佳,在图像重组时目标对象和背景的过渡会被明显观察到。文献[16]会出现信息丢失较多的情况。文献[19]为了保护目标对象选择提取目标对象,最终效果受目标提取的准确性和背景修复技术的影响。相比平面图像重组常用的基于网格形变驱动的图像重组技术,立体图像相关研究比较少。Islam等人[20]提出了基于形变的立体图像重组技术,但在目标对象的保持、缩放、特征线位置调整和视差适应等方面的研究不够深入。
为此,本文从图像布局调整和视差自适应的角度,提出一种基于网格形变的立体图像重组框架,主要创新包括:1)基于网格形变理论,构建了一种以图像质量、布局和视差自适应3种能量项为核心的立体图像重组框架;2)考虑多种重组因素,从目标对象、特征线和视差3个方面进行优化;3)用户可以指定参考图像的布局来引导立体图像的重组。
1 预处理
在进行图像重组操作时,需要输入一对立体图像和一幅二值图像分别作为源图像和参考图像(如图 1所示)。由于需要确定源图像目标对象的重组规则,因此要对其进行模板匹配操作。首先对源图像左图的目标对象、特征线、图像四周边界和空余区域进行采样,提取顶点并生成Delaunay网格,这些顶点位于源图像左图目标对象的边界与内部、特征线、四周边界和其余空余区域位置。然后根据视差图生成源图像右图的网格。利用模板匹配算法,将源图像左图目标对象掩膜与参考图像进行模板匹配,确定源图像目标对象需要移动的距离和缩放比例。
以
1.1 目标对象提取和显著图计算
1.2 Delaunay网格建立
建立Delaunay网格的关键在于网格顶点的确定。本文将顶点分为4部分:1)目标对象边界与内部顶点;2)图像特征线顶点;3)图像四周顶点;4)其余位置顶点。在提取目标对象后,考虑到掩膜覆盖的目标对象可能是多个对象,使用
图像四周的顶点采用等间隔采样得到,目的是保持图像分辨率,剩余区域用等间隔采样得到顶点并生成Delaunay网格。利用已知左图像的顶点和左视差图,通过计算确定右图像顶点的对应位置,建立右图像的网格
$ x_{{\rm{r}},k}^j = x_{{\rm{l}},k}^j + d_k^j $ | (1) |
式中,
1.3 模板匹配和布局规则确定
本文方法允许用户利用参考图像的布局来引导源图像的重组。将源图像左图掩膜用
目标对象的位移可以定义为
$ \left\{ \begin{array}{l} {\delta _x}\left( m \right) = \frac{{\sum\limits_{{\mathit{\boldsymbol{V}}_{{\rm{R}},i}} \in {\mathit{\boldsymbol{P}}_m}} {\sum\limits_{j = 1}^3 {x_{{\rm{R}},i}^j} } }}{{N\left( {{\mathit{\boldsymbol{P}}_m}} \right)}} - \frac{{\sum\limits_{{\mathit{\boldsymbol{V}}_{{\rm{S}},i}} \in {\mathit{\boldsymbol{O}}_m}} {\sum\limits_{j = 1}^3 {x_{{\rm{S}},i}^j} } }}{{N\left( {{\mathit{\boldsymbol{O}}_m}} \right)}}\\ {\delta _y}\left( m \right) = \frac{{\sum\limits_{{\mathit{\boldsymbol{V}}_{{\rm{R}},i}} \in {\mathit{\boldsymbol{P}}_m}} {\sum\limits_{j = 1}^3 {y_{{\rm{R}},i}^j} } }}{{N\left( {{\mathit{\boldsymbol{P}}_m}} \right)}} - \frac{{\sum\limits_{{\mathit{\boldsymbol{V}}_{{\rm{S}},i}} \in {\mathit{\boldsymbol{O}}_m}} {\sum\limits_{j = 1}^3 {y_{{\rm{S}},i}^j} } }}{{N\left( {{\mathit{\boldsymbol{O}}_m}} \right)}} \end{array} \right. $ | (2) |
式中,
根据三角形面积计算公式,计算源图像目标对象和参考图像目标对象的面积,并以面积的比值作为源图像目标对象的缩放比例
$ \left\{ \begin{array}{l} {A_{\rm{R}}}\left( m \right) = \sum\limits_{{\mathit{\boldsymbol{V}}_{{\rm{R}},i}} \in {\mathit{\boldsymbol{P}}_m}} {\frac{1}{2}\left| {\begin{array}{*{20}{c}} 1&{x_{{\rm{R}},i}^1}&{y_{{\rm{R}},i}^1}\\ 1&{x_{{\rm{R}},i}^2}&{y_{{\rm{R}},i}^2}\\ 1&{x_{{\rm{R}},i}^3}&{y_{{\rm{R}},i}^3} \end{array}} \right|} \\ {A_{\rm{S}}}\left( m \right) = \sum\limits_{{\mathit{\boldsymbol{V}}_{{\rm{S}},i}} \in {\mathit{\boldsymbol{O}}_m}} {\frac{1}{2}\left| {\begin{array}{*{20}{c}} 1&{x_{{\rm{S}},i}^1}&{y_{{\rm{S}},i}^1}\\ 1&{x_{{\rm{S}},i}^2}&{y_{{\rm{S}},i}^2}\\ 1&{x_{{\rm{S}},i}^3}&{y_{{\rm{S}},i}^3} \end{array}} \right|} \\ \rho \left( m \right) = \frac{{{A_{\rm{R}}}\left( m \right)}}{{{A_{\rm{S}}}\left( m \right)}} \end{array} \right. $ | (3) |
式中,
2 网格能量项的优化与约束
在完成网格建立和布局规则确立后,使用网格形变能实现立体图像的内容重组。本文主要构建3种能量项:1)构建图像质量能量项,通过将形变尽可能分散到非显著区域,保护显著区域,提升立体图像重组效果;2)构建布局匹配能量项,调整目标对象的位置与大小;3)构建视差适应能量项,保证重组后立体图像目标对象视差的自适应和非目标对象视差的保持。
2.1 图像质量能量项
由于网格在优化过程中出现形变是不可避免的,因此如何控制网格形变的趋势至关重要。一般而言,如果优化前的网格与优化后的网格是相似的,那么网格内的内容形变最小。因此希望建立一种形变失真能量项,使所有网格在优化后与原始网格是相似的。参考文献[24],该问题可以转化为将网格变化控制为相似性变换。给定源图像Delaunay网格顶点集合
$ \varepsilon \left( k \right) = \min \sum\limits_{j = 1}^3 {{{\left\| {f\left( {\mathit{\boldsymbol{v}}_k^j} \right) - \mathit{\boldsymbol{\tilde v}}_k^j} \right\|}^2}} $ | (4) |
式中,
$ f\left( {\mathit{\boldsymbol{v}}_k^j} \right) = \left[ {\begin{array}{*{20}{c}} {{a_k}}&{ - {b_k}}\\ {{b_k}}&{{a_k}} \end{array}} \right]\left[ {\begin{array}{*{20}{c}} {x_k^j}\\ {y_k^j} \end{array}} \right] + \left[ {\begin{array}{*{20}{c}} {{t_{x,k}}}\\ {{t_{y,k}}} \end{array}} \right],\mathit{\boldsymbol{v}}_k^j = \left[ {\begin{array}{*{20}{c}} {x_k^j}\\ {y_k^j} \end{array}} \right] $ | (5) |
式中,
将式(5)代入式(4),同一个Delaunay网格的3个顶点满足同一相似性变换,则可写成矩阵形式
$ \begin{array}{*{20}{c}} {{\mathit{\boldsymbol{G}}_k} = \left[ {\begin{array}{*{20}{c}} {x_k^1}&{ - y_k^1}&1&0\\ {y_k^1}&{x_k^1}&0&1\\ {x_k^2}&{ - y_k^2}&1&0\\ {y_k^2}&{x_k^2}&0&1\\ {x_k^3}&{ - y_k^3}&1&0\\ {y_k^3}&{x_k^3}&0&1 \end{array}} \right],{\mathit{\boldsymbol{P}}_k} = \left[ \begin{array}{l} {a_k}\\ {b_k}\\ {t_{x,k}}\\ {t_{y,k}} \end{array} \right],{\mathit{\boldsymbol{c}}_k} = \left[ \begin{array}{l} \tilde x_k^1\\ \tilde y_k^1\\ \tilde x_k^2\\ \tilde y_k^2\\ \tilde x_k^3\\ \tilde y_k^3 \end{array} \right]}\\ {\varepsilon = \min \sum\limits_{{\mathit{\boldsymbol{V}}_k} \in \mathit{\boldsymbol{V}}} {{{\left\| {{\mathit{\boldsymbol{G}}_k}{\mathit{\boldsymbol{P}}_k} - {\mathit{\boldsymbol{c}}_k}} \right\|}^2}} } \end{array} $ | (6) |
式中,
$ {\mathit{\boldsymbol{P}}_k} = {\left( {\mathit{\boldsymbol{G}}_k^{\rm{T}}{\mathit{\boldsymbol{G}}_k}} \right)^{ - 1}}\mathit{\boldsymbol{G}}_k^{\rm{T}}{\mathit{\boldsymbol{c}}_k} $ | (7) |
将式(7)代入式(6),得
$ \varepsilon = \min \sum\limits_{{\mathit{\boldsymbol{V}}_k} \in \mathit{\boldsymbol{V}}} {{{\left\| {\left[ {{\mathit{\boldsymbol{G}}_k}{{\left( {\mathit{\boldsymbol{G}}_k^{\rm{T}}{\mathit{\boldsymbol{G}}_k}} \right)}^{ - 1}}\mathit{\boldsymbol{G}}_k^{\rm{T}} - \mathit{\boldsymbol{I}}} \right]{\mathit{\boldsymbol{c}}_k}} \right\|}^2}} $ | (8) |
式中,
构造整体形变失真能量项为
$ \begin{array}{*{20}{c}} {{E_{{\rm{SD}}}} = \min \sum\limits_{{\mathit{\boldsymbol{V}}_k} \in \mathit{\boldsymbol{V}}} {I{M_{\rm{A}}}\left( {{\mathit{\boldsymbol{V}}_k}} \right)} \cdot }\\ {{{\left\| {\left[ {{\mathit{\boldsymbol{G}}_k}{{\left( {\mathit{\boldsymbol{G}}_k^{\rm{T}}{\mathit{\boldsymbol{G}}_k}} \right)}^{ - 1}}\mathit{\boldsymbol{G}}_k^{\rm{T}} - \mathit{\boldsymbol{I}}} \right]{\mathit{\boldsymbol{c}}_k}} \right\|}^2}} \end{array} $ | (9) |
式中,
$ \begin{array}{*{20}{c}} {\mathit{\boldsymbol{D}}_k^j = \left( {1 - \alpha _1^j} \right)\mathit{\boldsymbol{v}}_k^1 + \alpha _1^j\left( {1 - \alpha _2^j} \right)\mathit{\boldsymbol{v}}_k^2 + \alpha _1^j\alpha _2^j\mathit{\boldsymbol{v}}_k^3}\\ {\alpha _1^j \in \left[ {0,1} \right],\alpha _2^j \in \left[ {0,1} \right]} \end{array} $ | (10) |
$ I{M_{\rm{A}}}\left( {{\mathit{\boldsymbol{V}}_k}} \right) = \frac{{\sum\limits_{j = 1}^{N\left( {{\mathit{\boldsymbol{D}}_k}} \right)} {I{M_{\rm{P}}}\left( {\mathit{\boldsymbol{D}}_k^j} \right)} }}{{N\left( {{\mathit{\boldsymbol{D}}_k}} \right)}} $ | (11) |
式中,
在进行网格优化的过程中,另一个重要的问题是避免网格在优化后出现折叠。如果网格的线方向在优化前后的角度变化尽可能小,那么网格的折叠就可以得到抑制。参考文献[25],设
$ \Delta \left( {{\mathit{\boldsymbol{e}}_{i,j}}} \right) = \min {\left\| {\mathit{\boldsymbol{r}} \cdot {\mathit{\boldsymbol{e}}_{i,j}} - {{\mathit{\boldsymbol{\tilde e}}}_{i,j}}} \right\|^2} $ | (12) |
式中,
$ \Delta = \sum\limits_{{\mathit{\boldsymbol{e}}_{i,j}} \in {\mathit{\boldsymbol{L}}_{\rm{n}}}} {\min {{\left\| {\left[ {{\mathit{\boldsymbol{e}}_{i,j}}{{\left( {\mathit{\boldsymbol{e}}_{i,j}^{\rm{T}}{\mathit{\boldsymbol{e}}_{i,j}}} \right)}^{ - 1}}\mathit{\boldsymbol{e}}_{i,j}^{\rm{T}} - \mathit{\boldsymbol{I}}} \right]{{\mathit{\boldsymbol{\tilde e}}}_{i,j}}} \right\|}^2}} $ | (13) |
式中,
构造整体线角度变化能量项为
$ \begin{array}{*{20}{c}} {{E_{{\rm{AT}}}} = \min \sum\limits_{{\mathit{\boldsymbol{e}}_{i,j}} \in {\mathit{\boldsymbol{L}}_{\rm{n}}}} {I{M_{\rm{A}}}\left( {{\mathit{\boldsymbol{e}}_{i,j}}} \right)} \cdot }\\ {{{\left\| {\left[ {{\mathit{\boldsymbol{e}}_{i,j}}{{\left( {\mathit{\boldsymbol{e}}_{i,j}^{\rm{T}}{\mathit{\boldsymbol{e}}_{i,j}}} \right)}^{ - 1}}\mathit{\boldsymbol{e}}_{i,j}^{\rm{T}} - \mathit{\boldsymbol{I}}} \right]{{\mathit{\boldsymbol{\tilde e}}}_{i,j}}} \right\|}^2}} \end{array} $ | (14) |
式中,
2.2 布局匹配能量项
根据确立的布局规则,有时需要对目标对象进行缩放以增强图像显示效果。对目标对象进行缩放的本质是对目标对象覆盖的网格进行相似变换。构造目标对象缩放能量项如下
$ {E_{{\rm{SO}}}} = \min \sum\limits_{{\mathit{\boldsymbol{e}}_{i,j}} \in {\mathit{\boldsymbol{L}}_{\rm{o}}}} {{{\left\| {\sqrt \rho {\mathit{\boldsymbol{e}}_{i,j}} - {{\mathit{\boldsymbol{\tilde e}}}_{i,j}}} \right\|}^2}} $ | (15) |
式中,由于只考虑目标对象的缩放,
图像重组的一个重要目的是移动图像中目标对象的位置,实现目标对象位置的改变。根据本文的框架结构,这个问题可以简化为网格坐标位置的移动。这里给出目标对象的位置调整能量项,其余网格坐标会通过图像质量优化能量项自适应调整
$ \begin{array}{*{20}{c}} {{E_{{\rm{AO}}}} = \min \left\{ {{{\left| {\sum\limits_{{\mathit{\boldsymbol{V}}_i} \in {\mathit{\boldsymbol{ \boldsymbol{\varUpsilon} }} _{\rm{o}}}} {\sum\limits_{j = 1}^3 {\frac{{\tilde x_i^j - x_i^j}}{{N\left( {{\mathit{\boldsymbol{ \boldsymbol{\varUpsilon} }} _{\rm{o}}}} \right)}} - {\delta _x}} } } \right|}^2} + } \right.}\\ {\left. {{{\left| {\sum\limits_{{V_i} \in {\mathit{\boldsymbol{ \boldsymbol{\varUpsilon} }} _{\rm{o}}}} {\sum\limits_{j = 1}^3 {\frac{{\tilde y_i^j - y_i^j}}{{N\left( {{\mathit{\boldsymbol{ \boldsymbol{\varUpsilon} }} _{\rm{o}}}} \right)}} - {\delta _y}} } } \right|}^2}} \right\}} \end{array} $ | (16) |
式中,
2.3 视差适应能量项
相比平面图像,立体图像的深度线索是区别平面图像的重要特征。基于文献[26],当目标对象的大小发生改变时,其深度也需要改变,具体到图像平面就是视差必须改变。图 4 (a)表示目标对象能正常感知的情况;图 4 (b)表示在目标对象缩小但视差保持不变的情况下,感知到目标对象形变变窄;图 4 (c)表示在目标对象放大但视差保持不变的情况下,感知到目标对象形变变宽;图 4 (d)表示在目标对象缩小且视差对应缩小的情况下,目标对象能正常感知;图 4 (e)表示在目标对象放大且视差对应增大的情况下,目标对象能正常感知。参考文献[19],将目标对象的缩放比例等同于视差缩放比例
$ \rho \cdot d_i^j = \tilde x_{{\rm{r}},i}^j - \tilde x_{{\rm{l}},i}^j $ | (17) |
在观看源图像时,其深度感知在某一范围内。出于保护非目标对象深度感知范围的目的,对非目标对象进行视差保持。视差一致性的能量项可以构建为
$ \begin{array}{*{20}{c}} {{E_{{\rm{DS}}}} = \min \left\{ {\sum\limits_{{\mathit{\boldsymbol{V}}_i} \in {\mathit{\boldsymbol{ \boldsymbol{\varUpsilon} }} _{\rm{n}}}} {\sum\limits_{j = 1}^3 {\left[ {{{\left( {d_i^j - \left( {\tilde x_{{\rm{r}},i}^j - \tilde x_{{\rm{l}},i}^j} \right)} \right)}^2} + } \right.} } } \right.}\\ {\left. {{{\left( {\tilde y_{{\rm{r}},i}^j - \tilde y_{{\rm{l}},i}^j} \right)}^2}} \right] + \sum\limits_{{\mathit{\boldsymbol{V}}_i} \in {\mathit{\boldsymbol{ \boldsymbol{\varUpsilon} }} _{\rm{o}}}} {\sum\limits_{j = 1}^3 {\left[ {{{\left( {\rho \cdot d_i^j - \left( {\tilde x_{{\rm{r}},i}^j - \tilde x_{{\rm{l}},i}^j} \right)} \right)}^2} + } \right.} } }\\ {\left. {\left. {{{\left( {\tilde y_{{\rm{r}},i}^j - \tilde y_{{\rm{l}},i}^j} \right)}^2}} \right]} \right\}} \end{array} $ | (18) |
式中,
2.4 特征线与边界约束
本文在对源图像进行预处理的过程中提取了特征线并等间隔采样得到特征点,保持特征线的形状对图像的质量保持具有重要意义。具体到约束条件,就是使采样特征点的位置(纵坐标)以相同距离进行移动
$ \bigcup\limits_{\mathit{\boldsymbol{v}}_i^j \in {\mathit{\boldsymbol{ \boldsymbol{\varGamma} }}_{{\rm{le}}}}} {\tilde y_i^j} = y_i^j + \zeta $ | (19) |
式中,
在图像优化过程中,图像边界点的位置变动会对图像的尺寸和整体显示形状产生影响。本文主要研究图像内容的重组,不希望图像的尺寸和整体显示形状发生变化,因此需要对图像进行边界保持约束,其约束条件表示为
$ \bigcup\limits_{\mathit{\boldsymbol{v}}_i^j \in {\mathit{\boldsymbol{ \boldsymbol{\varGamma} }}_{{\rm{by}}}}} {\tilde x_i^j} = x_i^j,\tilde y_i^j = y_i^j $ | (20) |
式中,
2.5 整体能量项优化
根据建立的能量项,将网格形变转变为通过最小二乘优化求解最佳坐标点的问题,总能量项表示为
$ \begin{array}{*{20}{c}} {{E_{{\rm{total}}}} = {w_{{\rm{SD}}}}\left( {E_{{\rm{SD}}}^{\rm{l}} + E_{{\rm{SD}}}^{\rm{r}}} \right) + {w_{{\rm{AT}}}}\left( {E_{{\rm{AT}}}^{\rm{l}} + E_{{\rm{AT}}}^{\rm{r}}} \right) + }\\ {{w_{{\rm{SO}}}}\left( {E_{{\rm{SO}}}^{\rm{l}} + E_{{\rm{SO}}}^{\rm{r}}} \right) + {w_{{\rm{AO}}}}{E_{{\rm{AO}}}} + {w_{{\rm{DS}}}}{E_{{\rm{DS}}}}} \end{array} $ | (21) |
式中,
3 实验结果
为了测试重组的效果,本文使用南京大学立体数据库[27]进行实验,从特征线调整、目标对象位置移动、多目标对象缩放、目标对象位置同时移动与缩放和多目标对象同时缩小与放大5个方面进行对比实验分析,同时分析能量项的不同参数设置对图像重组的影响。
3.1 重组结果分析
本文方法的重组实验结果如图 5,每列为不同场景的图片,第1列是特征线与目标对象相交的情况,在纵坐标方向移动目标对象的同时特征线需要一同跟随移动。由于只涉及目标对象的移动,因此从视差图中可以看到目标对象优化前后视差保持不变,非目标对象的视差也得到了保持。图 5第2列也是特征线与目标对象相交的情况,但是由于目标对象只需要横向移动,因此特征线只要保持即可,不需要位置的调整。同样,由于目标对象没有进行缩放,所以目标对象与非目标对象区域的视差都得到了保持。图 5第3列没有明显的特征线,因此不考虑特征线因素。这里主要测试多目标对象一同缩放的效果。从视差图可以看出,2个目标对象缩小的同时目标对象视差也随之缩小,非目标对象视差依旧保持。图 5第4列的参考图像与目标对象形状不同,主要是为了说明参考图像的形状不需要与目标对象形状相似(图 5中其余的参考图像与目标对象形状相似主要是为了便于观察重组的效果)。该列是特征线与目标对象分离的情况,所以目标对象的调整相对自由。此处改变了目标对象的位置并放大了目标对象,从视差图中可以看出,目标对象的视差变大而非目标对象视差依旧保持。在图 5第5列中,对多目标对象同时进行缩小与放大操作,优化后蓝色的车变小而红色的车变大,同时目标对象视差也发生改变,非目标对象视差依旧保持。总体而言,图 5的视差自适应与理论相符,重组后的图像布局与质量令人满意。
3.2 不同参数对重组结果的影响
分析不同能量项对最终结果的影响能够检验能量项在实际优化中是否起到正确的作用。图像质量能量项的作用已经在文献[25]中验证,本文主要验证提出的布局匹配能量项和视差适应能量项。图 6显示了在式(21)不同参数设置情况下得到的优化结果。图 6 (a)(b)分别是源图像的左图和参考图像。图 6 (c)的参数设置如表 1中的方案1,主要分析参数设置对目标对象放大的影响。随着
表 1
不同方案的参数设置
Table 1
Parameter settings for different schemes
方案 | 描述 |
1 | |
2 | |
3 | |
4 |
3.3 与现有方法进行比较
文献[19]提出的ASDA方法与本文方法都是面向立体图像的重组与视差自适应,因此本文与其进行对比实验。在图 7 (b)中,第1列车轮左边出现模糊,第2列球与特征线相交处的直线扭曲丢失,第3列羊腿边出现伪影,第4列鸟嘴处出现伪影,第5列小孩裤子的阴影丢失。这些图像语义与源图像不一致是因为ASDA方法需要提取目标对象,对背景空洞进行修补会有模糊与伪影出现。而且将提取的目标对象与优化后的背景进行粘贴也会有语义错误出现。此外,该方法对于目标对象分割的精度要求很高,否则重组效果会受较大影响。相比之下,图 7 (c)的本文方法在复原ASDA方法重组效果的情况下没有语义错误的情况出现。而且本文方法的分割精度要求相对较低,只要求掩膜覆盖目标对象即可,不需要掩膜边界线条与目标对象边界完全重合。总的来说,相比ASDA方法,本文方法在语义的保持和目标对象提取方面具有优势。
文献[20]提出的ASWARP方法与本文方法都是应用网格形变进行立体图像重组,因此本文与其进行比较。在图 8 (b)中,ASWARP方法的第1、2行的鹰在位置调整后翅膀有形变且无法对鹰进行缩放,视差也不能自适应调整。第3、4行的骑手位置受特征线调整的影响。相比之下,本文方法的第1、2行的鹰在位置调整后翅膀没有明显形变且实现了对鹰的缩放,视差能自适应调整。第3、4行的骑手位置不受特征线调整的影响,说明本文方法能单独对特征线进行调整。总的来说,相比ASWARP方法,本文方法能实现对象的缩放、视差的自适应和特征线的调整。
3.4 局限性
3.5 算法复杂度分析
不考虑目标对象提取与显著图计算所需的时间,处理分辨率为450 × 487像素的立体图像,本文方法在Intel i3-2130 CPU,3.40 GHz和4 GB内存的条件下所需时间为59.4 s。考虑到ASDA方法在空洞修补时所需时间为2~4 min,本文方法所需的时间处于可接受范围。
4 结论
本文从网格形变角度提出了一种立体图像重组方法,利用参考图像进行模板匹配,使优化后的立体图像布局类似于参考图像。在视差方面,将目标对象的视差与缩放比例相联系,而非目标对象则视差保持,以此实现目标对象感知形状的保护和非目标对象深度感知范围的保持。结果表明,本文方法在重组后的语义保持方面具有一定优势,能够依据参考图像实现立体图像的重组。在接下来的工作中,考虑将裁剪方法与本文网格形变方法结合起来进行立体图像重组,进一步提升重组的灵活度。
参考文献
-
[1] Yao L, Suryanarayan P, Qiao M, et al. OSCAR:On-site composition and aesthetics feedback through exemplars for photographers[J]. International Journal of Computer Vision, 2012, 96(3): 353–383. [DOI:10.1007/s11263-011-0478-3]
-
[2] Islam M B, Wong L K, Wong C O. A survey of aesthetics-driven image recomposition[J]. Multimedia Tools and Applications, 2017, 76(7): 9517–9542. [DOI:10.1007/s11042-016-3561-5]
-
[3] Bhattacharya S, Sukthankar R, Shah M. A framework for photo-quality assessment and enhancement based on visual aesthetics[C]//Proceedings of the 18th ACM International Conference on Multimedia. Firenze, Italy: ACM, 2010: 271-280.[DOI:10.1145/1873951.1873990]
-
[4] Liu L G, Chen R J, Wolf L, et al. Optimizing photo composition[J]. Computer Graphics Forum, 2010, 29(2): 469–478. [DOI:10.1111/j.1467-8659.2009.01616.x]
-
[5] Wang W N, Liu J C, Xu X M, et al. Aesthetic enhancement of images based on photography composition guidelines[J]. Journal of South China University of Technology:Natural Science Edition, 2015, 43(5): 51–58. [王伟凝, 刘剑聪, 徐向民, 等. 基于构图规则的图像美学优化[J]. 华南理工大学学报:自然科学版, 2015, 43(5): 51–58. ] [DOI:10.3969/j.issn.1000-565X.2015.05.009]
-
[6] Liang Y, Wang X T, Zhang S H, et al. PhotoRecomposer:interactive photo recomposition by cropping[J]. IEEE Transactions on Visualization and Computer Graphics, 2017, 24(10): 2728–2742. [DOI:10.1109/TVCG.2017.2764895]
-
[7] Bhattacharya S, Sukthankar R, Shah M. A holistic approach to aesthetic enhancement of photographs[J]. ACM Transactions on Multimedia Computing, Communications, and Applications, 2011, 7: #21. [DOI:10.1145/2037676.2037678]
-
[8] Park J, Lee J Y, Tai Y W, et al. Modeling photo composition and its application to photo re-arrangement[C]//Proceedings of the 19th IEEE International Conference on Image Processing. Orlando, FL, USA: IEEE, 2012: 2741-2744.[DOI:10.1109/ICIP.2012.6467466]
-
[9] Guo G J, Wang H Z, Shen C H, et al. Automatic image cropping for visual aesthetic enhancement using deep neural networks and cascaded regression[J]. IEEE Transactions on Multimedia, 2018, 20(8): 2073–2085. [DOI:10.1109/TMM.2018.2794262]
-
[10] Zhang F L, Wang M, Hu S M. Aesthetic image enhancement by dependence-aware object recomposition[J]. IEEE Transactions on Multimedia, 2013, 15(7): 1480–1490. [DOI:10.1109/TMM.2013.2268051]
-
[11] Chang H T, Wang Y C F, Chen M S. Transfer in photography composition[C]//Proceedings of the 22nd ACM International Conference on Multimedia. Orlando, Florida, USA: ACM, 2014: 957-960.[DOI:10.1145/2647868.2654976]
-
[12] Li K, Yan B, Li J, et al. Seam carving based aesthetics enhancement for photos[J]. Signal Processing:Image Communication, 2015, 39: 509–516. [DOI:10.1016/j.image.2015.07.005]
-
[13] Wong L K, Low K L. Enhancing visual dominance by semantics-preserving image recomposition[C]//Proceedings of the 20th ACM International Conference on Multimedia. Nara, Japan: ACM, 2012: 845-848.[DOI:10.1145/2393347.2396327]
-
[14] Chang H T, Pan P C, Wang Y C F, et al. R2P: Recomposition and retargeting of photographic images[C]//Proceedings of the 23rd ACM International Conference on Multimedia. Brisbane, Australia: ACM, 2015: 927-930.[DOI:10.1145/2733373.2806366]
-
[15] Jin Y, Wu Q B, Liu L G. Aesthetic photo composition by optimal crop-and-warp[J]. Computers & Graphics, 2012, 36(8): 955–965. [DOI:10.1016/j.cag.2012.07.007]
-
[16] Niu Y Z, Liu F, Feng W C, et al. Aesthetics-based stereoscopic photo cropping for heterogeneous displays[J]. IEEE Transactions on Multimedia, 2012, 14(3): 783–796. [DOI:10.1109/TMM.2012.2186122]
-
[17] Tong R F, Zhang Y, Cheng K L. StereoPasting:interactive composition in stereoscopic images[J]. IEEE Transactions on Visualization and Computer Graphics, 2013, 19(8): 1375–1385. [DOI:10.1109/TVCG.2012.319]
-
[18] Luo S J, Shen I C, Chen B Y, et al. Perspective-aware warping for seamless stereoscopic image cloning[J]. ACM Transactions on Graphics, 2012, 31(6): #182. [DOI:10.1145/2366145.2366201]
-
[19] Islam M B, Wong L K, Low K L, et al. Aesthetics-driven stereoscopic 3-D image recomposition with depth adaptation[J]. IEEE Transactions on Multimedia, 2018, 20(11): 2964–2979. [DOI:10.1109/TMM.2018.2820324]
-
[20] Islam M B, Wong L K, Wong C O, et al. Stereoscopic image warping for enhancing composition aesthetics[C]//Proceedings of the 3rd IAPR Asian Conference on Pattern Recognition. Kuala Lumpur, Malaysia: IEEE, 2015: 645-649.[DOI:10.1109/ACPR.2015.7486582]
-
[21] Gastal E S L, Oliveira M M. Shared sampling for real-time alpha matting[J]. Computer Graphics Forum, 2010, 29(2): 575–584. [DOI:10.1111/j.1467-8659.2009.01627.x]
-
[22] Wang W G, Shen J B, Yu Y Z, et al. Stereoscopic thumbnail creation via efficient stereo saliency detection[J]. IEEE Transactions on Visualization and Computer Graphics, 2017, 23(8): 2014–2027. [DOI:10.1109/TVCG.2016.260059]
-
[23] Fernandes L A F, Oliveira M M. Real-time line detection through an improved Hough transform voting scheme[J]. Pattern Recognition, 2008, 41(1): 299–314. [DOI:10.1016/j.patcog.2007.04.003]
-
[24] Zhang G X, Cheng M M, Hu S M, et al. A shape-preserving approach to image resizing[J]. Computer Graphics Forum, 2010, 28(7): 1897–1906. [DOI:10.1111/j.1467-8659.2009.01568.x]
-
[25] Chang C H, Liang C K, Chuang Y Y. Content-aware display adaptation and interactive editing for stereoscopic images[J]. IEEE Transactions on Multimedia, 2011, 13(4): 589–601. [DOI:10.1109/TMM.2011.2116775]
-
[26] Niu Y Z, Feng W C, Liu F. Enabling warping on stereoscopic images[J]. ACM Transactions on Graphics, 2012, 31(6): #183. [DOI:10.1145/2366145.2366202]
-
[27] Ju R, Liu Y, Ren T W, et al. Depth-aware salient object detection using anisotropic center-surround difference[J]. Signal Processing:Image Communication, 2015, 38: 115–126. [DOI:10.1016/j.image.2015.07.002]