Detecting face in real-time is similar to detecting a face in still pictures. The only difference is in real-time face detection, and we have to take a video stream of computer. In this program, we used 'VideoCapture()' function. This function captures video from other camera and stores the frames temporarily in matrix assigned to it. Here this function captures video from the default camera and temporarily stores the frames in 'real_time' matrix.The following program detects human faces in real-time −Example#include #include #include //This header includes definition of 'rectangle()' function// #include //This header includes the definition of Cascade Classifier// #include using ... Read More
When we want to track the position of the face, it is better to enclose the face with ellipse because an ellipse has a center. This center is also the center point of the detected face. As result, tracking the position of detected face becomes more accurate.The following program tracks the center of detected face and show the position in console window −Example#include #include #include //This header includes definition of 'rectangle()' function// #include //This header includes the definition of Cascade Classifier// #include using namespace std; using namespace cv; int main(int argc, char** argv){ Mat image_with_humanface;//Declaring a matrix to load ... Read More
We will learn how to detect the largest face only. This topic is same as the previous topic. The only difference is we used an additional 'Rect' structure and a 'for loop' to detect the largest face.The actual format of this function −Mat faceROI = image_with_humanface(maxRect)The maxRect have the area and location information of the largest face located on the image. The line above is cropping the same area stored in maxRect on the same location where the largest face is located on the image and storing in 'faceROI' matrix.The following program detects the largest face from still pictures −Example#include ... Read More
TLS is also known as SSL (Secure Sockets Layer). It refers to Transport Layer Security.When there is an unencrypted connection between the MySQL client and the server, a person who has access to the network can watch all the traffic and inspect the data that is being sent or received between client and server. When the user wishes to move information over a network in a secure method, an unencrypted connection is not acceptable.To make any sort of data unreadable, encryption has to be used. Encryption algorithms usually include security elements that help resist many kinds of known attacks, some ... Read More
We will know how to crop the detected faces in OpenCV. To crop detected faces, we need multiple matrices. The most appropriate way is to use an image array. In this program using the following two lines, we have declared two image matrices −Mat cropped_faces[4];Mat faceROI[4];The first matrix is to store the cropped images, and the second matrix is to define the region of interest. In the detection process, first, the program locates the faces and store them in vectors. In our program, the name of the vector is 'faces' Vectors can contain multiple elements.Using the following two lines, we ... Read More
Counting the number of faces located in an image is easy. The program we wrote in the previous section already have the information of number of faces in 'faces.size()'. This code-'faces.size()' gives an integer value.For example, if we write 'int x = faces.size()', the 'x' will contain the number of faces.The following program calculates the number of faces from a given image and shows it in console window.Example#include #include #include //This header includes the definition of Cascade Classifier// #include using namespace std; using namespace cv; int main(int argc, char** argv){ Mat image_with_humanface;//Declaring a matrix to load image with human ... Read More
We detect the faces from the image. To detect the face, we used 'detectMultiScale()' function.The actual format of this function is −SyntaxdetectMultiScale(source matrix, vector, searchScaleFactor, minNeighbours, flags, minfeatureSize)By changing the function arguments, we can control the 'detect.MultiSpace()' function. This function takes the following arguments.Source MatrixIt is the matrix where the face will be detected. In this case, it will the matrix which is keeping the video frames.VectorThe 'detect.MultiScale()' function will be a vector of rectangular type. A rectangle is a vector in OpenCV, and we have to define it as a vector.searchScaleFactorSearch scale factor determines how many different sizes of ... Read More
Color tracking is similar to color detection. For tracking purpose, we added extra few lines to calculate the area of the detected object and then track the current position of that area and finally used line() function of OpenCV to show the object's path of motion.The following program demonstrates how to track the color in OpenCV using C++.Example#include #include #include using namespace std; using namespace cv; int main(int argc, char** argv) { VideoCapture video_load(0);//capturing video from default camera// namedWindow("Adjust");//declaring window to show the image// int Hue_Low= 0;//lower range of hue// int Hue_high = 22;//upper range of ... Read More
We will understand how to detect specific color and track object based on color. Performance of color detection and color detection based tracking system is environment dependent.If you change light of the room or if you change background color, there will be significant effect on color detection.The following program demonstrates how to detect the color using OpenCV in C++.Example#include #include #include using namespace std; using namespace cv; int main(int argc, char** argv) { VideoCapture video_load(0);//capturing video from default camera// namedWindow("Adjust");//declaring window to show the image// int Hue_Lower_Value = 0;//initial hue value(lower)// int Hue_Lower_Upper_Value = 22;//initial hue ... Read More
Mouse Events is one of the most useful features of OpenCV. In OpenCV, we can track the mouse pointer's position and track the clicks (right, left and middle-click). OpenCV has a wide application in robotics and computer vision. In robotics and computer vision tracking mouse pointer and clicks are frequently used.Here we will understand how to track the mouse pointer's location on an image and track the clicks.The following program demonstrates how to track the location of the mouse pointer and clicks.Example#include #include #include using namespace std; using namespace cv; void locator(int event, int x, int y, int flags, void* ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP