SlideShare a Scribd company logo
S T U D I O S T U D I O
Seeing Like Software
Andrew Lovett-Barron
@readywater
The machines can see
Computer Vision
CV in the day-to-day
http://techcrunch.com/2010/12/07/videos-the-best-kinect-
hacks-and-mods-one-month-in/
2011: The Kinect Is Born
Rafael Lozano Hemmer
Computer Vision and Art
http://www.flickr.com/photos/55705924@N08/5178241193/
David Rokeby
http://www.medienkunstnetz.de/works/videoplace/
Myron Krueger
http://www.d-p.cc/wp-content/uploads/2013/04/messa_
jaapsolo_ars_287015.jpg
Golan Levin
Rafael Lozano-Hemmer
Rafael Lozano-Hemmer
http://www.creativeapplications.net/environment/exr3-elli-
ot-woods-kyle-mcdonald/
Kyle McDonald
http://www.coolhunting.com/culture/funky-forest.php
Theo Watson
http://autoponics.org/?p=147
Getting past the Kinect Hack
Cheap distance and shape
Victor Castaneda, Nassir Navab Kinect Programming for
Computer Vision Summer Term 2011
Kinect and Structured Light
Victor Castaneda, Nassir Navab Kinect Programming for
Computer Vision Summer Term 2011
Other types of Depth Camera
Sensors live through Software
OpenCV toolkits
Overview of OpenCV toolkit
OpenCV 2.3 Cheat Sheet (C++)
The OpenCV C++ reference manual is here:
http: // opencv. willowgarage. com/ documentation/ cpp/ .
Use Quick Search to find descriptions of the particular
functions and classes
Key OpenCV Classes
Point Template 2D point class
Point3 Template 3D point class
Size Template size (width, height) class
Vec Template short vector class
Matx Template small matrix class
Scalar 4-element vector
Rect Rectangle
Range Integer value range
Mat 2D or multi-dimensional dense array
(can be used to store matrices, images,
histograms, feature descriptors, voxel
volumes etc.)
SparseMat Multi-dimensional sparse array
Ptr Template smart pointer class
Matrix Basics
Create a matrix
Mat image(240, 320, CV 8UC3);
[Re]allocate a pre-declared matrix
image.create(480, 640, CV 8UC3);
Create a matrix initialized with a constant
Mat A33(3, 3, CV 32F, Scalar(5));
Mat B33(3, 3, CV 32F); B33 = Scalar(5);
Mat C33 = Mat::ones(3, 3, CV 32F)*5.;
Mat D33 = Mat::zeros(3, 3, CV 32F) + 5.;
Create a matrix initialized with specified values
double a = CV PI/3;
Mat A22 = (Mat <float>(2, 2) <<
cos(a), -sin(a), sin(a), cos(a));
float B22data[] = {cos(a), -sin(a), sin(a), cos(a)};
Mat B22 = Mat(2, 2, CV 32F, B22data).clone();
Initialize a random matrix
randu(image, Scalar(0), Scalar(256)); // uniform dist
randn(image, Scalar(128), Scalar(10)); // Gaussian dist
Convert matrix to/from other structures
(without copying the data)
Mat image alias = image;
float* Idata=new float[480*640*3];
Mat I(480, 640, CV 32FC3, Idata);
vector<Point> iptvec(10);
Mat iP(iptvec); // iP – 10x1 CV 32SC2 matrix
IplImage* oldC0 = cvCreateImage(cvSize(320,240),16,1);
Mat newC = cvarrToMat(oldC0);
IplImage oldC1 = newC; CvMat oldC2 = newC;
... (with copying the data)
Mat newC2 = cvarrToMat(oldC0).clone();
vector<Point2f> ptvec = Mat <Point2f>(iP);
Access matrix elements
A33.at<float>(i,j) = A33.at<float>(j,i)+1;
Mat dyImage(image.size(), image.type());
for(int y = 1; y < image.rows-1; y++) {
Vec3b* prevRow = image.ptr<Vec3b>(y-1);
Vec3b* nextRow = image.ptr<Vec3b>(y+1);
for(int x = 0; y < image.cols; x++)
for(int c = 0; c < 3; c++)
dyImage.at<Vec3b>(y,x)[c] =
saturate cast<uchar>(
nextRow[x][c] - prevRow[x][c]);
}
Mat <Vec3b>::iterator it = image.begin<Vec3b>(),
itEnd = image.end<Vec3b>();
for(; it != itEnd; ++it)
(*it)[1] ^= 255;
Matrix Manipulations: Copying,
Shuffling, Part Access
src.copyTo(dst) Copy matrix to another one
src.convertTo(dst,type,scale,shift) Scale and convert to
another datatype
m.clone() Make deep copy of a matrix
m.reshape(nch,nrows) Change matrix dimensions and/or num-
ber of channels without copying data
m.row(i), m.col(i) Take a matrix row/column
m.rowRange(Range(i1,i2))
m.colRange(Range(j1,j2))
Take a matrix row/column span
m.diag(i) Take a matrix diagonal
m(Range(i1,i2),Range(j1,j2)),
m(roi)
Take a submatrix
m.repeat(ny,nx) Make a bigger matrix from a smaller one
flip(src,dst,dir) Reverse the order of matrix rows and/or
columns
split(...) Split multi-channel matrix into separate
channels
merge(...) Make a multi-channel matrix out of the
separate channels
mixChannels(...) Generalized form of split() and merge()
randShuffle(...) Randomly shuffle matrix elements
Example 1. Smooth image ROI in-place
Mat imgroi = image(Rect(10, 20, 100, 100));
GaussianBlur(imgroi, imgroi, Size(5, 5), 1.2, 1.2);
Example 2. Somewhere in a linear algebra algorithm
m.row(i) += m.row(j)*alpha;
Example 3. Copy image ROI to another image with conversion
Rect r(1, 1, 10, 20);
Mat dstroi = dst(Rect(0,10,r.width,r.height));
src(r).convertTo(dstroi, dstroi.type(), 1, 0);
Simple Matrix Operations
OpenCV implements most common arithmetical, logical and
other matrix operations, such as
• add(), subtract(), multiply(), divide(), absdiff(),
bitwise and(), bitwise or(), bitwise xor(), max(),
min(), compare()
– correspondingly, addition, subtraction, element-wise
multiplication ... comparison of two matrices or a
matrix and a scalar.
Example. Alpha compositing function:
void alphaCompose(const Mat& rgba1,
const Mat& rgba2, Mat& rgba dest)
{
Mat a1(rgba1.size(), rgba1.type()), ra1;
Mat a2(rgba2.size(), rgba2.type());
int mixch[]={3, 0, 3, 1, 3, 2, 3, 3};
mixChannels(&rgba1, 1, &a1, 1, mixch, 4);
mixChannels(&rgba2, 1, &a2, 1, mixch, 4);
subtract(Scalar::all(255), a1, ra1);
bitwise or(a1, Scalar(0,0,0,255), a1);
bitwise or(a2, Scalar(0,0,0,255), a2);
multiply(a2, ra1, a2, 1./255);
multiply(a1, rgba1, a1, 1./255);
multiply(a2, rgba2, a2, 1./255);
add(a1, a2, rgba dest);
}
• sum(), mean(), meanStdDev(), norm(), countNonZero(),
minMaxLoc(),
– various statistics of matrix elements.
• exp(), log(), pow(), sqrt(), cartToPolar(),
polarToCart()
– the classical math functions.
• scaleAdd(), transpose(), gemm(), invert(), solve(),
determinant(), trace() eigen(), SVD,
– the algebraic functions + SVD class.
• dft(), idft(), dct(), idct(),
– discrete Fourier and cosine transformations
For some operations a more convenient algebraic notation can
be used, for example:
Mat delta = (J.t()*J + lambda*
Mat::eye(J.cols, J.cols, J.type()))
.inv(CV SVD)*(J.t()*err);
implements the core of Levenberg-Marquardt optimization
algorithm.
Image Processsing
Filtering
filter2D() Non-separable linear filter
sepFilter2D() Separable linear filter
boxFilter(),
GaussianBlur(),
medianBlur(),
bilateralFilter()
Smooth the image with one of the linear
or non-linear filters
Sobel(), Scharr() Compute the spatial image derivatives
Laplacian() compute Laplacian: āˆ†I = āˆ‚2
I
āˆ‚x2 + āˆ‚2
I
āˆ‚y2
erode(), dilate() Morphological operations
1
How to navigate openCV
http://whiteglovetracking.com/ by Evan Roth
Focus and Regions of Interest
Image credit: Kineme
Processing to Analysis
Haar based detection by Adam Harvey
Methods of Analysis
http://golancourses.net/2013/wp-content/up-
loads/2013/01/openFrameworks.jpeg
Openframeworks
Alternatives to C++ for openCV
Starting off with OF
ofxAddons and community
Kyle McDonald showing off ofxCv
OfxCv
HOWTO: Interactive Lighting
Design process
Structuring the program
Ikea, Arduino, etc.
Document and share
http://github.com/readywater/
seeing-like-software
http://www.andrewlb.com/
						2013/06/sls-notes/
