Display videoPlayer in axes GUIDE

4 ビュー (過去 30 日間)
Arnaud Tullio
Arnaud Tullio 2017 年 9 月 7 日
コメント済み: Walter Roberson 2017 年 10 月 24 日
Hello, I would like to display my video in axes named handles.Video. The problem is that I would like to display step(videoPlayer,out) in my axes. My code is :
runloop=1;
while runloop
frame=getsnapshot(vid);
frame=frame(pos(2):(pos(2)+pos(4)),pos(1):(pos(1)+pos(3)),1);
point(1,:) = step(pointTracker,frame);
% Inserer physique sur la vidéo un marqueur
out = insertMarker(frame,point,'x');
% Calcule de la distance entre les 2 markers (norme)
Norme=sqrt(abs(((point(2,2) - point(1,2))).^2+abs((point(2,1) - point(1,1))).^2));
% Calcul de la distance en micro et microrad
Dmili=Norme*PixelNum*0.001;
Drad=(Dmili/FocaleNum)*1000;
% Affiche la distance entre les 2 points
set(handles.dist,'String',num2str(Drad));
set(handles.dist2,'String',num2str(Dmili));
% Affichage de la vidéo
axes(handles.Video)
step(videoPlayer,out)
end
  2 件のコメント
Walter Roberson
Walter Roberson 2017 年 9 月 7 日
Please show the code creating the videoplayer object
Arnaud Tullio
Arnaud Tullio 2017 年 9 月 7 日
Just before the while, I have that :
vid=videoinput(handles.ADA,handles.numero,handles.format);
% Capture one frame to get its size.
videoFrame = getsnapshot(vid);
videoFrame=videoFrame(pos(2):(pos(2)+pos(4)),pos(1):(pos(1)+pos(3)),1);
videoPlayer = vision.VideoPlayer('Position',pos);
% Création des trackers
pointTracker = vision.PointTracker('MaxBidirectionalError',20);
initialize(pointTracker,barycentre1,videoFrame);
point(2,:) = barycentre2;

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2017 年 9 月 15 日
  2 件のコメント
Arnaud Tullio
Arnaud Tullio 2017 年 10 月 23 日
I already checked it but the problem is that in your link, the video is open with a file. In my case, the video come from a camera in real time so i can't display it by "a frame" i display it with the video player. I just want to includ mon video player in my axes.
Walter Roberson
Walter Roberson 2017 年 10 月 24 日
In the routine,
function [frame,rotatedImg,angle] = getAndProcessFrame(videoSrc,angle)
replace
frame = step(videoSrc);
with
frame = getsnapshot(videoSrc);
In the routine,
function playCallback(hObject,~,videoSrc,hAxes)
comment out
if isDone(videoSrc)
reset(videoSrc);
end
and
if isDone(videoSrc)
hObject.String = 'Start';
end
In the routine
function exitCallback(~,~,videoSrc,hFig)
comment out
release(videoSrc);
In the routine
function VideoInCustomGUIExample()
replace
videoSrc = vision.VideoFileReader('vipmen.avi', 'ImageColorSpace', 'Intensity');
with
vid = videoinput(handles.ADA,handles.numero,handles.format);

サインインしてコメントする。

その他の回答 (1 件)

Sarah Mohamed
Sarah Mohamed 2017 年 9 月 15 日
Try using the function 'imshow'.
Assuming you've captured a frame in the variable 'out':
imshow(out, 'Parent', handles.Video);

カテゴリ

Help Center および File ExchangeCode Generation, GPU, and Third-Party Support についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by