Commit Graph

311 Commits

Author SHA1 Message Date
7c5c256fd5 Fix #29729: Blender crashes when camera solving with a disabled marker
Stupid mistake in index of last marker when detecting frames bounds
2011-12-30 08:34:00 +00:00
c2ae77e5bd Merging r42896 through r42944 from trunk into soc-2911-tomato 2011-12-28 18:31:32 +00:00
6963e43148 More fixes for timecode usage with BKE_movieclip_get_ibuf_flag 2011-12-27 11:09:06 +00:00
0ac3ab752f Fix #29688: Timecode is not used in tracking
Use proper timecode flags sending to BKE_movieclip_get_ibuf_flag function,
so now frames for tracking would be full-resolution but calculated using
timecode defined in th interface,
2011-12-27 10:52:23 +00:00
4d7c44717a Code cleanup: fix some clang static checker warnings. 2011-12-22 20:29:44 +00:00
1dc74acc12 Object tracking: configurable scale for object solution
Added slider to define scale of object solution which is used to define
"depth" of object relative to camera position. This slider effects on all
"users" of object solution such as bundles display, constrained objects and so.

Added new operator called "Set Solution Scale" to set real scale for object
solution based on real distance between two bundles reconstructed for this object.

New slider and operator can be found on "Object" panel in toolbox when in
reconstruction mode and active tracking object isn't a camera.
2011-12-19 15:12:33 +00:00
737648a0bf Merging r42648 through r42722 from trunk into soc-2011-tomato 2011-12-19 10:39:40 +00:00
74a1123059 Quite some compiler warnings... 2011-12-17 16:22:08 +00:00
3311164b24 Math lib: matrix multiplication order fix for two functions that were
inconsistent with similar functions & math notation:

mul_m4_m4m4(R, B, A) => mult_m4_m4m4(R, A, B)
mul_m3_m3m4(R, B, A) => mult_m3_m3m4(R, A, B)

For branch maintainers, it should be relatively simple to fix things manually,
it's also possible run this script after merging to do automatic replacement:
http://www.pasteall.org/27459/python
2011-12-16 19:53:12 +00:00
e534af906a Object tracking: various fixes and improvements
- Bundles selection is now available for object's bundles
- If bundles selection wasn't changed in 3D viewport, fallback to regular
  object selection, so objects behind bundles can be selected
- Snap cursor to selection now respects object's bundle selection
- Object and rack name now can be selected from list in constraint settings
- Added preset for tracks used for object tracking
2011-12-15 16:10:49 +00:00
535aee820b Merging r42602 through r42620 from trunk into soc-2011-tomato 2011-12-14 06:12:20 +00:00
6c90a192c6 Do not switch to safe malloc if tracking sequence
Malloc is getting to be safe on sequence tracking by the jobs system,
so no additional set up are necessary.

This hopefully fixes crash on OSX with OpenMP enabled when compiling by older gcc
2011-12-13 16:37:52 +00:00
b865c0314f Merging r42533 through r42601 from trunk into soc-2011-tomato 2011-12-13 11:58:59 +00:00
8b6100aa26 Fixed crash when tracking several tracks manually
Crash was caused by non-threadsafe guarded allocatio which becomes
threadsafe only when thread was started using BLI_threads module.
2011-12-13 10:07:22 +00:00
3717a4a9e1 Merging r42482 through r42532 from trunk into soc-2011-tomato 2011-12-09 10:02:01 +00:00
d568f56f18 Merging remained part of hybrid tracker which adds correlation threshold
Keir's comment:
  Add support for detecting tracking failure in the ESM tracker component of
  libmv. Since both KLT and Hybrid rely on ESM underneath, KLT and Hybrid now
  have a minimum correlation setting to match. With this fix, track failures
  should get detected quicker, with the issue that sometimes the tracker will
  give up too easily. That is fixable by reducing the required correlation (in
  the track properties).

Command used for merge: svn merge -r 42396:42397 -r 42399:42400 ^/branches/soc-2011-tomato
2011-12-07 14:54:03 +00:00
dbc9227a32 Disable markers when doing frame-by-frame tracking and tracker library returns failure 2011-12-07 11:02:34 +00:00
91796ab630 Tracks which were moved to close to boundary weren'haven't been disabled when doing
frame-by-frame tracking.
2011-12-07 10:53:51 +00:00
62fc8f5197 Make Hybrid tracker default for movie clips 2011-12-07 10:01:39 +00:00
f354d44cba Merging r42461 through r42481 from trunk into soc-2011-tomato 2011-12-07 09:24:45 +00:00
433033c2bf Camera tracking: some bug fixes
- Fixed bug with not putting disabled markers properly when doing backwards tracking
- Fixed margin size calculating from pattern size which used to be double-sized
  and prevented to track things on the image edges.
