Q
从背景提取前景
2
A
回答
1
如果您只想提取腿部图像,然后基于HSV的皮肤检测,然后重复扩张应该产生更好的结果。下面 见代码:
#include<iostream>
#include<opencv2/core/core.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<stdio.h>
using namespace std;
using namespace cv;
int main()
{
Mat b=imread("b2.png");//back
Mat f=imread("f2.png");//fore
Mat hsv_th;
cvtColor(b,b,CV_BGR2HSV);
cvtColor(f,f,CV_BGR2HSV);
inRange(f,Scalar(0,100,0),Scalar(100,255,100),hsv_th);
dilate(hsv_th,hsv_th,cv::Mat());
dilate(hsv_th,hsv_th,cv::Mat());
dilate(hsv_th,hsv_th,cv::Mat());
dilate(hsv_th,hsv_th,cv::Mat());
for(;;)
{
imshow("fore",f);
imshow("hsv",hsv_th);
char c=waitKey(10);
if(c=='b')//break when 'b' is pressed
{
break;
}
}
return 0;
}
相关问题
- 1. 从背景获取
- 2. 背景或前景线程?
- 3. iOS中的背景提取
- 4. 如何从图像中提取背景?
- 5. 从PPT PowerPoint文件中提取背景
- 6. UIAlertView从背景中提出
- 7. 从视频流中提取前景
- 8. 从提取前景中移除阴影
- 9. 从前景导航到背景时,如何暂停播放背景视频?
- 10. 获取背景
- 11. 背景透明和前景较暗
- 12. Android中的背景和前景图像
- 13. 基于背景更改TextBlock前景色
- 14. 根据背景更改前景
- 15. 终端背景和前景色
- 16. 从背景
- 17. 从背景
- 18. 如何读取XAML中的TextBox前景/背景属性?
- 19. 提取链接的背景,jsoup
- 20. 如何检测和计数当活动从背景到前景
- 21. 从前景到背景后,位置始终为空?
- 22. iPhone OS 4.0.x - 从背景到前景的过渡
- 23. 重新启动应用程序从背景到前景
- 24. 半页背景/列背景
- 25. iOS版 - 睡前背景
- 26. NSURLConnection sendSynchronousRequest - 前台背景
- 27. 从背景通知
- 28. 分割从背景
- 29. 无法从背景
- 30. AwesomeWM提示框背景
的可能的复制[CV - 提取的两个图像之间的差异(http://stackoverflow.com/questions/27035672/cv-extract-differences -between-two-images) – Miki