Matlab GUI面部跟踪功能



嗨,我正在创建一个 Matlab GUI,允许网络摄像头能够在执行人脸跟踪功能后检测一个人的脸。但是,我只能检测人脸,但它不会跟踪人脸。

% --- Executes on button press in Tracking.
function Tracking_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% hObject    handle to startStopCamera (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Create a cascade detector object.
faceDetector = vision.CascadeObjectDetector();
% Read a video frame and run the detector.
axes(handles.cameraAxes);    
frame  = getsnapshot(handles.vid); 
bbox   = step(faceDetector,frame);

% Draw the bounding box around the face.
rectangle('Position',bbox(1,:),'LineWidth',2,'EdgeColor',[1 1 0]);
%Track the face over successive video frames until the video is finished.
 while ~isDone(handles.vid)
% Extract the next video frame
frame = getsnapshot(handles.vid);
bbox   = step(faceDetector,frame);
% Insert a bounding box around the object being tracked
rectangle('Position',bbox(1,:),'LineWidth',2,'EdgeColor',[1 1 0]);

% Display the annotated video frame using the video player object
getsnapshot(handles.vid);
  end
 release(frame);
 release(handles.vid);

我正在使用图像采集工具箱,并访问了几个网站,但我似乎无法解决问题。

任何帮助将不胜感激!

Mathworks在这里提供了一些例子:

- 使用实时视频采集进行人脸检测和跟踪

- 使用KLT算法进行人脸检测和跟踪

- 使用CAMShift进行人脸检测和跟踪

最新更新