This is my make-through for the week's assignment. Grab a cup of coffee!
in this week we will Learn some tricks to make a cool stuff using computer vision at raspberry pi and open CV library
Thonny is an IDE for Python which is pre-installed on raspberry pi
if you are using windows you need to download and install it
now we need to install the required dependencies like opencv,python or any other library
Update os system
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk2.0-dev libgtk-3-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install python3-dev
sudo apt-get install python3-pip
pip3 install opencv-python
sudo apt-get install libqtgui4
sudo modprobe bcm2835-v4l2
sudo apt-get install libqt4-test
First you need to connect camera to RPI board Using Flat Cable
then write your first code to run camera and capture frames and view it
Detection and Recogration in openCV can run using per Tranned files called Classifiers
Haar-cascade is the most common classifier for a simple processes like detect face,eye,License plate ,or human bodies
After downloading HAAR-CASCADE we select required classifier and apply it to our captured frame
in our case we use class to detect face and other one to detect eye
now we need to track face or eye or whatever we have detect and read it's (x,y) location and based on it's location we can change color and print this coordination
the eye detection box will colored green if it's on left side and red in right side
as i sitting in center of the screen I get one eye in green and another one in red
we have two servos connected to each other using pan tilit kit that allow servos to move up and down, left and right
now we connect servos VCC, GND to RPI and Signal pins to 11 and 13
now we update our code and import GPIO Library and PWm
the problem here is there's now built-in library to move servo like arduino we need to create our own code block to map (x) value to pwm for the first servo and (y) value to the second servo