How can fix the position of Edit box with bounding box in matlab
2 ビュー (過去 30 日間)
古いコメントを表示
I am dealing with face detection and recognition and I am getting bounding box around the face. now I want to add Edit box at the bottom of bounding box displaying name. I am using this command
set(handles.result,'String','Unknown Person','units','pix','position',[bbox(1) bbox(2) 200 30]);
but it is not as I desire and also it is not fixed . in each frame it moves separately from the bounding box. Please guide me in this regard. Thnaks
0 件のコメント
回答 (2 件)
Joseph Cheng
2014 年 8 月 27 日
Some questions come to mind about your bounding box. is the bbox(1) and bbox(2) points relative to the axis handle or relative to the frame? Such as is the NxN frame around person's face centered on image pixel location (512,456). The edit box position would be in relation to the bottom left corner of the GUI window so the pixel positioning of the image wouldn't match.
1 件のコメント
Joseph Cheng
2014 年 8 月 27 日
I've expanded it to a single test script to give an example of positioning of the edit box.
I = imread('circuit.tif');
figure,
figH = axes;
set(figH,'units','pixel')
imagesc(I),colormap gray;
bbox =[20 40 50 100]; %generate where the box is
rectangle('Position',bbox,'linewidth',5,'edgecolor','r') %draw box
AXPos = get(figH,'Position'); %get Axis position
[row col] =size(I); %find image size
Posscale = [AXPos(3)/col AXPos(4)/row]; %find axis size to image pixel ratio
bboxLLC = [bbox(1) row-(bbox(2)+bbox(4))] %calc lower left corner (LLC) of bounding box (0,0) of image is Upper left corner.
editpos = [AXPos(1:2)+bboxLLC.*Posscale 200 30]; %calc position of edit box based on axis LLC.
uicontrol('style','edit','String','unkown person','Position',editpos);
Image Analyst
2014 年 8 月 27 日
Why not simply use the text() function instead()? That would be so easy.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Feature Detection and Extraction についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!