Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use OpenCV to realize watercolor effect in Python

Shulou Source: shulou.com Published: 2022-06-02 07:13:43 10月01日 Update

This article introduces how to use OpenCV to achieve watercolor effect in Python, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Request:

Oil painting effect

Watercolor effect

Oil painting effects need to use the OpenCV Contrib module, while other modules can be executed using a standard release of OpenCV. In addition, the art of dot painting also needs Sklearn and Scipy.

Pip install opencv-contrib-python==4.3.0.36pip install scikit-learnpip install scipy

Oil painting effect

It includes cv2.xphoto (), and also has some other cool features, such as image restoration, white balance, image denoising and so on.

Import cv2img = cv2.imread ('img.jpg') res = cv2.xphoto.oilPainting (img, 7,1)

Watercolor effect

Like oil painting effects, watercolor effects can be done in a single line of code, but do not include import and image reading.

Cv2.stylization (). Import cv2img = cv2.imread ('img.jpg') res = cv2.stylization (img, sigma_s=60, sigma_r=0.6) # sigma_s controls the size of the neighborhood. Range 1-20 years sigma_r controls the how dissimilar colors within the neighborhood will be averaged. A larger sigma_r results in large regions of constant color. Range 0-1 on how to use OpenCV in Python to achieve watercolor effect is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Effects watercolors oil paintings images content more modules help good code interests functions guys buddies articles standards knowledge articles art etc. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Huawei MySQL OPPO Reno Shulou Information