人体足部检测计算机视觉

时间:2017-02-11 08:23:37

标签: matlab computer-vision

我已经尝试了matlab CascadeObjectDetector,通过输入负片和正片图像,但它不能完成这项工作。我想检测人类站在图片中是否赤脚。物体探测器应检测裸脚。在负像中,我只给了鞋子图像。如果我能以某种方式在opencv中这样做,请分享这种技术。

non feet images(negative)

feet images(positive)

feet images文件夹包含labeledSession.mat,其中包含ROI(感兴趣区域)的信息

positiveInstances = labelingSession.ImageSet.ROIBoundingBoxes(1,:);

%Add the image directory to the MATLAB path.

imDir = fullfile(matlabroot,'toolbox','vision','visiondata',...
'feet');

addpath(imDir);
%Specify the foler for negative images.
negativeFolder = fullfile(matlabroot,'toolbox','vision','visiondata',...
'nonfeet');

%Create an imageDatastore object containing negative images.
negativeImages = imageDatastore(negativeFolder);
%Train a cascade object detector called 'stopSignDetector.xml' using HOG          features. NOTE: The command can take several minutes to run.
trainCascadeObjectDetector('shoeDetector.xml',positiveInstances, ...
negativeFolder,'FalseAlarmRate',0.1,'NumCascadeStages',5);

2 个答案:

答案 0 :(得分:0)

如果您只对提取足部图像感兴趣,那么基于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 f=imread("f2.png");//positive
Mat hsv_th;
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 :(得分:0)

如果您打算将脚部检测用作工具(即,您可以使用第三方库),那么可以看一下OpenPose,其中包括用于检测大脚趾,小脚趾,脚跟和脚踝的关键点每个人在现场的脚。链接:

https://github.com/CMU-Perceptual-Computing-Lab/openpose

我的猜测是,您可以直接在例如SIFT / SURF功能已应用于每个关键点。

相关问题