An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf ·...

19
Noname manuscript No. (will be inserted by the editor) An Image Composition Algorithm for Handling Global Visual Effects M. Shahid Farid · Arif Mahmood Accepted for publication in Multimedia Tools and Applications, November 2012. Final pub- lished copy may be slightly different. Abstract Image composition is widely used in television and film industry to create synthetic visual effects. It requires seamless integration of different parts of two or more images into a single image. Existing image composition techniques only change the local contents of the resulting image while in many cases local changes may also require some global effects as well. For exam- ple, if the image of sun from one image is transferred to another image, the global brightness pattern should also be transferred. Unfortunately existing techniques cannot handle global effects of local content manipulations. This paper describes a novel image composition technique which captures global effects associated with a specific local content from one image and in- corporates in the second image. In our proposed technique, all images are transformed to the frequency domain. The composite image is created in fre- quency domain by mixing different frequencies from multiple images and then transformed back to the spatial domain. We have experimented the proposed technique to shift the image of sun along with its global brightness pattern, the global effects of rain and also for transferring global texture pattern from one image to the other. In most of the cases the results produced by our al- gorithm appear far close to real images than state of the art existing image composition techniques. Keywords Image Composition · Image Fusion · Superimposed Images M. Shahid Farid Punjab University College of Information Technology University of the Punjab, Lahore, Pakistan Tel.: +92-42-111923923 E-mail: [email protected] Arif Mahmood School of Computer Science and Software Engineering The University of Western Australia, 35 Stirling Highway, Crawley, WA 6009 E-mail: [email protected]

Transcript of An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf ·...

Page 1: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

Noname manuscript No.(will be inserted by the editor)

An Image Composition Algorithm for HandlingGlobal Visual Effects

M. Shahid Farid · Arif Mahmood

Accepted for publication in Multimedia Tools and Applications, November 2012. Final pub-lished copy may be slightly different.

Abstract Image composition is widely used in television and film industryto create synthetic visual effects. It requires seamless integration of differentparts of two or more images into a single image. Existing image compositiontechniques only change the local contents of the resulting image while in manycases local changes may also require some global effects as well. For exam-ple, if the image of sun from one image is transferred to another image, theglobal brightness pattern should also be transferred. Unfortunately existingtechniques cannot handle global effects of local content manipulations.

This paper describes a novel image composition technique which capturesglobal effects associated with a specific local content from one image and in-corporates in the second image. In our proposed technique, all images aretransformed to the frequency domain. The composite image is created in fre-quency domain by mixing different frequencies from multiple images and thentransformed back to the spatial domain. We have experimented the proposedtechnique to shift the image of sun along with its global brightness pattern,the global effects of rain and also for transferring global texture pattern fromone image to the other. In most of the cases the results produced by our al-gorithm appear far close to real images than state of the art existing imagecomposition techniques.

Keywords Image Composition · Image Fusion · Superimposed Images

M. Shahid FaridPunjab University College of Information TechnologyUniversity of the Punjab, Lahore, PakistanTel.: +92-42-111923923E-mail: [email protected]

Arif MahmoodSchool of Computer Science and Software EngineeringThe University of Western Australia, 35 Stirling Highway, Crawley, WA 6009E-mail: [email protected]

Page 2: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

2 M. Shahid Farid, Arif Mahmood

1 Introduction

Photographers wish to master the art of photographing balanced, pleasantand meaningful pictures. However, camera can only capture what is in theviewfinder; it cannot capture what is in the mind of the photographer. In con-trast, painting has been the source to satisfy the lust to represent oneself’smind. After much advancement in the field of computer vision, image process-ing and computer graphics, there are various techniques to create imaginativephotographs which combine the arts of painting and photography. In thesestechniques, different photographs, as a whole or in parts, are merged togetherto create new images describing new premise, concept or theme. This processis called image composition and also known as copy-paste [46].

Any image composition technique works in two steps. A fine segmentationof the areas of interest from the source images and then merging the piecestogether seamlessly. Many image segmentation and composition techniqueshave been proposed during the last decade while the research is still in progressin these two important areas to achieve the optimality. The optimality inimage composition is derived by three factors; (1) automatic segmentation, (2)seamless assembly of the segments and (3) minimal execution time. Most of theavailable image composition techniques are based on the spatial representationof the images and they join different parts of various images into a single image.

Most of the research in image composition emphasizes on seamless mergeof one or more segments into an image and this merge just adds these segmentsin the source image without affecting the visual characteristics of the sourceimage or other segments. Sometimes, we may want to merge multiple segments(contents)1 to an image where contents are not just added in the image, theirglobal visual characteristics are also incorporated in the source image. Forexample, we may want to add a sun rising scene into a grassy field scene toget a sunny grassy field. The traditional composition techniques will segmentthe sun from the sunrise image and paste it in the grassy field image. Doingthis will result in a quite un-natural image, because adding sun in this way inthe grassy field image will not brighten the whole scene, in other words, theglobal effect of the local content are not added into the source image. Instead,we want an image where not just the sun has been added in the source imagebut the complete sun effect must be added. No technique exists for this kindof applications and we propose one in this paper.

