资源简介
能分割出人体的肤色,可用作手势识别,人脸识别
代码片段和文件信息
#include
using namespace cv;
using std::cout;
/*--------------- SKIN SEGMENTATION ---------------*/
int main () {
VideoCapture cap(0);//d:/avi/college_school.mp4
if(!cap.isOpened()){
cout << “Errore“; return -1;
}
Mat3b frame;
while(cap.read(frame)){
/* THRESHOLD ON HSV*/
cvtColor(frame frame CV_BGR2HSV);
GaussianBlur(frame frame Size(77) 1 1);
//medianBlur(frame frame 15);
for(int r=0; rame.rows; ++r){
for(int c=0; came.cols; ++c)
// 0 if( (frame(rc)[0]>5) && (frame(rc)[0] < 17) && (frame(rc)[1]>38) && (frame(rc)[1]<250) && (frame(rc)[2]>51) && (frame(rc)[2]<242) ); // do nothing
else for(int i=0; i<3; ++i) frame(rc)[i] = 0;
}
/* BGR CONVERSION AND THRESHOLD */
Mat1b frame_gray;
cvtColor(frame frame CV_HSV2BGR);
cvtColor(frame frame_gray CV_BGR2GRAY);
threshold(frame_gray frame_gray 60 255 CV_THRESH_BINARY);
morphologyEx(frame_gray frame_gray CV_MOP_ERODE Mat1b(331) Point(-1 -1) 3);
morphologyEx(frame_gray frame_gray CV_MOP_OPEN Mat1b(771) Point(-1 -1) 1);
morphologyEx(frame_gray frame_gray CV_MOP_CLOSE Mat1b(991) Point(-1 -1) 1);
medianBlur(frame_gray frame_gray 15);
imshow(“Threshold“ frame_gray);
cvtColor(frame frame CV_BGR2HSV);
resize(frame frame Size() 0.5 0.5);
imshow(“Video“frame);
waitKey(5);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 806 2014-05-16 15:02 skin_segmentation\Release\cl.command.1.tlog
文件 17548 2014-05-16 15:02 skin_segmentation\Release\CL.read.1.tlog
文件 522 2014-05-16 15:02 skin_segmentation\Release\CL.write.1.tlog
文件 1944 2014-05-16 15:02 skin_segmentation\Release\li
文件 4190 2014-05-16 15:02 skin_segmentation\Release\li
文件 720 2014-05-16 15:02 skin_segmentation\Release\li
文件 584 2014-05-16 15:02 skin_segmentation\Release\mt.command.1.tlog
文件 856 2014-05-16 15:02 skin_segmentation\Release\mt.read.1.tlog
文件 384 2014-05-16 15:02 skin_segmentation\Release\mt.write.1.tlog
文件 381 2014-05-16 15:02 skin_segmentation\Release\skin_segmentation.exe.intermediate.manifest
文件 73 2014-05-16 15:02 skin_segmentation\Release\skin_segmentation.lastbuildstate
文件 2520 2014-05-16 15:02 skin_segmentation\Release\skin_segmentation.log
文件 1056303 2014-05-16 15:02 skin_segmentation\Release\skin_segmentation.obj
文件 643072 2014-05-16 15:02 skin_segmentation\Release\vc100.pdb
文件 1473 2014-05-16 15:03 skin_segmentation\skin_segmentation.cpp
文件 4410 2014-05-16 11:00 skin_segmentation\skin_segmentation.vcxproj
文件 955 2014-05-16 10:59 skin_segmentation\skin_segmentation.vcxproj.filters
文件 387 2014-05-16 11:02 skin_segmentation\skin_segmentation.vcxproj.user
目录 0 2014-05-19 17:09 skin_segmentation\Release
目录 0 2014-05-19 17:09 skin_segmentation
----------- --------- ---------- ----- ----
1737128 20
- 上一篇:原理图和PCB封装库
- 下一篇:source insight 配置文件
评论
共有 条评论