I am getting this error while running a matlab code for face detection and tracking Error in noseDetector = vision.Cas​cadeObject​Detector('​Nose', 'UseROI', true);

조회 수: 2 (최근 30일)
% 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');
% Get the skin tone information by extracting the Hue from the video frame % converted to the HSV color space. [hueChannel,~,~] = rgb2hsv(videoFrame);
% Display the Hue Channel data and draw the bounding box around the face. figure, imshow(hueChannel), title('Hue channel data'); rectangle('Position',bbox(1,:),'LineWidth',2,'EdgeColor',[1 1 0]) % Detect the nose within the face region. The nose provides a more accurate % measure of the skin tone because it does not contain any background % pixels. noseDetector = vision.CascadeObjectDetector('Nose', 'UseROI', true); noseBBox = step(noseDetector, videoFrame, bbox(1,:));
% Create a tracker object. tracker = vision.HistogramBasedTracker;
% Initialize the tracker histogram using the Hue channel pixels from the % nose. initializeObject(tracker, hueChannel, noseBBox(1,:));
% Create a video player object for displaying video frames. videoInfo = info(videoFileReader); videoPlayer = vision.VideoPlayer('Position',[300 300 videoInfo.VideoSize+30]);
% Track the face over successive video frames until the video is finished. while ~isDone(videoFileReader)
% Extract the next video frame
videoFrame = step(videoFileReader);
% RGB -> HSV
[hueChannel,~,~] = rgb2hsv(videoFrame);
% Track using the Hue channel data
bbox = step(tracker, hueChannel);
% Insert a bounding box around the object being tracked
videoOut = insertObjectAnnotation(videoFrame,'rectangle',bbox,'Face');
% Display the annotated video frame using the video player object
step(videoPlayer, videoOut);
end % Release resources release(videoFileReader); release(videoPlayer);

답변 (2개)

Dima Lisin
Dima Lisin 2015년 12월 11일
What is the error message you are seeing? Could it be that there is no face in that video frame?

Prasad Kalane
Prasad Kalane 2015년 12월 11일
편집: Prasad Kalane 2015년 12월 11일
Correct following line of code:
% noseDetector = vision.CascadeObjectDetector('Nose', 'UseROI', true);
noseDetector = vision.CascadeObjectDetector('Nose');
% noseBBox = step(noseDetector, videoFrame, bbox(1,:));
noseBBox = step(noseDetector, videoFrame);
Use your own Nose training set to train classifier,as it is composed of weak classifiers(As documented)
  댓글 수: 1
Dima Lisin
Dima Lisin 2015년 12월 11일
Hi Prasad,
This would not fix the problem. Neelum is trying to detect the nose inside the bounding box containing the face, not in the entire image.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Tracking and Motion Estimation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by