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?
Ältere Kommentare anzeigen
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..
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Object Detection finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!