Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

opencv cartoonizer script

import cv2
import numpy as np

img = cv2.imread("adventure.jpeg")

# 1) 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)

# 2) Color
color = cv2.bilateralFilter(img, 9, 300, 300)

# 3) Cartoon
cartoon = cv2.bitwise_and(color, color, mask=edges)


cv2.imshow("Image", img)
cv2.imshow("Cartoon", cartoon)
cv2.imshow("color", color)
cv2.imshow("edges", edges)
cv2.waitKey(0)
cv2.destroyAllWindows()
Comment

PREVIOUS NEXT
Code Example
Python :: python generator cheat sheet download 
Python :: cv2 open blank window 
Python :: django model meta ordering multiple ordering 
Python :: python input byte array 
Python :: django test postgres extensions intarray 
Python :: np.linalg.eigvals positive check python 
Python :: split dat file into datafram in python 
Python :: why static kwyword not in python 
Python :: python output parameter 
Python :: import math print(m.cos(10)) 
Python :: inject dynamic value into string python 
Python :: qt line edit set text python 
Python :: discord.py delete own message 
Python :: how to access cookies in django 
Python :: pass in 2 numbers, A and B. You should create a list with A rows and B columns, then populate each cell 
Python :: Compute the mean of this RDD’s elements. 
Python :: there is no difference in R between a string scalar and a vector of strings 
Python :: staff user is not restricting permission in django 
Python :: jwt authentication python flask 
Python :: mask and then fillnan# 
Python :: add input to list python 
Python :: if using and in python 
Python :: compute mean over y for same x numpy 
Python :: Using built-in crawlers is very simple. A minimal example is shown as follows. 
Python :: Berlin 
Python :: Circular heatmap python 
Python :: lllll 
Python :: pandas difference between subsequent lines 
Python :: pandas to latex table width pylatex 
Python :: poython command options 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =