SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
Modelling Research Seminar


     Machine vision and device integration with the Ruby Programming Language

                                                J. Wedekinda

                                        Friday, February 29th 2008
                              Microsystems and Machine Vision Laboratory
                 Modelling Research Centre, Materials Engineering Research Institute




a
    Dr J. R. Travis, Dr M. Thompson, Dr B. P. Amavasai, Nanorobotics EPSRC Basic Technology grant GR/S85696/01
Introduction
          Nanorobotics Project

                   environment
• transmission electron microscope
• digital camera
• piezo controller
• nano indenter
Introduction
            MiCRoN Project

                   environment
• micro camera
• digital camera
• piezo drives
• gripper
Introduction
Proprietary Business Model
Introduction
            Community Development Model




“The market need is greatest for platform products
because of the importance of a reliable promise that
vendor lock-in will not endanger the survival of products
built or modified on the software stack above that
platform.” - Ron Goldman & Richard P. Gabriel

“It is important to remove as many barriers to
collaboration as possible: social, political, and technical.” -
Ron Goldman & Richard P. Gabriel
Introduction
                                              GPLv3 versus BSD license

four freedoms (Richard Stallman)
 1. The freedom to run the program, for any purpose.
 2. The freedom to study how the program works, and adapt it to
    your needs.
 3. The freedom to redistribute copies so you can help your neighbor.
 4. The freedom to improve the program, and release your
    improvements to the public, so that the whole community
    benefits.
respect the freedom of downstream users (Richard Stallman)
GPL requires derived works to be available under the same license.
covenant not to assert patent claims (Eben Moglen)
GPLv3 deters users of the program from instituting patent ligitation by
the threat of withdrawing further rights to use the program.
other (Eben Moglen)
GPLv3 has regulations against DMCA restrictions and tivoization.
Introduction
Code Reuse
Ruby Programming Language
                                                Tiobe Index

Position Position                                        Ratings   Delta
                  Delta in Position Programming Language                   Status
Feb 2008 Feb 2007                                        Feb 2008 Feb 2007
   1        1                               Java         21.483%   +2.50%   A

   2        2                                C           14.859%   11.24%   A
   3        5                          (Visual) Basic    11.604%   +3.24%   A
   4        4                               PHP          9.890%    +1.04%   A
   5        3                              C++           9.274%    11.49%   A
   6        6                               Perl         6.205%    +0.13%   A

   7        7                             Python         4.763%    +1.20%   A

   8        8                               C#           4.510%    +1.32%   A
   9        12                            Delphi         2.798%    +0.72%   A
  10        9                            JavaScript      2.334%    10.65%   A
  11        10                             Ruby          1.862%    10.67%   A
  12        15                               D           1.190%    10.01%   A
  13        13                            PL/SQL         0.981%    10.65%   A
  14        11                              SAS          0.949%    11.38%   A
  15        18                            COBOL          0.842%    +0.19%   A
  16        22                         FoxPro/xBase      0.538%    +0.02%   B
  17        19                            Pascal         0.445%    10.15%   B
  18        44                              Lua          0.388%    +0.27%   B
  19        17                              Ada          0.385%    10.28%   B
  20        16                         Lisp/Scheme       0.354%    10.37%   B


                     http://www.tiobe.com/
Ruby Programming Language
                              Speed Comparison




Language   Implementation    Time     Relative Speed

C          gcc 4.0.1         0.05 s     1.00×
Java       Java 1.4.2        0.40 s     8.00×
Lua        Lua 5.1           1.50 s    30.00×
Python     Python 2.5.1      9.99 s   199.80×
Perl       Perl 5.8.6       21.75 s   435.00×
Ruby       Ruby 1.8.4       34.31 s   686.18×
Lisp       Emacs Lisp       47.25 s   945.00×

http://www.timestretch.com/FractalBenchmark.html
Ruby Programming Language
                                Trivial Facts


                               Ruby
 • created by Yukihiro Matsumoto
 • released 1995
 • inspired by Perl, Python, Smalltalk, Eiffel, Ada, and Lisp
 • “pseudo simplicity”: simple syntax ⇔ multi-paradigm language
 • highly portable
