help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getframe() alternatives


From: Philip Nienhuis
Subject: Re: getframe() alternatives
Date: Fri, 30 Aug 2013 20:44:56 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

Cameron MacArthur wrote:
<long snip>
1. Sorry, but I'm not sure what you mean by "top post". I just hit
"reply" to the email, should I respond a different way i.e through the
forum etc? Or scroll to the bottom of the email and respond here like
I've done this time?

The latter yes. Looks good now, thanks very much.

The idea is to answer immediately below relevant stanzas, like I try to do below (and snip irrelevant stuff on the way). Get the idea?

<snip>
I tried copying and pasting the lines one-by-one into the command
prompt, but the print statement, imread etc, is all in a larger loop
with the code above it that overlays a scatterplot over each frame, so I
just return the error once I finish typing the loop.

Well you can also edit getframe.m and temporarily add the statement

 keyboard

immediately under the "function" statement and before all the other statements. getframe.m will be interrupted there and then you can do

 dbstep

in the Octave terminal to execute each command in turn. After each step you can inspect variable values.

I'm positive that
ghostscript is installed, and nearly positive that octave can find it, I
added an environment variable to it just to be sure, so I don't think
that's the error. Is there something I can type into Octave to check though?

Ghostscript isn't vital. GIF, JPG etc should work too. I just chose ppm because it gave me the best picture quality (YMMV). Windows metafile (emf) may also work, but I don't know if imread can read it (didn't try).

To check ghostscript:   In the Octave terminal, type:

system ("gswin32")

and check if a Ghostscript terminal pops up (it does on my WinXP box with octave-3.6.4_gcc4.6.2, i.e. the same version as yours AFAICS.

system ("gswin32c")

should get you a Ghostscript prompt within the Octave terminal (exit it by typing:
quit

If this doesn't work you obviously may have to fix this first.
Older Octave versions for Windows used to require the file gswin32c.exe to be copied to gs.exe (in the ghostscript ./bin subdir). A while ago I was told that this bug has been fixed ages ago; but maybe this helps (worth a try). Another issue could be that you have ghostscript installed in a path containing spaces (the infinitely-abusive "C:\Program Files" or worse: "C:\Program Files (X86)") - a recipe for havoc.

I tried nearly all of the other devices, especially the ones that don't
need ghostscript, and still get the same error.
Here are my commands to make the movie:
call to avifile to make movie, create figure and handle:
% open movie and prepare rendering window
mov = avifile(output_file,'compression','msmpeg4v2');
%open(mov);
hnd = figure;
set(hnd,'visible','off');
                    ^^^^
What if you comment this one out?

set(hnd,'WindowStyle','normal');
getframe/addframe:

Literally like that?

print (gcf,'tmp.fig','-dppm');%print (h, 'tmp.fig', '-dppm');

Literally like that?

ret = im2double (imread ('tmp.fig'));
% Truncate to even size to accomodate addframe()
if (mod (size (ret, 1), 2) > 0); ret = ret(2:end, :, :); endif
if (mod (size (ret, 2), 2) > 0); ret = ret(:, 2:end, :); endif
mov = addframe(mov,ret);
%addframe(mov,gcf);
end

For the sake of completeness, I had mentioned earlier that the
getframe/addframe is in a larger loop (to overlay scatterplot data). The
entire larger loop for rendering is included below.

<long snip>

It is usually not efficient to debug individual functions while called in a loop. First check if a function works "stand-alone".
So, better do something like:

sombrero   # Octave makes a nice plot
# No need to supply figure handle, sombrero is the current figure:
print ("tmp.fig", "-dppm")

If the print command doesn't work, you'll have to find out why - I can't from here.
If it does, do:

sombrero
hhh = getframe

and only then start debugging getframe as per my previous reply.

Success,

Philip


reply via email to

[Prev in Thread] Current Thread [Next in Thread]