Get the App
SLTechnology News&Howtos  ›  Development  › 

How to automatically add rainbow special effects to pictures by OpenCV

Shulou Source: shulou.com Published: 2022-06-02 12:28:27 10月05日 Update

Editor to share with you how OpenCV automatically add rainbow special effects to pictures, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!

Implementation step [1] prepare a picture of summer scenery, load and read Mat src = imread ("summer.jpg")

[2] create a black map of the same size as the original image, and then draw a rainbow Mat dst;int row = srcImg.rows;int col = srcImg.cols;Mat img (row, col, CV_8UC3, Scalar::all (0)) by drawing an elliptic function; ellipse (img, Point (col/2, row*4/5), Size (col/2+100, row*4/5), 180,0,180, Scalar (255j0128), 5) Ellipse (img, Point (col/2,row*4/5), Size (col/2-8, 0,180, Scalar (255 Lot0), 5); ellipse (img, Point (col/2,row*4/5), Size (col/2-8, 0,180), Scalar (255, 0,180) Ellipse (img, Point (col/2,row*4/5), Size (col/2-80003), 180,0,180, Scalar (0pr 255 (col/2,row*4/5), 5); ellipse (img, Point (col/2,row*4/5), Size (col/2-84th 100th RWBG), 180,0,180, Scalar (0255255), 5) Ellipse (img, Point (col/2,row*4/5), Size (col/2-8135m100), 180,0,180, Scalar (0128255), 5); ellipse (img, Point (col/2,row*4/5), Size (col/2-8pp61600), Scalar (0m0255), 5)

[3] Gaussian blur, soften rainbow edges and transition GaussianBlur (img, img, Size (7,7), 0,0)

[4] mixed superposition of rainbow image and landscape map (better with Poisson fusion) addWeighted (srcImg, 1.0, img, 0.2,0, dst)

Change a few pictures to test:

The above is all the content of the article "how OpenCV automatically adds rainbow special effects to pictures". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Rainbows pictures articles special effects content scenery soft not so much functions original pictures images size most effects more ellipses steps knowledge industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Microsoft Huawei Apple OPPO Reno