How to continuously update 2 plots and plotted Camera in same figure

조회 수: 4 (최근 30일)
Ihtisham Ali
Ihtisham Ali 2016년 3월 10일
My goal is to continuously plot the position & orientation of camera relative to marker using MATLAB builtin toolkits. There are three thing to plot.(1)camera (2)all circle points (3)origin point '*' Both the camera and points will be moving in each frame.I plotted all these three things in a static figure i.e. using hold on. as shown in the attached figure.
Now i want to plot them all continuously (real time) in the same figure as the values change.Till now i have only been able to dynamically update only one of these things i.e. the circular points for some random values, using the code pasted below. If I add another plot ,it conflicts.Can you please tell me how to update multiple plots in same figure and the plotCamera.There is also matlab example of moving the camera, but that is separately, I mean updating all of them in same figure PS:Ihave tried using the same update method for '*'origin point and the cicular point together since they are of same format but it gives error 'Invalid or deleted object.' so i think they somehow owerwrite each other
% code
hF = figure;
hAx = gca;
im_pt_2world=rand(3,3);
x_o=im_pt_2world(1,1); y_o=im_pt_2world(1,2); %origin of the calibrated world points
x_ip=im_pt_2world(:,1); y_ip=im_pt_2world(:,2);
hpoints = plot3(x_ip, y_ip,zeros(size(im_pt_2world, 1),1),'ro');
while (1) & ishandle(hpoints)
im_pt_2world=rand(3,3);
x_ip=im_pt_2world(:,1); y_ip=im_pt_2world(:,2);
set(hpoints,'ydata',y_ip);
set(hpoints,'xdata',x_ip);
drawnow %updates the display
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for USB Webcams에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by