21
logo Climb A Generic and Dynamic Approach to Image Processing Christopher Chedeau June 09, 2010

Climb - A Generic and Dynamic Approach to Image Processing

Embed Size (px)

DESCRIPTION

LRDE (EPITA Research & Development Lab http://www.lrde.epita.fr/) Seminar: A Generic and Dynamic Approach to Image Processing Abstract: "Climb is a generic image processing library. A case study of the erosion algorithm from mathematical morphology highlights the issues of a non-generic implementation. Structures such as Image, Site Set and Accumulator are defined to solve them. Genericity is even increased by the concept of Morphers: a way to alter the communication between an object and the outside world. All these additions are done using the dynamic aspect of Lisp that allows for rapid prototyping." Olena - http://olena.lrde.epita.fr/

Citation preview

Page 1: Climb - A Generic and Dynamic Approach to Image Processing

logo

ClimbA Generic and Dynamic Approach to Image Processing

Christopher Chedeau

June 09, 2010

Page 2: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Introduction

I Climb: Common Lisp image processing

I Same Genericity as Olena1

I With more Interactivity

1olena.lrde.epita.fr2 / 21

Page 3: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

ErosionDefinitionNaive VersionGenericity IssuesFinal Version

MorpherMorpher DefinitionContent MorpherCombination

Demonstration

ConclusionConclusionQuestionsBibliography

3 / 21

Page 4: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

ErosionDefinitionNaive VersionGenericity IssuesFinal Version

MorpherMorpher DefinitionContent MorpherCombination

Demonstration

ConclusionConclusionQuestionsBibliography

4 / 21

Page 5: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Erosion Definition

”All the pixels are replaced by the minimum value of thepixels around.”

5 / 21

Page 6: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Erosion Example

http://homepages.inf.ed.ac.uk/rbf/HIPR2/erode.htm

6 / 21

Page 7: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Dilation Example

http://homepages.inf.ed.ac.uk/rbf/HIPR2/dilate.htm

7 / 21

Page 8: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Naive Boolean 2D Version

// Loop through a l l t h e v a l i d image p i x e l sf o r ( x = 0 ; x < i mg w id t h ; ++x )

f o r ( y = 0 ; y < i m g h e i g h t ; ++y )

// I n i t i a l i z e t h e output imagenew image [ x ] [ y ] = TRUE;

// Loop through a l l t h e n e i g h b o r h o o d p i x e l sn e i g h b o r h o o d :

f o r ( i = −n e i g h b w i d t h ; i <= n e i g h b w i d t h ; ++i )f o r ( j = −n e i g h b h e i g h t ; j <= n e i g h b h e i g h t ; ++j )

i f ( ( x + i >= 0 && x + i < i mg w id t h ) &&( y + j >= 0 && y + j < i m g h e i g h t ) )

/∗ A l g o r i t h m ∗/i f ( o l d i m a g e [ x + i ] [ y + j ] == FALSE)

new image [ x ] [ y ] = FALSE ;b r e a k n e i g h b o r h o o d ;

8 / 21

Page 9: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Genericity Issues

I Image Structure

I Neighborhood

8-connexity 4-connexity Custom

I Algorithm• Difference between erosion and dilation? Min / Max• Accumulator• Black Box: Many inputs, Compute a result

I Value Type• Bool, Gray, RGB, ...• Specialize the Accumulator

9 / 21

Page 10: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Final Version

( de fun e r o s i o n ( img n e i g h b )( image−map img

( accu−r e d u c e n e i g h b( min−accu ) ) ) )

I Readable Algorithm

I Small Functions: Easily Unit Testable

I Extensible

I Write Once, Support Everything

10 / 21

Page 11: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

ErosionDefinitionNaive VersionGenericity IssuesFinal Version

MorpherMorpher DefinitionContent MorpherCombination

Demonstration

ConclusionConclusionQuestionsBibliography

11 / 21

Page 12: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Definition

I Alter communication protocol

I Non intrusive, Transparent, Memory Free

I Glue between Objects

Value Morpher

Image

Accumulator

Site Set

f Update

f get value

next

result

Query set value

take

12 / 21

Page 13: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

RGB to Gray Implementation

( make−direct−value−morpher− imageimage( lambda ( g r a y ) ( v e c t o r g r a y g r a y g r a y ) )( lambda ( rgb ) (/ ( r e d u c e #’+ rgb ) 3 ) )

13 / 21

Page 14: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Content MorpherI Work on SetsI Restriction

Content Morpher

Restriction

f

Site Set

Site

Site

Site

Site

• Custom-shaped Site Set• Cropped Image

I Addition• Image Border

I Ordering14 / 21

Page 15: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Combination

Available Value Morphers

Available Content Morphers

Available Concrete Objects

Object 2

Object 1

I Possibilities: Combination of ...• Concrete Objects• Value Morpher• Content Morpher• Repetition

15 / 21

Page 16: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

ErosionDefinitionNaive VersionGenericity IssuesFinal Version

MorpherMorpher DefinitionContent MorpherCombination

Demonstration

ConclusionConclusionQuestionsBibliography

16 / 21

Page 17: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Demonstration

( d e f p a r a m e t e r l e n a ( load− image ” l e n a . png” : magick ) )

( d e f p a r a m e t e r g r a y( make−direct−value−morpher− image l e n a

( lambda ( g r a y ) ( v e c t o r g r a y g r a y g r a y ) )( lambda ( rgb ) (/ ( r e d u c e #’+ rgb ) 3 ) ) ) )

( d e f p a r a m e t e r c8 ( make−box ( make−point −1 −1) ( make−point 1 1 ) ) )( d e f p a r a m e t e r c4 ( site−set−mask c8 #∗010111010))

( d e f p a r a m e t e r e r o ( e r o s i o n g r a y c4 ) )( d e f p a r a m e t e r d i l ( d i l a t i o n g r a y c4 ) )( d e f p a r a m e t e r d i f f ( image−combine−values #’− d i l e r o ) )

( d e f p a r a m e t e r f i n a l ( image−combine−values( lambda ( rgb edge )

( i f (> edge 50) ( v e c t o r 255 0 0) rgb ) )l e n a d i f f ) )

( save− image f i n a l ” f i n a l . png” : png )

Lena Gray Erosion Dilation Diff Final

17 / 21

Page 18: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

ErosionDefinitionNaive VersionGenericity IssuesFinal Version

MorpherMorpher DefinitionContent MorpherCombination

Demonstration

ConclusionConclusionQuestionsBibliography

18 / 21

Page 19: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Conclusion

I Personal Additions:• Fusion of Olena Concepts with Functionnal and

Dynamic Programming• Developer Friendly

I Current• Basic Morphological Operators• Morpher System

I Future• Genericity on Value Types• More Algorithms and Image Types• Performance

19 / 21

Page 20: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Questions

Questions ?

20 / 21

Page 21: Climb - A Generic and Dynamic Approach to Image Processing

logo

Climb

Erosion

Definition

Naive Version

Genericity Issues

Final Version

Morpher

Morpher Definition

Content Morpher

Combination

Demonstration

Conclusion

Conclusion

Questions

Bibliography

Bibliography

I Soille, P. (1999). Morphological Image Analysis -Principles and Applications. Springer-Verlag.

I Geraud, T. and Levillain, R. (2008). Semantics-drivengenericity: A sequel to the static c++ object-orientedprogramming paradigm (Scoop 2). In 6th InternationalWorkshop on Multiparadigm Programming withObject-Oriented Languages.

I Ballas, N. (2008). Image taxonomy in milena.Technical report, EPITA Research and DevelopmentLaboratory (LRDE).

I Denuziere, L. (2009). CLIMB: A dynamic approach togeneric image processing. Technical report, EPITAResearch and Development Laboratory (LRDE).

I Denuziere, L. (2010). Property-based genericity: Adynamic approach. Technical report, EPITA Researchand Development Laboratory (LRDE).

21 / 21