Build Your Own Live Video To Draw Sketch App In 7 Minutes | Computer Vision | OpenCV

In this tutorial, I have touched you, how to create a Live Video To Make Sketch in only 7 Minutes. Its computer vision Artificial Intelligence project and I used OpenCV Python Library and Cascade Classifier.

Live Video To Draw Sketch App

import cv2

# generate sketch image
def sketch(image):
    # Convert color image to grayscale
    img_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    # make blure image --GaussianBlur(src, ksize, sigmaX[, dst[, sigmaY[, borderType]]])
    img_gray_blur = cv2.GaussianBlur(img_gray, (5,5), 0)
    # Extract edges - Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]])
    canny_edges = cv2.Canny(img_gray_blur, 60, 90)
    #return blure image
    return canny_edges

#start video carmera
cap = cv2.VideoCapture(0)

while True:
    #read images fro the camera
    responce, frame =
    if responce == False:
    #show the stech image
    cv2.imshow('Live Sketch Drawing', sketch(frame))
    # wait for 1ms for kye 'q' no responce then show next image
    if cv2.waitKey(1) & 0xFF == ord('q'): 
# Release camera and close all windows

Leave a Reply