Sometimes you also maybe feel boar doing the same projects and need some fun in your work(coding) so this is the project for you. You can have fun with it and also give good weight to your resume
Module:
The only main module we will use in this project is OpenCV
Code:
import cv2
import numpy as np
# reading image
img = cv2.imread("mark.jpg")
# Edges
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = cv2.medianBlur(gray, 5)
edges = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C,
cv2.THRESH_BINARY, 9, 9)
# Cartoonization
color = cv2.bilateralFilter(img, 8, 150, 150)
cartoon = cv2.bitwise_and(color, color, mask=edges)
cv2.imshow("Image", img)
cv2.imshow("edges", edges)
cv2.imshow("Cartoon", cartoon)
cv2.waitKey(0)
cv2.destroyAllWindows()
Github:
For image files and code you can find them here
Thanku for this code 🤗
ReplyDelete