SlideShare une entreprise Scribd logo
1  sur  32
Télécharger pour lire hors ligne
Python Master Class
Part 3
By
Chathuranga Bandara - www.chathuranga.com
Agenda
● Intro to Image Processing
● Usage of Opencv
● Usage of Scikit - Image
What is it?
the analysis and manipulation of a digitized image, especially in order to
improve its quality.
It’s basically 3 steps
1. Import the Image
2. Analyse and manipulate the Image
3. Output the Image
Purpose of Image processing
Visualization - Observe the objects that are not visible.
Image sharpening and restoration - To create a better image.
Image retrieval - Seek for the image of interest.
Measurement of pattern – Measures various objects in an image.
Image Recognition – Distinguish the objects in an image.
OpenCV
OpenCV (Open Source Computer Vision) is a library of programming
functions mainly aimed at real-time computer vision,
developed by Intel's research center in Nizhny Novgorod (Russia),
later supported by Willow Garage and now maintained by Itseez.
How to install : First Download
https://raw.githubusercontent.com/milq/scripts-ubuntu-debian/master/install-opencv.sh
How to install
bash install-opencv.sh
Combine The Two
scikit - image
As per scikit-image.org:
“scikit-image is a collection of algorithms for image processing. It is
available free of charge and free of restriction. We pride ourselves on
high-quality, peer-reviewed code, written by an active community of
volunteers.”
How to install
Pip install -u scikit-image
Science Kit - Image
First steps.
1. Create a file called: hello-image.py
2. Open with notepad
3. Try this code.
# imports the thing.
from scikit import data, io, filters
image = data.coins()
edges = filters.sobel(image)
io.imshow(edges)
io.show()
Another Example
# imports the thing.
from scikit import data, io, filters
import matplotlib.pyplot as plt
image = data.camera()
val = filters.threshold_otsu(image)
mask = camera - val
# save to disk
plt.imsave('mask.jpg', mask)
How about some cool stuff?
from skimage import data, draw
from skimage import transform, util
import numpy as np
from skimage import filters, color
from matplotlib import pyplot as plt
hl_color = np.array([0, 1, 0])
img = data.rocket()
img = util.img_as_float(img)
eimg = filters.sobel(color.rgb2gray(img))
plt.title('Original Image')
plt.imshow(img)
resized = transform.resize(img, (img.shape[0], img.shape[1] - 200))
plt.figure()
plt.title('Resized Image')
plt.imshow(resized)
out = transform.seam_carve(img, eimg, 'vertical', 200)
plt.figure()
plt.title('Resized using Seam Carving')
plt.imshow(out)
masked_img = img.copy()
poly = [(404, 281), (404, 360), (359, 364), (338, 337), (145, 337), (120, 322),
(145, 304), (340, 306), (362, 284)]
pr = np.array([p[0] for p in poly])
pc = np.array([p[1] for p in poly])
rr, cc = draw.polygon(pr, pc)
masked_img[rr, cc, :] = masked_img[rr, cc, :]*0.5 + hl_color*.5
plt.figure()
plt.title('Object Marked')
plt.imshow(masked_img)
eimg[rr, cc] -= 1000
plt.figure()
plt.title('Object Removed')
out = transform.seam_carve(img, eimg, 'vertical', 90)
resized = transform.resize(img, out.shape)
plt.imshow(out)
plt.show()
https://github.com/DrunkenCub/intro2pyimage
It’s your time to shine!
Thank You.

Contenu connexe

En vedette

Dive into Python Class
Dive into Python ClassDive into Python Class
Dive into Python ClassJim Yeh
 
A deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio moduleA deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio moduleSaúl Ibarra Corretgé
 
Comandos para ubuntu 400 que debes conocer
Comandos para ubuntu 400 que debes conocerComandos para ubuntu 400 que debes conocer
Comandos para ubuntu 400 que debes conocerGeek Advisor Freddy
 
