필터 지우기
필터 지우기

How can fix the position of Edit box with bounding box in matlab

조회 수: 1 (최근 30일)
talal
talal 2014년 8월 27일
답변: Image Analyst 2014년 8월 27일
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

답변 (2개)

Joseph Cheng
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
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
Image Analyst 2014년 8월 27일
Why not simply use the text() function instead()? That would be so easy.

카테고리

Help CenterFile Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by