Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image MATLAB中的视频图形用户界面_Image_Matlab_Image Processing_Video Processing_Matlab Guide - Fatal编程技术网

Image MATLAB中的视频图形用户界面

Image MATLAB中的视频图形用户界面,image,matlab,image-processing,video-processing,matlab-guide,Image,Matlab,Image Processing,Video Processing,Matlab Guide,我有一个大约200帧的视频。我想捕捉每10帧,对其进行一些图像处理,并显示原始图像和绘图(在图像处理步骤之后)。输出应该是第10帧的第一帧和它的绘图,只有在我点击一个按钮后,它才能继续移动,并在第20帧上进行处理,显示它,以此类推。一旦我获得所需的帧,例如第180帧,我想显示到达该帧所用的总时间(如果帧速率为10帧/秒,则应显示18秒) 到目前为止,我一直在处理单独的帧,对它们进行图像处理,并手动计算结果。但是一个GUI会使这个过程更加高效,这是一个很好的问题。以下是您可以做的: 在程序启动时,

我有一个大约200帧的视频。我想捕捉每10帧,对其进行一些图像处理,并显示原始图像和绘图(在图像处理步骤之后)。输出应该是第10帧的第一帧和它的绘图,只有在我点击一个按钮后,它才能继续移动,并在第20帧上进行处理,显示它,以此类推。一旦我获得所需的帧,例如第180帧,我想显示到达该帧所用的总时间(如果帧速率为10帧/秒,则应显示18秒)


到目前为止,我一直在处理单独的帧,对它们进行图像处理,并手动计算结果。但是一个GUI会使这个过程更加高效,这是一个很好的问题。以下是您可以做的:

  • 在程序启动时,使用(如下所示:
    filelist=dir('*.bmp')
    )获取正在工作的文件夹中所有图像文件的列表
  • 将该列表分配给guidata句柄,如下所示:
    handles.filelist=filelist
    。在使用时,添加另一个句柄值以保存当前图像索引,
    handles.frameindex=1
    ,稍后您将需要该值。以后别忘了更新
  • 在按钮的按下回调函数中,执行以下操作:

    filelist=handles.filelist;
    frameindex=handles.frameindex;
    currentframefile=文件列表(frameindex);
    handles.frameindex=frameindex+1

  • 在现有GUI中使用currentframefile,它是一个包含当前帧名称的字符串


  • 如果我理解正确,这应该能回答你的问题。如果你需要澄清,请告诉我。祝你好运

    你的问题很简单
    你需要每10帧迭代一次来处理你的图像

    您可以使用子绘图功能在一个图形中绘制不同的图形。

    subplot(n,m,p) = takes 3 arguments
    n = number of rows
    m = number of columns
    p = location of current figure (from left to right , top to bottom flow)
    
    因此,
    子图(1,2,2)
    将图形分成两部分(单行和两列),并在第二列中绘制图形

    WaitForButton按
    将允许您暂停屏幕,直到您在图形上单击鼠标或按任意键

    幸运的是,我做了一些非常类似的事情
    我更改了一些代码,我想这就是您正在尝试做的

    代码是自解释的,因为注释

    % get a video file
    [f, p] = uigetfile({'*.avi'});
    
    % create a video reader object.
    frames = VideoReader([p,f]);
    get(frames);
    % get the framerate of video
    fps = frames.FrameRate;
    % get the number of frames in video
    nframes = frames.NumberOfFrames;
    
    pickind = 'jpg';
    
    % create a figure to plot on
    figure,
    
    % iterate for each 10th frame in image (in step of 10)
    for i = 10:10:nframes
    
        %Use your fps to calculate time elasped
        disp('Time Elasped:');
        disp(i/fps);
    
        % read a frame to image
        I = read(frames, i);
    
        % in first row & first column 1st plot will be the original image
        % itself
        subplot(1,2,1);
        imshow(I) ;
    
        % in first row & second column 2nd plot will be a graph of
        % processed image (do your image processing here)
        subplot(1,2,2);
        imhist(rgb2gray(I));
    
        % Hit a key to process next 10th frame from video
        k = waitforbuttonpress ;
    end
    
    %close the figure
    close
    
    要正确注释绘图,请了解
    图形、绘图和子绘图
    ,因为matlab文档本身有很多资料


    快乐学习

    你试过什么吗……我只做了图像处理部分。我不熟悉GUI和视频处理,因此需要帮助!我做了一个基本的图形用户界面,一次只能在一个画面上工作,每次我都要加载新的图像。我已经手动将所有视频帧存储在一个文件夹中。这个过程是缓慢的,这就是为什么需要一个更快的方法谢谢!正是我需要的!谢谢我知道这一部分,制作GUI很困难。但现在我有了更清晰的思路…谢谢!