How to change the parameter width and height of bbox from vision.cascade object detector?

1 view (last 30 days)
I'm working on my final project for a lip readings. I face a problem to detect lip automatically by using cascade tool. My input data is video that record face region from eye brow to neck, but the auto lip detection coding is not accurate for all frames in the video. when the mouth opens too wide it will crop the upper and lower lip.
here is the coding that i used to auto detect lip region for every frame.
% Create a cascade detector object. mouthDetector = vision.CascadeObjectDetector('Mouth','MergeThreshold',32);
% Read a video frame and run the detector. videoFileReader = vision.VideoFileReader('M2U02039.avi'); videoFrame = step(videoFileReader);
bbox = step(mouthDetector, videoFrame);
boxInserter = vision.ShapeInserter('BorderColor','Custom',... 'CustomBorderColor',[255 255 0]); videoOut = step(boxInserter, videoFrame, int32(bbox)); figure, imshow(videoOut), title('Detected Mouth');
rgbImage = imcrop(videoFrame,bbox);
Thanks,

Accepted Answer

Dima Lisin
Dima Lisin on 30 Apr 2015
There are multiple things you can try to fix this problem:
  • The simplest approach is to enlarge the box returned by vision.CascadeObjectDetector by some fixed amount. If you are lucky, you may find the number that makes the box big enough most of the time.
  • Since you are working with a video, you can track a detected mouth, rather than re-detect it in every frame. See this example. You may have to modify the code not to compute a transformation between tracked points, because your deformation is non-rigid.
  • A much more labor intensive approach would be to train your own mouth detector using trainCascadeObjectDetector that is tailored specifically to your data. You can use the trainingImageLabeler app to create a set of training instances.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!