“Ruby is simple in appearance, but is very complex inside, just like
our human body.” - Yukihiro Matsumoto
                          Ruby on Rails
 • web application framework based on Ruby
 • created by David Heinemeier Hansson
 • released 2004
Ruby Programming Language
                                                          Simple Syntax

                                                                                         #
require ’complex’
class Mandelbrot                                                                     ##
                                                                                   ######
  def initialize                                                                   ######
                                                                                #   ###
    for y in -15..15 do                                                  ##   ################
                                                                         ##########################
      for x in -50..23 do                                               ##########################
        print iterate( x/30.0, y/15.0 )                                #############################
                                                                     #################################
      end; puts; end                                   #   #         ################################
                                                       #########    #################################
  end                                                ############# ##################################
  def iterate( x, y )                               ################################################
                                       ##########################################################
    c, z = Complex( x, y ), 0.0                     ################################################
                                                     ############# ##################################
    for i in 0...100                                   #########    #################################
                                                       #   #         ################################
      z = z ** 2 + c                                                 #################################
      return ’ ’ if ( z.abs2 > 4 )                                     #############################
                                                                        ##########################
    end                                                                  ##########################
                                                                         ##   ################
    return ’#’                                                                  #   ###
  end                                                                              ######
                                                                                   ######
end                                                                                  ##

Mandelbrot.new                                                                           #
Ruby Programming Language
                                                        Properties I




• interpreted language (“def” is a statement which defines a method)

• dynamically typed variable: name, value

• everything is an object (no basic types as in C++, Java, ...)

• type inspection
Ruby Programming Language
                                                        Properties II




• mark-and-sweep garbage collector

• object orientation, dynamic single-dispatch

• reflection (message passing)

• metaprogramming (overloading methods during runtime)
Ruby Programming Language
                                                       Properties III




• graph of context objects (using garbage collector) instead of global namespace and stack

• closures (lambda expression with context)
   – unifying concept for function objects, iterators
   – control structures can be exported as methods

• continuations instead of goto/break

• mixins: unifying concept for namespaces and interfaces

• exception handling: decouple occurrence and handling of error
Ruby Programming Language
                                               Ruby Extensions I

                                      mbrot.cc
// g++ -shared -fPIC -I/usr/lib/ruby/1.8/x86_64-linux -o mbrot.so mbrot.cc
#include <complex>
#include <ruby.h>
VALUE iterate( VALUE rbSelf, VALUE rbX, VALUE rbY )
{
  std::complex< double > c( NUM2DBL( rbX ), NUM2DBL( rbY ) ), z( 0, 0 );
  for ( int i=0; i<100; i++ ) {
    z = z * z + c;
    if ( std::norm( z ) > 4 ) return rb_str_new2( " " );
  };
  return rb_str_new2( "#" );
}
extern "C" void Init_mbrot(void) {
  VALUE cMandelbrot = rb_define_class( "Mandelbrot", rb_cObject );
  rb_define_method( cMandelbrot, "iterate", RUBY_METHOD_FUNC( iterate ), 2 );
  rb_require( "mbrot_ext.rb" );
}
Ruby Programming Language
                                           Ruby Extensions II

                                                                                       #

                                                                                    ##
                                                                                  ######
mbrot ext.rb                                                                      ######
                                                                               #   ###
class Mandelbrot                                                        ##   ################
                                                                        ##########################
  def initialize                                                       ##########################
    for y in -15..15 do                                               #############################
                                                                    #################################
      for x in -50..23 do                             #   #         ################################
                                                      #########    #################################
        print iterate( x/30.0, y/15.0 )             ############# ##################################
                                                   ################################################
      end; puts; end                  ##########################################################
  end                                              ################################################
                                                    ############# ##################################
end                                                   #########    #################################
                                                      #   #         ################################
                                                                    #################################
