SlideShare a Scribd company logo
1 of 28
Genetic Vectorizer
                       By
                  Roger Alsing
Roger Alsing




                                    C#
Polygons        Overlap
                                 Vertex
3<Vertex<=10

                    ARGB
0<=Color<=255



0<Polygon<=255
        X,Y Field           Structure                 Point


Index                Node                 Link List
0<Index<255
DNADrawing                            DNAPoint
Init();
Mutate();
                                 Init();
addPolygon();
                                 Mutate();//move point
movePolygon();
removePolygon();
    LinkList<DNAPolygon >
                                 Int x,y;
           Polygons;
        DNAPolygon                            DNABrush
                                 Init();
Mutate();                        Mutate();//for each color
addPoint();
removePoint();                   Int Red;
                                 Int Blue;
                                 Int Green;
LinkList< DNAPoint > Polygons;   Int Alpha;
Brush brush;
Create initial random
       chromosome



  Mutate the chromosome



        Mutate gens

             No


      Evaluate fitness            Yes   Stop



Termination criteria satisfied?
DNADrawing
                      DNAPolygon



             Canvas




                                   …
                                   …
mutate()
removePolygon() movePolygon() addPolygon()

                                      mutate()
Mutate the chromosome

public void Mutate()
     {
        if (Tools.WillMutate( Settings.ActiveAddPolygonMutationRate ))
            AddPolygon();

        if (Tools.WillMutate( Settings.ActiveRemovePolygonMutationRate ) )
            RemovePolygon();

        if (Tools.WillMutate( Settings.ActiveMovePolygonMutationRate ))
            MovePolygon();

        foreach (DnaPolygon polygon in Polygons)
           polygon.Mutate(this);
    }
Node
                        Polygon


Overlap




     X=x;
     Y=y;   3<=Points<=10

               0<=RED <=255
               0<= BLUE <=255
               0<= GREEN
               <=255
               10<= ALPHA
Mutate Gens


public void Mutate( DnaDrawing drawing )
    {
       if (Tools.WillMutate( Settings.ActiveAddPointMutationRate ))
           AddPoint(drawing);

        if (Tools.WillMutate( Settings.ActiveRemovePointMutationRate ) )
            RemovePoint(drawing);

        Brush.Mutate ( drawing ) ;
        Points.ForEach (p => p.Mutate(drawing));
    }
Evaluate fitness
public static double GetDrawingFitness( DnaDrawing newDrawing,
Color[,]sourceColors)


for (int y = 0; y < Tools.MaxHeight; y++)
            {
               for (int x = 0; x < Tools.MaxWidth; x++)
               {
                  Color c1 = GetPixel(bmd1, x, y);
                  Color c2 = sourceColors[x, y];
                  double pixelError = GetColorFitness(c1, c2);
                  error += pixelError;
               }                                               r = orginal.R - current2.R;
            }                                                  g = orginal.G - current.G;
                                                               b = orginal.B - current.B;
 return error;
}                                                              return r*r + g*g + b*b;
Mona lisa
Mona lisa
Mona lisa
Mona lisa
Mona lisa
Mona lisa
Mona lisa
Mona lisa
Mona lisa
Mona lisa
Mona lisa
Mona lisa
Mona lisa
Mona lisa
Mona lisa
Mona lisa

More Related Content

What's hot

What's hot (20)

Дмитрий Верескун «Синтаксический сахар C#»
Дмитрий Верескун «Синтаксический сахар C#»Дмитрий Верескун «Синтаксический сахар C#»
Дмитрий Верескун «Синтаксический сахар C#»
 
OOP v3
OOP v3OOP v3
OOP v3
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Java programs
Java programsJava programs
Java programs
 
Container adapters
Container adaptersContainer adapters
Container adapters
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Pas oct12
Pas oct12Pas oct12
Pas oct12
 
PAS 2012
PAS 2012PAS 2012
PAS 2012
 
