1
votes

I'm trying to create some video in Octave. I have a matlab file that works to do what I want, but i'm trying to get it to work in 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.

I found a reverse-solution here (someone trying to use hardcopy): 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). 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?

1

1 Answers

1
votes

It's not a satisfying solution, but you could use the higher-level print command to save individual frames to files. Have a look at the partial code examples on pages 91–93 in this PDF presentation. The frames could then be assembled into a movie using other tools (e.g., ffmpeg as is done here).

For a more efficient frame grabbing solution you'll have to go to OpenGL (which is what hardcopy is doing). This thread suggests some starting points, but may need to write C/C++ code.