2011-12-07 09:21:50 +00:00
cbe9713b50 Object solver: minor tweaks
- Rename solving button to Object Motion if active tracking object isn't a camera
- Ignore refine flags when solving object
2011-12-05 19:31:21 +00:00
9355cc5c39 Object tracking; initial commit
This commit implements basis stuff needed for object tracking,
use case isn't perfect now, interface also should be cleaned a bit.

- Added list of objects to be tracked. Default there's only one object called
  "Camera" which is used for solving camera motion. Other objects can be added
  and each of them will have it;s own list of tracks. Only one object can be used
  for camera solving at this moment.
- Added new constraint called "Object Tracking" which makes oriented object be
  moving in the save way as solved object motion.
- Scene orientation tools can be used for orienting object to bundles.
- All tools which works with list of tracks or reconstruction data now
  gets that lists from active editing object.
- All objects and their tracking data are available via python api.
2011-12-05 18:57:17 +00:00
f55f9e95db Merging r42413 through r42441 form trunk into soc-2011-tomato 2011-12-05 18:53:09 +00:00
8582495c16 Minor whitespace fixes 2011-12-05 07:56:31 +00:00
756ac13e3a Merging r42394 through r42412 form trunk into soc-2011-tomato 2011-12-04 17:26:35 +00:00
af8587c6d6 Small code cleanup of tracking.c 2011-12-04 14:42:21 +00:00
f4b1c34ff0 Fix of pattern position clamping 2011-12-04 14:42:10 +00:00
5d6fff3c7b Remove an unused parameter from tracking.c 2011-12-04 14:08:21 +00:00
f1454ec399 Turn grayscale preview on if any channel toggles are active for motion tracking. 2011-12-04 13:58:40 +00:00
4bd3a296bb Add support for detecting tracking failure in the ESM tracker component of
libmv. Since both KLT and Hybrid rely on ESM underneath, KLT and Hybrid now
have a minimum correlation setting to match. With this fix, track failures
should get detected quicker, with the issue that sometimes the tracker will
give up too easily. That is fixable by reducing the required correlation (in
the track properties).
2011-12-04 13:46:25 +00:00
d261623800 Camera tracking: merge hybrid tracker from tomato branch
Comment from Keir's commit:

Add a new hybrid region tracker for motion tracking to libmv, and
add it as an option (under "Hybrid") in the tracking settings. The
region tracker is a combination of brute force tracking for coarse
alignment, then refinement with the ESM/KLT algorithm already in
libmv that gives excellent subpixel precision (typically 1/50'th
of a pixel)

This also adds a new "brute force" region tracker which does a
brute force search through every pixel position in the destination
for the pattern in the first frame. It leverages SSE if available,
similar to the SAD tracker, to do this quickly. Currently it does
some unnecessary conversions to/from floating point that will get
fixed later.

The hybrid tracker glues the two trackers (brute & ESM) together
to get an overall better tracker. The algorithm is simple:

1. Track from frame 1 to frame 2 with the brute force tracker.
   This tries every possible pixel position for the pattern from
   frame 1 in frame 2. The position with the smallest
   sum-of-absolute-differences is chosen. By definition, this
   position is only accurate up to 1 pixel or so.
2. Using the result from 1, initialize a track with ESM. This does
   a least-squares fit with subpixel precision.
3. If the ESM shift was more than 2 pixels, report failure.
4. If the ESM track shifted less than 2 pixels, then the track is
   good and we're done. The rationale here is that if the
   refinement stage shifts more than 1 pixel, then the brute force
   result likely found some random position that's not a good fit.

