SlideShare a Scribd company logo
1 of 43
Download to read offline
Computer Vision
A Beginner’s Guide
How do computers
actually see?
Like this?
Okay…maybe like this?
Actually it’s more like
this
Matrix Math
• From basic to complex
• “Seeing the Matrix”
So how do you “do”
computer vision?
OpenCV
Step zero is to install OpenCV
and python
• OpenCV no walk in the park
• Resources at the end of my slides
OpenCV
Step one is to start with your
image source
import cv2
image =
cv2.imread(“nebraska_small.jpg")
OpenCV
Step two is to convert to
greyscale for most libraries /
functions
import cv2
image =
cv2.imread(“nebraska_small.jpg”, 0)
OpenCV
Step three is to use OpenCV
to process your image
import cv2
image = cv2.imread(“nebraska_small.jpg”, 0)
ret, thresh1 = cv2.threshold(image, 127, 255,
cv2.THRESH_BINARY)
ret, thresh2 = cv2.threshold(image, 127, 255,
cv2.THRESH_BINARY_INV)
ret, thresh3 = cv2.threshold(image, 127, 255,
cv2.THRESH_TRUNC)
ret, thresh4 = cv2.threshold(image, 127, 255,
cv2.THRESH_TOZERO)
Binary Binary Inverse
Trunc To Zero
OpenCV
Step four is to use AI and ML
to create powerful projects!
•TensorFlow + Inception
•Google Vision API
•Microsoft Azure Computer
Vision
•Amazon Rekognition API
•…OpenCV
OpenCV
Easier to use in mobile
• iOS - pod ‘OpenCV'
• Android - OpenCV4Android SDK
• Natural fit with built in camera
About Me
Unconventional Background = Outsider
Hard work and passion creates amazing opportunities
Wide Wide World of
Computer Vision
Windows vs. Mac vs.
Linux vs. iOS vs. Android
vs. Raspberry Pi
• HOG Detectors (Histogram of Oriented
Gradients)
• SLAM (Simultaneous Localization And Mapping)
• CNN (Convolutional Neural Networks)
• GAN (Generative Adversarial Nets)
• Structure from Motion
TensorFlow +
Inception
C++ vs. Python
TensorFlow + Inception
giant panda, panda, panda bear,
coon bear, Ailuropoda melanoleuca
(score = 0.89107)
indri, indris, Indri indri, Indri
brevicaudatus
(score = 0.00779)
lesser panda, red panda, panda,
bear cat, cat bear, Ailurus
fulgens
(score = 0.00296)
custard apple
(score = 0.00147)
earthstar
(score = 0.00117)
TensorFlow + Inception
seashore, coast, seacoast,
sea-coast (score = 0.24771)
monitor
(score = 0.08148)
bell cote, bell cot
(score = 0.06853)
dome
(score = 0.05676)
palace
(score = 0.05457)
Google Cloud Vision
API
Label Detection
{
"mid": "/m/0j_s4",
"description": "metropolitan area",
"score": 0.9773918
},
{
"mid": "/m/01w5c_",
"description": "aerial photography",
"score": 0.9537865
},
{
"mid": "/m/08863x",
"description": "bird's eye view",
"score": 0.9332659
},
Landmark Detection
"mid": "/m/04f57c",
"description": "Union Station",
"score": 0.553656,
"boundingPoly": {
"vertices": […]
},
"locations": [
{
"latLng": {
"latitude": 39.081365,
"longitude": -94.58586931228638
}
Text Detection
• Recognized about 1,700
words
• Fairly high success %
import io
import os
# Imports the Google Cloud client library
from google.cloud import vision
# Instantiates a client
vision_client = vision.Client()
image = vision_client.image(source_uri='http://u.b5z.net/i/u/10192948/i/
Restaurant_Association_Marker_2014.jpg')
# Performs label detection on the image file
labels = image.detect_text()
print('Text:')
fullText = ""
for label in labels:
fullText += label.description + " "
print fullText
Microsoft Azure
Computer Vision
Visual Features
{
"categories": [{
"name": "outdoor_",
"score": 0.01171875
}, {
"name": "outdoor_sportsfield",
"score": 0.81640625
}],
"requestId": “e6…df”,
"metadata": {
"width": 838,
"height": 546,
"format": "Jpeg"
}
}
Landmarks
{
"categories": [{
"name": "building_",
"score": 0.54296875,
"detail": {
"landmarks": []
}
}, {
"name": "outdoor_",
"score": 0.01171875
}],
"requestId": “0e…f026”,
"metadata": {
"width": 960,
"height": 540,
"format": "Jpeg"
OCR
THE GREATER KANSAS CITY RESTAURANT ASSOCIAT!ON The Greater
Cit' Restaurant • in 1916. when three Visionary My row, C e
orge Fowler. and Guy Taylor began meeting the baseme#i Of
Myron Green" Cafeteria on this at Walnut. 'g17ö . 'the;
asuocIat20n organized a boycott to combat the rtslnq-
co$t„ eggs from Suppliers Charging unfair prices. effect* -
attention and 1919 the group launched ASSOC i •tiOn CNR A).
The NRA headquarters remained tn Kansas City until 1927 yhen
moved to Chicago. and eventually to Washington. D.C. Today.
the NRA supports the foodservice Industry, which consists of
13.1 employees (10% of the U.S. workforce) generates $660.5
billion in annual sales of the U.S. gross domestic product),
The GKCRA remains One of the strongest chapters of the NRA.
serving the needs of the area's hospitality industry tn parts
of Missouri and Kansas. Focused education and community
support. each year the GKCRA invests thoussnds of dollars into
hospitality scholarships for area youth, Wen as continuing the
education gf alt hospitality employees. Also dedicated to the
financial wen- being or Keans City end the promotion Of
businesses in our reglon, the CKCRA joined the city's effort
to initiate convention and tourism funding in 1974. Original
construction and continued maintenance of Bartle Hall end
other taurtsm and neighborhood development project' ere fUnded
by patrons Of the restaurant and hotel Industries. 2016 marks
the centennial anniversary of the Greater Kansas City
Restaurant Association. 1214 T KE SONS of KANSAS
• Not quiet as good as Google
• JSON structure is a PAIN
using System;

using System.IO;

using System.Net.Http;

using System.Net.Http.Headers;



namespace CSHttpClientSample

{

static class Program

{

static void Main()

{

MakeAnalysisRequest("/Users/me/Desktop/nebraska_small.jpg");



Console.WriteLine("nnnHit ENTER to exit...");

Console.ReadLine();

}



static byte[] GetImageAsByteArray(string imageFilePath)

{

FileStream fileStream = new FileStream(imageFilePath, FileMode.Open, FileAccess.Read);

BinaryReader binaryReader = new BinaryReader(fileStream);

return binaryReader.ReadBytes((int)fileStream.Length);

}



static async void MakeAnalysisRequest(string imageFilePath)

{

var client = new HttpClient();



// Request headers - replace this example key with your valid subscription key.

client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "key");



// Request parameters. A third optional parameter is "details".

string requestParameters = "visualFeatures=Categories&language=en&details=Landmarks";

string uri = "https://westus.api.cognitive.microsoft.com/vision/v1.0/analyze?" + requestParameters;

Console.WriteLine(uri);



HttpResponseMessage response;



// Request body. Try this sample with a locally stored JPEG image.

byte[] byteData = GetImageAsByteArray(imageFilePath);



using (var content = new ByteArrayContent(byteData))

{

// This example uses content type "application/octet-stream".

// The other content types you can use are "application/json" and "multipart/form-data".

content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

response = await client.PostAsync(uri, content);

string responseBody = await response.Content.ReadAsStringAsync();

Console.Write(responseBody);

}

}

}

}

Amazon Rekognition
Object and Scene Detection
Aerial View 99%
City 95.9%
Downtown 95.9%
Neighborhood 74.3%
Town 74.3%
Metropolis 73.7%
Urban 73.7%
Building 67.7%
Computer Vision
• Standing on the shoulders of giants
• Projects over tools
• Explore, Use, Learn
• Taking the leap
Computer Vision at VML
Computer Vision at VML
Special Thanks
• David Mitchell VML
• Heather Downing VML
• u/davis685
• u/run7b
• u/dcc194
• u/slippy0
• u/vraGG_
Resources
• Install OpenCV http://www.pyimagesearch.com/
2016/12/19/install-opencv-3-on-macos-with-
homebrew-the-easy-way/
• Master OpenCV in Python Udemy https://
www.udemy.com/master-computer-vision-with-
opencv-in-python/
• http://www.learnopencv.com/histogram-of-oriented-gradients/
• https://ocw.mit.edu/courses/aeronautics-and-astronautics/
16-412j-cognitive-robotics-spring-2005/projects/
1aslam_blas_repo.pdf
• http://eric-yuan.me/cnn/
• http://bamos.github.io/2016/08/09/deep-completion/
• http://www.morethantechnical.com/2012/02/07/structure-from-
motion-and-3d-reconstruction-on-the-easy-in-opencv-2-3-w-
code/
• http://docs.opencv.org/trunk/d7/d8b/
tutorial_py_face_detection.html

More Related Content

What's hot

MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Thomas Fuchs
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScripters
gerbille
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
Edward Capriolo
 

What's hot (20)

MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
 
OneRing @ OSCamp 2010
OneRing @ OSCamp 2010OneRing @ OSCamp 2010
OneRing @ OSCamp 2010
 
Sensmon couchdb
Sensmon couchdbSensmon couchdb
Sensmon couchdb
 
FalcorJS
FalcorJSFalcorJS
FalcorJS
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016
 
ES6 is Nigh
ES6 is NighES6 is Nigh
ES6 is Nigh
 
Lambda expressions in C++
Lambda expressions in C++Lambda expressions in C++
Lambda expressions in C++
 
High Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
High Performance XQuery Processing in PHP with Zorba by Vikram VaswaniHigh Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
High Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
 
New Design of OneRing
New Design of OneRingNew Design of OneRing
New Design of OneRing
 
Programming the cloud with Skywriting
Programming the cloud with SkywritingProgramming the cloud with Skywriting
Programming the cloud with Skywriting
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
 
Naked Performance With Clojure
Naked Performance With ClojureNaked Performance With Clojure
Naked Performance With Clojure
 
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
 
Malli: inside data-driven schemas
Malli: inside data-driven schemasMalli: inside data-driven schemas
Malli: inside data-driven schemas
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using Room
 
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
 
FwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsFwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.js
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScripters
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 

Similar to Computer vision Nebraska (Nebraska Code)

"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
Edge AI and Vision Alliance
 
How to build a html5 websites.v1
How to build a html5 websites.v1How to build a html5 websites.v1
How to build a html5 websites.v1
Bitla Software
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
Remy Sharp
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02
PL dream
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
Igor Bronovskyy
 
Rotoscope inthebrowserppt billy
Rotoscope inthebrowserppt billyRotoscope inthebrowserppt billy
Rotoscope inthebrowserppt billy
nimbleltd
 

Similar to Computer vision Nebraska (Nebraska Code) (20)

Intro to computer vision in .net
Intro to computer vision in .netIntro to computer vision in .net
Intro to computer vision in .net
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
 
How to build a html5 websites.v1
How to build a html5 websites.v1How to build a html5 websites.v1
How to build a html5 websites.v1
 
Intro to computer vision in .net update
Intro to computer vision in .net   updateIntro to computer vision in .net   update
Intro to computer vision in .net update
 
HTML5 Canvas
HTML5 CanvasHTML5 Canvas
HTML5 Canvas
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02
 
Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017
Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017
Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
Yavorsky
YavorskyYavorsky
Yavorsky
 
Svcc 2013-d3
Svcc 2013-d3Svcc 2013-d3
Svcc 2013-d3
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
 
Information from pixels
Information from pixelsInformation from pixels
Information from pixels
 
Couchbas for dummies
Couchbas for dummiesCouchbas for dummies
Couchbas for dummies
 
Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
 
Rotoscope inthebrowserppt billy
Rotoscope inthebrowserppt billyRotoscope inthebrowserppt billy
Rotoscope inthebrowserppt billy
 
Vertically Scaled Design Patters
Vertically Scaled Design PattersVertically Scaled Design Patters
Vertically Scaled Design Patters
 
Hi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextHi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreText
 
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel AvivSelf Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
 
Canvas
CanvasCanvas
Canvas
 

Recently uploaded

+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...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
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
panagenda
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
+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...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Computer vision Nebraska (Nebraska Code)

  • 6.
  • 7.
  • 8. Matrix Math • From basic to complex • “Seeing the Matrix”
  • 9. So how do you “do” computer vision?
  • 10. OpenCV Step zero is to install OpenCV and python • OpenCV no walk in the park • Resources at the end of my slides
  • 11. OpenCV Step one is to start with your image source import cv2 image = cv2.imread(“nebraska_small.jpg")
  • 12. OpenCV Step two is to convert to greyscale for most libraries / functions import cv2 image = cv2.imread(“nebraska_small.jpg”, 0)
  • 13. OpenCV Step three is to use OpenCV to process your image import cv2 image = cv2.imread(“nebraska_small.jpg”, 0) ret, thresh1 = cv2.threshold(image, 127, 255, cv2.THRESH_BINARY) ret, thresh2 = cv2.threshold(image, 127, 255, cv2.THRESH_BINARY_INV) ret, thresh3 = cv2.threshold(image, 127, 255, cv2.THRESH_TRUNC) ret, thresh4 = cv2.threshold(image, 127, 255, cv2.THRESH_TOZERO) Binary Binary Inverse Trunc To Zero
  • 14. OpenCV Step four is to use AI and ML to create powerful projects! •TensorFlow + Inception •Google Vision API •Microsoft Azure Computer Vision •Amazon Rekognition API •…OpenCV
  • 15. OpenCV Easier to use in mobile • iOS - pod ‘OpenCV' • Android - OpenCV4Android SDK • Natural fit with built in camera
  • 16. About Me Unconventional Background = Outsider Hard work and passion creates amazing opportunities
  • 17. Wide Wide World of Computer Vision
  • 18. Windows vs. Mac vs. Linux vs. iOS vs. Android vs. Raspberry Pi
  • 19. • HOG Detectors (Histogram of Oriented Gradients) • SLAM (Simultaneous Localization And Mapping) • CNN (Convolutional Neural Networks) • GAN (Generative Adversarial Nets) • Structure from Motion
  • 22. TensorFlow + Inception giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca (score = 0.89107) indri, indris, Indri indri, Indri brevicaudatus (score = 0.00779) lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens (score = 0.00296) custard apple (score = 0.00147) earthstar (score = 0.00117)
  • 23. TensorFlow + Inception seashore, coast, seacoast, sea-coast (score = 0.24771) monitor (score = 0.08148) bell cote, bell cot (score = 0.06853) dome (score = 0.05676) palace (score = 0.05457)
  • 25. Label Detection { "mid": "/m/0j_s4", "description": "metropolitan area", "score": 0.9773918 }, { "mid": "/m/01w5c_", "description": "aerial photography", "score": 0.9537865 }, { "mid": "/m/08863x", "description": "bird's eye view", "score": 0.9332659 },
  • 26. Landmark Detection "mid": "/m/04f57c", "description": "Union Station", "score": 0.553656, "boundingPoly": { "vertices": […] }, "locations": [ { "latLng": { "latitude": 39.081365, "longitude": -94.58586931228638 }
  • 27. Text Detection • Recognized about 1,700 words • Fairly high success %
  • 28. import io import os # Imports the Google Cloud client library from google.cloud import vision # Instantiates a client vision_client = vision.Client() image = vision_client.image(source_uri='http://u.b5z.net/i/u/10192948/i/ Restaurant_Association_Marker_2014.jpg') # Performs label detection on the image file labels = image.detect_text() print('Text:') fullText = "" for label in labels: fullText += label.description + " " print fullText
  • 30. Visual Features { "categories": [{ "name": "outdoor_", "score": 0.01171875 }, { "name": "outdoor_sportsfield", "score": 0.81640625 }], "requestId": “e6…df”, "metadata": { "width": 838, "height": 546, "format": "Jpeg" } }
  • 31. Landmarks { "categories": [{ "name": "building_", "score": 0.54296875, "detail": { "landmarks": [] } }, { "name": "outdoor_", "score": 0.01171875 }], "requestId": “0e…f026”, "metadata": { "width": 960, "height": 540, "format": "Jpeg"
  • 32. OCR THE GREATER KANSAS CITY RESTAURANT ASSOCIAT!ON The Greater Cit' Restaurant • in 1916. when three Visionary My row, C e orge Fowler. and Guy Taylor began meeting the baseme#i Of Myron Green" Cafeteria on this at Walnut. 'g17ö . 'the; asuocIat20n organized a boycott to combat the rtslnq- co$t„ eggs from Suppliers Charging unfair prices. effect* - attention and 1919 the group launched ASSOC i •tiOn CNR A). The NRA headquarters remained tn Kansas City until 1927 yhen moved to Chicago. and eventually to Washington. D.C. Today. the NRA supports the foodservice Industry, which consists of 13.1 employees (10% of the U.S. workforce) generates $660.5 billion in annual sales of the U.S. gross domestic product), The GKCRA remains One of the strongest chapters of the NRA. serving the needs of the area's hospitality industry tn parts of Missouri and Kansas. Focused education and community support. each year the GKCRA invests thoussnds of dollars into hospitality scholarships for area youth, Wen as continuing the education gf alt hospitality employees. Also dedicated to the financial wen- being or Keans City end the promotion Of businesses in our reglon, the CKCRA joined the city's effort to initiate convention and tourism funding in 1974. Original construction and continued maintenance of Bartle Hall end other taurtsm and neighborhood development project' ere fUnded by patrons Of the restaurant and hotel Industries. 2016 marks the centennial anniversary of the Greater Kansas City Restaurant Association. 1214 T KE SONS of KANSAS • Not quiet as good as Google • JSON structure is a PAIN
  • 33. using System;
 using System.IO;
 using System.Net.Http;
 using System.Net.Http.Headers;
 
 namespace CSHttpClientSample
 {
 static class Program
 {
 static void Main()
 {
 MakeAnalysisRequest("/Users/me/Desktop/nebraska_small.jpg");
 
 Console.WriteLine("nnnHit ENTER to exit...");
 Console.ReadLine();
 }
 
 static byte[] GetImageAsByteArray(string imageFilePath)
 {
 FileStream fileStream = new FileStream(imageFilePath, FileMode.Open, FileAccess.Read);
 BinaryReader binaryReader = new BinaryReader(fileStream);
 return binaryReader.ReadBytes((int)fileStream.Length);
 }
 
 static async void MakeAnalysisRequest(string imageFilePath)
 {
 var client = new HttpClient();
 
 // Request headers - replace this example key with your valid subscription key.
 client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "key");
 
 // Request parameters. A third optional parameter is "details".
 string requestParameters = "visualFeatures=Categories&language=en&details=Landmarks";
 string uri = "https://westus.api.cognitive.microsoft.com/vision/v1.0/analyze?" + requestParameters;
 Console.WriteLine(uri);
 
 HttpResponseMessage response;
 
 // Request body. Try this sample with a locally stored JPEG image.
 byte[] byteData = GetImageAsByteArray(imageFilePath);
 
 using (var content = new ByteArrayContent(byteData))
 {
 // This example uses content type "application/octet-stream".
 // The other content types you can use are "application/json" and "multipart/form-data".
 content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
 response = await client.PostAsync(uri, content);
 string responseBody = await response.Content.ReadAsStringAsync();
 Console.Write(responseBody);
 }
 }
 }
 }

  • 35. Object and Scene Detection Aerial View 99% City 95.9% Downtown 95.9% Neighborhood 74.3% Town 74.3% Metropolis 73.7% Urban 73.7% Building 67.7%
  • 36. Computer Vision • Standing on the shoulders of giants • Projects over tools • Explore, Use, Learn • Taking the leap
  • 40. • David Mitchell VML • Heather Downing VML • u/davis685 • u/run7b • u/dcc194 • u/slippy0 • u/vraGG_
  • 42. • Install OpenCV http://www.pyimagesearch.com/ 2016/12/19/install-opencv-3-on-macos-with- homebrew-the-easy-way/ • Master OpenCV in Python Udemy https:// www.udemy.com/master-computer-vision-with- opencv-in-python/
  • 43. • http://www.learnopencv.com/histogram-of-oriented-gradients/ • https://ocw.mit.edu/courses/aeronautics-and-astronautics/ 16-412j-cognitive-robotics-spring-2005/projects/ 1aslam_blas_repo.pdf • http://eric-yuan.me/cnn/ • http://bamos.github.io/2016/08/09/deep-completion/ • http://www.morethantechnical.com/2012/02/07/structure-from- motion-and-3d-reconstruction-on-the-easy-in-opencv-2-3-w- code/ • http://docs.opencv.org/trunk/d7/d8b/ tutorial_py_face_detection.html