当前位置:网站首页>[opencv practice] in cold winter, there will be a rainbow. Do you love this special effect?
[opencv practice] in cold winter, there will be a rainbow. Do you love this special effect?
2022-06-11 00:02:00 【Programmer pear】
Preface
author :“ Programmer pear ”
** The article brief introduction **: This article mainly explains the use of Opencv The library adds rainbow effects to pictures and videos .
** Article source code access **: In order to thank everyone who pays attention to me, the project source code of each article is distributed free of charge
Enjoy drops
Welcome friends give the thumbs-up 、 Collection 、 Leaving a message.
Text
There is always light rain in winter in the South , Sunny days are becoming extravagant .( Shivering with cold .jpg)
here , How I wish I could feel the warmth of summer , Even if it's rainy , Sometimes I see rainbows ! Think of this and start , look for
Find summer photos and videos , use OpenCV Add a rainbow to them .

Implementation steps ——
1) Prepare a picture of summer scenery , Load read .
Mat src = imread("summer.jpg");
2) Create a black image of the same size as the original image , Then draw the rainbow by drawing an elliptic function .
Mat dst;
int row = srcImg.rows;
int col = srcImg.cols;
Mat img(row, col, CV_8UC3, Scalar::all(0));
ellipse(img, Point(col/2, row*4/5), Size(col/2+100, row*4/5), 180, 0, 180, Scalar(255,0,128), 5);
ellipse(img, Point(col/2,row*4/5), Size(col/2-8+100,row*4/5-8), 180, 0, 180, Scalar(255,0,0), 5);
ellipse(img, Point(col/2,row*4/5), Size(col/2-8*2+100,row*4/5-8*2), 180, 0, 180, Scalar(255,255,0), 5);
ellipse(img, Point(col/2,row*4/5), Size(col/2-8*3+100,row*4/5-8*3), 180, 0, 180, Scalar(0,255,0), 5);
ellipse(img, Point(col/2,row*4/5), Size(col/2-8*4+100,row*4/5-8*4), 180, 0, 180, Scalar(0,255,255), 5);
ellipse(img, Point(col/2,row*4/5), Size(col/2-8*5+100,row*4/5-8*5), 180, 0, 180, Scalar(0,128,255), 5);
ellipse(img, Point(col/2,row*4/5), Size(col/2-8*6+100,row*4/5-8*6), 180, 0, 180, Scalar(0,0,255), 5);
3) Gaussian blur , Make the rainbow edge softer transition .
GaussianBlur(img, img, Size(7, 7), 0, 0);
4) Rainbow image and landscape image are mixed and superimposed ( Poisson fusion is better ).
addWeighted(srcImg, 1.0, img, 0.2, 0, dst);
Change some pictures to test :


summary
Hee hee , These rainbows look good ~ The video test is up to you Why do I take the source code
Follow Xiaobian for more wonderful content ! Remember to click on the portal
Remember Sanlian ! If you need packaged source code + Free sharing of materials !! Portal

边栏推荐
- LabVIEW获取Clamp函数找到的所有点的信息
- MySQL learning child query
- Redis installation and common problem solving based on centeros7 (explanation with pictures)
- [turtle confessions collection] "the moon at the bottom of the sea is the moon in the sky, and the person in front of us is the sweetheart." Be happy for the rest of your life, and be safe for ever ~
- Vs tomato assistant add header comments and usage
- Kubernetes 基本介绍及核心组件
- 都说验证码是爬虫中的一道坎,看我只用五行代码就突破它。
- LabVIEW或MAX下的VISA测试面板中串口无法工作
- Create millisecond time id in LabVIEW
- LabVIEW获取IMAQ Get Last Event坐标
猜你喜欢
![[pyGame] this](/img/7c/adc13c0c87ca31c8581d68e6f21363.jpg)
[pyGame] this "groundhog" game is going to be popular (come on, come on)

easyrecovery15操作简单方便的数据恢复工具

【Pygame小游戏】别找了,休闲游戏专题来了丨泡泡龙小程序——休闲游戏研发推荐

【Opencv实战】这个印章“神器”够牛,节省了时间提高了效率,厉害~(附完整源码)

【Pygame小游戏】首月破亿下载 一款高度融合了「超休闲游戏特性」的佳作~

干货丨MapReduce的工作流程是怎样的?

LabVIEW prohibits other multi-core processing applications from executing on all cores

LabVIEW displays the time and date on the waveform chart or waveform chart

都说验证码是爬虫中的一道坎,看我只用五行代码就突破它。

【颜值检测神器】来,请拿出你们的绝活(这颜值,对得起观众么?)
随机推荐
easyrecovery15操作简单方便的数据恢复工具
Analysis of Genesis public chain
给线程池里面线程添加名称的4种方式
Openresty installation
[pyGame games] in the first month, it broke 100 million to download a masterpiece that is highly integrated with "super casual game features"~
LabVIEW图片在从16位强制转换为8位后看起来要亮或暗
【Pygame小游戏】剧情流推荐:什么样的游戏才能获得大家的喜欢呢?(魔鬼恋人、霸总娇妻版)
Opencv实战之图像的基本操作:这效果出来惊艳了众人(附代码解析)
【漫天烟花】绚烂烟花点亮夜空也太美了叭、某程序员携带烟花秀给大家拜年啦~
How to remove the blank at the top of listview
【数学】【连续介质力学】流体力学中的对称张量、应变张量和应力张量
【Pygame小游戏】不怕你走不过系列:极致AI走迷宫,学习完带你打开新世界大门~(附游戏源码)
It is said that the verification code is a barrier in the crawler. I can break through it with only five lines of code.
[mathematics] [continuum mechanics] symmetry tensor, strain tensor and stress tensor in fluid mechanics
[latex] latex vs Code Snippets
[turtle confessions collection] "the moon at the bottom of the sea is the moon in the sky, and the person in front of us is the sweetheart." Be happy for the rest of your life, and be safe for ever ~
2022年高考量化卷|请各位量化考生答题
LabVIEW performs a serial loopback test
LabVIEW用VISA Read函数来读取USB中断数据
LabVIEW and VDM extract color and generate gray image