The main contribution of this paper is a new image composition techniquein which an image is composed from multiple images in a way that globalvisual characteristics of all the contents are incorporated in the source image.Further, the composition step is carried out in the frequency domain ratherthan in spatial domain. This gives us better control over the global visualcharacteristics of the image. A composite image is actually a superimposedimage from a set of two or more images, called source images. The proposedtechnique may be used to add global effects in images like light effects, rain

1 In the rest of the text term segment and content will be used interchangeably.

Page 3: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

Image Composition 3

(a) Clouds of fire. (b) Sunrise scene.

Fig. 1: Examples of composite images produced by the proposed technique.

effects, and may also be used to create textures and art images. Section ?? de-scribes these applications in detail. Figure 1 shows two examples of compositeimages produced by our technique.

2 Related work

In image processing and computer graphics, image composition refers to theassembly of a set of images into a new image. Different objects from differentimages may be cut and pasted together to form a new image. The quality ofthe resultant image depends on how seamlessly the objects are blended. Otherclosely related areas include image blending, fusion [19], matting, mosaics,overlaying, lerping, metamorphosis, morphing, and stitching. These techniqueshas been used in films, animations and cartoons.

An initial image composition technique was proposed by Bruce A. Wal-lace [39] which was meant for cartoon animations. Different chunks of artworkwere merged together to generate a single composite frame of the animation.Individual pieces of a scene or frame were designed separately and then con-verted into pixels in computer and corresponding pixels were assembled andthus a frame of animation was created. Porter and Duff described four opera-tors to generate composite images [28] in RGBA model. Each image pixels inthis model was a quadruple represented as (r, g, b, α), where r, g and b werethe color components and α was coverage factor ranging from 0 to 1 and con-trolled the proportion of pixel value from the two images. This technique wasextended by James Blinn [18]. Pyramids have been successfully used in manyimage fusion techniques such as [1,38,37,3,48,14].

Goshtasby presented a fusion method [16] to fuse multiple images takenfrom a single and static camera of a static scene. In each image some areascontain maximum information where as the other areas do not. These multipleimages are composed into a single image that has maximum information at

Page 4: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

4 M. Shahid Farid, Arif Mahmood

each pixel. The technique, first, divides the images into blocks. Each blockwith maximum information is selected and then combined together to get asingle image using a monotonically decreasing blending function. An excellentliterature on image stitching may be found in [36,17].

One of the classical methods of image composition was described in [27].It is based on Poisson equation with Dirichlet boundary condition used withguidance vector. Digital Photomontage framework for image composition wasproposed by Agarwala et al. [2]. It used two techniques, graph cut optimization[9,8] and gradient domain fusion [12,23] to create a new image from multiplesource images. Graph cut optimization technique was used to cut the optimalseam of the objects from source images. Gradient domain fusion was then usedto fuse the source objects in the composite image so that any visible artifactsmay be removed.

One important task in any image composition algorithms is to select theregion of interest which is done manually. Selection of the boundary of a com-plex region of interest may become cumbersome and time consuming. Jiaya Jiaet. al. [20] proposed a shortest closed path algorithm to select the boundaryof the region of interest extracted from source image using Graph-Cut [29].Their proposed approach was an extension of Poisson image editing [27] withoptimized boundary condition. Jinli Suo et.al. also used Poisson image editingtechnique for face fusion and gender conversion [35].

Image morphing is a special technique used in film and television industryto transform one scene to another in a seamless manner. The proposed imagecomposition technique and image morphing have some similarity because inboth a superimposed image is generated but they are different because inimage morphing, given two images, a set of intermediate images are createdwhich show the smooth transformation of one image to the other. Whereas inour approach, given a set of images, a single image is generated.

3 Motivation

Important current image composition techniques are discussed in section 2.These techniques take multiple image segments and stitch them together seam-lessly. Those segments may belong to same or different images, representingdifferent themes while the composite image may have a completely new con-cept. The composition is nothing but a seamless merge of multiple image piecesand each piece has no effect on others. Some times it is required that thesepieces affect each other. These effects can be change in brightness of the otherparts or addition of a certain color component. Existing image compositiontechniques do not provide such functionality.

As an example, suppose we have an image of a grassy field (Figure 2 (a))and we want to add the dazzling sun in it (selected area in Figure 2 (b)).A composition of these two images, shown in Figure 2 (c)), adds the sun inthe grassy field at location (100, 250) using the famous Poisson Image Editing

Page 5: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

Image Composition 5

(a) (b) (c)

Fig. 2: Image ‘a’ and ‘b’ are two source images of size 640×480 for composition.The highlighted area in image ‘b’ is the part to be merged in image ‘a’. Image‘c’ is the resultant image created using Poisson Image Editing approach [27].

approach [27]2. Though, the sun has merged in grassy field but this is notwhat we expected. We not only want to add sun in the grassy field, but alsowant to add the global effects of sun, that is sunshine, in the grassy field. Thiscannot be achieved by using the existing image composition techniques, whichis the motivation for the new proposed algorithm.

4 The Proposed Image Composition Algorithm

The proposed technique works in three steps. First it transforms the sourceimages (images to be merged) to the frequency domain and in the secondstep, the frequencies are mixed together in a desired proportion to create anew spectrum. In the third step, the resultant spectrum is normalized andis converted back to the spatial domain yielding the composite image. Thiswhole process is shown in the Figure 3.

4.1 Frequency Domain Transformation

To generate a composite image of n source images, each image is represented infrequency domain. There are many transforms available to represent an imagein frequency domain like Fourier transform, Sine transform, Cosine transformand wavelets. We chose the Discrete Cosine Transform (DCT) for our proposedapproach. There are two reasons for this choice, first, due to the decorrelationproperty of DCT and second, DCT is space efficient than others because inDCT only real values are computed. DCT of an image I of size m × n iscalculated as:

D(u, v) = αuβv

m−1∑i=0

n−1∑j=0

I(i, j)cos

m(i+

1

2)u)

]cos

n(j +

1

2)v)

](1)

2 Source code is taken from author’s website: http://www.umiacs.umd.edu/ aa-grawal/ICCV2007Course/index.html

Page 6: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

6 M. Shahid Farid, Arif Mahmood

 

Image 2

Gaussian Lowpass Filter with cut-off r1

Normalize the sum

Compute inverse DCT

Resultant composite image

Image 1

Compute DCT Compute DCT

Gaussian Lowpass Filter with cut-off r2

Sum the respective color channels

Fig. 3: Flowchart of the proposed technique.

where

αu =

{ 1√m

if u = 0√2m if 0 < u < m

and

βv =

{ 1√n

if v = 0√2n if 0 < v < n

When an image is represented as DCT coefficients, the DC component lies atthe top-left corner of the transform and represents average of all the values inthe source image. Low frequencies lie around the DC and as we move away fromDC, higher frequencies are found. Low frequencies in a transform represent thestructure of the image while the high frequencies represent the fine details inthe image.

4.2 Separating Required Frequencies

After transforming the source images into the frequency domain, in the nextstep the frequencies are mixed in different proportions. Low frequencies corre-spond to the structural details in the image and high frequencies represent thefine details in the image. Low frequencies of the source images are extracted

Page 7: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

Image Composition 7

using low-pass filter with different cut-off frequencies. The low-pass filteredimages are then combined to compose a new image. The image whose globaleffect is to be added in the other images is low-pass filtered with a large cut-offso that its effect prevails in the resultant image. To extract a portion of thefrequency spectrum of an image one or more of low pass, high pass, band passand band reject filters may be used. Since we want to extract the low frequen-cies we use low-pass filter. There are three basic low-pass filters: ideal low-passfilter, Butter Worth low-pass filter and Gaussian low-pass filer. Ideal low-passfilter (ILF) is the simplest filter in frequency domain but it suffers with theringing effect. Butterworth low-pass filter does not exhibits the ringing effectand it is smoother than ILF but for very large degree value, BLF behaves likeILF. The Gaussian low-pass Filter (GLF) is defined as:

H(u, v) = e−D(u,v)2

D02 (2)

where D0 is cut-off frequency and D(u,v) is the distance of the point (u,v) fromthe center of the frequency and is given by equation 3. Like BLF, Gaussianlow-pass filter does not exhibits the ringing effect and it is smoother thanILF and BLF. We use Gaussian low-pass filter in our approach to extract lowfrequencies in images due to its better performance in terms of ringing effect.

D(u, v) =

√(u− M

2)2 + (v − N

2)2 (3)

4.3 Generating Composite Images

There are three steps to generate a composite image in our algorithm. (1) Thesource images are converted into frequency domain. (2) Each image is lowpassfiltered using Gaussian lowpass filter and finally (3) The lowpass filtered imagesare added up and normalized to get the resultant composite image.

Let I1(x, y), I2(x, y), I3(x, y), · · · In(x, y) be n source images, each with di-mension M ×N . Let I1(u, v), I2(u, v), I3(u, v), · · · In(u, v) be the Discrete Co-sine Transform of these n source images. That is:

Ii(u, v) = DCT (Ii(x, y)) (4)

where 0 ≤ u ≤M and 0 ≤ v ≤ N .To extract frequencies in a radius r, we use Gaussian low pass filter G(u, v).

G(u, v) = e−D2(u,v)

2D20 (5)

where D(u, v) is the distance of (u, v) from the origin of the transform. D0

is known as radius of the filter or cut-off frequency. Figure 4 shows an imageand its low pass filtered version generated with Gaussian low pass filter withdifferent cut-off frequencies. The image labeled 4a is the source image and the

Page 8: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

8 M. Shahid Farid, Arif Mahmood

(a) (b) (c) (d)

Fig. 4: Image ‘a’ is a source image and images ‘b’, ‘c’ and ‘d’ are its threelowpass filtered versions with decreasing radii.

remaining three images are its Gaussian lowpass filtered images with differentcut-off frequency D0. The limit on D0 is:

0 < D0 ≤√M2 +N2

2(6)

where M and N are dimensions of the images.Let I ′1(u, v), I ′2(u, v), I ′3(u, v), · · · I ′n(u, v) be the n Gaussian lowpass filtered

images with radii r1, r2, r3, · · · rn. That is

I ′i(u, v) = Ii(u, v) ∗Gri(u, v) (7)

where Gri(u, v) is Gaussian lowpass filter with radius ri. The composite imageF (u, v) of these n images is obtained as:

F (u, v) =I ′1(u, v) + I ′2(u, v) + · · ·+ I ′n(u, v)

R(8)

where R is the normalizing factor and is given by:

R =r1 + r2 + r3 + · · ·+ rn√

M2+N2

2

(9)

To get the resultant image in spatial domain, we take inverse discrete cosinetransform of F (u, v).

f(x, y) = iDCT (F (u, v)) (10)

A gray scale image is directly transformed into frequency domain using Dis-crete Cosine Transform (DCT), but in case of color images, the image hasmore than one channels and DCT should not be applied directly on the wholeimage. In our approach the source images are in RGB color model and hence,there are three color channels.

A number of other color models are also available, for example, RGB,CMYK, Y CbCr, and YUV. Each color model has its own applications andcharacteristics. CYMK is best for printing and YUV is used for TV broad-casting. The RGB color model is considered to be the best for image represen-tation because it covers the maximum of visible spectrum. In our algorithm,we have used RGB color model.

Page 9: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

Image Composition 9

Algorithm 1 Generating A Composite Image

Require: n input images Ii=1···nEnsure: Ires: A composite image

1: for i = 1 to n do2: I ′i(u, v)← DCT (Ii)3: I ′′i (u, v)← I ′i(u, v) ∗Gri(u,v)

{Gri(u,v) is Gaussian Low pass filter with radius ri}4: end for

5: If (u, v)← 1R

n∑i=1

I ′′i (u, v)

{Where R is normalizing factor given by equation 9}6: Ires ← iDCT (If (u, v)) {iDCT is inverse of DCT}7: return Ires

The DCT is computed for each color channel red, green and blue sep-arately. Similarly, in the second step the low-pass filters are applied on eachcolor channel. In the final step, each filtered color channel of the source imagesare added up and normalized resulting in a composite image. The resultantchannels are then transformed back to spatial domain using inverse DCT op-eration resulting in an RBG image again.

Cut-off frequency is a crucial parameter in generating a composite imagebecause it decides which contents of the source images will prevail the resultantimage and what proportion of each source image contributes in the compositeimage. Each source image may have a different cut-off frequency dependingon how much of its contents are desired in the resultant image. Suppose wehave two images of same size, image A and image B. Both A and B are low-pass filtered with cut-off frequencies r1 and r2 respectively. Larger the cut-offfrequency means more contents of that image will be visible in the resultantimage. Now, if we want to add the global effect of image A into image B, weset r1 to a larger value as compared to r2 which will be a small value. On theother hand, if global effects of B are desired in A, r2 must be greater thanr1. So, the cut-off frequency for each source image is decided on the basis ofits contribution desired in the resultant image. A number of experiments arecarried out to demonstrate this technique in the next section.

5 Experiments and Results

The proposed technique is implemented in Matlab and large number of ex-periments are performed for demonstration. In each experiment the executiontime is also computed and reported in table 1, based on Intel Core 2 DUOCPU @ 2.2 GHz with 1 GB of RAM.

Figure 5 shows the first experiment where two images of size 640× 480 areused as source images to our approach. The first image is a scene of a grassyfield (Fig. 5a) and second image is a dazzling view of the sun (Fig. 5b). The

Page 10: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

10 M. Shahid Farid, Arif Mahmood

(a) (b) (c)

Fig. 5: Sunrise in Grassy Field: Image ‘a’ is a photo of a field and ‘b’ is asunrise scene. These two images are composed using by using our approachresulting in a new scene where sun is rising behind the fields.

task is to create a new image in which the sun is shining behind a grassy field.The two source images are combined together using the proposed techniquewith cut-off frequencies r1 = 600 and r2 = 280 respectively giving the desiredimage (Fig. 5c). In the resultant image, the sun is added in the grassy filedand also the sunshine effect which is changing as we move to the bottom of theimage. This kind of effect may not be produced by existing image compositiontechniques as shown in Figure 2 that was generated by using Poisson ImageEditing approach [27].

It is very important that what cut-off frequencies are chosen for the sourceimages while applying the Gaussian low-pass filter. Varying the cut-off fre-quencies of source images will vary the output composite image. For example,if you swap the source images (5a and 5b) in the first experiment shown inFigure 5 without swapping their cut-offs, the resultant composite image willbe different. This is because in this experiment r1 = 600 and r2 = 280 whichmeans ‘Sunrise’ image is filtered with a low-pass filter of cut-off 600 and ‘GrassyField’ image is filtered with cut-off 200. This means, the composite image willhave more contents of first image as compared to the second image and hence,the global contents of sunrise prevail the resultant image.

In second experiment, we want to create an imaginary image of whiteclouds full of fire. Many images of clouds are available on Internet or can becaptured easily using a hand held camera. Figure 6a shows such a simple imageof clouds captured on a sunny day. Figure 6b shows an other image of cloudsthat was captured in the evening while sun was setting. By combining thesetwo images using the proposed technique with cut-off frequency r1 = 450 forfirst source image (6a) and r2 = 500 for second source image (6b), we get theresultant image shown in Figure 6c.

Figure 7 shows the third experiment where a composite image with daf-fodils in rain is generated. The two source images are of size 250 × 250. Fig-ure 7a is a scene of rain fall and Figure 7b shows daffodils. The images arecombined using cut-off frequency of 150 for first source image, and 350 forthe second source image. In fourth experiment, a scene of clouds (Fig. 17) ismerged with a scene of sunset behind the ocean (Fig. 8b). Figure 8c shows the

Page 11: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

Image Composition 11

(a) (b) (c)

Fig. 6: Clouds of Fire: Image ‘a’ and ‘b’ are two source images of clouds of size320× 320. Image ‘c’ is the resultant image created using proposed algorithm.

(a) (b) (c)

Fig. 7: Daffodils in Rain: ‘a’ is daffodils image composed with ’b’, a rain sceneresulting in image ‘c’.

(a) (b) (c)

Fig. 8: A cloud image merged with a sunset scene giving a new theme wheresun is rising behind the clouds. The rays of the sun are passing through theclouds giving it a natural look.

resultant composite image generated with cut-off frequencies are 650 and 980respectively. In experiment 5, light rays effect is added in a scene of strawberrypicking. The composite image generated as a result of mixing frequencies ofthe two images, that lie within the radius of 500 for image ’a’ and 200 forimage ’b’, is shown in Figure 9c. Figure 10 shows another example where arainbow is added in a flying bird image.

Page 12: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

12 M. Shahid Farid, Arif Mahmood

(a) (b) (c)

Fig. 9: A strawberry in hand scene composed with the sun rays.

(a) (b) (c)

Fig. 10: Image ‘a’ and ‘b’ are two source images of size 670× 450 for compo-sition. Image ‘c’ is the resultant image created using proposed approach.

Table 1: Execution time for the given ten experiments. NOI is the number ofsource images, Size is the dimensions of the source images, r1, r2 are cut-offfrequencies used in corresponding images and Execution Time is in seconds.

Exp No. Experiment NOI Size r1 r2 Time1 Sunrise in Grassy Field 2 640 × 480 600 280 0.8442 Clouds of Fire 2 320 × 320 450 250 0.2823 Daffodils in Rain 2 250 × 250 150 350 0.1884 Sunrise 2 800 × 495 650 680 1.4065 Strawberry 2 506 × 338 500 200 0.5946 Rainbow 2 670 × 450 250 400 1.187

5.1 Adding Light Effects

Many times we want to add shining of some other light source to an image.Using traditional composition techniques, one can cut the light source fromone image and paste it in the second. But doing so will not produce a pleasantand natural image because just adding the sun in the image would not effectthe other part of the image. The proposed technique not only adds the lightsource in the image, but also adds the light effect in the whole image, creatinga more natural look. Figure 11 shows an example of adding a sun setting imageto a mountain image, giving a sun-rise scene (Figure 11c) where all parts inthe image are proportionally illuminated. Figures 12 and 13 show some moreexamples of adding light effect.

Page 13: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

Image Composition 13

(a) (b) (c)

Fig. 11: Image ‘a’ is a sunset scene that is merged in a valley scene. Theresultant image ‘c’ shows the sun setting behind the mountains of the valley.

(a) (b) (c)

Fig. 12: A composite image of forest with added light effects.

(a) (b) (c)

Fig. 13: A composite image of aeroplane flying over the ocean and the sunsetting in the background

5.2 Creating New Textures

The proposed technique may also be used to create different types of textureimages by using two or more existing images. Figure 14c shows such a texturecreated by composing a wall image (Figure 14a) and the daffodils image (Fig-ure 14b) with cut-off frequencies 440 and 180 respectively. Figure 15 showsanother example of creating a textured wall, where frequencies of stone wallare combined with a flower image with cut-offs 1400 and 700 respectively. Theresultant image (Figure 15c) is shown at zoom 2.1 to make the texture morevisible.

5.3 Adding Rain Effects

Adding rain effect to an image is desirable in many situations to create a newvisual effect or to enhance the beauty of an image. The proposed technique can

Page 14: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

14 M. Shahid Farid, Arif Mahmood

(a) (b) (c)

Fig. 14: Images ‘a’ and ‘b’ are the two source texture images and image ‘c’ isthe resultant texture image.

(a) (b) (c)

Fig. 15: A texture on the wall is created using the proposed technique. Image‘a’ and ‘b’ are two source texture images and image ‘c’ is the resultant textureimage.

(a) (b) (c)

Fig. 16: Rain effects added to a flower image.

also be used to add such effect in images. Figure 16 shows such an image whererain effect to a flower image is added. In Figure 17, rain image is combinedwith Lena image, and resultant image 17c is Lenna’s photo taken behind thewindow in rain. Figure 18 shows another example.

Page 15: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

Image Composition 15

(a) (b) (c)

Fig. 17: Rain effects added to the Lenna’s image.

(a) (b) (c)

Fig. 18: Rain effects added to a girl’s image.

(a) (b) (c)

Fig. 19: A bare trees image and water splashes image with green backgroundare composed using proposed approach with cut-off frequencies 100 and 150respectively.

5.4 Creating Art Images

The proposed technique can be effectively used to generate abstract art images.In Figure 19, a water drops with green background is added to trees image andresultant image is a more attractive image with a new theme. In next example(Figure 20), a pigeons image is added to carpet fabric image. The resultantlooks like pigeons are embroidered in the fabric.

5.5 Adding More Visual Effects

There are some other applications of the proposed technique as well. It canbe used to compose a new image according to one’s theme in mind from two

Page 16: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

16 M. Shahid Farid, Arif Mahmood

(a) (b) (c)

Fig. 20: A pigeons image composed with a fabric image. The resultant image‘c’ looks like pigeons are engraved in the fabric.

(a) (b) (c)

Fig. 21: A rainbow added to a farm image

Table 2: Execution time for the experiments described in this section by cate-gory. NOI is the number of source images, Size is the dimensions of the sourceimages, r1, r2 are cut-off frequencies used in corresponding images and Execu-tion Time is in seconds.

Application Experiment NOI Size r1 r2 Time

Light EffectValley 2 500× 316 180 450 0.875Far Away 2 522× 393 500 300 1.640Aeroplane 2 500× 350 200 450 1.234

TextureTexture - 1 2 400× 550 550 160 1.093Texture - 2 2 1600× 1200 1000 700 10.015

Rain EffectDaffodils 2 250× 250 150 350 0.188Lenna 2 512× 512 650 300 1.750Girl 2 500× 381 450 200 1.422

ArtAutumn 2 250× 177 100 150 0.422Engraving 2 2048× 1613 800 1800 68.717

More Visual Effect Rainbow 2 599× 450 250 700 3.156

or more images. Figure 21 shows another example where a rainbow is addedin the image of a farm. Table 2 shows the statistics of all the experimentsdescribed in this section.

Page 17: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

Image Composition 17

6 Conclusion

Different Image composition techniques have been proposed to generate a newimage by seamlessly combining multiple pieces or objects from multiple images.The existing image composition techniques merge different pieces togetherseamlessly but the characteristics of one piece, like brightness, rain effect orlight effect, do not affect the other piece in the composite image. Some timesit required that the visual characteristics of one piece affect the other pieces.This paper presented such a technique that works in frequency domain andgenerates a new image from multiple images by mixing the frequencies of thesource images in different proportions. There are three steps in the proposedalgorithm; first, the source images are converted in frequency domain usingDiscrete Cosine Transform. In the second step, the resultant images are low-pass filtered with different cut-off frequencies. In the third step, the resultantimages are added up and normalized and then the resultant image is convertedback to the spatial domain. The efficacy of the proposed technique is demon-strated by carrying out a number of experiments and different applications.

References

1. Adelson, E.H., Anderson, C.H., Bergen, J.R., Burt, P.J., Ogden, J.M.: Pyramid methodsin image processing. RCA Engineer 29(6), 33–41 (1984)

2. Agarwala, A., Dontcheva, M., Agrawala, M., Drucker, S., Colburn, A., Curless, B.,Salesin, D., Cohen, M.: Interactive digital photomontage. ACM Trans. Graph. 23, 294–302 (2004). DOI http://doi.acm.org/10.1145/1015706.1015718. URL http://doi.acm.

org/10.1145/1015706.1015718

3. Arivazhagan, S., Ganesan, L., Subash Kumar, T.: A modified statistical approach forimage fusion using wavelet transform. Signal, Image and Video Processing 3, 137–144(2009). URL http://dx.doi.org/10.1007/s11760-008-0065-4. 10.1007/s11760-008-0065-4

4. Azuma, R.: Overview of augmented reality. In: ACM SIGGRAPH 2004 Course Notes,SIGGRAPH ’04. ACM, New York, NY, USA (2004). DOI 10.1145/1103900.1103926.URL http://doi.acm.org/10.1145/1103900.1103926

5. Azuma, R., Baillot, Y., Behringer, R., Feiner, S., Julier, S., MacIntyre, B.: Recentadvances in augmented reality. IEEE Comput. Graph. Appl. 21(6), 34–47 (2001). DOI10.1109/38.963459. URL http://dx.doi.org/10.1109/38.963459

6. Azuma, R.T.: A Survey of Augmented Reality. Presence 6, 355–385 (1997). URLhttp://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.30.4999

7. Beier, T., Neely, S.: Feature-based image metamorphosis. SIGGRAPH Comput. Graph.26, 35–42 (1992). DOI http://doi.acm.org/10.1145/142920.134003. URL http://doi.

acm.org/10.1145/142920.134003

8. Boykov, Y., Jolly, M.P.: Interactive graph cuts for optimal boundary amp; region seg-mentation of objects in n-d images. In: Computer Vision, 2001. ICCV 2001. Proceedings.Eighth IEEE International Conference on, vol. 1, pp. 105 –112 vol.1 (2001). DOI10.1109/ICCV.2001.937505

9. Boykov, Y., Veksler, O., Zabih, R.: Fast approximate energy minimization via graphcuts. IEEE Trans. Pattern Anal. Mach. Intell. 23, 1222–1239 (2001). DOI 10.1109/34.969114. URL http://portal.acm.org/citation.cfm?id=505471.505473

10. Catmull, E., Smith, A.R.: 3d transformations of images in scanline order. SIGGRAPHComput. Graph. 14, 279–285 (1980). DOI http://doi.acm.org/10.1145/965105.807505.URL http://doi.acm.org/10.1145/965105.807505

Page 18: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

18 M. Shahid Farid, Arif Mahmood

11. Farid, M., Mahmood, A.: Image morphing in frequency domain. Journal of Math-ematical Imaging and Vision 42, 50–63 (2012). URL http://dx.doi.org/10.1007/

s10851-011-0273-3. 10.1007/s10851-011-0273-312. Fattal, R., Lischinski, D., Werman, M.: Gradient domain high dynamic range compres-

sion. ACM Trans. Graph. 21, 249–256 (2002). DOI http://doi.acm.org/10.1145/566654.566573. URL http://doi.acm.org/10.1145/566654.566573

13. Fischer, J., Eichler, M., Bartz, D., Straıer, W.: Virtual environments: A hybrid trackingmethod for surgical augmented reality. Comput. Graph. 31(1), 39–52 (2007). DOI10.1016/j.cag.2006.09.007. URL http://dx.doi.org/10.1016/j.cag.2006.09.007

14. Flitti, F., Collet, C., Slezak, E.: Image fusion based on pyramidal multiband multireso-lution markovian analysis. Signal, Image and Video Processing 3, 275–289 (2009). URLhttp://dx.doi.org/10.1007/s11760-008-0080-5. 10.1007/s11760-008-0080-5

15. Geys, I., Gool, L.V.: View synthesis by the parallel use of gpu and cpu. Image andVision Computing 25(7), 1154 – 1164 (2007). DOI DOI:10.1016/j.imavis.2006.07.023. URL http://www.sciencedirect.com/science/article/pii/S0262885606002708.Computer Vision Applications

16. Goshtasby, A.A.: Fusion of multi-exposure images. Image Vision Comput. 23, 611–618(2005). DOI http://dx.doi.org/10.1016/j.imavis.2005.02.004. URL http://dx.doi.org/

10.1016/j.imavis.2005.02.004

17. Gracias, N., Mahoor, M., Negahdaripour, S., Gleason, A.: Fast image blending us-ing watersheds and graph cuts. Image and Vision Computing 27(5), 597 – 607(2009). DOI DOI:10.1016/j.imavis.2008.04.014. URL http://www.sciencedirect.com/

science/article/pii/S0262885608001005. The 17th British Machine Vision Confer-ence (BMVC 2006)

18. Graphics, I.C., Staff, A.: Compositing, part 1: Theory. IEEE Comput. Graph. Appl.14, 83–87 (1994). DOI 10.1109/38.310740. URL http://portal.acm.org/citation.

cfm?id=616032.617920

19. Haenselmann, T., Busse, M., Kopf, S., King, T., Effelsberg, W.: Multi perspectivepanoramic imaging. Image and Vision Computing 27(4), 391 – 401 (2009). DOI DOI:10.1016/j.imavis.2008.06.008. URL http://www.sciencedirect.com/science/article/

pii/S0262885608001303

20. Jia, J., Sun, J., Tang, C.K., Shum, H.Y.: Drag-and-drop pasting. ACM Trans. Graph.25, 631–637 (2006). DOI http://doi.acm.org/10.1145/1141911.1141934. URL http:

//doi.acm.org/10.1145/1141911.1141934

21. Kass, M., Witkin, A., Terzopoulos, D.: Snakes: Active contour models. INTERNA-TIONAL JOURNAL OF COMPUTER VISION 1(4), 321–331 (1988)

22. Lee, S., Wolberg, G., Shin, S.Y.: Polymorph: morphing among multiple images. Com-puter Graphics and Applications, IEEE 18(1), 58 –71 (1998). DOI 10.1109/38.637304

23. Levin, A., Zomet, A., Peleg, S., Weiss, Y.: Seamless image stitching in the gradientdomain. In: In Eighth European Conference on Computer Vision (ECCV 2004, pp.377–389. Springer-Verlag (2003)

24. Lin, L., Wang, Y., Liu, Y., Xiong, C., Zeng, K.: Marker-less registration basedon template tracking for augmented reality. Multimedia Tools Appl. 41(2), 235–252 (2009). DOI 10.1007/s11042-008-0227-y. URL http://dx.doi.org/10.1007/

s11042-008-0227-y

25. Maidi, M., Ababsa, F., Mallem, M.: Handling occlusions for robust augmented realitysystems. J. Image Video Process. 2010, 4:1–4:12 (2010). DOI 10.1155/2010/146123.URL http://dx.doi.org/10.1155/2010/146123

26. Mitchell, J.L.: Real-time synthesis and rendering of ocean water. ATI Technical Report27. Perez, P., Gangnet, M., Blake, A.: Poisson image editing. ACM Trans. Graph. 22,

313–318 (2003). DOI http://doi.acm.org/10.1145/882262.882269. URL http://doi.

acm.org/10.1145/882262.882269

28. Porter, T., Duff, T.: Compositing digital images. SIGGRAPH Comput. Graph. 18,253–259 (1984). DOI http://doi.acm.org/10.1145/964965.808606. URL http://doi.

acm.org/10.1145/964965.808606

29. Rother, C., Kolmogorov, V., Blake, A.: ”grabcut”: interactive foreground extractionusing iterated graph cuts. ACM Trans. Graph. 23, 309–314 (2004). DOI http://doi.acm.org/10.1145/1015706.1015720. URL http://doi.acm.org/10.1145/1015706.1015720

Page 19: An Image Composition Algorithm for Handling Global Visual ...farid/papers/MTAP2012.pdf · Photographers wish to master the art of photographing balanced, pleasant and meaningful pictures.

Image Composition 19

30. Ruprecht, D., Muller, H.: Image warping with scattered data interpolation. IEEEComput. Graph. Appl. 15, 37–43 (1995). DOI 10.1109/38.365004. URL http:

//portal.acm.org/citation.cfm?id=616035.617967

31. Seitz, S., Dyer, C.R.: View morphing: Uniquely predicting scene appearance from basisimages. In: In Proc. Image Understanding Workshop, pp. 881–887 (1997)

32. Seitz, S.M., Dyer, C.R.: View morphing. In: Proceedings of the 23rd annual conferenceon Computer graphics and interactive techniques, SIGGRAPH ’96, pp. 21–30. ACM,New York, NY, USA (1996). DOI http://doi.acm.org/10.1145/237170.237196. URLhttp://doi.acm.org/10.1145/237170.237196

33. Seitz, S.M., Kutulakos, K.N.: Plenoptic image editing. In: Proceedings of the SixthInternational Conference on Computer Vision, ICCV ’98, pp. 17–. IEEE ComputerSociety, Washington, DC, USA (1998). URL http://portal.acm.org/citation.cfm?

id=938978.939187

34. Stich, T., Linz, C., Wallraven, C., Cunningham, D., Magnor, M.: Perception-motivatedinterpolation of image sequences. ACM Trans. Appl. Percept. 8, 11:1–11:25 (2011).DOI http://doi.acm.org/10.1145/1870076.1870079. URL http://doi.acm.org/10.

1145/1870076.1870079

35. Suo, J., Lin, L., Shan, S., Chen, X., Gao, W.: High-resolution face fusion for gen-der conversion. Systems, Man and Cybernetics, Part A: Systems and Humans, IEEETransactions on 41(2), 226 –237 (2011). DOI 10.1109/TSMCA.2010.2064304

36. Szeliski, R.: Image alignment and stitching: a tutorial. Found. Trends. Comput.Graph. Vis. 2, 1–104 (2006). DOI 10.1561/0600000009. URL http://portal.acm.

org/citation.cfm?id=1295184.1295185

37. Toet, A.: Hierarchical image fusion. Mach. Vision Appl. 3, 1–11 (1990). DOI http://dx.doi.org/10.1007/BF01211447. URL http://dx.doi.org/10.1007/BF01211447

38. Toet, A., van Ruyven, J.J., Valeton, J.: Merging thermal and visual images by a contrastpyramid. Optical Engineering 14, 789–792 (1989)

39. Wallace, B.A.: Merging and transformation of raster images for cartoon animation.SIGGRAPH Comput. Graph. 15, 253–262 (1981). DOI http://doi.acm.org/10.1145/965161.806813. URL http://doi.acm.org/10.1145/965161.806813

40. Whitaker, R.: A level-set approach to image blending. Image Processing, IEEE Trans-actions on 9(11), 1849 –1861 (2000). DOI 10.1109/83.877208

41. Wolberg, G.: Digital Image Warping, 1st edn. IEEE Computer Society Press, LosAlamitos, CA, USA (1994)

42. Wolberg, G.: Recent advances in image morphing. In: Proceedings of the 1996 Con-ference on Computer Graphics International, CGI ’96, pp. 64–. IEEE Computer So-ciety, Washington, DC, USA (1996). URL http://portal.acm.org/citation.cfm?id=

792755.792831

43. Xiao, J., Shah, M.: Tri-view morphing. Comput. Vis. Image Underst. 96, 345–366(2004). DOI http://dx.doi.org/10.1016/j.cviu.2004.03.014. URL http://dx.doi.org/

10.1016/j.cviu.2004.03.014

44. Xiaogang, J., Huagen, W., Qunsheng, P.: Geometric deformations based on 3d volumemorphing. J. Comput. Sci. Technol. 16, 443–449 (2001). DOI 10.1007/BF02948962.URL http://portal.acm.org/citation.cfm?id=570063.570069

45. Xu, C., Prince, J.: Snakes, shapes, and gradient vector flow. Image Processing, IEEETransactions on 7(3), 359 –369 (1998). DOI 10.1109/83.661186

46. Yang, W., Zheng, J., Cai, J., Rahardja, S., Chen, C.W.: Natural and seamless imagecomposition with color control. Trans. Img. Proc. 18(11), 2584–2592 (2009)

47. Yuan, M.L., Ong, S.K., Nee, A.Y.C.: Technical section: A generalized registrationmethod for augmented reality systems. Comput. Graph. 29(6), 980–997 (2005). DOI10.1016/j.cag.2005.09.014. URL http://dx.doi.org/10.1016/j.cag.2005.09.014

48. Zhang, Q., Wang, L., Li, H., Ma, Z.: Similarity-based multimodality image fusionwith shiftable complex directional pyramid. Pattern Recogn. Lett. 32, 1544–1553(2011). DOI http://dx.doi.org/10.1016/j.patrec.2011.06.002. URL http://dx.doi.org/

10.1016/j.patrec.2011.06.002