* 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.
---
milena/ChangeLog | 11 +++++++++++
milena/apps/morphers/Makefile.am | 2 +-
milena/apps/morphers/iz.cc | 21 +++++++++++++--------
3 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index a8c9cad..fdb278b 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,16 @@
2012-06-21 Roland Levillain <roland(a)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(a)lrde.epita.fr>
+
Use the lazy recorder morpher in apps/morphers/iz.
* apps/morphers/iz.cc (main): Here.
diff --git a/milena/apps/morphers/Makefile.am b/milena/apps/morphers/Makefile.am
index 829ba8a..309e089 100644
--- a/milena/apps/morphers/Makefile.am
+++ b/milena/apps/morphers/Makefile.am
@@ -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 = \
diff --git a/milena/apps/morphers/iz.cc b/milena/apps/morphers/iz.cc
index 729b2f9..4216dc5 100644
--- a/milena/apps/morphers/iz.cc
+++ b/milena/apps/morphers/iz.cc
@@ -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;
}
}
--
1.7.2.5
Show replies by date