mandelbrot2.rb                                                        #############################
                                                                       ##########################
require ’mbrot’                                                         ##########################
                                                                        ##   ################
Mandelbrot.new                                                                 #   ###
                                                                                  ######
                                                                                  ######
                                                                                    ##

                                                                                       #
Device Integration
    JEOL Transmission Electron Microscope




Serial Interface, ECL
Device Integration
Nanomagnetics Instruments Ltd




.4




PCI-DIO24 driver by Warren Jasper
Device Integration
   TVIPS Firewire Digital Camera




 • IEEE1394 electronic interface
 • IIDC/DCAM protocol
libdc1394 and coriander by
Damien Douxchamps
Machine Vision
                           Colourspace Conversions




                                         
 Y   0.299
  
                   0.587     0.114 
                                      
                                         R  0 
                                             
                                             
  
                                   
                                            
                                             
 =
  
  
Cb  −0.168736 −0.331264
                                      
                                          + 
                                             
                                             
                                0.500    G 128
                                   
                                            
  
  
                                   
                                      
                                            
                                             
                                             
  
                                   
                                            
                                             
C   0.500
   r               −0.418688 −0.081312    B  128
           also see: http://fourcc.org/
Machine Vision
                                                                         Array Operations



                   +,−                                  *,/
RGB                                RGB
                                                                                Computing “img/2”
Complex                            Complex
                                                                        1. Message “/” with parameter “2” is
Scalar                             Scalar
                                                                           send to “img”
                   Complex




                                                        Complex
          Scalar




                                               Scalar
                                                                        2. Message is dispatched to class
                             RGB




                                                                  RGB
                                                                           “MultiArray”
                   **                       clip_lower,clip_upper
RGB                                RGB                                  3. Method
Complex                            Complex
                                                                           “scalarright div ubyte ubytergb” is
                                                                           checked for
Scalar                             Scalar
                                                                        4. Native implementation is invoked
                   Complex




                                                        Complex
          Scalar




                                               Scalar
                             RGB




                                                                  RGB
Machine Vision
                                                 Warps




w, h = img.shape[0], img.shape[1] / 2
v = MultiArray.new( MultiArray::LINT,
                    h, h, 2 )
x = xramp( h, h )
y = yramp( h, h )
c = 0.5 * h
v[ 0...h, 0...h, 0 ] =
  ( ( ( x - c ).atan2( y - c ) / PI + 1 ) *
    w / 2 - 0.5 )
v[ 0...h, 0...h, 1 ] =
  ( ( x - c ) ** 2 + ( y - c ) ** 2 ).sqrt
result = img.warp_clipped( v )
Machine Vision
   Warps
Machine Vision
                 CMU project “Lucas-Kanade 20 Years On”




http://www.ri.cmu.edu/projects/project_515.html
Machine Vision
                                               Lucas-Kanade Tracker

                                    Initialisation
p = Vector[ xshift, yshift, rotation ]
x, y = xramp( *tpl.shape ), yramp( *tpl.shape )
gx = tpl.gauss_gradient_x( sigma )
gy = tpl.gauss_gradient_y( sigma )
c = Matrix[ [ 1, 0 ], [ 0, 1 ], [ -y, x ] ] * Vector[ gx, gy ]
hs = ( c * c.covector ).collect { |e| e.sum }

                                  Tracking Iteration
field = MultiArray.new( MultiArray::LINT, w, h, 2 )
field[ 0...w, 0...h, 0 ] = x * cos( p[2] ) - y * sin( p[2] ) + p[0]
field[ 0...w, 0...h, 1 ] = x * sin( p[2] ) + y * cos( p[2] ) + p[1]
diff = img.warp_clipped( field ).to_type( MultiArray::SFLOAT ) - tpl
s = c.collect { |e| ( e * diff ).sum }
d = hs.inverse * s
p += Matrix[ [ cos(p[2]), -sin(p[2]), 0 ],
             [ sin(p[2]), cos(p[2]), 0 ],
             [          0,          0, 1 ] ] * d
