Introduction
Hello , I am going to setup the Open CV on windows OS. Open CV is in under open-source BSD license. Originally developed by Intel and this is supports the deep learning frameworks like TensorFlow.
OpenCV's application areas include:
- 2D and 3D feature toolkits
- Egomotion estimation
- Facial recognition system
- Gesture recognition
- Human–computer interaction (HCI)
- Mobile robotics
- Motion understanding
- Object identification
- Segmentation and recognition
- Stereopsis stereo vision: depth perception from 2 cameras
- Structure from motion (SFM)
- Motion tracking
- Augmented reality
It is written by mainly C++ interface and supported C++,python,java even android package,Matlab,C# for development. Therefore this tutorial I am going to use python language.
Installations
- If you haven't already installed python get it here (My version is 2.7) and install it.
- Then Download and install OpenCV here (My version is Open CV 2)
- Open python installed folder and copy the path (for ex C:\Python27)
- Then Run-> type systempropertiesadvanced
- open Environment variable -> User variable .....->path->paste the python installed path and Scripts path.(you can see it below)
Numpy install
"numpy" is a scientific and mathematical package and which is required to run opencv package.
- open the CMD then type pip install numpy (Make sure you have connected to the internet)
Make the link between python and opencv package
- Go to this path opencv\build\python\2.7\x64 then copy cv2.pyd file
- paste cv2.pyd into the Python27\Lib\site-packages folder
Test
- Open the python IDE and type import numpy and import cv2 to verify whether packages work or not. if any error is not displayed, you are done.
First Program - Face and Eye Detection
Then I load my pyscript IDE , you can simply use python default IDE or any python IDE. I will explain this code segment in next part broadly.
import numpy as np
import cv2 as cv
face_cascade = cv.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv.CascadeClassifier('haarcascade_eye.xml')
img = cv.imread('praneeth.png')
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
for (x,y,w,h) in faces:
cv.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
roi_gray = gray[y:y+h, x:x+w]
roi_color = img[y:y+h, x:x+w]
eyes = eye_cascade.detectMultiScale(roi_gray)
for (ex,ey,ew,eh) in eyes:
cv.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)
cv.imshow('img',img)
cv.waitKey(0)
cv.destroyAllWindows()
output
References
- https://opencv.org
- https://en.wikipedia.org/wiki/OpenCV
- https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRyp5yAZXk4rDv5DELPPv3ZqhEAUMJJIFw1m-sKd0cpwDfDQS_J
- https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRhLXSKHikcgnn1rhnVzw194t2Os8TUd6139jkFTn9v3NeZuAVY
Aftershokz titanium - TITanium Art
ReplyDeleteWe created a titanium pipe beautiful ford focus titanium aftershokz titanium inspired design that titanium pots and pans uses the most exquisite tools titanium body armor of the best designers titanium tv alternative in the field.