使用 matlab 显示 avi 时从键盘获取输入

发布于 2024-10-12 17:33:48 字数 422 浏览 3 评论 0原文

大家好
我编写了一个显示 avi 文件的简短程序。我需要程序在电影运行时(而不是结束后)从键盘获取输入: 这是我的代码:

<块引用>

图('菜单栏','无')
set(gcf,'颜色', '白色')
set(gca,'颜色','白色');
set(gca,'XColor','白色');
set(gca,'YColor','白色');
m=aviread('c:/t1.avi')
a=30:1:100;
b=100:-1:30;
c=[ababababab] %来回运行电影
movie(m,c) %运行电影

谢谢您的帮助
爱丽儿

Hi all
I wrote a short program that displays an avi file. I need the program to get input from the keyboard while the movie is running (and not after it ends):
this is my code:

figure('MenuBar','none')
set(gcf,'Color', 'white')
set(gca,'Color','white');
set(gca,'XColor','white');
set(gca,'YColor','white');
m=aviread('c:/t1.avi')
a=30:1:100;
b=100:-1:30;
c=[a b a b a b a b a b] %to run the movie back and forth
movie(m,c) %runs the movie

Thank you for any help
Ariel

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

清醇 2024-10-19 17:33:48

也许您可以将视频插入 UIPanel(或其他合适的 GUI 项目)中并使用 KeyPressFcn 回调。
看看这个:回调排序和中断(我不知道不知道它是否有效,但可能值得尝试)。

Maybe you can insert your video in an UIPanel (or another suitable GUI item) and use the KeyPressFcn callback.
Have a look on this : Callback Sequencing and Interruption (I don't know if it can works but it's probably worth trying).

北城挽邺 2024-10-19 17:33:48

据我所知,MATLAB 中的多线程或并行处理能力是有限的;但似乎有补救措施。 本文介绍了如何使用 MEX 文件组合 MATLAB 和 C++ 代码。

现在我必须承认我从未尝试过这个,所以我不能真正声称它适用于你的情况,但这将是一个很好的起点。

As far as I know multi-threading or parallel processing capabilities in MATLAB are limited; however it appears as there are remedies. This article describes combining MATLAB and C++ code, with use of MEX files.

Now I have to admit that I have never tried this so I can't really claim that it would work in your case, but it would be a good place to start.

梦里南柯 2024-10-19 17:33:48

除非将 movie() 设计为监视输入,否则我认为您将必须使用多线程,从其他答案之一来看,这听起来有点复杂。

您可以播放视频的一小部分,然后运行代码来检查输入,然后播放视频的下一部分。我不确定您是否可以依靠用户在视频播放进入输入缓冲区时键入的内容。

Unless movie() has been designed to watch for input I think you will have to multithread, which from one of the other answers sounds a bit complicated.

You could play a short section of the video, then run come code to check for inputs and then play the next bit of the video. I'm not sure if you can count on things that the user types whilst the video plays going into the input buffer though.

意中人 2024-10-19 17:33:48

解决方案是使用 winopen('c:/filename.avi')

<块引用>

winopen('c:/文件名.avi')
此命令打开媒体播放器并在 matlab 脚本中运行以下命令。它不会等到电影结束。它在后台运行。
谢谢大家
阿里尔

the solution is to use winopen('c:/filename.avi')

winopen('c:/filename.avi')
this command opens media player and runs following commands in the matlab script. it doesn't wait for the movie to end. it runs in the background.
thanks every one
ariel

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文