Skip to content

Reading the image in RGB format and converting it to a grayscale image using CV2 library from python, matplotlib, style cvtcolor, bitwise_not, Gaussian_Blur and divide and converting the image.

Notifications You must be signed in to change notification settings

JaanviG/Image-to-pencil-Sketch-Python-CV2-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Image to pencil Sketch using Python CV2 library

(Note:- If you feel that this task has improved your abilities, don't forget to click the star icon in the upper right.)

Problem Statement:-

  • We need to read the image in RBG format and then convert it to a grayscale image. This will turn an image into a classic black and white photo. Then the next thing to do is invert the grayscale image also called negative image, this will be our inverted grayscale image. Inversion can be used to enhance details.
  • Then we can finally create the pencil sketch by mixing the grayscale image with the inverted blurry image.
  • This can be done by dividing the grayscale image by the inverted blurry image. Since images are just arrays, we can easily do this programmatically using the divide function from the cv2 library in Python.

Reading the image in RGB format and converting it to a grayscale image using CV2 library from python, matplotlib, style cvtcolor, bitwise_not, Gaussian_Blur and divide and converting the image.

image

  • Imported original Image

image

  • Grayscale image by using cvtcolor

image

  • Inverted image by using bitwise

image

  • Smoothen image by using Gaussian_Blur

image

  • Final output skechted Image

Steps:

  1. Convert the color image to grayscale.

  2. Invert the grayscale image to get a negative (invert image).

  3. Apply a GaussianBlur() to the negative from previous step.

  4. Finally, by using divide get the sketch image from the smoothen Image.

About

Reading the image in RGB format and converting it to a grayscale image using CV2 library from python, matplotlib, style cvtcolor, bitwise_not, Gaussian_Blur and divide and converting the image.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published