informatics practices practical file
informatics practices practical fileinformatics practices practical file
informatics practices practical file
 
C++ Programming - 11th Study
C++ Programming - 11th StudyC++ Programming - 11th Study
C++ Programming - 11th Study
 
Lecture04
Lecture04Lecture04
Lecture04
 
Advance java
Advance javaAdvance java
Advance java
 
C test
C testC test
C test
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_paper
 
High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14
 
Lambda Expressions in C++
Lambda Expressions in C++Lambda Expressions in C++
Lambda Expressions in C++
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)
 
硕士答辩Keynote
硕士答辩Keynote硕士答辩Keynote
硕士答辩Keynote
 
Advanced JavaScript
Advanced JavaScript Advanced JavaScript
Advanced JavaScript
 
C tech questions
C tech questionsC tech questions
C tech questions
 

Viewers also liked

Nova Apresentaçao Equipe Mais BBOM
Nova Apresentaçao Equipe Mais BBOMNova Apresentaçao Equipe Mais BBOM
Nova Apresentaçao Equipe Mais BBOMSandra Mangabeira
 
Voyage en toscane - deuxième diaporama - avril 2013
Voyage en toscane - deuxième diaporama - avril 2013Voyage en toscane - deuxième diaporama - avril 2013
Voyage en toscane - deuxième diaporama - avril 2013Lycée Le Corbusier
 
Orms news flash december 2014
Orms news flash december 2014Orms news flash december 2014
Orms news flash december 2014ORMSSupport
 
ORMS News Flash January 2014
ORMS News Flash January 2014ORMS News Flash January 2014
ORMS News Flash January 2014ORMSSupport
 
ORMS News Flash January 2014
ORMS News Flash January 2014ORMS News Flash January 2014
ORMS News Flash January 2014ORMSSupport
 
Orms news flash october 2013
Orms news flash october 2013Orms news flash october 2013
Orms news flash october 2013ORMSSupport
 
Orms news flash april 2014
Orms news flash april 2014Orms news flash april 2014
Orms news flash april 2014ORMSSupport
 
Orms news flash august 2014
Orms news flash august 2014Orms news flash august 2014
Orms news flash august 2014ORMSSupport
 
May chapter newsletter recap
May chapter newsletter recapMay chapter newsletter recap
May chapter newsletter recapORMSSupport
 

Viewers also liked (13)

Nova Apresentaçao Equipe Mais BBOM
Nova Apresentaçao Equipe Mais BBOMNova Apresentaçao Equipe Mais BBOM
Nova Apresentaçao Equipe Mais BBOM
 
Advance software engineering rm odp
Advance software  engineering rm odpAdvance software  engineering rm odp
Advance software engineering rm odp
 
Voyage en toscane - deuxième diaporama - avril 2013
Voyage en toscane - deuxième diaporama - avril 2013Voyage en toscane - deuxième diaporama - avril 2013
Voyage en toscane - deuxième diaporama - avril 2013
 
Rational unified processing
Rational unified processingRational unified processing
Rational unified processing
 
Zugzwang Chess Academy in Bangalore
Zugzwang Chess Academy in BangaloreZugzwang Chess Academy in Bangalore
Zugzwang Chess Academy in Bangalore
 
Orms news flash december 2014
Orms news flash december 2014Orms news flash december 2014
Orms news flash december 2014
 
ORMS News Flash January 2014
ORMS News Flash January 2014ORMS News Flash January 2014
ORMS News Flash January 2014
 
ORMS News Flash January 2014
ORMS News Flash January 2014ORMS News Flash January 2014
ORMS News Flash January 2014
 
Hp case study
Hp case studyHp case study
Hp case study
 
Orms news flash october 2013
Orms news flash october 2013Orms news flash october 2013
Orms news flash october 2013
 
Orms news flash april 2014
Orms news flash april 2014Orms news flash april 2014
Orms news flash april 2014
 