Practical continuous quality gates for development process
Practical continuous quality gates for development processPractical continuous quality gates for development process
Practical continuous quality gates for development processAndrii Soldatenko
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and pythonChetan Giridhar
 
Async Tasks with Django Channels
Async Tasks with Django ChannelsAsync Tasks with Django Channels
Async Tasks with Django ChannelsAlbert O'Connor
 
The Awesome Python Class Part-4
The Awesome Python Class Part-4The Awesome Python Class Part-4
The Awesome Python Class Part-4Binay Kumar Ray
 
What is the best full text search engine for Python?
What is the best full text search engine for Python?What is the best full text search engine for Python?
What is the best full text search engine for Python?Andrii Soldatenko
 
Python as number crunching code glue
Python as number crunching code gluePython as number crunching code glue
Python as number crunching code glueJiahao Chen
 
Building social network with Neo4j and Python
Building social network with Neo4j and PythonBuilding social network with Neo4j and Python
Building social network with Neo4j and PythonAndrii Soldatenko
 
Async Web Frameworks in Python
Async Web Frameworks in PythonAsync Web Frameworks in Python
Async Web Frameworks in PythonRyan Johnson
 
SylkServer: State of the art RTC application server
SylkServer: State of the art RTC application serverSylkServer: State of the art RTC application server
SylkServer: State of the art RTC application serverSaúl Ibarra Corretgé
 
Escalabilidad horizontal desde las trincheras
Escalabilidad horizontal desde las trincherasEscalabilidad horizontal desde las trincheras
Escalabilidad horizontal desde las trincherasSaúl Ibarra Corretgé
 

En vedette (18)

Dive into Python Class
Dive into Python ClassDive into Python Class
Dive into Python Class
 
Python class
Python classPython class
Python class
 
A deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio moduleA deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio module
 
The future of async i/o in Python
The future of async i/o in PythonThe future of async i/o in Python
The future of async i/o in Python
 
Python, do you even async?
Python, do you even async?Python, do you even async?
Python, do you even async?
 
Comandos para ubuntu 400 que debes conocer
Comandos para ubuntu 400 que debes conocerComandos para ubuntu 400 que debes conocer
Comandos para ubuntu 400 que debes conocer
 
Python Async IO Horizon
Python Async IO HorizonPython Async IO Horizon
Python Async IO Horizon
 
Practical continuous quality gates for development process
Practical continuous quality gates for development processPractical continuous quality gates for development process
Practical continuous quality gates for development process
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and python
 
Async Tasks with Django Channels
Async Tasks with Django ChannelsAsync Tasks with Django Channels
Async Tasks with Django Channels
 
The Awesome Python Class Part-4
The Awesome Python Class Part-4The Awesome Python Class Part-4
The Awesome Python Class Part-4
 
Regexp
RegexpRegexp
Regexp
 
What is the best full text search engine for Python?
What is the best full text search engine for Python?What is the best full text search engine for Python?
What is the best full text search engine for Python?
 
Python as number crunching code glue
Python as number crunching code gluePython as number crunching code glue
Python as number crunching code glue
 
Building social network with Neo4j and Python
Building social network with Neo4j and PythonBuilding social network with Neo4j and Python
Building social network with Neo4j and Python
 
Async Web Frameworks in Python
Async Web Frameworks in PythonAsync Web Frameworks in Python
Async Web Frameworks in Python
 
SylkServer: State of the art RTC application server
SylkServer: State of the art RTC application serverSylkServer: State of the art RTC application server
SylkServer: State of the art RTC application server
 
Escalabilidad horizontal desde las trincheras
Escalabilidad horizontal desde las trincherasEscalabilidad horizontal desde las trincheras
Escalabilidad horizontal desde las trincheras
 

Similaire à Python Master Class - Image Processing with OpenCV and Scikit-Image

Introduction to Machine Learning by MARK
Introduction to Machine Learning by MARKIntroduction to Machine Learning by MARK
Introduction to Machine Learning by MARKMRKUsafzai0607
 
