Path: blob/main/Convert-Image-to-Sketch/Convert-Image-to-Sketch.ipynb
292 views
Convert Image To Pencil Sketch
Step 1: Find an image that we want to convert into a pencil sketch. I am going to use the image of a Baby.
Step 2: Read in the Red, Blue, Green (RBG) image and then convert it to a grayscale image. This effectively makes the image a classic “black and white” photo. This will be our “greyscale image”.
Step 3: We are going to invert the “grey scaled image” also known as getting the image negative, this will be our “inverted greyscale image”. Inversion can be used to enhance details.
Step 4: Use a Gaussian function to blur the image. In image processing, a Gaussian blur (also known as Gaussian smoothing) is the result of blurring an image by a Gaussian function.
Step 5: Invert the newly created “blurred image”, this will be called the “inverted blurred image”.
Step 6: Now we are going to create the pencil sketch image by blending the “greyscale image” with the “inverted blurred image”. This can be done by dividing the “grayscale image” by the “inverted blurred image”. Since images are just arrays we can easily do this in programming by using the divide function from the cv2 library