opencv2_蓝屏抠图(图像相减并去噪)
来源:互联网 发布:保罗16年数据 编辑:程序博客网 时间:2024/05/06 22:09
问题描述:
Ø蓝屏抠图
建立一个纯色背景(如蓝色或绿色),先拍摄一幅空背景图像,再在背景前拍摄一幅自己的图像,尝试将两幅图像的对应像素相减并去噪,实现人像的抠图处理。
C++代码:
#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2\opencv.hpp>#include <iostream>using namespace cv;using namespace std; int main() { //读入图片 Mat img1 = imread("背景.jpg"); Mat img2 = imread("图片.jpg"); Mat img_result1, img_result2; //相减 subtract(img1,img2, img_result1); subtract(img2,img1, img_result2); //中值滤波Mat mf1(img_result1.size(),img_result1.type());medianBlur(img_result1,mf1,3);Mat mf2(img_result2.size(),img_result2.type());medianBlur(img_result2,mf2,3);//显示 imshow("result1",img_result1); imshow("result2",img_result2); waitKey(); return 0; }背景(没有蓝色背景,就用实验室红色鼠标垫充当啦):
图片:
处理结果:
0 0
- opencv2_蓝屏抠图(图像相减并去噪)
- OPenCV2_如何使用迭代器遍历图像
- 图像去噪 - Lena
- 图像去噪
- 图像去噪
- 图像去噪
- 图像去噪
- 图像去噪
- 图像去噪算法
- 图像去噪笔记
- 图像去噪处理
- 图像去噪
- 图像去噪
- 图像去噪
- 图像去噪
- 图像去噪
- OpenCV图像去噪
- X射线图像如何去噪(图像增强)如图下
- [Amazon笔试]求比数n大的最小回文数的字符串形式
- 怎么使float保留两位小数或多位小数
- sublime使用笔记
- Codeforces 474 E. Pillars
- 心情日记 2014.10.09
- opencv2_蓝屏抠图(图像相减并去噪)
- 第7周项目4改错
- HDU 4344 随机法判素数(费马小定理
- Jump Game II
- 求数组中最长递增子序列的长度
- matlab编写线性单元的梯度下降算法(delta法则)
- Javascript 面向对象编程
- Android中 int 和 String 互相转换的多种方法
- ExtJs中panel学习