Using the code below- I need help with creating code for the following.pdf
Using the code below- I need help with creating code for the following.pdfUsing the code below- I need help with creating code for the following.pdf
Using the code below- I need help with creating code for the following.pdfacteleshoppe
 
Image Processing TARUS: a FARMBOT
Image Processing TARUS: a FARMBOTImage Processing TARUS: a FARMBOT
Image Processing TARUS: a FARMBOTShivang Rana
 
IRJET- Object Detection in an Image using Convolutional Neural Network
IRJET- Object Detection in an Image using Convolutional Neural NetworkIRJET- Object Detection in an Image using Convolutional Neural Network
IRJET- Object Detection in an Image using Convolutional Neural NetworkIRJET Journal
 
502021435-12345678Minor-Project-Ppt.pptx
502021435-12345678Minor-Project-Ppt.pptx502021435-12345678Minor-Project-Ppt.pptx
502021435-12345678Minor-Project-Ppt.pptxshrey4922
 
Object detection
Object detectionObject detection
Object detectionSomesh Vyas
 
AI UNIT 4 - SRCAS JOC.pptx enjoy this ppt
AI UNIT 4 - SRCAS JOC.pptx enjoy this pptAI UNIT 4 - SRCAS JOC.pptx enjoy this ppt
AI UNIT 4 - SRCAS JOC.pptx enjoy this pptPavankalayankusetty
 
Primer vistazo al computer vision | 4Sessions Feb17
Primer vistazo al computer vision | 4Sessions Feb17Primer vistazo al computer vision | 4Sessions Feb17
Primer vistazo al computer vision | 4Sessions Feb17[T]echdencias
 
OpenCV 3.0 - Latest news and the Roadmap
OpenCV 3.0 - Latest news and the RoadmapOpenCV 3.0 - Latest news and the Roadmap
OpenCV 3.0 - Latest news and the RoadmapEugene Khvedchenya
 
Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...
Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...
Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...Ashwin Hariharan
 
IMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editor
IMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editorIMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editor
IMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editorRAHUL DANGWAL
 
Scraping recalcitrant web sites with Python & Selenium
Scraping recalcitrant web sites with Python & SeleniumScraping recalcitrant web sites with Python & Selenium
Scraping recalcitrant web sites with Python & SeleniumRoger Barnes
 
Practical Digital Image Processing 1
Practical Digital Image Processing 1Practical Digital Image Processing 1
Practical Digital Image Processing 1Aly Abdelkareem
 
Neuroscience Lab: a tour through the eyes of a pythonista, PyData Barcelona2017
Neuroscience Lab: a tour through the eyes of  a pythonista, PyData Barcelona2017Neuroscience Lab: a tour through the eyes of  a pythonista, PyData Barcelona2017
Neuroscience Lab: a tour through the eyes of a pythonista, PyData Barcelona2017Javier Martinez Alcantara
 
Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...
Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...
Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...INFOGAIN PUBLICATION
 
Finding Eigen values using numerical shooting method
Finding Eigen values using numerical shooting methodFinding Eigen values using numerical shooting method
Finding Eigen values using numerical shooting methodVijayananda Mohire
 
Computer Vision.pdf
Computer Vision.pdfComputer Vision.pdf
Computer Vision.pdfBantuBytes
 
maXbox starter75 object detection
maXbox starter75 object detectionmaXbox starter75 object detection
maXbox starter75 object detectionMax Kleiner
 
Kinect kunkuk final_
Kinect kunkuk final_Kinect kunkuk final_
Kinect kunkuk final_Yunkyu Choi
 

Similaire à Python Master Class - Image Processing with OpenCV and Scikit-Image (20)

OpenCV+Android.pptx
OpenCV+Android.pptxOpenCV+Android.pptx
OpenCV+Android.pptx
 
Introduction to Machine Learning by MARK
Introduction to Machine Learning by MARKIntroduction to Machine Learning by MARK
Introduction to Machine Learning by MARK
 