svn command used: svn merge -r 42375:42376 -r 42377:42379 ^/branches/soc-2011-tomato
2011-12-04 13:26:11 +00:00
d00bb6dd56 Add a toggle button to display motion tracker previews in grayscale. 2011-12-04 12:58:31 +00:00
4e0b4de0bf Merging r42350 through r42393 from trunk into soc-2011-tomato 2011-12-04 12:32:26 +00:00
bb81c03e39 Revert "Fix a segfault in the tracker caused by attempting a one-frame track after the active tracker has become disabled."
BKE_tracking_next shouldn't be called if there's nothing to track.
Fixed in trunk, would be fixed here after upcoming merge.
2011-12-04 12:06:01 +00:00
458ecaebf4 Do not clamp search size when adding new track with non-klt tracker set 2011-12-04 11:57:23 +00:00
3113fff5ed Make the tracker preview in the motion tracking panel show exactly what the
tracking algorithm will see when any of the R/G/B channels are disabled, rather
than the RGB view that was there previously.
2011-12-04 06:02:09 +00:00
7f46db1ecc Fix a segfault in the tracker caused by attempting a one-frame track after the active tracker has become disabled. 2011-12-04 04:51:30 +00:00
232248d2e0 Add a new hybrid region tracker for motion tracking to libmv, and
add it as an option (under "Hybrid") in the tracking settings. The
region tracker is a combination of brute force tracking for coarse
alignment, then refinement with the ESM/KLT algorithm already in
libmv that gives excellent subpixel precision (typically 1/50'th
of a pixel)

This also adds a new "brute force" region tracker which does a
brute force search through every pixel position in the destination
for the pattern in the first frame. It leverages SSE if available,
similar to the SAD tracker, to do this quickly. Currently it does
some unnecessary conversions to/from floating point that will get
fixed later.

The hybrid tracker glues the two trackers (brute & ESM) together
to get an overall better tracker. The algorithm is simple:

1. Track from frame 1 to frame 2 with the brute force tracker.
   This tries every possible pixel position for the pattern from
   frame 1 in frame 2. The position with the smallest
   sum-of-absolute-differences is chosen. By definition, this
   position is only accurate up to 1 pixel or so.
2. Using the result from 1, initialize a track with ESM. This does
   a least-squares fit with subpixel precision.
3. If the ESM shift was more than 2 pixels, report failure.
4. If the ESM track shifted less than 2 pixels, then the track is
   good and we're done. The rationale here is that if the
   refinement stage shifts more than 1 pixel, then the brute force
   result likely found some random position that's not a good fit.
2011-12-03 22:27:32 +00:00
f0b3ec33f6 fix for weight paint mode drawing selected verts even when it wasnt the active object. 2011-12-03 20:26:53 +00:00
0668ad2d55 Camera tracking: SAD tracker now supports patterns with any size
(rectangle patterns are getting enlarged to square like it's happening for KLT)
2011-11-28 21:48:49 +00:00
c126bfba82 view3d - replace magic numbers with an enum to be used with mesh_foreachScreenVert, mesh_foreachScreenEdge since it wasnt clear how the values are used.
also resolved use of un-initialized variable.
2011-11-28 16:44:17 +00:00
9f3c921957 Camera tracking: moved camera solver into it's own job
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.
2011-11-28 13:49:42 +00:00
a3623a046b Camera tracking: merging tracking presets stuff from tomato branch
This commit implements:

- Configurable settings for newly creating tracks
  Now it's possible to set tracking algorithm and it's settings for
  all newly creating tracks including manual tracks creation and
  tracks creation by "Detect Features" operator.
- Moves margin, frames limit and adjust frame inside per-track
  settings.
  Was request from Francois for this.
- Adjust Frames replaced with menu called Pattern Match where it's
  possible to choose between matching pattern from keyframe frame
  or from previously tracked frame.
  Didn't see somebody used adjust frames values differ from 0 and 1,
  and this menu should make things more clear here/
2011-11-28 13:26:46 +00:00
5bac67956c Camera tracking: refactor of tracks synchronization stuff
Currently this stuff is used for 2d tracking job only, but the same
thing would necessary for camera solver job, so moved it into more
general utility stuff.
2011-11-27 19:17:59 +00:00
30fd1ab523 replace ImBuf.depth with ImBuf.planes to match ImageFormatData.planes & to avoid confusion with ImageFormatData.depth 2011-11-21 20:47:19 +00:00
02a164baaa Camera tracking: code cleanup 2011-11-21 20:43:25 +00:00
d1e2dcc57a Just another typo in recent commit. 2011-11-21 20:39:06 +00:00
e0482b2def Oops, forgot to remove this unused variable 2011-11-21 20:09:04 +00:00
a41c693ad4 Fixed threading issue when tracking several tracks
Issue was caused by using and changing clip user from tracking context.
2011-11-21 19:54:47 +00:00