Conclusion



conclusion

 • native implementation in C++, Ruby as glue-code

 • development platform for microscopy software and general purpose machine vision

 • used for medical imaging, industrial inspection, measuring abrasion

future work

 • feature-based object recognition algorithm

 • GPU acceleration, parallel processing

 • support typical workflow on a microscope

web
http://www.wedesoft.demon.co.uk/hornetseye-api/
http://rubyforge.org/projects/hornetseye/
http://sourceforge.net/projects/hornetseye/

Mais conteúdo relacionado

Semelhante a Machine vision and device integration with the Ruby programming language (2008)

Ruby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programingRuby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programingBozhidar Batsov
 
Ruby for .NET developers
Ruby for .NET developersRuby for .NET developers
Ruby for .NET developersMax Titov
 
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...Etiene Dalcol
 
XML Amsterdam 2012 Keynote
XML Amsterdam 2012 KeynoteXML Amsterdam 2012 Keynote
XML Amsterdam 2012 Keynotejimfuller2009
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHiroshi SHIBATA
 
Migrating To Ruby1.9
Migrating To Ruby1.9Migrating To Ruby1.9
Migrating To Ruby1.9tomaspavelka
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for RubyHiroshi SHIBATA
 
Join Our Party: The Cloud Native Adventure Brigade (Kubernetes Belgium 2019)
Join Our Party: The Cloud Native Adventure Brigade (Kubernetes Belgium 2019)Join Our Party: The Cloud Native Adventure Brigade (Kubernetes Belgium 2019)
Join Our Party: The Cloud Native Adventure Brigade (Kubernetes Belgium 2019)bridgetkromhout
 
Spring, CDI, Jakarta EE good parts
Spring, CDI, Jakarta EE good partsSpring, CDI, Jakarta EE good parts
Spring, CDI, Jakarta EE good partsJarek Ratajski
 
Types are eating the world
Types are eating the worldTypes are eating the world
Types are eating the worldFangda Wang
 
Raphael Amorim - Scrating React Fiber
Raphael Amorim - Scrating React FiberRaphael Amorim - Scrating React Fiber
Raphael Amorim - Scrating React FiberReact Conf Brasil
 
Functional solid
Functional solidFunctional solid
Functional solidMatt Stine
 
(java2days) Is the Future of Java Cloudy?
(java2days) Is the Future of Java Cloudy?(java2days) Is the Future of Java Cloudy?
(java2days) Is the Future of Java Cloudy?Steve Poole
 
Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)Tobias Pfeiffer
 

Semelhante a Machine vision and device integration with the Ruby programming language (2008) (20)

Ruby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programingRuby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programing
 
Ruby for .NET developers
Ruby for .NET developersRuby for .NET developers
Ruby for .NET developers
 
Ruby
RubyRuby
Ruby
 
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
 
Web application intro
Web application introWeb application intro
Web application intro
 
XML Amsterdam 2012 Keynote
XML Amsterdam 2012 KeynoteXML Amsterdam 2012 Keynote
XML Amsterdam 2012 Keynote
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby Core
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
 
Migrating To Ruby1.9
Migrating To Ruby1.9Migrating To Ruby1.9
Migrating To Ruby1.9
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for Ruby
 
Join Our Party: The Cloud Native Adventure Brigade (Kubernetes Belgium 2019)
Join Our Party: The Cloud Native Adventure Brigade (Kubernetes Belgium 2019)Join Our Party: The Cloud Native Adventure Brigade (Kubernetes Belgium 2019)
Join Our Party: The Cloud Native Adventure Brigade (Kubernetes Belgium 2019)
 
Spring, CDI, Jakarta EE good parts
Spring, CDI, Jakarta EE good partsSpring, CDI, Jakarta EE good parts
Spring, CDI, Jakarta EE good parts
 
Plataforma java
Plataforma javaPlataforma java
Plataforma java
 
Types are eating the world
Types are eating the worldTypes are eating the world
Types are eating the world
 
