Assignment 4: Seamless Editing

Similar documents
Color Me Right Seamless Image Compositing

Today. Motivation. Motivation. Image gradient. Image gradient. Computational Photography

Computer Vision 2. SS 18 Dr. Benjamin Guthier Professur für Bildverarbeitung. Computer Vision 2 Dr. Benjamin Guthier

Assignment 3: Edge Detection

Chapter - 2 : IMAGE ENHANCEMENT

SECTION 5 IMAGE PROCESSING 2

Edge detection. Winter in Kraków photographed by Marcin Ryczek

EE795: Computer Vision and Intelligent Systems

Image Manipulation in MATLAB Due Monday, July 17 at 5:00 PM

C E N T E R A T H O U S T O N S C H O O L of H E A L T H I N F O R M A T I O N S C I E N C E S. Image Operations II

Edge detection. Winter in Kraków photographed by Marcin Ryczek

Gesture based PTZ camera control

Topic 4 Image Segmentation

Digital Makeup Face Generation

BLIND MEASUREMENT OF BLOCKING ARTIFACTS IN IMAGES Zhou Wang, Alan C. Bovik, and Brian L. Evans. (

CIS581: Computer Vision and Computational Photography Project 2: Face Morphing and Blending Due: Oct. 17, 2017 at 3:00 pm

Edge Detection CSC 767

Introduction to Computer Graphics. Image Processing (1) June 8, 2017 Kenshi Takayama

Analysis of Image and Video Using Color, Texture and Shape Features for Object Identification

Panoramic Image Stitching

Babu Madhav Institute of Information Technology Years Integrated M.Sc.(IT)(Semester - 7)

APPM 2360 Project 2 Due Nov. 3 at 5:00 PM in D2L

Region-based Segmentation

What will we learn? Neighborhood processing. Convolution and correlation. Neighborhood processing. Chapter 10 Neighborhood Processing

Motion Estimation. There are three main types (or applications) of motion estimation:

Lecture #13. Point (pixel) transformations. Neighborhood processing. Color segmentation

Free Appearance-Editing with Improved Poisson Image Cloning

CS443: Digital Imaging and Multimedia Binary Image Analysis. Spring 2008 Ahmed Elgammal Dept. of Computer Science Rutgers University

Object Removal Using Exemplar-Based Inpainting

ELEC Dr Reji Mathew Electrical Engineering UNSW

Fast Image Stitching and Editing for Panorama Painting on Mobile Phones

IT Digital Image ProcessingVII Semester - Question Bank

Image Blending and Compositing NASA

Color Adjustment for Seamless Cloning based on Laplacian-Membrane Modulation

3. Raster Algorithms. 3.1 Raster Displays. (see Chapter 1 of the Notes) CRT LCD. CS Dept, Univ of Kentucky

Digital Image Processing. Prof. P. K. Biswas. Department of Electronic & Electrical Communication Engineering

Computer Vision I - Basics of Image Processing Part 1

CS 5540 Spring 2013 Assignment 3, v1.0 Due: Apr. 24th 11:59PM

[ ] Review. Edges and Binary Images. Edge detection. Derivative of Gaussian filter. Image gradient. Tuesday, Sept 16

Detection of Edges Using Mathematical Morphological Operators

DTU M.SC. - COURSE EXAM Revised Edition

EE795: Computer Vision and Intelligent Systems

Part 3: Image Processing

ELEC Dr Reji Mathew Electrical Engineering UNSW

Segmentation algorithm for monochrome images generally are based on one of two basic properties of gray level values: discontinuity and similarity.

Biomedical Image Analysis. Mathematical Morphology

CS 664 Segmentation. Daniel Huttenlocher

Edges and Binary Images

A Random Variable Shape Parameter Strategy for Radial Basis Function Approximation Methods

Sharpening through spatial filtering

Supervised texture detection in images

CHAPTER 3 IMAGE ENHANCEMENT IN THE SPATIAL DOMAIN

Broad field that includes low-level operations as well as complex high-level algorithms

Image Processing

EECS490: Digital Image Processing. Lecture #19

Image Inpainting and Selective Motion Blur

CHAPTER 9 INPAINTING USING SPARSE REPRESENTATION AND INVERSE DCT

Computer Vision I. Announcements. Fourier Tansform. Efficient Implementation. Edge and Corner Detection. CSE252A Lecture 13.

Image gradients and edges April 11 th, 2017

Image Processing. CSCI 420 Computer Graphics Lecture 22

Image Processing. Alpha Channel. Blending. Image Compositing. Blending Errors. Blending in OpenGL

ECG782: Multidimensional Digital Signal Processing

ECG782: Multidimensional Digital Signal Processing

Image gradients and edges April 10 th, 2018

Biometrics Technology: Image Processing & Pattern Recognition (by Dr. Dickson Tong)

Computer Vision I - Basics of Image Processing Part 2

Fuzzy Inference System based Edge Detection in Images

EDGE BASED REGION GROWING

Texture. Frequency Descriptors. Frequency Descriptors. Frequency Descriptors. Frequency Descriptors. Frequency Descriptors

Fast Image Labeling for Creating High-Resolution Panoramic Images on Mobile Devices

Practical Image and Video Processing Using MATLAB

SUPPLEMENTARY FILE S1: 3D AIRWAY TUBE RECONSTRUCTION AND CELL-BASED MECHANICAL MODEL. RELATED TO FIGURE 1, FIGURE 7, AND STAR METHODS.

Artifacts and Textured Region Detection

Fast Image Stitching and Editing for Panorama Painting on Mobile Phones

Digital Image Processing. Introduction

Edge linking. Two types of approaches. This process needs to be able to bridge gaps in detected edges due to the reason mentioned above

Image processing. Reading. What is an image? Brian Curless CSE 457 Spring 2017

An ICA based Approach for Complex Color Scene Text Binarization

IMA Preprint Series # 1979

Anno accademico 2006/2007. Davide Migliore

EE795: Computer Vision and Intelligent Systems

Keywords: Thresholding, Morphological operations, Image filtering, Adaptive histogram equalization, Ceramic tile.

IMPLEMENTATION OF THE CONTRAST ENHANCEMENT AND WEIGHTED GUIDED IMAGE FILTERING ALGORITHM FOR EDGE PRESERVATION FOR BETTER PERCEPTION

Denoising and Edge Detection Using Sobelmethod

Chapter 10 Image Segmentation. Yinghua He

Computer Vision I. Announcement. Corners. Edges. Numerical Derivatives f(x) Edge and Corner Detection. CSE252A Lecture 11

Colorization: History

Digital Image Processing ERRATA. Wilhelm Burger Mark J. Burge. An algorithmic introduction using Java. Second Edition. Springer

Edge and local feature detection - 2. Importance of edge detection in computer vision

EE795: Computer Vision and Intelligent Systems

Anti-aliasing and sampling

Chapter 3: Intensity Transformations and Spatial Filtering

Image Segmentation and Registration

A New Technique of Extraction of Edge Detection Using Digital Image Processing

AVOIDING BLEEDING IN IMAGE BLENDING. TNList, Tsinghua University School of Computer Science and Informatics, Cardiff University

Image Processing Fundamentals. Nicolas Vazquez Principal Software Engineer National Instruments

Fundamentals of Digital Image Processing

Smart robotics for high added value footwear industry Deliverable

AN ANALYTICAL STUDY OF DIFFERENT IMAGE INPAINTING TECHNIQUES

Image Resizing Based on Gradient Vector Flow Analysis

Transcription:

Assignment 4: Seamless Editing - EE Affiliate I. INTRODUCTION This assignment discusses and eventually implements the techniques of seamless cloning as detailed in the research paper [1]. First, a summary of the paper is included with the the key ideas and applications listed. Next, a region in grayscale image is filled using the algorithm set out. Subsequently, the introduction of a guidance field is observed with seamless cloning shown for both importing gradients and mixing multiple gradients. This application is extended to colour images. Finally, a full face swap application is implemented and potential improvements to the framework highlighted. II. BACKGROUND The paper looks to implement seamless editing by discussing a guided interpolation framework and showing results for various applications. The initial work in the paper sets out the problem rigorously using mathematical notation. The first step is to describe the filling of some region Ω in the image by interpolating from the known intensity values at the boundary. The aim is to create a smooth gradient of intensity from one boundary to the other hence minimising the sum of the absolute gradient at all points. The boundary condition is that the pixels at the boundary must take on the known values f Ω min f 2 with f Ω = f Ω (1) f Ω The gradient will be more true under the guidance of some known vector field v. Here the minimisation problem will be adapted. min f v 2 with f Ω = f Ω (2) f Ω In the seamless cloning section, the effect of the guidance field is shown. This field is simply the change in intensity of pixels (gradient) over the source image. The source image takes the target pixels intensities at the boundary and the other pixel intensities are interpolated by following the original gradient. The paper looks at an extension of this, creating a composite guidance field by mixing the gradient of the target with that of the source. At each point in the region Ω, the dominant gradient magnitude is used. The final section in the paper details numerous other applications of this framework. One aspect is to look at modification of the guidance field (the gradient of image intensities). Retaining only dominant gradient components, i.e. those in which an edge exists between two points, results in texture flattening. Dynamic range of selections may be modified by adjusting the logarithmic guidance field, this builds on the algorithm proposed in Fattal 2002 [2]. Logarithms of luminance are approximately equivalent to perceived brightness where large gradients show drastic luminance changes. Applying the change and solving the Poisson equation for regions of the images allow illumination correction of specific foreground objects as is shown in the paper. Further, local colour correction is implemented in the case of isolating a colour object from a monochrome background. The Poisson equation is solved for some loose region Ω around the object. The monochrome destination receives colour in the region using the gradient data from the source luminance channel. The final application of the framework discussed is that of seamless tiling. A tessellating region can be adjusted by enforcing the boundary conditions at the edges of each tile. It is evident that this paper has been written for an academic with a background in the field. Both the mathematical formalism and the use of technical jargon such as stroke and guidance field introduce a level of abstraction from a real implementation which makes the algorithms and techniques hard to understand. A supplementary paper referencing some source code or some pseudo code exploring the core ideas would be more useful. Due to the low resolution of images in the paper, it is difficult to assess the quality of the framework. It would be better practise if the paper referenced high resolution web versions of the images. Artefacts are evident in seamless cloning when the gradient is not mixed: this is because the edge around some object still has its initial texture. In mixing gradients, these artefacts are less apparent. III. GRAYSCALE REGION FILLING WITHOUT GUIDANCE FIELD The discrete solution of the Poisson equation is given in the paper. It can be seen this is just the differentiation with respect to f p of the equation that precedes it. N p f p q N p Ω f q = q N p Ω f q + q N p v pq (3) The most plausible method to solve this series of simultaneous equations is to adopt a matrix form. Ax = b (4)

The column vector x represents the image. Each pixel has an index x i where i = M N (rows by columns). The matrix A calculates the gradient terms. Each row is populated as the simultaneous equation requires with the number of neighbours in the diagonal column and - 1 as the coefficient at each neighbour. Else, for a pixel not in the region, the intensity is left untouched with a 1 value at the diagonal of the corresponding row. The image is processed as a 1D column vector. It is known that neighbours below and above will be one cell away and those to the left and right will be distanced by the number of rows M in the image. A = a ij (5) Next to each pixel x i, there is a neighbour x q where x i q = {i + 1, i 1, i + M, i M} (6) N p if j = i and x i Ω 1 if j = i and x a ij = i / Ω 1 if j = q and x i Ω 0 otherwise As this matrix will be sparsely populated, the algorithm can be implemented speedily by pre-populating a matrix using the sparse() command with the row and column coordinates of non-zero elements and the values to take at each point. Additionally, the known boundary conditions will be stored in a column vector b. Each pixel on the boundary of the region Ω located at i will be stored at b i. The result of this algorithm is to create a continuous interpolation over the region. Over smooth regions, this works well as is seen Fig 1. However, it is clear in the larger object that blurring of the bottom of the building has occurred making the concealment more obvious. In high frequency regions such as the waves of the sea, object concealment is much more obvious using this technique. In Fig 2, a blurry patch appears where the boat once was. This may be improved by adding some guidance information using a gradient field. (7) record of the source gradient, i.e. the change in intensity across this region. The results are shown in Fig 3. On close inspection, at the region boundary, some artefacts are seen where the waves of the ocean fail to reach the body of the octopus. This may be improved by using the mixed gradient technique. B. Mixing Gradients This technique has been summarised in the background section. The absolute gradient between a pixel and each of its neighbour are compared for the source S and target image T and the dominant term used in the guidance field. v = v iq i q N p (8) T (i) T (q) if T (i) T (q) > S(i) S(q) v iq = S(i) S(q) if T (i) T (q) S(i) S(q) 0 if T (i) / Ω (9) The result is shown in Fig 4. A much looser selection can be made and the smooth source sea replaced with the edges in the target waves. However, the wave pattern can be seen in regions of smooth octopus skin giving the octopus less definition than the previous method. V. SEAMLESS CLONING ON COLOUR IMAGES It is simple to extend the cloning technique to colour images. The same algorithm is performed on a per channel basis. The results of this can be seen in Fig 5. It is observed that the effect of intensity changes to match the target is more apparent with colour images. The octopus has turned bright red. The quality of the implementation can be assessed using the tic and toc commands. The program reports the full processing, including each colour level, takes 17.043292 seconds. IV. SEAMLESS CLONING A. Importing Gradients VI. MULTIPLE STROKES: IMPLEMENTING A FACE SWAP ALGORITHM Seamless cloning is achieved using the technique described in the paper. A region in a source image is selected with roipoly(). This source image is grown to the size of the target image using black pixel padding and a corresponding region is selected in the target. Using the intensity values around the boundary of the target region, the source image can be inserted by growing across this region through solving the Poisson equation under the presence of a guidance field. This guidance field is the The framework can be made more extensible by allowing multiple selections to be made. A popular Facebook application takes two faces from a photograph and swaps them. It should be feasible to adapt the Poisson cloning code to do this. The initial hurdle is to allow accurate selection of the two faces. This was implemented using the ginput() command to select a pixel location for the second mask and a control sequence with two dialogue boxes to allow the second face to be repositioned or the 2 of 12

initial mask to be redrawn entirely. Next the faces had to be repositioned at their new locations. This was achieved using the circshift() command to find the location of the first true value in each 1D column matrix representation of the binary mask and shift the respective masked image data to this location. Initially it was considered that each selection would have to be solved individually. However, the two masks and guidance fields could be combined in the same matrix for much faster execution. The individual masks are maintained to check which face to populate the guidance field from and the boundary pixels found from the edge of the combined mask. It was noted that a bug was apparent in that a border of black pixels appeared in the guidance field. This was fixed using knowledge of image morphology acquired in the second assignment. The mask was eroded by a 4 pixel square strel. This allowed the mask to be slightly smaller and no black pixels on the edge were included in the guidance field as the gradient at all points in the image could now be computed. The results of this seamless composite are shown in Fig 6. VII. FRAMEWORK IMPROVEMENTS The positioning of source images should be more intuitive. A placement GUI could be implemented similar to the roipoly() mask select. Implementing this algorithm in the C language could allow more control over this. It should be possible to scale these source images. Different resolution images need to be matched to achieve a realistic composite. This stretch and placement tool could be integrated. Additionally, it would be beneficial if multiple source images could be added to the target simultaneously to create a more expressive result. This would require the development of a full application. The framework specified in the paper is more of a back-bone structure. For consumer use, a more complete package would need development. VIII. CONCLUSIONS In conclusion, all key sections of the paper [1] have been implemented. This has included region filling without a guidance field, using importing a gradient as a guidance field and mixing two gradients to make a guidance field. This has been extended to an RGB colour image. The paper has been discussed fully prior to this and a good understanding as to the operation of each algorithm shown. As an extension, a full face swapping application has been developed using multiple region filling under a gradient guidance field and good results shown. Further improvements to the framework have been suggested. [1] P. Pérez, M. Gangnet, and A. Blake, Poisson image editing, ACM SIGGRAPH 2003 Papers on - SIGGRAPH 03, p. 313, 2003. [2] R. Fattal, D. Lischinski, and M. Werman, Gradient Domain High Dynamic Range Compression, ACM Transactions on Graphics (TOG), 2002. 3 of 12

FIG. 1: Here shows region filling over a smooth sky region. The top image shows the flag concealed and the bottom shows concealment of the larger big ben tower 4 of 12

FIG. 2: The sea has edges so the attempt concealment is more obvious FIG. 3: Seamless cloning has been achieved by importing the gradient of the octopus to a region 5 of 12

FIG. 4: Mixing gradients allows a looser region selection but introduces transparency in the octopus FIG. 5: Importing the gradient on all three colour channels 6 of 12

FIG. 6: Here, two famous characters have their faces swapped 7 of 12