Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use OpenCV to realize watercolor effect in Python

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report