Raphael Amorim - Scrating React Fiber
Raphael Amorim - Scrating React FiberRaphael Amorim - Scrating React Fiber
Raphael Amorim - Scrating React Fiber
 
Ruby Kaigi 2008 LT
Ruby Kaigi 2008 LTRuby Kaigi 2008 LT
Ruby Kaigi 2008 LT
 
Functional solid
Functional solidFunctional solid
Functional solid
 
(java2days) Is the Future of Java Cloudy?
(java2days) Is the Future of Java Cloudy?(java2days) Is the Future of Java Cloudy?
(java2days) Is the Future of Java Cloudy?
 
C c#
C c#C c#
C c#
 
Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)
 

Mais de Jan Wedekind

The SOLID Principles for Software Design
The SOLID Principles for Software DesignThe SOLID Principles for Software Design
The SOLID Principles for Software DesignJan Wedekind
 
Computer vision for microscopes
Computer vision for microscopesComputer vision for microscopes
Computer vision for microscopesJan Wedekind
 
Reconstruction (of micro-objects) based on focus-sets using blind deconvoluti...
Reconstruction (of micro-objects) based on focus-sets using blind deconvoluti...Reconstruction (of micro-objects) based on focus-sets using blind deconvoluti...
Reconstruction (of micro-objects) based on focus-sets using blind deconvoluti...Jan Wedekind
 
Fokus-serien basierte Rekonstruktion von Mikroobjekten (2002)
Fokus-serien basierte Rekonstruktion von Mikroobjekten (2002)Fokus-serien basierte Rekonstruktion von Mikroobjekten (2002)
Fokus-serien basierte Rekonstruktion von Mikroobjekten (2002)Jan Wedekind
 
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...Jan Wedekind
 
Machine Vision made easy with Ruby - ShRUG June 2010
Machine Vision made easy with Ruby - ShRUG June 2010Machine Vision made easy with Ruby - ShRUG June 2010
Machine Vision made easy with Ruby - ShRUG June 2010Jan Wedekind
 
Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009Jan Wedekind
 
Real-time Computer Vision With Ruby - OSCON 2008
Real-time Computer Vision With Ruby - OSCON 2008Real-time Computer Vision With Ruby - OSCON 2008
Real-time Computer Vision With Ruby - OSCON 2008Jan Wedekind
 
Object Recognition and Real-Time Tracking in Microscope Imaging - IMVIP 2006
Object Recognition and Real-Time Tracking in Microscope Imaging - IMVIP 2006Object Recognition and Real-Time Tracking in Microscope Imaging - IMVIP 2006
Object Recognition and Real-Time Tracking in Microscope Imaging - IMVIP 2006Jan Wedekind
 
Steerable Filters generated with the Hypercomplex Dual-Tree Wavelet Transform...
Steerable Filters generated with the Hypercomplex Dual-Tree Wavelet Transform...Steerable Filters generated with the Hypercomplex Dual-Tree Wavelet Transform...
Steerable Filters generated with the Hypercomplex Dual-Tree Wavelet Transform...Jan Wedekind
 
Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009
Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009
Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009Jan Wedekind
 

Mais de Jan Wedekind (11)

The SOLID Principles for Software Design
The SOLID Principles for Software DesignThe SOLID Principles for Software Design
The SOLID Principles for Software Design
 
Computer vision for microscopes
Computer vision for microscopesComputer vision for microscopes
Computer vision for microscopes
 
Reconstruction (of micro-objects) based on focus-sets using blind deconvoluti...
Reconstruction (of micro-objects) based on focus-sets using blind deconvoluti...Reconstruction (of micro-objects) based on focus-sets using blind deconvoluti...
Reconstruction (of micro-objects) based on focus-sets using blind deconvoluti...
 
Fokus-serien basierte Rekonstruktion von Mikroobjekten (2002)
Fokus-serien basierte Rekonstruktion von Mikroobjekten (2002)Fokus-serien basierte Rekonstruktion von Mikroobjekten (2002)
Fokus-serien basierte Rekonstruktion von Mikroobjekten (2002)
 
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...
Digital Imaging with Free Software - Talk at Sheffield Astronomical Society J...
 
Machine Vision made easy with Ruby - ShRUG June 2010
Machine Vision made easy with Ruby - ShRUG June 2010Machine Vision made easy with Ruby - ShRUG June 2010
Machine Vision made easy with Ruby - ShRUG June 2010
 
Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009
 
Real-time Computer Vision With Ruby - OSCON 2008
Real-time Computer Vision With Ruby - OSCON 2008Real-time Computer Vision With Ruby - OSCON 2008
Real-time Computer Vision With Ruby - OSCON 2008
 
Object Recognition and Real-Time Tracking in Microscope Imaging - IMVIP 2006
Object Recognition and Real-Time Tracking in Microscope Imaging - IMVIP 2006Object Recognition and Real-Time Tracking in Microscope Imaging - IMVIP 2006
Object Recognition and Real-Time Tracking in Microscope Imaging - IMVIP 2006
 
Steerable Filters generated with the Hypercomplex Dual-Tree Wavelet Transform...
Steerable Filters generated with the Hypercomplex Dual-Tree Wavelet Transform...Steerable Filters generated with the Hypercomplex Dual-Tree Wavelet Transform...
Steerable Filters generated with the Hypercomplex Dual-Tree Wavelet Transform...
 
Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009
Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009
Ruby & Machine Vision - Talk at Sheffield Hallam University Feb 2009
 

