为了对图像破损区域进行修补和前景去除,提出一种基于样本的图像修补算法.首先引入“分块的方向梯度能量”来评估像素块在某个方向上的整体颜色变化情况;然后利用最大方向梯度能量估算该像素块中存在的边缘的强度与方向.该算法包括像素块填充优先级计算、像素块匹配和更新未知区域边界、可信任度等全局参数的更新3个步骤.在计算像素块填充优先级时,考察像素块在待修补区域边界法向上的方向梯度能量,优先选取包含更强边缘信息的未知区域;而在像素块匹配过程中,除比较像素块对应的颜色值之外,还利用方向梯度能量对它们可能存在的边缘进行比较与匹配.实验结果表明,该算法能够使图像的结构信息正确地传播到待修补的未知区域中,填充后的图像具有较为平滑的边缘.
This paper presents a new exemplar-based image inpainting algorithm for image inpainting and object removal. A concept, called patch oriented gradient energy, is introduced to estimate the color change of an image patch. By means of the maximum patch-oriented gradient energy among all the patches, the direction and strength of an edge in the patch can be estimated. Exemplar-based inpainting methods often contain three steps: the first is to compute the priority of each patch to be inpainted; the second is to match the patches; and the third is to update the global parameters such as unknown region's contour and the confidence values. Using the oriented gradient energy in the normal direction of the unknown region's contour, we firstly select the patches containing the strongest structure information (i. e. , edge information). In the matching step, we compare not only the color values of the corresponding pixels, but also the edge information in the patches by the patch-oriented gradient energy. The experiments show that our algorithm can propagate the structures and textures near boundaries of the areas to be inpainted to the unknown regions in a correct way to obtain results with visually smooth edges in the inpainted image.