Orms news flash august 2014
Orms news flash august 2014Orms news flash august 2014
Orms news flash august 2014
 
May chapter newsletter recap
May chapter newsletter recapMay chapter newsletter recap
May chapter newsletter recap
 

Similar to Mona lisa

C# v8 new features - raimundas banevicius
C# v8 new features - raimundas baneviciusC# v8 new features - raimundas banevicius
C# v8 new features - raimundas baneviciusRaimundas Banevičius
 
Detecting Bugs in Binaries Using Decompilation and Data Flow Analysis
Detecting Bugs in Binaries Using Decompilation and Data Flow AnalysisDetecting Bugs in Binaries Using Decompilation and Data Flow Analysis
Detecting Bugs in Binaries Using Decompilation and Data Flow AnalysisSilvio Cesare
 
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Sean May
 
1 introduction to c program
1 introduction to c program1 introduction to c program
1 introduction to c programNishmaNJ
 
Marimba - A MapReduce-based Programming Model for Self-maintainable Aggregate...
Marimba - A MapReduce-based Programming Model for Self-maintainable Aggregate...Marimba - A MapReduce-based Programming Model for Self-maintainable Aggregate...
Marimba - A MapReduce-based Programming Model for Self-maintainable Aggregate...Johannes Schildgen
 
Soft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JSoft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JFlorent Biville
 
C C++ tutorial for beginners- tibacademy.in
C C++ tutorial for beginners- tibacademy.inC C++ tutorial for beginners- tibacademy.in
C C++ tutorial for beginners- tibacademy.inTIB Academy
 
clegoues-pwlconf-sept16-asPDF.pdf
clegoues-pwlconf-sept16-asPDF.pdfclegoues-pwlconf-sept16-asPDF.pdf
clegoues-pwlconf-sept16-asPDF.pdfaoecmtin
 
Refactoring group 1 - chapter 3,4,6
Refactoring   group 1 - chapter 3,4,6Refactoring   group 1 - chapter 3,4,6
Refactoring group 1 - chapter 3,4,6Duy Lâm
 
[系列活動] Data exploration with modern R
[系列活動] Data exploration with modern R[系列活動] Data exploration with modern R
[系列活動] Data exploration with modern R台灣資料科學年會
 
Bindings: the zen of montage
Bindings: the zen of montageBindings: the zen of montage
Bindings: the zen of montageKris Kowal
 
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)jon_bell
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1Troy Miles
 
Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Ismar Silveira
 
DevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JDevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JFlorent Biville
 
A gremlin in my graph confoo 2014
A gremlin in my graph confoo 2014A gremlin in my graph confoo 2014
A gremlin in my graph confoo 2014Damien Seguy
 

Similar to Mona lisa (20)

Genetic Programming in Python
Genetic Programming in PythonGenetic Programming in Python
Genetic Programming in Python
 
C# v8 new features - raimundas banevicius
C# v8 new features - raimundas baneviciusC# v8 new features - raimundas banevicius
C# v8 new features - raimundas banevicius
 
Detecting Bugs in Binaries Using Decompilation and Data Flow Analysis
Detecting Bugs in Binaries Using Decompilation and Data Flow AnalysisDetecting Bugs in Binaries Using Decompilation and Data Flow Analysis
Detecting Bugs in Binaries Using Decompilation and Data Flow Analysis
 
Java operators
Java operatorsJava operators
Java operators
 
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
 
1 introduction to c program
1 introduction to c program1 introduction to c program
1 introduction to c program
 
C sharp 8
C sharp 8C sharp 8
C sharp 8
 
Marimba - A MapReduce-based Programming Model for Self-maintainable Aggregate...
Marimba - A MapReduce-based Programming Model for Self-maintainable Aggregate...Marimba - A MapReduce-based Programming Model for Self-maintainable Aggregate...
Marimba - A MapReduce-based Programming Model for Self-maintainable Aggregate...
 
Soft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JSoft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4J
 
Php & my sql
Php & my sqlPhp & my sql
Php & my sql
 
C C++ tutorial for beginners- tibacademy.in
C C++ tutorial for beginners- tibacademy.inC C++ tutorial for beginners- tibacademy.in
C C++ tutorial for beginners- tibacademy.in
 
clegoues-pwlconf-sept16-asPDF.pdf
clegoues-pwlconf-sept16-asPDF.pdfclegoues-pwlconf-sept16-asPDF.pdf
clegoues-pwlconf-sept16-asPDF.pdf
 
Refactoring group 1 - chapter 3,4,6
Refactoring   group 1 - chapter 3,4,6Refactoring   group 1 - chapter 3,4,6
Refactoring group 1 - chapter 3,4,6
 
[系列活動] Data exploration with modern R
[系列活動] Data exploration with modern R[系列活動] Data exploration with modern R
[系列活動] Data exploration with modern R
 
Bindings: the zen of montage
Bindings: the zen of montageBindings: the zen of montage
Bindings: the zen of montage
 
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1
 
Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4
 
DevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JDevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4J
 
A gremlin in my graph confoo 2014
A gremlin in my graph confoo 2014A gremlin in my graph confoo 2014
A gremlin in my graph confoo 2014
 

Mona lisa

  • 1.
  • 2.
  • 3. Genetic Vectorizer By Roger Alsing Roger Alsing C#
  • 4. Polygons Overlap Vertex 3<Vertex<=10 ARGB 0<=Color<=255 0<Polygon<=255 X,Y Field Structure Point Index Node Link List 0<Index<255
  • 5. DNADrawing DNAPoint Init(); Mutate(); Init(); addPolygon(); Mutate();//move point movePolygon(); removePolygon(); LinkList<DNAPolygon > Int x,y; Polygons; DNAPolygon DNABrush Init(); Mutate(); Mutate();//for each color addPoint(); removePoint(); Int Red; Int Blue; Int Green; LinkList< DNAPoint > Polygons; Int Alpha; Brush brush;
  • 6. Create initial random chromosome Mutate the chromosome Mutate gens No Evaluate fitness Yes Stop Termination criteria satisfied?
  • 7. DNADrawing DNAPolygon Canvas … …
  • 9. Mutate the chromosome public void Mutate() { if (Tools.WillMutate( Settings.ActiveAddPolygonMutationRate )) AddPolygon(); if (Tools.WillMutate( Settings.ActiveRemovePolygonMutationRate ) ) RemovePolygon(); if (Tools.WillMutate( Settings.ActiveMovePolygonMutationRate )) MovePolygon(); foreach (DnaPolygon polygon in Polygons) polygon.Mutate(this); }
  • 10. Node Polygon Overlap X=x; Y=y; 3<=Points<=10 0<=RED <=255 0<= BLUE <=255 0<= GREEN <=255 10<= ALPHA
  • 11. Mutate Gens public void Mutate( DnaDrawing drawing ) { if (Tools.WillMutate( Settings.ActiveAddPointMutationRate )) AddPoint(drawing); if (Tools.WillMutate( Settings.ActiveRemovePointMutationRate ) ) RemovePoint(drawing); Brush.Mutate ( drawing ) ; Points.ForEach (p => p.Mutate(drawing)); }
  • 12. Evaluate fitness public static double GetDrawingFitness( DnaDrawing newDrawing, Color[,]sourceColors) for (int y = 0; y < Tools.MaxHeight; y++) { for (int x = 0; x < Tools.MaxWidth; x++) { Color c1 = GetPixel(bmd1, x, y); Color c2 = sourceColors[x, y]; double pixelError = GetColorFitness(c1, c2); error += pixelError; } r = orginal.R - current2.R; } g = orginal.G - current.G; b = orginal.B - current.B; return error; } return r*r + g*g + b*b;