Using the code below- I need help with creating code for the following.pdf
Using the code below- I need help with creating code for the following.pdfUsing the code below- I need help with creating code for the following.pdf
Using the code below- I need help with creating code for the following.pdf
 
Image Processing TARUS: a FARMBOT
Image Processing TARUS: a FARMBOTImage Processing TARUS: a FARMBOT
Image Processing TARUS: a FARMBOT
 
IRJET- Object Detection in an Image using Convolutional Neural Network
IRJET- Object Detection in an Image using Convolutional Neural NetworkIRJET- Object Detection in an Image using Convolutional Neural Network
IRJET- Object Detection in an Image using Convolutional Neural Network
 
502021435-12345678Minor-Project-Ppt.pptx
502021435-12345678Minor-Project-Ppt.pptx502021435-12345678Minor-Project-Ppt.pptx
502021435-12345678Minor-Project-Ppt.pptx
 
Object detection
Object detectionObject detection
Object detection
 
AI UNIT 4 - SRCAS JOC.pptx enjoy this ppt
AI UNIT 4 - SRCAS JOC.pptx enjoy this pptAI UNIT 4 - SRCAS JOC.pptx enjoy this ppt
AI UNIT 4 - SRCAS JOC.pptx enjoy this ppt
 
Primer vistazo al computer vision | 4Sessions Feb17
Primer vistazo al computer vision | 4Sessions Feb17Primer vistazo al computer vision | 4Sessions Feb17
Primer vistazo al computer vision | 4Sessions Feb17
 
OpenCV 3.0 - Latest news and the Roadmap
OpenCV 3.0 - Latest news and the RoadmapOpenCV 3.0 - Latest news and the Roadmap
OpenCV 3.0 - Latest news and the Roadmap
 
Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...
Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...
Fashion E-Commerce: Using Computer Vision to Find Clothing that Fits Like a G...
 
IMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editor
IMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editorIMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editor
IMAGE ENHANCEMENT /ENHANCHING the feature of an image/ Image editor
 
Scraping recalcitrant web sites with Python & Selenium
Scraping recalcitrant web sites with Python & SeleniumScraping recalcitrant web sites with Python & Selenium
Scraping recalcitrant web sites with Python & Selenium
 
Practical Digital Image Processing 1
Practical Digital Image Processing 1Practical Digital Image Processing 1
Practical Digital Image Processing 1
 
Neuroscience Lab: a tour through the eyes of a pythonista, PyData Barcelona2017
Neuroscience Lab: a tour through the eyes of  a pythonista, PyData Barcelona2017Neuroscience Lab: a tour through the eyes of  a pythonista, PyData Barcelona2017
Neuroscience Lab: a tour through the eyes of a pythonista, PyData Barcelona2017
 
Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...
Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...
Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...
 
Finding Eigen values using numerical shooting method
Finding Eigen values using numerical shooting methodFinding Eigen values using numerical shooting method
Finding Eigen values using numerical shooting method
 
Computer Vision.pdf
Computer Vision.pdfComputer Vision.pdf
Computer Vision.pdf
 
maXbox starter75 object detection
maXbox starter75 object detectionmaXbox starter75 object detection
maXbox starter75 object detection
 
Kinect kunkuk final_
Kinect kunkuk final_Kinect kunkuk final_
Kinect kunkuk final_
 

Plus de Chathuranga Bandara

Plus de Chathuranga Bandara (8)

What is F# and why should we give a f#ck?
What is F# and why should we give a f#ck?What is F# and why should we give a f#ck?
What is F# and why should we give a f#ck?
 
Is your app secure
Is your app secureIs your app secure
Is your app secure
 
Agile negotiations
Agile negotiations Agile negotiations
Agile negotiations
 
Python master class 2
Python master class 2Python master class 2
Python master class 2
 
Python master class part 1
Python master class part 1Python master class part 1
Python master class part 1
 
Introduction to Celery
Introduction to CeleryIntroduction to Celery
Introduction to Celery
 
Introduction to Cloud Computing
Introduction to Cloud Computing  Introduction to Cloud Computing
Introduction to Cloud Computing
 
Responsive Vs Dedicated: Insight into Mobile Web
Responsive Vs Dedicated: Insight into Mobile WebResponsive Vs Dedicated: Insight into Mobile Web
Responsive Vs Dedicated: Insight into Mobile Web
 

Dernier

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 

Dernier (20)

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 

Python Master Class - Image Processing with OpenCV and Scikit-Image

  • 1. Python Master Class Part 3 By Chathuranga Bandara - www.chathuranga.com
  • 2. Agenda ● Intro to Image Processing ● Usage of Opencv ● Usage of Scikit - Image
  • 4. the analysis and manipulation of a digitized image, especially in order to improve its quality.
  • 5. It’s basically 3 steps 1. Import the Image 2. Analyse and manipulate the Image 3. Output the Image
  • 6. Purpose of Image processing Visualization - Observe the objects that are not visible. Image sharpening and restoration - To create a better image. Image retrieval - Seek for the image of interest. Measurement of pattern – Measures various objects in an image. Image Recognition – Distinguish the objects in an image.
  • 7.
  • 8. OpenCV OpenCV (Open Source Computer Vision) is a library of programming functions mainly aimed at real-time computer vision, developed by Intel's research center in Nizhny Novgorod (Russia), later supported by Willow Garage and now maintained by Itseez.
  • 9. How to install : First Download https://raw.githubusercontent.com/milq/scripts-ubuntu-debian/master/install-opencv.sh
  • 10. How to install bash install-opencv.sh
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 17.
  • 18. scikit - image As per scikit-image.org: “scikit-image is a collection of algorithms for image processing. It is available free of charge and free of restriction. We pride ourselves on high-quality, peer-reviewed code, written by an active community of volunteers.”
  • 19. How to install Pip install -u scikit-image
  • 20. Science Kit - Image
  • 21. First steps. 1. Create a file called: hello-image.py 2. Open with notepad 3. Try this code.
  • 22. # imports the thing. from scikit import data, io, filters image = data.coins() edges = filters.sobel(image) io.imshow(edges) io.show()
  • 23. Another Example # imports the thing. from scikit import data, io, filters import matplotlib.pyplot as plt image = data.camera() val = filters.threshold_otsu(image) mask = camera - val # save to disk plt.imsave('mask.jpg', mask)
  • 24. How about some cool stuff?
  • 25. from skimage import data, draw from skimage import transform, util import numpy as np from skimage import filters, color from matplotlib import pyplot as plt hl_color = np.array([0, 1, 0]) img = data.rocket() img = util.img_as_float(img) eimg = filters.sobel(color.rgb2gray(img)) plt.title('Original Image') plt.imshow(img)
  • 26. resized = transform.resize(img, (img.shape[0], img.shape[1] - 200)) plt.figure() plt.title('Resized Image') plt.imshow(resized)
  • 27. out = transform.seam_carve(img, eimg, 'vertical', 200) plt.figure() plt.title('Resized using Seam Carving') plt.imshow(out)
  • 28. masked_img = img.copy() poly = [(404, 281), (404, 360), (359, 364), (338, 337), (145, 337), (120, 322), (145, 304), (340, 306), (362, 284)] pr = np.array([p[0] for p in poly]) pc = np.array([p[1] for p in poly]) rr, cc = draw.polygon(pr, pc) masked_img[rr, cc, :] = masked_img[rr, cc, :]*0.5 + hl_color*.5 plt.figure() plt.title('Object Marked') plt.imshow(masked_img)
  • 29. eimg[rr, cc] -= 1000 plt.figure() plt.title('Object Removed') out = transform.seam_carve(img, eimg, 'vertical', 90) resized = transform.resize(img, out.shape) plt.imshow(out) plt.show()
  • 31. It’s your time to shine!