Create a Sketch video from your web cam

Today we continue with the Sketch project. We use the web built-in cam in our opencv app to Sketch the image and display it but today we modify our app in order to have a video.

For doing this we have to follow some specific steps :

1.- Convert our image to gray scale, using cv2 library and cv2.cvtColor(p1,p2) function. Where p1 is the image we want to sketch and p2 is the color Gray in this case.

2.- Clean up resulting image from previous step, using cv2.GuassianBlur(p1,p2,p3) function from cv2 library. Where p1 is the image from previous step, p2 is Gaussian Kernel Size. [height width]. height and width should be odd and can have different values. If ksize is set to [0 0], then ksize is computed from sigma values. p3 is Kernel standard deviation along Y-axis (vertical direction). If sigmaY=0, then sigmaX value is taken for sigmaY

3.- Extract edges using function cv2.Canny(p1,p2,p3) from cv2 library. Where p1 is the image from previous step, p2 is the High threshold value of intensity gradient and p3 is the Low threshold value of intensity gradient.

4.- Invert binarize the image using function cv2.threshold(p1,p2,p3,p4) from cv2 library. Where p1 is the image from previous step, which is a Grayscale Image array, p2 is a value which is used to classify the pixel values, p3 is the value to be given if pixel value is more than (sometimes less than) the threshold value, and p4 is the type of thresholding to be applied.

That’s it you use your built in camera and voila, you should have your image sketch….

Look at the results!!!

Video Sketch