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