Computer Vision as you know (or even if you don’t) is a very powerful tool with immense possibilities. So, when I set up to prepare a comic of one of my friend’s college life, I soon realized that I needed something that would reduce my efforts of actually painting it but will retain the quality and I came up with the following solution.
Let’s see the result first –
Edges obtained from the image (Adaptive Threshold result)
Let’s see the code:
Basically we are going to use a series of filters and image conversions.
- First we downscale the image and then apply bilateral filter to get a cartoon flavour. Then again we upscale the image.
- Next step is getting a blurred version of the original image. Now, we don’t want the colours to interfere in this process. We only want the blurring of the boundaries. For this, we first convert the image to gray – scale and then we apply the media blur filter.
- Next step is to identify the edges in the image and then add this to the previously modified images to get a sketch pen effect. For this first we are using adaptive threshold. You can experiment with other types of threshold techniques also. Because Computer Vision is all about experimenting. In step 5, we compile the final images obtained from the previous steps.
Simpler Implementation –
What you can do?
Experiment! Try changing the down sample steps, or the number of bilateral filters applied, or even the size of the filter, or the threshold technique to get the edges. Now, one thing to keep in mind. This process is a general one and will not give the best result for different images. That’s why, you should experiment with different values to get a feel of the whole process.
That’s all from my side! Auf Wiedersehen!
About the author:
Vishwesh Shrimali is an Undergraduate Mechanical Engineering student at BITS Pilani. He fulfils about all the requirements not taught in his branch- white hat hacker, network security operator, and an ex – Competitive Programmer. As a firm believer in power of Python, his majority work has been in the same language. Whenever he get some time apart from programming, attending classes, watching CSI Cyber, he go for a long walk and play guitar in silence. His motto of life is – “Enjoy your life, ‘cause it’s worth enjoying!”
If you also wish to showcase your blog here, please see GBlog for guest blog writing on GeeksforGeeks.
- Image Steganography using OpenCV in Python
- Image Processing without OpenCV | Python
- Image Translation using OpenCV | Python
- Image Pyramid using OpenCV | Python
- Reading an image in OpenCV using Python
- Python | Image blurring using OpenCV
- Image Registration using OpenCV | Python
- Image Resizing using OpenCV | Python
- Log transformation of an image using Python and OpenCV
- Python | Detect Polygons in an Image using OpenCV
- Negative transformation of an image using Python and OpenCV
- OpenCV Python Program to blur an image
- Python | Detect corner of an image using OpenCV
- OpenCV Python Program to analyze an image using Histogram
- Find Circles and Ellipses in an Image using OpenCV | Python
Improved By : Sourabh_Sinha