0

I am unable to detect mouth using vision.CascadeObjectDetector. When I try it to extreme HD image it works fine. But on images/videos captured through Front Mobile Camera (5mp minimum), it gives error - Please assist how can I get it working for all/most data.

vidObj = VideoReader('faceVideo.mp4');
img = read(vidObj, 1);

faceDetector = vision.CascadeObjectDetector('Mouth', 'MergeThreshold', 500);
cornerDetector = vision.CornerDetector('Method', 'Harris corner detection(Harris & Stephens)');

Irgb2gray = rgb2gray(img);

bboxes = step(faceDetector, Irgb2gray);

% Following line of code gives error
lips = imcrop(Irgb2gray, bboxes);

Error is :

Error using corner>parseInputs (line 191) The value of 'Image' is invalid. Expected input number 1, I, to be nonempty.

Error in corner (line 80) filter_coef,max_corners,quality_level] = parseInputs(varargin{:});

Error in SmileyForVideo (line 22) C = corner(lips);

Suever
  • 64,497
  • 14
  • 82
  • 101
  • can you display Irgb2gray? – Piglet Apr 15 '16 at 17:54
  • It actually displays irgb2gray and makes me manually select the lips region - which is impossible to do with hundreds of frame in a video – Baseer Ul Hassan Apr 15 '16 at 17:59
  • why does the error message contain the word corner multiple times if the error is caused by the imcrop line? – Piglet Apr 15 '16 at 18:10
  • I commented the corner lines - The issue is persisting. It asked me to manually select Mouth region of a frame and worked fine for a single image. But when i give video as input, i cant manually do all mouth region marking - i cancel the window asking me to mark - and it produces the error mentioned in question. – Baseer Ul Hassan Apr 15 '16 at 18:15
  • Manual Marking mouth is impossible in case of video - cascadeObjectDetector fails to detect mouth and asks me to do it - how to avoid it. – Baseer Ul Hassan Apr 15 '16 at 18:17
  • to avoid the error, you should check that the cascade was able to find objects in the image, if not, skip the frame... – Amro Apr 15 '16 at 19:49
  • Amro@ i totally agree with your point of view - but it will waste most of data set which i have from front CAM. i want to solve this problem. Still Any smarter suggestion ? – Baseer Ul Hassan Apr 16 '16 at 20:13
  • please share the code/syntax as well to skip invalid cascade frame. – Baseer Ul Hassan Apr 16 '16 at 20:45

0 Answers0