简体   繁体   English

用八度功能代替“硬拷贝”

[英]replacing “hardcopy” with Octave function

I'm trying to create some video in Octave. 我正在尝试在Octave中创建一些视频。 I have a matlab file that works to do what I want, but i'm trying to get it to work in Octave. 我有一个可以执行我想要的工作的matlab文件,但是我正在尝试使其在Octave中工作。 Basically the function 'hardcopy' is an undocumented matlab function used in this code and I'd like to replace it with something octave-friendly. 基本上,函数“ hardcopy”是此代码中使用的未记录的matlab函数,我想将其替换为八度友好的东西。

I found a reverse-solution here (someone trying to use hardcopy): http://www.mathworks.com/support/solutions/en/data/1-3NMHJ5/?solution=1-3NMHJ5 我在这里找到了反向解决方案(有人尝试使用纸质副本): http : //www.mathworks.com/support/solutions/en/data/1-3NMHJ5/? solution=1-3NMHJ5

but I'm a super novice in terms of matlab and octave, so while option 2 of that solution looks like it will work (i think octave has the imread functions) I don't know what to change about the code I have (I didn't write it, and, as I said, I don't know matlab). 但我在Matlab和octave方面还是个超级新手,因此虽然该解决方案的选项2看起来可以工作(我认为octave具有imread函数),但我不知道该更改我拥有的代码(我没写,就像我说的,我不懂matlab)。 The code is 该代码是

    % add this frame to movie file
    %mov = addframe(mov,gcf);
    renderer = get(hnd,'renderer');
    if strcmp(renderer,'painters')
        renderer = 'opengl';
    end
    set(hnd, 'Units', 'pixels');
    pixelsperinch = get(0,'screenpixelsperInch');

    frame = hardcopy(hnd, ['-d' renderer], ['-r' num2str(round(pixelsperinch))]);
    addframe(mov,frame);

Does anyone know how to swap out that hardcopy function for an alternative? 有谁知道如何将硬拷贝功能换成替代品?

It's not a satisfying solution, but you could use the higher-level print command to save individual frames to files. 这不是令人满意的解决方案,但是您可以使用更高级别的print命令将单个框架保存到文件中。 Have a look at the partial code examples on pages 91–93 in this PDF presentation . 请查看此PDF演示文稿中第91–93页的部分代码示例。 The frames could then be assembled into a movie using other tools (eg, ffmpeg as is done here ). 然后可以使用其他工具(例如ffmpeg ,如此处完成 )将帧组装成电影。

For a more efficient frame grabbing solution you'll have to go to OpenGL (which is what hardcopy is doing). 为了获得更有效的抓帧解决方案,您必须使用OpenGL( hardcopy正在这样做)。 This thread suggests some starting points, but may need to write C/C++ code. 该线程提出了一些起点,但可能需要编写C / C ++代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM