In some cases solving can take a while (especially when refining is used)
and keeping interface locked is a bit annoying. Now camera solver is moved
to job system and interface isn't locking.
Reporting progress isn't really accurate, but trying to make it more linear
can lead to spending more effort on it than having benefit. Also, changing
status in the information line helps to understand that blender isn't hang
up and solving is till working nicely.
Main changes in code:
- libmv_solveReconstruction now accepts additional parameters:
* progress_update_callback - a function which is getting called
from solver algorithm to report progress back to Blender.
* callback_customdata - a user-defined context which is passing
to progress_update_callback so progress can be updated in needed
blender-side data structures.
This parameters are optional.
- Added structure MovieTrackingStats which is placed in MovieTracking
structure. It's supposed to be used for displaying information about
different operations (currently it's only camera solver, but can be
easily used for something else in the future) in clip editor.
This statistics structure is getting allocated for time operator is
working and not saving into .blend file.
- Clip Editor now displays statistics stored in MovieTrackingStats structure
like it's done for rendering.
- Fixed incorrect memory access on distoritons more than 128 pixels
- Do not use UNDO operators flags for delete proxy operator (files can't be restored form disk),
and also do not use UNDO for set as background operator (background images are storing in
3d viewport which isn't getting re-loaded on undo which can lead to incorrect users count
of movie clip user).
- Add support for refining the camera's intrinsic parameters
during a solve. Currently, refining supports only the following
combinations of intrinsic parameters:
f
f, cx, cy
f, cx, cy, k1, k2
f, k1
f, k1, k2
This is not the same as autocalibration, since the user must
still make a reasonable initial guess about the focal length and
other parameters, whereas true autocalibration would eliminate
the need for the user specify intrinsic parameters at all.
However, the solver works well with only rough guesses for the
focal length, so perhaps full autocalibation is not that
important.
Adding support for the last two combinations, (f, k1) and (f,
k1, k2) required changes to the library libmv depends on for
bundle adjustment, SSBA. These changes should get ported
upstream not just to libmv but to SSBA as well.
- Improved the region of convergence for bundle adjustment by
increasing the number of Levenberg-Marquardt iterations from 50
to 500. This way, the solver is able to crawl out of the bad
local minima it gets stuck in when changing from, for example,
bundling k1 and k2 to just k1 and resetting k2 to 0.
- Add several new region tracker implementations. A region tracker
is a libmv concept, which refers to tracking a template image
pattern through frames. The impact to end users is that tracking
should "just work better". I am reserving a more detailed
writeup, and maybe a paper, for later.
- Other libmv tweaks, such as detecting that a tracker is headed
outside of the image bounds.
This includes several changes made directly to the libmv extern
code rather expecting to get those changes through normal libmv
channels, because I, the libmv BDFL, decided it was faster to work
on libmv directly in Blender, then later reverse-port the libmv
changes from Blender back into libmv trunk. The interesting part
is that I added a full Levenberg-Marquardt loop to the region
tracking code, which should lead to a more stable solutions. I
also added a hacky implementation of "Efficient Second-Order
Minimization" for tracking, which works nicely. A more detailed
quantitative evaluation will follow.
Original patch by Keir, cleaned a bit by myself.
===========================
Commiting camera tracking integration gsoc project into trunk.
This commit includes:
- Bundled version of libmv library (with some changes against official repo,
re-sync with libmv repo a bit later)
- New datatype ID called MovieClip which is optimized to work with movie
clips (both of movie files and image sequences) and doing camera/motion
tracking operations.
- New editor called Clip Editor which is currently used for motion/tracking
stuff only, but which can be easily extended to work with masks too.
This editor supports:
* Loading movie files/image sequences
* Build proxies with different size for loaded movie clip, also supports
building undistorted proxies to increase speed of playback in
undistorted mode.
* Manual lens distortion mode calibration using grid and grease pencil
* Supervised 2D tracking using two different algorithms KLT and SAD.
* Basic algorithm for feature detection
* Camera motion solving. scene orientation
- New constraints to "link" scene objects with solved motions from clip:
* Follow Track (make object follow 2D motion of track with given name
or parent object to reconstructed 3D position of track)
* Camera Solver to make camera moving in the same way as reconstructed camera
This commit NOT includes changes from tomato branch:
- New nodes (they'll be commited as separated patch)
- Automatic image offset guessing for image input node and image editor
(need to do more tests and gather more feedback)
- Code cleanup in libmv-capi. It's not so critical cleanup, just increasing
readability and understanadability of code. Better to make this chaneg when
Keir will finish his current patch.
More details about this project can be found on this page:
http://wiki.blender.org/index.php/User:Nazg-gul/GSoC-2011
Further development of small features would be done in trunk, bigger/experimental
features would first be implemented in tomato branch.
- Upgrade Eigen2 library to Eigen3
- Upgrade colamd library and placed in extern/ so other libraries from extern/ can use it
NOTE: With previous version of Eigen (3.0.1) it was necessary to define
EIGEN_DONT_ALIGN_STATICALLY macro to make it compilable on windows 32bit.
After latest upgrade it seems to be unnecessary (at least when was testing libmv),
so i removed that defines which can reduce speed and lead to other problems.
- Upgrade Recast library to latest portable version
- Implement recast_qsort based on FreeBSD qsort.c to have
portable thread safe quick sort for use in conversion routine.
- Better default value for the Build Navigation Mesh operator
- Some declarations after statement left.
- Do not use static inline functions in MOD_navmesh. It produces errors
with msvc and not sure it's actually helps -- optimizer should
make it inlined itself.
and it's callback.
Also do not use char constants like 'NAVM' which is casting to int.
And added defautl section to switch in KX_NavMeshObject::DrawNavMesh.
- rearrange structs to work for 64bit
- define all vars before goto's
- ifdefs for qsort_r/qsort_s
- dont cast pointers to int only for NULL checks
- dont printf STR_String directly, get the char pointer from it
also minor change to gpu py module, no need to pass empty tuple to PyObject_CallObject, can just be NULL
Change OURPLATFORM from "linux<major_version>" to simple "linux".
Since new policy for linux kernel versions that major version in
platform doesn't make much sense for building rules so the same
rules could be used for both of linux2 and linux3 now/
Tested on both of linux2 and linux3 systems.
blender_add_lib now takes a separate include argument to suppress warnings in system includes (mostly ffmpeg & python).
also only build wm_apple.c on apple+carbon configuration.
discussed with Janne, Ton, Nathan and we agreed this kind of change at least needs discussion with module owners.
Its also too close to release to be making these kinds of changes.
commands used:
# reverse merge
svn merge -r36073:36072 .
# for some reason this gave a lot of property changes
svn revert `svn st | grep "^ M" | awk '{print $2}'`
# reverse merging didn't work here, removing while dir.
svn rm extern/eltopo/
# manually fixed conflict in
# ./source/blenderplayer/CMakeLists.txt
#
# also manually removed 2 lines from
# ./CMakeLists.txt