i am having problem using a HistogramBasedTracker as it is showing "Error using HistogramBasedTracker Expected R to be of size 1x4 when it is actually size 2x4." how to solve it?
이전 댓글 표시
i am new in MATLAB and making a face detector using image Image Acquisition Toolbox but a error is showing every time i ran the code....the error is like: " Error using HistogramBasedTracker
Expected R to be of size 1x4 when it is actually size 2x4.
Error in vision.HistogramBasedTracker/initializeObject (line 281)
validateattributes(roi, {'numeric'}, ...
Error in maybefinal (line 20)
initializeObject(tracker, hueChannel, noseBBox);"
but code is given below : " viddevice= imaq.VideoDevice('winvideo', 1, 'MJPG_640x400');
vidplayerobject= vision.VideoPlayer;
vidplayerobject.Name = 'facedetected Video';
faceDetector = vision.CascadeObjectDetector();
noseDetector = vision.CascadeObjectDetector('Nose');
tracker = vision.HistogramBasedTracker;
nFrames = 0;
while (nFrames<1500)
videoFrame=step(viddevice);
bbox = step(faceDetector, videoFrame);
boxInserter = vision.ShapeInserter('BorderColor','Custom',...
'CustomBorderColor',[255 255 0]);
videoOut = step(boxInserter, videoFrame,bbox);
faceImage = imcrop(videoFrame,bbox);
noseBBox = step(noseDetector,faceImage);
noseBBox(1:2) = noseBBox(1:2) + bbox(1:2);
initializeObject(tracker, hueChannel, noseBBox);
[hueChannel,~,~] = rgb2hsv(videoFrame);
bbox = step(tracker, hueChannel);
videoOut = step(boxInserter, videoFrame, bbox);
step(vidplayerobject,videoOut);
nFrames = nFrames + 1;
end
release(viddevice);
release(vidplayerobject);
release(faceDetector);
release(noseDetector);
release(tracker); " i am not understanding the problem........... so i will be greatfull if someone help me with my codes and the way to solve the error..
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Object Detection에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!