22
Plug-in and tutorial de velopment for GIMP- Cat hy Irwin, 2004 The Development of The Development of Image Completion and Image Completion and Tutorial Tutorial Plug-ins for the GIMP Plug-ins for the GIMP By: Cathy Irwin Supervisors: Shaun Bangay and Adele Lobb

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Embed Size (px)

Citation preview

Page 1: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

The Development of The Development of Image Completion and Image Completion and

Tutorial Tutorial Plug-ins for the GIMPPlug-ins for the GIMP

By: Cathy Irwin

Supervisors: Shaun Bangay and Adele Lobb

Page 2: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Project AimsProject Aims

Automatic image completion plug-in for GIMP (GNU Image Manipulation Package)

Tutorial for general plug-in development

Page 3: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Image CompletionImage Completion Remove scratches, defects, writing & objects,

reconstruct damaged images - Manual techniques

are painstaking

Automate process – user only selects region to be

removed

Plug-in: realistically fill in background regions by

analysing known regions

Page 4: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Related WorkRelated Work

Texture synthesis

Image inpainting Efros & Freeman (2001)

Bertalmio, Sapiro, Caselles & Ballester (2000)

Page 5: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Image Completion Plug-inImage Completion Plug-in

‘Fragment-Based Image Completion’– Drori, Cohen-Or & Yeshurun (2003)

Page 6: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

My ApproachMy Approach

Re-implementing proven technique BUT Incorporating it into the GIMP Inevitable differences – due to language, environment,

coding style

Verify authors’ results Scenarios

Textured regions Smooth regions Geometric shapes

Page 7: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Fragment-Based Image Fragment-Based Image Completion AlgorithmCompletion Algorithm

Fast Approximation

Confidence Map

Candidate Position Map

Search

Composite Fragments

Page 8: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Implementation in the GIMPImplementation in the GIMP

GIMP 2.0Use ‘empty’ plug-in templates as basis for

implementation The implementation language: C Gimp and GTK libraries

manipulate the GIMP-specific elements: images, drawables, channels and layers

Page 9: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Fast ApproximationFast Approximation

X

Page 10: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Fast ApproximationFast Approximation

Each step is added as a new layer to the original image

Manipulate and view independently of one another

Page 11: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Confidence MapConfidence Map Certainty with which the colour value of each pixel is

known Gaussian falloff value used to decreases the confidence

level towards the center of the unknown region

Page 12: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Candidate Position MapCandidate Position Map Takes confidence map as input Pixel with the maximum value in the candidate map is

concluded to be the next most appropriate target pixel to be used in the search and composite phases

Page 13: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Search PhaseSearch Phase

Iterates through each pixel in a 20 x 20 pixel block around the target to find an appropriate source pixel

Average value of the pixels around each potential source it is taken to determine the best possible match with the neighbourhood surrounding the target pixel

Size of this neighbourhood region determined by the user at run time but is usually about 8 pixels wide

The search formula finds the pixels which have a higher confidence in the source than in the target regions and correspond well in terms of colour

Page 14: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Compositing FragmentsCompositing Fragments Superimpose that source fragment over the target

fragment so that the detail from the source merges seamlessly with the region around the target.

Transparent edges - blend in convincingly Use existing GIMP functions:

– Selections– Copy– Paste

Page 15: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Page 16: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

ResultsResultsSuited to: Stochastic (random)

texture that occurs often in the surrounding region

Effective at making the reconstructed area blend into the known regions

Page 17: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Results cont…Results cont…

3D structure not taken into account

Complete image according to the direction the line was taking at the edge of the gap and not according to mathematical principles

Page 18: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Results cont…Results cont… Parameter values depend on the size of the gap

and the type of texture in the picture 160 x 120 pixel image: between 12 minutes and an

hour to process Smaller gaps need a smaller blur radius and

smaller neighbourhood search region. Larger, smooth or stochastic regions can be accurately completed using a larger neighbourhood region that also decreases the processing time

Page 19: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

Results cont…Results cont…

Page 20: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

On-line Plug-in Tutorial On-line Plug-in Tutorial General tutorial for writing plug-ins for the GIMP in

C Tutorial Page Provide a starting point for beginners, not a definitive

guide on every aspect of plug-in development Areas covered:

– areas that I found problematic during the development of the plug-in

– features that were discovered to be particularly useful– references to where more specific information can be

found

Page 21: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004

ConclusionConclusion Plug-in development aided by availability of templates and

documentation regarding GIMP specific functions Some common image manipulation operations complex to

implement Not possible to re-implement the original paper exactly

within the GIMP environment due to the tool and function constraints and the extra processing required for certain operations

A plausibly similar implementation has been achieved - takes advantage of GIMP functions to approximate the intentions of the original paper

Page 22: Plug-in and tutorial development for GIMP- Cathy Irwin, 2004 The Development of Image Completion and Tutorial Plug-ins for the GIMP By: Cathy Irwin Supervisors:

Plug-in and tutorial development for GIMP- Cathy Irwin, 2004