Commit b4ca8d4c authored by Roland Levillain's avatar Roland Levillain
Browse files

Improve the (movie) output of apps/morphers/iz.

	* apps/morphers/iz.cc (save_colorized): Skip consecutive identical
	frames.
	Swap the frame reconstruction and write operations, so that the
	last frame is eventually saved.
	* apps/morphers/Makefile.am (tmp_iz.avi): Use a speedup of 50
	instead of 10.
parent 08bc024b
2012-06-21 Roland Levillain <roland@lrde.epita.fr>
Improve the (movie) output of apps/morphers/iz.
* apps/morphers/iz.cc (save_colorized): Skip consecutive identical
frames.
Swap the frame reconstruction and write operations, so that the
last frame is eventually saved.
* apps/morphers/Makefile.am (tmp_iz.avi): Use a speedup of 50
instead of 10.
2012-06-21 Roland Levillain <roland@lrde.epita.fr>
 
Use the lazy recorder morpher in apps/morphers/iz.
......@@ -52,7 +52,7 @@ iz_output.ppm: iz$(EXEEXT) iz_input.pbm
./$< $(srcdir)/iz_input.pbm $@
# Likewise, the dependency of this target is a (wrong) shortcut.
tmp_iz.avi: iz_output.ppm
mencoder "mf://tmp_iz*.png" -o tmp_iz.avi -ovc lavc -lavcopts vcodec=mjpeg -speed 10
mencoder "mf://tmp_iz*.png" -o tmp_iz.avi -ovc lavc -lavcopts vcodec=mjpeg -speed 50
endif HAVE_MAGICKXX
MOSTLYCLEANFILES = \
......
......@@ -43,19 +43,24 @@ save_colorized(const mln::decorated_image< I, lazy_recorder<I> >& rec,
const std::string& prefix)
{
mln_concrete(I) frame = mln::duplicate(rec.decoration().initial);
std::stringstream s;
s << std::setfill ('0') << std::setw (6) << 0;
mln::io::magick::save(mln::labeling::colorize(mln::value::rgb8(), frame),
prefix + s.str() + ".png");
for (size_t i = 0; i < rec.decoration().sequence.size(); ++i)
{
// Next change (`frame(p)' is assigned the value `v' in the next
// frame).
mln_psite(I) p = rec.decoration().sequence[i].first;
mln_value(I) v = rec.decoration().sequence[i].second;
// Skip consecutive identical frames.
if (frame(p) == v)
continue;
frame(p) = v;
std::stringstream s;
s << std::setfill ('0') << std::setw (6) << i;
s << std::setfill ('0') << std::setw (6) << i + 1;
mln::io::magick::save(mln::labeling::colorize(mln::value::rgb8(), frame),
prefix + s.str() + ".png");
// Apply the I-th change to the next frame.
//
// Changes are applied after the I-th image has been written,
// to mimic the behavior of the original recorder morpher (see
// recorder.hh).
frame(rec.decoration().sequence[i].first) =
rec.decoration().sequence[i].second;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment