Question Regarding MATLAB GUI, a problem while playing back a live video.

1 view (last 30 days)
Greetings programmers,
I have completed my codes for live video streaming and wanted to move into GUI to make it look nicer. The problem I have encountered is that when I put my codes into my Start Button Callback function, Matlab always opens another window to show me the video instead of inside the created Axel when I was creating the GUI. Previously I have created a GUI using image processing which uses this function: preview() to show vide insides of axel.
In this coding, my final output is a step(OriginalVideo, FinalProcessed). How do I make it in such a way that my video will stay inside the axel instead of a separate window?
Thank you very much.
Regards,
Akira
  2 Comments
Walter Roberson
Walter Roberson on 7 Sep 2015
Please show the code you use in your Start Button Callback, along with the code you use to play the video.
Akira Chan
Akira Chan on 7 Sep 2015
Dear Mr Walter,
function Start_Callback(hObject, eventdata, handles)
% hObject handle to Start (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
LiveVideo = imaq.VideoDevice('winvideo', 1, 'MJPG_640x480');
vidInfo = imaqhwinfo(LiveVideo);
VideoOut = vision.VideoPlayer('Name', 'Live Video Testing', ...
'Position', [50 10 vidInfo.MaxWidth+45 vidInfo.MaxHeight+65]);
while (nFrames < 200)
<Preprocessing Algorithms are here, Fill is the final output of pre-processed image and VideoOut is my Video>
step(VideoOut, Fill);
end
I think I should not use step function here, I need something else maybe?
Thank you very much.
Regards,
Akira

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 7 Sep 2015
vision.VideoPlayer() appears to always create a new Figure to display the content in. It cannot be configured to display the video in an axes.
Unfortunately the key routine for that, showFrameOnAxis() is example code that I do not have access to so I do not know how it works.
  2 Comments
Akira Chan
Akira Chan on 7 Sep 2015
Dear Mr Walter,
Oh, thank you very much sir. I try that now.
Regards,
Akira
Akira Chan
Akira Chan on 14 Sep 2015
Dear Mr Walter,
You are totally right, I need to use showframeonaxis, but now I have encountered a problem, it only show me a blank axes when I start my system. Nevertheless, I will create a question thread so people will know what to do when come to this problem.
Thank you very much.
Regards,
Akira

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!