Learn to see the invisible
S T U D I O S T U D I O
Andrew Lovett-Barron
@readywater
http://andrewlb.com
andrew@relaystudio.com

More Related Content

PPTX
Deep learning study 3
San Kim
Ā 
PDF
ćÆć˜ć‚ć¦ć§ć‚‚ć‚ć‹ć‚‹ćƒ™ć‚¤ć‚ŗåˆ†é”žå™Ø ļ¼åŸŗē¤Žć‹ć‚‰Mahoutå®Ÿč£…ć¾ć§ļ¼
Naoki Yanai
Ā 
KEY
ć€‡ć€‡ć®åøøč­˜ćÆā– ā– ć®éžåøøč­˜
Yoichi Hirai
Ā 
PDF
Data Visualization With R: Learn To Combine Multiple Graphs
Rsquared Academy
Ā 
PDF
The matplotlib Library
Haim Michael
Ā 
PDF
Abstracting over the Monad yielded by a for comprehension and its generators
Philip Schwarz
Ā 
PDF
3 R Tutorial Data Structure
Sakthi Dasans
Ā 
PDF
Queue
A. S. M. Shafi
Ā 
Deep learning study 3
San Kim
Ā 
ćÆć˜ć‚ć¦ć§ć‚‚ć‚ć‹ć‚‹ćƒ™ć‚¤ć‚ŗåˆ†é”žå™Ø ļ¼åŸŗē¤Žć‹ć‚‰Mahoutå®Ÿč£…ć¾ć§ļ¼
Naoki Yanai
Ā 
ć€‡ć€‡ć®åøøč­˜ćÆā– ā– ć®éžåøøč­˜
Yoichi Hirai
Ā 
Data Visualization With R: Learn To Combine Multiple Graphs
Rsquared Academy
Ā 
The matplotlib Library
Haim Michael
Ā 
Abstracting over the Monad yielded by a for comprehension and its generators
Philip Schwarz
Ā 
3 R Tutorial Data Structure
Sakthi Dasans
Ā 

What's hot (18)

PDF
Basics of Computer graphics lab
Priya Goyal
Ā 
PDF
Matlab plotting
pramodkumar1804
Ā 
PPTX
My favorite slides
Mitchell Wand
Ā 
PDF
Monoids - Part 2 - with examples using Scalaz and Cats
Philip Schwarz
Ā 
PPTX
Graph Plots in Matlab
DataminingTools Inc
Ā 
PDF
Use the Matplotlib, Luke @ PyCon Taiwan 2012
Wen-Wei Liao
Ā 
PPTX
Data visualization in python/Django
kenluck2001
Ā 
PDF
Introducing: A Complete Algebra of Data
Inside Analysis
Ā 
PPTX
IGraph a tool to analyze your network
Pushpendra Tiwari
Ā 
PDF
Matlab Graphics Tutorial
Cheng-An Yang
Ā 
DOCX
Heap sort &amp; bubble sort
Shanmuga Raju
Ā 
PDF
Matplotlib ē°”ä»‹čˆ‡ä½æē”Ø
Vic Yang
Ā 
PDF
Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...
Spark Summit
Ā 
DOC
CS8391 Data Structures Part B Questions Anna University
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
Ā 
PDF
R Data Visualization Tutorial: Bar Plots
Rsquared Academy
Ā 
PDF
Ss matlab solved
Vijendrasingh Rathor
Ā 
PPTX
Enter The Matrix
Mike Anderson
Ā 
PDF
Machine learning with scikit-learn
Qingkai Kong
Ā 
Basics of Computer graphics lab
Priya Goyal
Ā 
Matlab plotting
pramodkumar1804
Ā 
My favorite slides
Mitchell Wand
Ā 
Monoids - Part 2 - with examples using Scalaz and Cats
Philip Schwarz
Ā 
Graph Plots in Matlab
DataminingTools Inc
Ā 
Use the Matplotlib, Luke @ PyCon Taiwan 2012
Wen-Wei Liao
Ā 
Data visualization in python/Django
kenluck2001
Ā 
Introducing: A Complete Algebra of Data
Inside Analysis
Ā 
IGraph a tool to analyze your network
Pushpendra Tiwari
Ā 
Matlab Graphics Tutorial
Cheng-An Yang
Ā 
Heap sort &amp; bubble sort
Shanmuga Raju
Ā 
Matplotlib ē°”ä»‹čˆ‡ä½æē”Ø
Vic Yang
Ā 
Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...
Spark Summit
Ā 
CS8391 Data Structures Part B Questions Anna University
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
Ā 
R Data Visualization Tutorial: Bar Plots
Rsquared Academy
Ā 
Ss matlab solved
Vijendrasingh Rathor
Ā 
Enter The Matrix
Mike Anderson
Ā 
Machine learning with scikit-learn
Qingkai Kong
Ā 
Ad

Similar to Seeing Like Software (20)

PDF
2nd section
Hadi Rahmat-Khah
Ā 
PPT
Intro_OpenCV.ppt
RithikRaj25
Ā 
PPT
Introduction to Machine Vision
Nasir Jumani
Ā 
PPTX
RoboCV Module 3: Delving Deeper into OpenCV
roboVITics club
Ā 
PDF
Fcv core szeliski_zisserman
zukun
Ā 
PPTX
Cvpr2010 open source vision software, intro and training part v open cv and r...
zukun
Ā 
PPTX
Image analytics - A Primer
Gopi Krishna Nuti
Ā 
PPT
ip111.ppt
Supriya428412
Ā 
PPTX
20110220 computer vision_eruhimov_lecture02
Computer Science Club
Ā 
PDF
Lecture32
zukun
Ā 
PPT
Lecture01 intro ece
Kesava Shiva
Ā 
PDF
Introduction to VTK
Waldir Pimenta
Ā 
DOCX
Computer vision,,summer training programme
Praveen Pandey
Ā 
PDF
Introduction to Digital Image Processing Using MATLAB
Ray Phan
Ā 
PPTX
OpenCV+Android.pptx
Vishwas459764
Ā 
PPTX
Computer vision
Antonio Radesca
Ā 
PPTX
RoboCV Module 5: Contours using OpenCV
roboVITics club
Ā 
PPTX
Computer vision series
Perry Lea
Ā 
PPTX
COMPUTER VISION- ARTIFICIAL INTELLIGENCE
sarmiladevin
Ā 
2nd section
Hadi Rahmat-Khah
Ā 
Intro_OpenCV.ppt
RithikRaj25
Ā 
Introduction to Machine Vision
Nasir Jumani
Ā 
RoboCV Module 3: Delving Deeper into OpenCV
roboVITics club
Ā 
Fcv core szeliski_zisserman
zukun
Ā 
Cvpr2010 open source vision software, intro and training part v open cv and r...
zukun
Ā 
Image analytics - A Primer
Gopi Krishna Nuti
Ā 
ip111.ppt
Supriya428412
Ā 
20110220 computer vision_eruhimov_lecture02
Computer Science Club
Ā 
Lecture32
zukun
Ā 
Lecture01 intro ece
Kesava Shiva
Ā 
Introduction to VTK
Waldir Pimenta
Ā 
Computer vision,,summer training programme
Praveen Pandey
Ā 
Introduction to Digital Image Processing Using MATLAB
Ray Phan
Ā 
OpenCV+Android.pptx
Vishwas459764
Ā 
Computer vision
Antonio Radesca
Ā 
RoboCV Module 5: Contours using OpenCV
roboVITics club
Ā 
Computer vision series
Perry Lea
Ā 
COMPUTER VISION- ARTIFICIAL INTELLIGENCE
sarmiladevin
Ā 
Ad

More from Andrew Lovett-Barron (6)

PDF
SF Critical Design meetup: Designed Futures in a non-linear world
Andrew Lovett-Barron
Ā 
PDF
GAFFTA Talk on Decay of Digital Things
Andrew Lovett-Barron
Ā 
PDF
Having Conversations through Technology in Public Space
Andrew Lovett-Barron
Ā 
PDF
Prototyping for Communication
Andrew Lovett-Barron
Ā 
PDF
Intro to BackboneJS + Intermediate Javascript
Andrew Lovett-Barron
Ā 
PDF
Pechakucha 2012 Ambient Technology
Andrew Lovett-Barron
Ā 
SF Critical Design meetup: Designed Futures in a non-linear world
Andrew Lovett-Barron
Ā 
GAFFTA Talk on Decay of Digital Things
Andrew Lovett-Barron
Ā 
Having Conversations through Technology in Public Space
Andrew Lovett-Barron
Ā 
Prototyping for Communication
Andrew Lovett-Barron
Ā 
Intro to BackboneJS + Intermediate Javascript
Andrew Lovett-Barron
Ā 
Pechakucha 2012 Ambient Technology
Andrew Lovett-Barron
Ā 

Recently uploaded (20)

PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
Ā 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
Ā 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
Ā 
PDF
Software Development Methodologies in 2025
KodekX
Ā 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
Ā 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
Ā 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
Ā 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
Ā 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
Ā 
PDF
The Future of Artificial Intelligence (AI)
Mukul
Ā 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
Ā 
PDF
Doc9.....................................
SofiaCollazos
Ā 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
Ā 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
Ā 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
Ā 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
Ā 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
Ā 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
Ā 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
Ā 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
Ā 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
Ā 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
Ā 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
Ā 
Software Development Methodologies in 2025
KodekX
Ā 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
Ā 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
Ā 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
Ā 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
Ā 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
Ā 
The Future of Artificial Intelligence (AI)
Mukul
Ā 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
Ā 
Doc9.....................................
SofiaCollazos
Ā 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
Ā 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
Ā 
Presentation about Hardware and Software in Computer
snehamodhawadiya
Ā 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
Ā 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
Ā 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
Ā 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
Ā 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
Ā 

Seeing Like Software