Último

Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Último (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Machine vision and device integration with the Ruby programming language (2008)

  • 1. Modelling Research Seminar Machine vision and device integration with the Ruby Programming Language J. Wedekinda Friday, February 29th 2008 Microsystems and Machine Vision Laboratory Modelling Research Centre, Materials Engineering Research Institute a Dr J. R. Travis, Dr M. Thompson, Dr B. P. Amavasai, Nanorobotics EPSRC Basic Technology grant GR/S85696/01
  • 2. Introduction Nanorobotics Project environment • transmission electron microscope • digital camera • piezo controller • nano indenter
  • 3. Introduction MiCRoN Project environment • micro camera • digital camera • piezo drives • gripper
  • 5. Introduction Community Development Model “The market need is greatest for platform products because of the importance of a reliable promise that vendor lock-in will not endanger the survival of products built or modified on the software stack above that platform.” - Ron Goldman & Richard P. Gabriel “It is important to remove as many barriers to collaboration as possible: social, political, and technical.” - Ron Goldman & Richard P. Gabriel
  • 6. Introduction GPLv3 versus BSD license four freedoms (Richard Stallman) 1. The freedom to run the program, for any purpose. 2. The freedom to study how the program works, and adapt it to your needs. 3. The freedom to redistribute copies so you can help your neighbor. 4. The freedom to improve the program, and release your improvements to the public, so that the whole community benefits. respect the freedom of downstream users (Richard Stallman) GPL requires derived works to be available under the same license. covenant not to assert patent claims (Eben Moglen) GPLv3 deters users of the program from instituting patent ligitation by the threat of withdrawing further rights to use the program. other (Eben Moglen) GPLv3 has regulations against DMCA restrictions and tivoization.
  • 8. Ruby Programming Language Tiobe Index Position Position Ratings Delta Delta in Position Programming Language Status Feb 2008 Feb 2007 Feb 2008 Feb 2007 1 1 Java 21.483% +2.50% A 2 2 C 14.859% 11.24% A 3 5 (Visual) Basic 11.604% +3.24% A 4 4 PHP 9.890% +1.04% A 5 3 C++ 9.274% 11.49% A 6 6 Perl 6.205% +0.13% A 7 7 Python 4.763% +1.20% A 8 8 C# 4.510% +1.32% A 9 12 Delphi 2.798% +0.72% A 10 9 JavaScript 2.334% 10.65% A 11 10 Ruby 1.862% 10.67% A 12 15 D 1.190% 10.01% A 13 13 PL/SQL 0.981% 10.65% A 14 11 SAS 0.949% 11.38% A 15 18 COBOL 0.842% +0.19% A 16 22 FoxPro/xBase 0.538% +0.02% B 17 19 Pascal 0.445% 10.15% B 18 44 Lua 0.388% +0.27% B 19 17 Ada 0.385% 10.28% B 20 16 Lisp/Scheme 0.354% 10.37% B http://www.tiobe.com/
  • 9. Ruby Programming Language Speed Comparison Language Implementation Time Relative Speed C gcc 4.0.1 0.05 s 1.00× Java Java 1.4.2 0.40 s 8.00× Lua Lua 5.1 1.50 s 30.00× Python Python 2.5.1 9.99 s 199.80× Perl Perl 5.8.6 21.75 s 435.00× Ruby Ruby 1.8.4 34.31 s 686.18× Lisp Emacs Lisp 47.25 s 945.00× http://www.timestretch.com/FractalBenchmark.html
  • 10. Ruby Programming Language Trivial Facts Ruby • created by Yukihiro Matsumoto • released 1995 • inspired by Perl, Python, Smalltalk, Eiffel, Ada, and Lisp • “pseudo simplicity”: simple syntax ⇔ multi-paradigm language • highly portable “Ruby is simple in appearance, but is very complex inside, just like our human body.” - Yukihiro Matsumoto Ruby on Rails • web application framework based on Ruby • created by David Heinemeier Hansson • released 2004
  • 11. Ruby Programming Language Simple Syntax # require ’complex’ class Mandelbrot ## ###### def initialize ###### # ### for y in -15..15 do ## ################ ########################## for x in -50..23 do ########################## print iterate( x/30.0, y/15.0 ) ############################# ################################# end; puts; end # # ################################ ######### ################################# end ############# ################################## def iterate( x, y ) ################################################ ########################################################## c, z = Complex( x, y ), 0.0 ################################################ ############# ################################## for i in 0...100 ######### ################################# # # ################################ z = z ** 2 + c ################################# return ’ ’ if ( z.abs2 > 4 ) ############################# ########################## end ########################## ## ################ return ’#’ # ### end ###### ###### end ## Mandelbrot.new #
  • 12. Ruby Programming Language Properties I • interpreted language (“def” is a statement which defines a method) • dynamically typed variable: name, value • everything is an object (no basic types as in C++, Java, ...) • type inspection
  • 13. Ruby Programming Language Properties II • mark-and-sweep garbage collector • object orientation, dynamic single-dispatch • reflection (message passing) • metaprogramming (overloading methods during runtime)
  • 14. Ruby Programming Language Properties III • graph of context objects (using garbage collector) instead of global namespace and stack • closures (lambda expression with context) – unifying concept for function objects, iterators – control structures can be exported as methods • continuations instead of goto/break • mixins: unifying concept for namespaces and interfaces • exception handling: decouple occurrence and handling of error
  • 15. Ruby Programming Language Ruby Extensions I mbrot.cc // g++ -shared -fPIC -I/usr/lib/ruby/1.8/x86_64-linux -o mbrot.so mbrot.cc #include <complex> #include <ruby.h> VALUE iterate( VALUE rbSelf, VALUE rbX, VALUE rbY ) { std::complex< double > c( NUM2DBL( rbX ), NUM2DBL( rbY ) ), z( 0, 0 ); for ( int i=0; i<100; i++ ) { z = z * z + c; if ( std::norm( z ) > 4 ) return rb_str_new2( " " ); }; return rb_str_new2( "#" ); } extern "C" void Init_mbrot(void) { VALUE cMandelbrot = rb_define_class( "Mandelbrot", rb_cObject ); rb_define_method( cMandelbrot, "iterate", RUBY_METHOD_FUNC( iterate ), 2 ); rb_require( "mbrot_ext.rb" ); }
  • 16. Ruby Programming Language Ruby Extensions II # ## ###### mbrot ext.rb ###### # ### class Mandelbrot ## ################ ########################## def initialize ########################## for y in -15..15 do ############################# ################################# for x in -50..23 do # # ################################ ######### ################################# print iterate( x/30.0, y/15.0 ) ############# ################################## ################################################ end; puts; end ########################################################## end ################################################ ############# ################################## end ######### ################################# # # ################################ ################################# mandelbrot2.rb ############################# ########################## require ’mbrot’ ########################## ## ################ Mandelbrot.new # ### ###### ###### ## #
  • 17. Device Integration JEOL Transmission Electron Microscope Serial Interface, ECL
  • 18. Device Integration Nanomagnetics Instruments Ltd .4 PCI-DIO24 driver by Warren Jasper
  • 19. Device Integration TVIPS Firewire Digital Camera • IEEE1394 electronic interface • IIDC/DCAM protocol libdc1394 and coriander by Damien Douxchamps
  • 20. Machine Vision Colourspace Conversions          Y   0.299       0.587 0.114    R  0                           =       Cb  −0.168736 −0.331264    +          0.500  G 128                                                  C   0.500 r −0.418688 −0.081312  B  128 also see: http://fourcc.org/
  • 21. Machine Vision Array Operations +,− *,/ RGB RGB Computing “img/2” Complex Complex 1. Message “/” with parameter “2” is Scalar Scalar send to “img” Complex Complex Scalar Scalar 2. Message is dispatched to class RGB RGB “MultiArray” ** clip_lower,clip_upper RGB RGB 3. Method Complex Complex “scalarright div ubyte ubytergb” is checked for Scalar Scalar 4. Native implementation is invoked Complex Complex Scalar Scalar RGB RGB
  • 22. Machine Vision Warps w, h = img.shape[0], img.shape[1] / 2 v = MultiArray.new( MultiArray::LINT, h, h, 2 ) x = xramp( h, h ) y = yramp( h, h ) c = 0.5 * h v[ 0...h, 0...h, 0 ] = ( ( ( x - c ).atan2( y - c ) / PI + 1 ) * w / 2 - 0.5 ) v[ 0...h, 0...h, 1 ] = ( ( x - c ) ** 2 + ( y - c ) ** 2 ).sqrt result = img.warp_clipped( v )
  • 23. Machine Vision Warps
  • 24. Machine Vision CMU project “Lucas-Kanade 20 Years On” http://www.ri.cmu.edu/projects/project_515.html
  • 25. Machine Vision Lucas-Kanade Tracker Initialisation p = Vector[ xshift, yshift, rotation ] x, y = xramp( *tpl.shape ), yramp( *tpl.shape ) gx = tpl.gauss_gradient_x( sigma ) gy = tpl.gauss_gradient_y( sigma ) c = Matrix[ [ 1, 0 ], [ 0, 1 ], [ -y, x ] ] * Vector[ gx, gy ] hs = ( c * c.covector ).collect { |e| e.sum } Tracking Iteration field = MultiArray.new( MultiArray::LINT, w, h, 2 ) field[ 0...w, 0...h, 0 ] = x * cos( p[2] ) - y * sin( p[2] ) + p[0] field[ 0...w, 0...h, 1 ] = x * sin( p[2] ) + y * cos( p[2] ) + p[1] diff = img.warp_clipped( field ).to_type( MultiArray::SFLOAT ) - tpl s = c.collect { |e| ( e * diff ).sum } d = hs.inverse * s p += Matrix[ [ cos(p[2]), -sin(p[2]), 0 ], [ sin(p[2]), cos(p[2]), 0 ], [ 0, 0, 1 ] ] * d
  • 26. Conclusion conclusion • native implementation in C++, Ruby as glue-code • development platform for microscopy software and general purpose machine vision • used for medical imaging, industrial inspection, measuring abrasion future work • feature-based object recognition algorithm • GPU acceleration, parallel processing • support typical workflow on a microscope web http://www.wedesoft.demon.co.uk/hornetseye-api/ http://rubyforge.org/projects/hornetseye/ http://sourceforge.net/projects/hornetseye/