<filename>canny_edge_detection.py
# import libraries of python OpenCV  
# where its functionality resides 
import cv2  
  
# np is an alias pointing to numpy library 
import numpy as np 
  
# capture frames from a camera 
cap = cv2.VideoCapture(0) 

# loop runs if capturing has been initialized 
while(1):

    # reads frames from a camera 
    ret, frame = cap.read()

    # Converting the image to grayscale.
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 

    # Converting gray scale image to GaussianBlur  
    # so that change can be find easily 
    gaussianblur = cv2.GaussianBlur(gray, (5, 5), 0)

    #using canny function in gray
    edges_gray = cv2.Canny(gray, 60, 120)

    # using Canny function in gaussian blur
    edges = cv2.Canny(gaussianblur, 60, 120)

    #original frame
    cv2.imshow('Original',frame) 

    #edge_gray frame
    cv2.imshow('edge_gray', edges_gray)
    
    # edge frame
    cv2.imshow('edges', edges)

    #exit 
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# Close the window 
cap.release() 
  
# De-allocate any associated memory usage 
cv2.destroyAllWindows()  




<filename>canny_edge_detection.py
# import libraries of python OpenCV  
# where its functionality resides 
import cv2  
  
# np is an alias pointing to numpy library 
import numpy as np 
  
# capture frames from a camera 
cap = cv2.VideoCapture(0) 

# loop runs if capturing has been initialized 
while(1):

    # reads frames from a camera 
    ret, frame = cap.read()

    # Converting the image to grayscale.
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 

    # Converting gray scale image to GaussianBlur  
    # so that change can be find easily 
    gaussianblur = cv2.GaussianBlur(gray, (5, 5), 0)

    #using canny function in gray
    edges_gray = cv2.Canny(gray, 60, 120)

    # using Canny function in gaussian blur
    edges = cv2.Canny(gaussianblur, 60, 120)

    #original frame
    cv2.imshow('Original',frame) 

    #edge_gray frame
    cv2.imshow('edge_gray', edges_gray)
    
    # edge frame
    cv2.imshow('edges', edges)

    #exit 
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# Close the window 
cap.release() 
  
# De-allocate any associated memory usage 
cv2.destroyAllWindows()  




# import libraries of python OpenCV # where its functionality resides # np is an alias pointing to numpy library # capture frames from a camera # loop runs if capturing has been initialized # reads frames from a camera # Converting the image to grayscale. # Converting gray scale image to GaussianBlur # so that change can be find easily #using canny function in gray # using Canny function in gaussian blur #original frame #edge_gray frame # edge frame #exit # Close the window # De-allocate any associated memory usage