我需要一个Matlab代码,用于从人物图像中裁剪脸部。我一直在谷歌搜索过去3天但无法找到正常运行的代码。有人可以告诉我该怎么做。
答案 0 :(得分:4)
您可以阅读wavelets,我不相信您已经"搜索谷歌3天"。
Image Processing using Gabor Filter
如果您拥有vision toolbox的许可证:
% Create a cascade detector object.
faceDetector = vision.CascadeObjectDetector();
% Read a video frame and run the detector.
videoFileReader = vision.VideoFileReader('visionface.avi');
videoFrame = step(videoFileReader);
bbox = step(faceDetector, videoFrame);
% Draw the returned bounding box around the detected face.
videoOut = insertObjectAnnotation(videoFrame,'rectangle',bbox,'Face');
figure, imshow(videoOut), title('Detected face');
上面的代码将输出以下检测。请注意,该算法无法识别Mathwork工程师背后的图片中的2个面部,也不会识别他右边的液晶屏幕上自己的面部: