Why my image displayed on axis small ?
Show older comments
anyone know what happen to this axis?
here i attach my source code .
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%mouth detection%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouthDetect = vision.CascadeObjectDetector('Mouth','MergeThreshold',100); %eyes detect library
% mouth detection
BBM = step(MouthDetect,j);
%colour detected mouth in image by red
%crop mouth
[x1,y1,z1] = size(BBM)
m = imcrop(j,BBM(x1,:,:))
%show mouth
axes(handles.axes6)
imshow(m);
handles.ImgData6 = m;
guidata(hObject,handles);
2 Comments
Walter Roberson
on 26 Mar 2019
Your code seems a bit overly complicated. The output of step() is going to be a something-by-4 array of bounding box information, one box per row. It is not going to be 3D, so no need to be concerned about the z coordinates. Getting size() of BBM and indexing at the size is not actually wrong, but because it is not common, it would leave people second-guessing about whether you had some special reason for doing things that way, whether there was something subtle about the output of the detector that you knew but they did not. To avoid all that, it would make more sense to simply access
m = imcrop(j, BBM(end,:));
It might make even more sense to look to see which the largest entry is in BBM, in case of accidental matching on small objects:
[~, maxidx] = max(BBM(:,3).*BBM(:,4)); %maximum area
m = imcrop(j, BBM(idx,:));
Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!