Animation Plugin Developed

Questions related to plugins development
rwicks
Posts: 4
Joined: Wed Aug 19, 2015 8:15 pm

Animation Plugin Developed

Post by rwicks »

Hello,

I've developed a plugin that allows you to take multiple views of a cloud, and generate a series of of images that interpolate smoothly between the different views. This was developed in response to the request for an animation plugin on the users/plugins board (http://www.danielgm.net/cc/forum/viewto ... =17&t=1113) (I work for the person who made the request originally).

The plugin works by creating a series of time stamped images that can be post-processed into a movie using a tool like mplayer or ffmpeg. To use the plugin, create a series of views of the cloud you want to animate. Then select the views you want to animate, and run the plugin. The window that comes up each pair of views as a single entity. Adjust the overall frame rate and the time to interpolate over each set of views. You can preview the end result, although it runs a little slowly. Choose a directory to save the files into and then output the files.

Here's an example video (this ones a little jerky, it can be made smoother with practice, or if someone wants to improve the interpolation algorithm): https://www.youtube.com/watch?v=JFlj8rXycWs

This plugin has been built under Linux and Windows 7 and works in both.

I've attached a .zip file containing the plugin.

One known bug is that it only works with an Orthographic projection. It isn't working right now with an Object-centered perspective.

-Ryan Wicks
Attachments
qVideo.zip
(15.05 KiB) Downloaded 1815 times
daniel
Site Admin
Posts: 7709
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Animation Plugin Developed

Post by daniel »

That's great!

I'll look at the code asap.

Can I add this to the official repository? Maybe you'll want to do a 'pull request' yourself on github so as to be clearly tracked as the 'first author'?

P.S.: do you need help to fix the 'perspective' mode issue?
Daniel, CloudCompare admin
rwicks
Posts: 4
Joined: Wed Aug 19, 2015 8:15 pm

Re: Animation Plugin Developed

Post by rwicks »

You can add it to the repository. I'm not too concerned about first authorship.

I haven't looked at the perspective mode problem yet. I'll take a look and see if I can fix it first. It's probably something simple.
daniel
Site Admin
Posts: 7709
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Animation Plugin Developed

Post by daniel »

Ok, so before pushing the code I fixed several things:
- to be more compliant with the equivalent tools in other applications, I renamed 'qVideo' in 'qAnimation'
- I also renamed several files accordingly
- I fixed the headers (so as to clearly make always the same copyright appear: "COPYRIGHT: Ryan Wicks, 2G Robotics Inc., 2015")
- I fixed some parts of the code to be a little more compliant with CC's coding rules
- I fixed the CMake script (you don't need to import the ui files and process them - CMake takes care of them)
- I'm not sure why but the last selected viewport was ignored
- and more importantly I fixed the way the 4x4 matrix interpolation was conducted (you can't interpolate each value separately - you have to use quaternions or equivalent methods otherwise you generate non-normal rotation matrices - otherwise the cloud was 'skewed' sometimes during the animation ;)

Anyway thanks for this great contribution. I'll surely continue to modify the code (in particular I'd like to set the frame rate as a constant displacement speed instead of a number of steps between each viewpoints). And I'll try to add support for the creation of videos files (without the need to use an external tool - maybe with https://code.google.com/p/qtffmpegwrapper/).

Can you continue to work with the online version from now on?

The code is in https://github.com/cloudcompare/trunk/t ... qAnimation
Daniel, CloudCompare admin
rwicks
Posts: 4
Joined: Wed Aug 19, 2015 8:15 pm

Re: Animation Plugin Developed

Post by rwicks »

Thanks for making those changes and getting it into the repo. I'll update my copy and work from there if I need to make any changes.

I'll take a look at what you've done with the interpolation. I'm interested to see how you interpolate using quaternions.

I'm glad to be able to help out. I use Cloud Compare all the time at work, and recommend it to all of our customers.
Dimitri
Posts: 156
Joined: Mon Oct 18, 2010 9:01 am
Location: Rennes (France)
Contact:

Re: Animation Plugin Developed

Post by Dimitri »

Thanks a lot Ryan for your contribution. I can' wait to try it !

Cheers

Dimitri
daniel
Site Admin
Posts: 7709
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Animation Plugin Developed

Post by daniel »

Okay I've finished the first update. A new icon, a dialog reorganized and lots of the code syntax fixed.

But more importantly, I added an optional support in CMake for FFmpeg (https://www.ffmpeg.org/) to generate movies instead of a series of images.

Simply check the 'WITH_FFMPEG_SUPPORT' option in CMake then set the required fields. I only tested it on Windows for now:
cc_cmake_ffmpeg.jpg
cc_cmake_ffmpeg.jpg (112.88 KiB) Viewed 41639 times
(for Windows, the FFmpeg binaries can be downloaded from http://ffmpeg.zeranoe.com/builds/)

Next steps:
[*] let the user set a constant speed (and only a speed modifier for each step)
[*] display the total length/duration of the movie
[*] find a way to save/remember those settings
[*] show the trajectory in 3D
Daniel, CloudCompare admin
daniel
Site Admin
Posts: 7709
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Animation Plugin Developed

Post by daniel »

I just added progress bars (and "Cancel" buttons ;).

And here is a first shot of what can be done with this new plugin:
https://youtu.be/TZpsOP0uW6s
Daniel, CloudCompare admin
rwicks
Posts: 4
Joined: Wed Aug 19, 2015 8:15 pm

Re: Animation Plugin Developed

Post by rwicks »

I tried the plugin with FFMPEG under Arch linux, and it works great. The only change I had to make was to switch the FFMPEG linking to dynamic from static.

I also noticed that the perspective problems seems to have disappeared, in linux at least (the person who reported it was working in Windows). My guess is that this has something to do with the non-normal rotation in the first version.
daniel
Site Admin
Posts: 7709
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Animation Plugin Developed

Post by daniel »

I've just uploaded a first version of the plugin with the latest beta (2.7.2).

It can be downloaded from the 'Download' page of the website:
http://www.cloudcompare.org/release/
Daniel, CloudCompare admin
Post Reply