SlideShare una empresa de Scribd logo
1 de 24
CAMERA VISION
IN PYTHON USINGOPENCV
INTRODUCTION
TO
PresentedBy
Ethi$h Kumar Keerthi
17K65A0501
List of
Contents
 INTRODUCTION
 HISTORY
 INSTALLATION
 READ/OPEN IMAGE
 ACCESS WEB CAM
 TECHNIQUES
 APPLICATIONS
 ALTERNATIVES
INTRODUCTION
OpenCV (Open source computer vision) is a library of programming functions mainly aimed at real-
time computer vision. “Computer Vision is a field of deep learning that enables machines to see,
identify and process images like humans”.
Computer vision is one of the hottest fields in the industry right now. You can expect plenty of job
openings to come up in the next 2-4 years. The question then is – are you ready to take advantage of
these opportunities?
CONT...
Take a moment to ponder this – which applications or products come to your mind when you think of
computer vision? The list is HUGE. We use some of them everyday! Features like unlocking our
phones using face recognition, our smartphone cameras, self-driving cars – computer vision is
everywhere
History
Officially launched in 1999 the OpenCV project was initially an Intel Research initiative to advance
CPU-intensive applications, part of a series of projects including real-time ray tracing and 3D display
walls.The main contributors to the project included a number of optimization experts in Intel Russia,
as well as Intel's Performance Library Team. In the early days of OpenCV, the goals of the project
were described as:
Advance vision research by providing not only open but also optimized code for basic vision
infrastructure. No more reinventing the wheel.
Disseminate vision knowledge by providing a common infrastructure that developers could build on,
so that code would be more readily readable and transferable.
Advance vision-based commercial applications by making portable, performance-optimized code
available for free – with a license that did not require code to be open or free itself.
The first alpha version of OpenCV was released to the public at the IEEE Conference on Computer
Vision and Pattern Recognition in 2000, and five betas were released between 2001 and 2005. The
first 1.0 version was released in 2006. A version 1.1 "pre-release" was released in October 2008.
CONT...
The second major release of the OpenCV was in October 2009. OpenCV 2 includes major changes to
the C++ interface, aiming at easier, more type-safe patterns, new functions, and better
implementations for existing ones in terms of performance (especially on multi-core systems).
Official releases now occur every six months and development is now done by an independent
Russian team supported by commercial corporations.In August 2012, support for OpenCV was taken
over by a non-profit foundation OpenCV.org, which maintains a developer.On May 2016, Intel signed
an agreement to acquire Itseez, a leading developer of OpenCV
OpenCV runs on the following desktop operating systems:
Windows, Linux, macOS, FreeBSD, NetBSD, OpenBSD.
OpenCV runs on the following mobile operating systems: Android, iOS, Maemo,BlackBerry 10. The
user can get official releases from SourceForge or take the latest sources from GitHub.
Before going to our topic first we have to pay our sincere attention to PYTHON 2
So It's time to change our code to PYTHON 3
INSTALLATION
windows
• Python 3+ https://www.python.org/downloads/
• After installing the python and set path and install pip
• After installing pip, Open CMD as Adminstrator
•we need to install Frequently used Libraries before we install opencv : Numpy, Matplotlib, Scipy
• All we need to just type these commands
>>>pip install numpy
>>>pip install matplotlib
>>>pip install scipy
INSTALLATION
• Or try Anaconda (Python 3+ popular libraries) https://www.continuum.io/downloads
• Download latest OpenCV release from sourceforge site and click to extract it
(http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.6/OpenCV-2.4.6.0.exe/download)
• Goto opencv/build/python/3.5 folder(your respective version folder).
• Copy cv2.pyd to C:/Python35/lib/site-packeges.
• Open Python IDLE and type following codes in Python terminal.
>>>import cv2
•If cv2 imported successfully than your installation is completed
INSTALLATION
MAC
• Python 3.5 or 3.6 or Anaconda https://www.python.org/downloads/
https://www.continuum.io/downloads
• Frequently used Libraries : Numpy, Matplotlib, Scipy in Terminals : pip3 install –U numpy scipy
matplotlib (for Python 3.X)
• Download openCV http://opencv.org/downloads.html
• Install Xcode https://developer.apple.com/xcode/
• Install Cmake https://cmake.org/download/
• Build openCV for Python http://luigolas.com/blog/2014/09/15/install-opencv3-with- python-3-mac-
osx/
Read/Show Image
• In these we just interact with the opencv by giving
image as input
Code-
import cv2
img = cv2.imread('C:/Users/91741/Desktop/projects
python/seminar ppt/ammababoi.jpg')
cv2.imshow('sample image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Output
Code
import cv2
import numpy as np
cap = cv2.VideoCapture('chaplin.mp4')
if (cap.isOpened()== False):
print("Error opening video stream or file")
while(cap.isOpened()):
ret, frame = cap.read()
if ret == True:
cv2.imshow('Frame',frame)
if cv2.waitKey(25) & 0xFF == ord('q'):
break
else:
break
cap.release()
cv2.destroyAllWindows()
Read/Show Video
• In these we just interact with the opencv by giving Video as
input
• In these we need to use NUMPY package
ACCESS WEB CAM
• In opencv main component is camera so now we look at the simple code for open webcam using
python code
>>> import cv2
cap = cv2.VideoCapture(0)
if not cap.isOpened():
raise IOError("Cannot open webcam")
while True:
ret, frame = cap.read()
frame = cv2.resize(frame, None, fx=1.5, fy=1.5, interpolation=cv2.INTER_AREA)
cv2.imshow('Input', frame)
c = cv2.waitKey(1)
if c == 27:
break
cap.release()
cv2.destroyAllWindows()
TECHNIQUES AND METHODS
• In opencv we have so many techniques some of them are
 Changing Color Spaces
 Resizing Images
 Image Rotation
 Image Translation
 Simple Image Thresholding
 Adaptive Thresholding
 Image Segmentation (Watershed Algorithm)
 Bitwise Operations
 Edge Detection
 Image Filtering
 Image Contours
Here we discuss about some frequently used methods
CANNY EDGE DETECTION
The Canny edge detector is an edge detection operator that uses a multi-stage algorithm to detect a
wide range of edges in images. It was developed by John F. Canny in 1986. Canny also produced a
computational theory of edge detection explaining why the technique works.
Canny edge detection is a technique to extract useful structural information from different vision
objects and dramatically reduce the amount of data to be processed. It has been widely applied in
various computer vision systems. Canny has found that the requirements for the application of edge
detection on diverse vision systems are relatively similar. Thus, an edge detection solution to address
these requirements can be implemented in a wide range of situations. The general criteria for edge
detection include:
Detection of edge with low error rate, which means that the detection should accurately catch as many
edges shown in the image as possible
CONT...
The edge point detected from the operator should accurately localize on the center of the edge.
A given edge in the image should only be marked once, and where possible, image noise should
not create false edges.
To satisfy these requirements Canny used the calculus of variations – a technique which finds the
function which optimizes a given functional. The optimal function in Canny's detector is described
by the sum of four exponential terms, but it can be approximated by the first derivative of a
Gaussian.
Among the edge detection methods developed so far, Canny edge detection algorithm is one of the
most strictly defined methods that provides good and reliable detection. Owing to its optimality to
meet with the three criteria for edge detection and the simplicity of process for implementation, it
became one of the most popular algorithms for edge detection.
Code For Canny Edge Detection for Image
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('Brahmi.jpg',0)
edges = cv2.Canny(img,100,200)
plt.subplot(121),plt.imshow(img,cmap = 'gray')
plt.title('Original Image'), plt.xticks([]), plt.yticks([])
plt.subplot(122),plt.imshow(edges,cmap = 'gray')
plt.title('Canny Edge Image'), plt.xticks([]), plt.yticks([])
plt.show()
Output
Code For Canny Edge Detection for Live Video
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while(1):
frame = cap.read()
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
lower_red = np.array([30,150,50])
upper_red = np.array([255,255,180])
mask = cv2.inRange(hsv, lower_red, upper_red)
res = cv2.bitwise_and(frame,frame, mask= mask)
laplacian = cv2.Laplacian(frame,cv2.CV_64F)
sobelx = cv2.Sobel(frame,cv2.CV_64F,1,0,ksize=5)
sobely = cv2.Sobel(frame,cv2.CV_64F,0,1,ksize=5)
cv2.imshow('Original',frame)
cv2.imshow('Mask',mask)
cv2.imshow('laplacian',laplacian)
cv2.imshow('sobelx',sobelx)
cv2.imshow('sobely',sobely)
k = cv2.waitKey(5) & 0xFF
if k == 27:
break
cv2.destroyAllWindows()
cap.release()
Image Filtering
In order to filter you have a few options.
Generally, you are probably going to convert
your colors to HSV, which is "Hue
Saturation Value." This can help you actually
pinpoint a more specific color, based on hue
and saturation ranges, with a variance of
value, for example. If you wanted, you could
actually produce filters based on BGR
values, but this would be a bit more difficult.
If you're having a hard time visualizing HSV,
don't feel silly, check out the Wikipedia page
on HSV, there is a very useful graphic there
for you to visualize it. Hue for color,
saturation for the strength of the color, and
value for light is how I would best describe
it personally. Now let's hop in.
Code For Image Filtering
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while(1):
frame = cap.read()
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
lower_red = np.array([30,150,50])
upper_red = np.array([255,255,180])
mask = cv2.inRange(hsv, lower_red, upper_red)
res = cv2.bitwise_and(frame,frame, mask= mask)
cv2.imshow('frame',frame)
cv2.imshow('mask',mask)
cv2.imshow('res',res)
k = cv2.waitKey(5) & 0xFF
if k == 27:
break
cv2.destroyAllWindows()
cap.release()
Output for Image Filtering
APPLICATIONS
OpenCV is being used for a very wide range of applications which include:
• Road Lane Detection Image Processing
• Street view image stitching
• Automated inspection and surveillance
• Robot and driver-less car navigation and control
• Medical image analysis
• Video/image search and retrieval
• Movies - 3D structure from motion
• Interactive art installations
ALTERNATIVES
Like Opencv we have different alternative tools/Libraries some of them are
• SimpleCV
• Accord.NET Framework
• ImageUltimate
• BoofCV
• libdwt
• FastCV Computer Vision
• LeptonicaSharp
END WORDS
OpenCV is truly an all emcompassing library for computer vision tasks. I just tried out all the
above codes on my machine – the best way to learn computer vision is by applying it on your
own. I encourage you to build your own applications and experiment with OpenCV as much as
you can if you intrested.
OpenCV is continually adding new modules for latest algorithms from Machine learning, do
check out their Github repository and get familiar with implementation.
THANK YOU
UR's
Ethi$h Kumar Keerthi

Más contenido relacionado

Similar a Opencv

OpenCV (Open source computer vision)
OpenCV (Open source computer vision)OpenCV (Open source computer vision)
OpenCV (Open source computer vision)Chetan Allapur
 
Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCVAutomatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCVEditor IJCATR
 
Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV Editor IJCATR
 
Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...Krunal Patel
 
Ijsrdv1 i4049
Ijsrdv1 i4049Ijsrdv1 i4049
Ijsrdv1 i4049ijsrd.com
 
License Plate Recognition System using Python and OpenCV
License Plate Recognition System using Python and OpenCVLicense Plate Recognition System using Python and OpenCV
License Plate Recognition System using Python and OpenCVVishal Polley
 
502021435-12345678Minor-Project-Ppt.pptx
502021435-12345678Minor-Project-Ppt.pptx502021435-12345678Minor-Project-Ppt.pptx
502021435-12345678Minor-Project-Ppt.pptxshrey4922
 
An AI Based ATM Intelligent Security System using Open CV and YOLO
An AI Based ATM Intelligent Security System using Open CV and YOLOAn AI Based ATM Intelligent Security System using Open CV and YOLO
An AI Based ATM Intelligent Security System using Open CV and YOLOYogeshIJTSRD
 
"The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming...
"The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming..."The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming...
"The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming...Edge AI and Vision Alliance
 
OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012Wingston
 
Starting with OpenCV on i.MX 6 Processors
Starting with OpenCV on i.MX 6 ProcessorsStarting with OpenCV on i.MX 6 Processors
Starting with OpenCV on i.MX 6 ProcessorsToradex
 
Open Cv – An Introduction To The Vision
Open Cv – An Introduction To The VisionOpen Cv – An Introduction To The Vision
Open Cv – An Introduction To The VisionHemanth Haridas
 
Kinect installation guide
Kinect installation guideKinect installation guide
Kinect installation guidegilmsdn
 
Presentation1.2.pptx
Presentation1.2.pptxPresentation1.2.pptx
Presentation1.2.pptxpranaykusuma
 
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019Codemotion
 
Monteverdi 2.0 - Remote sensing software for Pleiades images analysis
Monteverdi 2.0 - Remote sensing software for Pleiades images analysisMonteverdi 2.0 - Remote sensing software for Pleiades images analysis
Monteverdi 2.0 - Remote sensing software for Pleiades images analysisotb
 
Machine Vision On Embedded Platform
Machine Vision On Embedded Platform Machine Vision On Embedded Platform
Machine Vision On Embedded Platform Omkar Rane
 

Similar a Opencv (20)

OpenCV (Open source computer vision)
OpenCV (Open source computer vision)OpenCV (Open source computer vision)
OpenCV (Open source computer vision)
 
Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCVAutomatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV
 
Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV
 
OpenCV+Android.pptx
OpenCV+Android.pptxOpenCV+Android.pptx
OpenCV+Android.pptx
 
Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...
 
Ijsrdv1 i4049
Ijsrdv1 i4049Ijsrdv1 i4049
Ijsrdv1 i4049
 
License Plate Recognition System using Python and OpenCV
License Plate Recognition System using Python and OpenCVLicense Plate Recognition System using Python and OpenCV
License Plate Recognition System using Python and OpenCV
 
502021435-12345678Minor-Project-Ppt.pptx
502021435-12345678Minor-Project-Ppt.pptx502021435-12345678Minor-Project-Ppt.pptx
502021435-12345678Minor-Project-Ppt.pptx
 
An AI Based ATM Intelligent Security System using Open CV and YOLO
An AI Based ATM Intelligent Security System using Open CV and YOLOAn AI Based ATM Intelligent Security System using Open CV and YOLO
An AI Based ATM Intelligent Security System using Open CV and YOLO
 
"The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming...
"The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming..."The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming...
"The OpenCV Open Source Computer Vision Library: What’s New and What’s Coming...
 
OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012
 
Starting with OpenCV on i.MX 6 Processors
Starting with OpenCV on i.MX 6 ProcessorsStarting with OpenCV on i.MX 6 Processors
Starting with OpenCV on i.MX 6 Processors
 
Digit recognizer
Digit recognizerDigit recognizer
Digit recognizer
 
Open Cv – An Introduction To The Vision
Open Cv – An Introduction To The VisionOpen Cv – An Introduction To The Vision
Open Cv – An Introduction To The Vision
 
Kinect installation guide
Kinect installation guideKinect installation guide
Kinect installation guide
 
Presentation1.2.pptx
Presentation1.2.pptxPresentation1.2.pptx
Presentation1.2.pptx
 
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
 
Monteverdi 2.0 - Remote sensing software for Pleiades images analysis
Monteverdi 2.0 - Remote sensing software for Pleiades images analysisMonteverdi 2.0 - Remote sensing software for Pleiades images analysis
Monteverdi 2.0 - Remote sensing software for Pleiades images analysis
 
Ionic debugger
Ionic debuggerIonic debugger
Ionic debugger
 
Machine Vision On Embedded Platform
Machine Vision On Embedded Platform Machine Vision On Embedded Platform
Machine Vision On Embedded Platform
 

Último

Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 

Último (20)

(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 

Opencv

  • 1. CAMERA VISION IN PYTHON USINGOPENCV INTRODUCTION TO PresentedBy Ethi$h Kumar Keerthi 17K65A0501
  • 2. List of Contents  INTRODUCTION  HISTORY  INSTALLATION  READ/OPEN IMAGE  ACCESS WEB CAM  TECHNIQUES  APPLICATIONS  ALTERNATIVES
  • 3. INTRODUCTION OpenCV (Open source computer vision) is a library of programming functions mainly aimed at real- time computer vision. “Computer Vision is a field of deep learning that enables machines to see, identify and process images like humans”. Computer vision is one of the hottest fields in the industry right now. You can expect plenty of job openings to come up in the next 2-4 years. The question then is – are you ready to take advantage of these opportunities?
  • 4. CONT... Take a moment to ponder this – which applications or products come to your mind when you think of computer vision? The list is HUGE. We use some of them everyday! Features like unlocking our phones using face recognition, our smartphone cameras, self-driving cars – computer vision is everywhere
  • 5. History Officially launched in 1999 the OpenCV project was initially an Intel Research initiative to advance CPU-intensive applications, part of a series of projects including real-time ray tracing and 3D display walls.The main contributors to the project included a number of optimization experts in Intel Russia, as well as Intel's Performance Library Team. In the early days of OpenCV, the goals of the project were described as: Advance vision research by providing not only open but also optimized code for basic vision infrastructure. No more reinventing the wheel. Disseminate vision knowledge by providing a common infrastructure that developers could build on, so that code would be more readily readable and transferable. Advance vision-based commercial applications by making portable, performance-optimized code available for free – with a license that did not require code to be open or free itself. The first alpha version of OpenCV was released to the public at the IEEE Conference on Computer Vision and Pattern Recognition in 2000, and five betas were released between 2001 and 2005. The first 1.0 version was released in 2006. A version 1.1 "pre-release" was released in October 2008.
  • 6. CONT... The second major release of the OpenCV was in October 2009. OpenCV 2 includes major changes to the C++ interface, aiming at easier, more type-safe patterns, new functions, and better implementations for existing ones in terms of performance (especially on multi-core systems). Official releases now occur every six months and development is now done by an independent Russian team supported by commercial corporations.In August 2012, support for OpenCV was taken over by a non-profit foundation OpenCV.org, which maintains a developer.On May 2016, Intel signed an agreement to acquire Itseez, a leading developer of OpenCV OpenCV runs on the following desktop operating systems: Windows, Linux, macOS, FreeBSD, NetBSD, OpenBSD. OpenCV runs on the following mobile operating systems: Android, iOS, Maemo,BlackBerry 10. The user can get official releases from SourceForge or take the latest sources from GitHub.
  • 7. Before going to our topic first we have to pay our sincere attention to PYTHON 2 So It's time to change our code to PYTHON 3
  • 8. INSTALLATION windows • Python 3+ https://www.python.org/downloads/ • After installing the python and set path and install pip • After installing pip, Open CMD as Adminstrator •we need to install Frequently used Libraries before we install opencv : Numpy, Matplotlib, Scipy • All we need to just type these commands >>>pip install numpy >>>pip install matplotlib >>>pip install scipy
  • 9. INSTALLATION • Or try Anaconda (Python 3+ popular libraries) https://www.continuum.io/downloads • Download latest OpenCV release from sourceforge site and click to extract it (http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.6/OpenCV-2.4.6.0.exe/download) • Goto opencv/build/python/3.5 folder(your respective version folder). • Copy cv2.pyd to C:/Python35/lib/site-packeges. • Open Python IDLE and type following codes in Python terminal. >>>import cv2 •If cv2 imported successfully than your installation is completed
  • 10. INSTALLATION MAC • Python 3.5 or 3.6 or Anaconda https://www.python.org/downloads/ https://www.continuum.io/downloads • Frequently used Libraries : Numpy, Matplotlib, Scipy in Terminals : pip3 install –U numpy scipy matplotlib (for Python 3.X) • Download openCV http://opencv.org/downloads.html • Install Xcode https://developer.apple.com/xcode/ • Install Cmake https://cmake.org/download/ • Build openCV for Python http://luigolas.com/blog/2014/09/15/install-opencv3-with- python-3-mac- osx/
  • 11. Read/Show Image • In these we just interact with the opencv by giving image as input Code- import cv2 img = cv2.imread('C:/Users/91741/Desktop/projects python/seminar ppt/ammababoi.jpg') cv2.imshow('sample image',img) cv2.waitKey(0) cv2.destroyAllWindows() Output
  • 12. Code import cv2 import numpy as np cap = cv2.VideoCapture('chaplin.mp4') if (cap.isOpened()== False): print("Error opening video stream or file") while(cap.isOpened()): ret, frame = cap.read() if ret == True: cv2.imshow('Frame',frame) if cv2.waitKey(25) & 0xFF == ord('q'): break else: break cap.release() cv2.destroyAllWindows() Read/Show Video • In these we just interact with the opencv by giving Video as input • In these we need to use NUMPY package
  • 13. ACCESS WEB CAM • In opencv main component is camera so now we look at the simple code for open webcam using python code >>> import cv2 cap = cv2.VideoCapture(0) if not cap.isOpened(): raise IOError("Cannot open webcam") while True: ret, frame = cap.read() frame = cv2.resize(frame, None, fx=1.5, fy=1.5, interpolation=cv2.INTER_AREA) cv2.imshow('Input', frame) c = cv2.waitKey(1) if c == 27: break cap.release() cv2.destroyAllWindows()
  • 14. TECHNIQUES AND METHODS • In opencv we have so many techniques some of them are  Changing Color Spaces  Resizing Images  Image Rotation  Image Translation  Simple Image Thresholding  Adaptive Thresholding  Image Segmentation (Watershed Algorithm)  Bitwise Operations  Edge Detection  Image Filtering  Image Contours Here we discuss about some frequently used methods
  • 15. CANNY EDGE DETECTION The Canny edge detector is an edge detection operator that uses a multi-stage algorithm to detect a wide range of edges in images. It was developed by John F. Canny in 1986. Canny also produced a computational theory of edge detection explaining why the technique works. Canny edge detection is a technique to extract useful structural information from different vision objects and dramatically reduce the amount of data to be processed. It has been widely applied in various computer vision systems. Canny has found that the requirements for the application of edge detection on diverse vision systems are relatively similar. Thus, an edge detection solution to address these requirements can be implemented in a wide range of situations. The general criteria for edge detection include: Detection of edge with low error rate, which means that the detection should accurately catch as many edges shown in the image as possible
  • 16. CONT... The edge point detected from the operator should accurately localize on the center of the edge. A given edge in the image should only be marked once, and where possible, image noise should not create false edges. To satisfy these requirements Canny used the calculus of variations – a technique which finds the function which optimizes a given functional. The optimal function in Canny's detector is described by the sum of four exponential terms, but it can be approximated by the first derivative of a Gaussian. Among the edge detection methods developed so far, Canny edge detection algorithm is one of the most strictly defined methods that provides good and reliable detection. Owing to its optimality to meet with the three criteria for edge detection and the simplicity of process for implementation, it became one of the most popular algorithms for edge detection.
  • 17. Code For Canny Edge Detection for Image import cv2 import numpy as np from matplotlib import pyplot as plt img = cv2.imread('Brahmi.jpg',0) edges = cv2.Canny(img,100,200) plt.subplot(121),plt.imshow(img,cmap = 'gray') plt.title('Original Image'), plt.xticks([]), plt.yticks([]) plt.subplot(122),plt.imshow(edges,cmap = 'gray') plt.title('Canny Edge Image'), plt.xticks([]), plt.yticks([]) plt.show() Output
  • 18. Code For Canny Edge Detection for Live Video import cv2 import numpy as np cap = cv2.VideoCapture(0) while(1): frame = cap.read() hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) lower_red = np.array([30,150,50]) upper_red = np.array([255,255,180]) mask = cv2.inRange(hsv, lower_red, upper_red) res = cv2.bitwise_and(frame,frame, mask= mask) laplacian = cv2.Laplacian(frame,cv2.CV_64F) sobelx = cv2.Sobel(frame,cv2.CV_64F,1,0,ksize=5) sobely = cv2.Sobel(frame,cv2.CV_64F,0,1,ksize=5) cv2.imshow('Original',frame) cv2.imshow('Mask',mask) cv2.imshow('laplacian',laplacian) cv2.imshow('sobelx',sobelx) cv2.imshow('sobely',sobely) k = cv2.waitKey(5) & 0xFF if k == 27: break cv2.destroyAllWindows() cap.release()
  • 19. Image Filtering In order to filter you have a few options. Generally, you are probably going to convert your colors to HSV, which is "Hue Saturation Value." This can help you actually pinpoint a more specific color, based on hue and saturation ranges, with a variance of value, for example. If you wanted, you could actually produce filters based on BGR values, but this would be a bit more difficult. If you're having a hard time visualizing HSV, don't feel silly, check out the Wikipedia page on HSV, there is a very useful graphic there for you to visualize it. Hue for color, saturation for the strength of the color, and value for light is how I would best describe it personally. Now let's hop in. Code For Image Filtering import cv2 import numpy as np cap = cv2.VideoCapture(0) while(1): frame = cap.read() hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) lower_red = np.array([30,150,50]) upper_red = np.array([255,255,180]) mask = cv2.inRange(hsv, lower_red, upper_red) res = cv2.bitwise_and(frame,frame, mask= mask) cv2.imshow('frame',frame) cv2.imshow('mask',mask) cv2.imshow('res',res) k = cv2.waitKey(5) & 0xFF if k == 27: break cv2.destroyAllWindows() cap.release()
  • 20. Output for Image Filtering
  • 21. APPLICATIONS OpenCV is being used for a very wide range of applications which include: • Road Lane Detection Image Processing • Street view image stitching • Automated inspection and surveillance • Robot and driver-less car navigation and control • Medical image analysis • Video/image search and retrieval • Movies - 3D structure from motion • Interactive art installations
  • 22. ALTERNATIVES Like Opencv we have different alternative tools/Libraries some of them are • SimpleCV • Accord.NET Framework • ImageUltimate • BoofCV • libdwt • FastCV Computer Vision • LeptonicaSharp
  • 23. END WORDS OpenCV is truly an all emcompassing library for computer vision tasks. I just tried out all the above codes on my machine – the best way to learn computer vision is by applying it on your own. I encourage you to build your own applications and experiment with OpenCV as much as you can if you intrested. OpenCV is continually adding new modules for latest algorithms from Machine learning, do check out their Github repository and get familiar with implementation.