人脚检测计算机视觉
human foot detection computer vision
我已经尝试通过输入负片和正片图像来使用 matlab CascadeObjectDetector,但它没有 job.I 想要检测站在图片中的人是否赤脚。对象检测器应该检测裸 feet.In 负面图像我只给鞋子 images.If 我可以在 opencv 中以某种方式做到这一点,也请分享该技术。
feet 图像文件夹包含 labelingSession.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);
如果您只对提取脚部图像感兴趣,那么 HSV-based 皮肤检测,然后重复扩张应该会产生更好的结果。请参阅下面的代码:
#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;
}
如果你打算使用足部检测作为工具(即,你可以使用第 3 方库),那么你可以看看 OpenPose,它包括大脚趾、小脚趾、脚跟和脚踝关键点检测场景中所有人的每只脚。 Link:
https://github.com/CMU-Perceptual-Computing-Lab/openpose
我猜你可以直接在上面应用 SVM 检测器。 SIFT/SURF 个特征应用于每个关键点。
我已经尝试通过输入负片和正片图像来使用 matlab CascadeObjectDetector,但它没有 job.I 想要检测站在图片中的人是否赤脚。对象检测器应该检测裸 feet.In 负面图像我只给鞋子 images.If 我可以在 opencv 中以某种方式做到这一点,也请分享该技术。
feet 图像文件夹包含 labelingSession.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);
如果您只对提取脚部图像感兴趣,那么 HSV-based 皮肤检测,然后重复扩张应该会产生更好的结果。请参阅下面的代码:
#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;
}
如果你打算使用足部检测作为工具(即,你可以使用第 3 方库),那么你可以看看 OpenPose,它包括大脚趾、小脚趾、脚跟和脚踝关键点检测场景中所有人的每只脚。 Link:
https://github.com/CMU-Perceptual-Computing-Lab/openpose
我猜你可以直接在上面应用 SVM 检测器。 SIFT/SURF 个特征应用于每个关键点。