Blender V2.61 - r43446
Classes | Typedefs | Functions | Variables

tracking.c File Reference

#include <stddef.h>
#include <limits.h>
#include <math.h>
#include <memory.h>
#include "MEM_guardedalloc.h"
#include "DNA_gpencil_types.h"
#include "DNA_camera_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_math_base.h"
#include "BLI_listbase.h"
#include "BLI_ghash.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_threads.h"
#include "BKE_global.h"
#include "BKE_tracking.h"
#include "BKE_movieclip.h"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "BKE_main.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"

Go to the source code of this file.

Classes

struct  MovieDistortion
struct  TracksMap
struct  TrackContext
struct  MovieTrackingContext
struct  MovieReconstructContext
struct  ReconstructProgressData

Typedefs

typedef struct MovieDistortion MovieDistortion
typedef struct TracksMap TracksMap
typedef struct TrackContext TrackContext
typedef struct MovieTrackingContext MovieTrackingContext
typedef struct
MovieReconstructContext 
MovieReconstructContext
typedef struct
ReconstructProgressData 
ReconstructProgressData

Functions

void BKE_tracking_init_settings (MovieTracking *tracking)
void BKE_tracking_clamp_track (MovieTrackingTrack *track, int event)
void BKE_tracking_track_flag (MovieTrackingTrack *track, int area, int flag, int clear)
MovieTrackingTrackBKE_tracking_add_track (MovieTracking *tracking, ListBase *tracksbase, float x, float y, int framenr, int width, int height)
MovieTrackingMarkerBKE_tracking_insert_marker (MovieTrackingTrack *track, MovieTrackingMarker *marker)
void BKE_tracking_delete_marker (MovieTrackingTrack *track, int framenr)
MovieTrackingMarkerBKE_tracking_get_marker (MovieTrackingTrack *track, int framenr)
MovieTrackingMarkerBKE_tracking_ensure_marker (MovieTrackingTrack *track, int framenr)
MovieTrackingMarkerBKE_tracking_exact_marker (MovieTrackingTrack *track, int framenr)
int BKE_tracking_has_marker (MovieTrackingTrack *track, int framenr)
void BKE_tracking_free_track (MovieTrackingTrack *track)
static void put_disabled_marker (MovieTrackingTrack *track, MovieTrackingMarker *ref_marker, int before, int overwrite)
void BKE_tracking_clear_path (MovieTrackingTrack *track, int ref_frame, int action)
int BKE_tracking_test_join_tracks (MovieTrackingTrack *dst_track, MovieTrackingTrack *src_track)
void BKE_tracking_join_tracks (MovieTrackingTrack *dst_track, MovieTrackingTrack *src_track)
static void tracking_tracks_free (ListBase *tracks)
static void tracking_reconstruction_free (MovieTrackingReconstruction *reconstruction)
static void tracking_object_free (MovieTrackingObject *object)
static void tracking_objects_free (ListBase *objects)
void BKE_tracking_free (MovieTracking *tracking)
static MovieTrackingTrackduplicate_track (MovieTrackingTrack *track)
void BKE_tracking_free_clipboard (void)
void BKE_tracking_clipboard_copy_tracks (MovieTracking *tracking, MovieTrackingObject *object)
int BKE_tracking_clipboard_has_tracks (void)
void BKE_tracking_clipboard_paste_tracks (MovieTracking *tracking, MovieTrackingObject *object)
static TracksMaptracks_map_new (const char *object_name, int is_camera, int num_tracks, int customdata_size)
static int tracks_map_size (TracksMap *map)
static void tracks_map_get (TracksMap *map, int index, MovieTrackingTrack **track, void **customdata)
static void tracks_map_insert (TracksMap *map, MovieTrackingTrack *track, void *customdata)
static void tracks_map_merge (TracksMap *map, MovieTracking *tracking)
static void tracks_map_free (TracksMap *map, void(*customdata_free)(void *customdata))
MovieTrackingContextBKE_tracking_context_new (MovieClip *clip, MovieClipUser *user, short backwards, short sequence)
static void track_context_free (void *customdata)
void BKE_tracking_context_free (MovieTrackingContext *context)
void BKE_tracking_disable_imbuf_channels (ImBuf *ibuf, int disable_red, int disable_green, int disable_blue, int grayscale)
static void disable_imbuf_channels (ImBuf *ibuf, MovieTrackingTrack *track, int grayscale)
static ImBufget_area_imbuf (ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker, float min[2], float max[2], int margin, int anchored, float pos[2], int origin[2])
ImBufBKE_tracking_get_pattern_imbuf (ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker, int margin, int anchored, float pos[2], int origin[2])
ImBufBKE_tracking_get_search_imbuf (ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker, int margin, int anchored, float pos[2], int origin[2])
void BKE_tracking_sync (MovieTrackingContext *context)
void BKE_tracking_sync_user (MovieClipUser *user, MovieTrackingContext *context)
int BKE_tracking_next (MovieTrackingContext *context)
int BKE_tracking_can_reconstruct (MovieTracking *tracking, MovieTrackingObject *object, char *error_msg, int error_size)
MovieReconstructContextBKE_tracking_reconstruction_context_new (MovieTracking *tracking, MovieTrackingObject *object, int keyframe1, int keyframe2, int width, int height)
void BKE_tracking_reconstruction_context_free (MovieReconstructContext *context)
void BKE_tracking_solve_reconstruction (MovieReconstructContext *context, short *stop, short *do_update, float *progress, char *stats_message, int message_size)
int BKE_tracking_finish_reconstruction (MovieReconstructContext *context, MovieTracking *tracking)
void BKE_track_unique_name (ListBase *tracksbase, MovieTrackingTrack *track)
MovieTrackingTrackBKE_tracking_named_track (MovieTracking *tracking, MovieTrackingObject *object, const char *name)
static int reconstruction_camera_index (MovieTrackingReconstruction *reconstruction, int framenr, int nearest)
static void scale_reconstructed_camera (MovieTrackingObject *object, float mat[4][4])
MovieReconstructedCameraBKE_tracking_get_reconstructed_camera (MovieTracking *tracking, MovieTrackingObject *object, int framenr)
void BKE_tracking_get_interpolated_camera (MovieTracking *tracking, MovieTrackingObject *object, int framenr, float mat[4][4])
void BKE_get_tracking_mat (Scene *scene, Object *ob, float mat[4][4])
void BKE_tracking_camera_shift (MovieTracking *tracking, int winx, int winy, float *shiftx, float *shifty)
void BKE_tracking_camera_to_blender (MovieTracking *tracking, Scene *scene, Camera *camera, int width, int height)
void BKE_tracking_projection_matrix (MovieTracking *tracking, MovieTrackingObject *object, int framenr, int winx, int winy, float mat[4][4])
ListBaseBKE_tracking_get_tracks (MovieTracking *tracking)
MovieTrackingTrackBKE_tracking_active_track (MovieTracking *tracking)
MovieTrackingObjectBKE_tracking_active_object (MovieTracking *tracking)
MovieTrackingObjectBKE_tracking_get_camera_object (MovieTracking *tracking)
ListBaseBKE_tracking_object_tracks (MovieTracking *tracking, MovieTrackingObject *object)
MovieTrackingReconstructionBKE_tracking_object_reconstruction (MovieTracking *tracking, MovieTrackingObject *object)
MovieTrackingReconstructionBKE_tracking_get_reconstruction (MovieTracking *tracking)
void BKE_tracking_apply_intrinsics (MovieTracking *tracking, float co[2], float nco[2])
void BKE_tracking_invert_intrinsics (MovieTracking *tracking, float co[2], float nco[2])
void BKE_tracking_detect_fast (MovieTracking *tracking, ListBase *tracksbase, ImBuf *ibuf, int framenr, int margin, int min_trackness, int min_distance, bGPDlayer *layer, int place_outside_layer)
MovieTrackingTrackBKE_tracking_indexed_track (MovieTracking *tracking, int tracknr, ListBase **tracksbase_r)
static int stabilization_median_point (MovieTracking *tracking, int framenr, float median[2])
static void calculate_stabdata (MovieTracking *tracking, int framenr, float width, float height, float firstmedian[2], float median[2], float loc[2], float *scale, float *angle)
static float stabilization_auto_scale_factor (MovieTracking *tracking, int width, int height)
static ImBufstabilize_alloc_ibuf (ImBuf *cacheibuf, ImBuf *srcibuf, int fill)
void BKE_tracking_stabilization_data (MovieTracking *tracking, int framenr, int width, int height, float loc[2], float *scale, float *angle)
ImBufBKE_tracking_stabilize (MovieTracking *tracking, int framenr, ImBuf *ibuf, float loc[2], float *scale, float *angle)
void BKE_tracking_stabdata_to_mat4 (int width, int height, float loc[2], float scale, float angle, float mat[4][4])
MovieDistortionBKE_tracking_distortion_create (void)
MovieDistortionBKE_tracking_distortion_copy (MovieDistortion *distortion)
void BKE_tracking_distortion_update (MovieDistortion *distortion, MovieTracking *tracking, int width, int height)
ImBufBKE_tracking_distortion_exec (MovieDistortion *distortion, MovieTracking *tracking, ImBuf *ibuf, int width, int height, float overscan, int undistort)
void BKE_tracking_distortion_destroy (MovieDistortion *distortion)
ImBufBKE_tracking_undistort (MovieTracking *tracking, ImBuf *ibuf, int width, int height, float overscan)
ImBufBKE_tracking_distort (MovieTracking *tracking, ImBuf *ibuf, int width, int height, float overscan)
void BKE_tracking_select_track (ListBase *tracksbase, MovieTrackingTrack *track, int area, int extend)
void BKE_tracking_deselect_track (MovieTrackingTrack *track, int area)
MovieTrackingObjectBKE_tracking_new_object (MovieTracking *tracking, const char *name)
void BKE_tracking_remove_object (MovieTracking *tracking, MovieTrackingObject *object)
void BKE_tracking_object_unique_name (MovieTracking *tracking, MovieTrackingObject *object)
MovieTrackingObjectBKE_tracking_named_object (MovieTracking *tracking, const char *name)

Variables

struct {
   ListBase   tracks
tracking_clipboard

Detailed Description

Definition in file tracking.c.


Typedef Documentation

typedef struct TrackContext TrackContext
typedef struct TracksMap TracksMap

Function Documentation

void BKE_get_tracking_mat ( Scene scene,
Object ob,
float  mat[4][4] 
)
void BKE_track_unique_name ( ListBase tracksbase,
MovieTrackingTrack track 
)
MovieTrackingObject* BKE_tracking_active_object ( MovieTracking tracking) [read]
MovieTrackingTrack* BKE_tracking_active_track ( MovieTracking tracking) [read]
MovieTrackingTrack* BKE_tracking_add_track ( MovieTracking tracking,
ListBase tracksbase,
float  x,
float  y,
int  framenr,
int  width,
int  height 
) [read]
void BKE_tracking_apply_intrinsics ( MovieTracking tracking,
float  co[2],
float  nco[2] 
)
void BKE_tracking_camera_shift ( MovieTracking tracking,
int  winx,
int  winy,
float *  shiftx,
float *  shifty 
)
void BKE_tracking_camera_to_blender ( MovieTracking tracking,
Scene scene,
Camera camera,
int  width,
int  height 
)
int BKE_tracking_can_reconstruct ( MovieTracking tracking,
MovieTrackingObject object,
char *  error_msg,
int  error_size 
)

Definition at line 1755 of file tracking.c.

References BKE_tracking_object_tracks(), and BLI_strncpy().

Referenced by solve_camera_initjob().

void BKE_tracking_clamp_track ( MovieTrackingTrack track,
int  event 
)
void BKE_tracking_clear_path ( MovieTrackingTrack track,
int  ref_frame,
int  action 
)
void BKE_tracking_clipboard_copy_tracks ( MovieTracking tracking,
MovieTrackingObject object 
)
int BKE_tracking_clipboard_has_tracks ( void  )

Definition at line 631 of file tracking.c.

References NULL, and tracking_clipboard.

Referenced by paste_tracks_poll().

void BKE_tracking_clipboard_paste_tracks ( MovieTracking tracking,
MovieTrackingObject object 
)
void BKE_tracking_context_free ( MovieTrackingContext context)
MovieTrackingContext* BKE_tracking_context_new ( MovieClip clip,
MovieClipUser user,
short  backwards,
short  sequence 
) [read]
void BKE_tracking_delete_marker ( MovieTrackingTrack track,
int  framenr 
)
void BKE_tracking_deselect_track ( MovieTrackingTrack track,
int  area 
)

Definition at line 2871 of file tracking.c.

References BKE_tracking_track_flag(), and SELECT.

Referenced by deselect_all_tracks(), and mouse_select().

void BKE_tracking_detect_fast ( MovieTracking tracking,
ListBase tracksbase,
ImBuf ibuf,
int  framenr,
int  margin,
int  min_trackness,
int  min_distance,
bGPDlayer layer,
int  place_outside_layer 
)

Definition at line 2342 of file tracking.c.

References MEM_freeN(), ImBuf::x, and ImBuf::y.

Referenced by detect_features_exec().

void BKE_tracking_disable_imbuf_channels ( ImBuf ibuf,
int  disable_red,
int  disable_green,
int  disable_blue,
int  grayscale 
)
ImBuf* BKE_tracking_distort ( MovieTracking tracking,
ImBuf ibuf,
int  width,
int  height,
float  overscan 
) [read]
MovieDistortion* BKE_tracking_distortion_copy ( MovieDistortion distortion) [read]

Definition at line 2736 of file tracking.c.

References MovieDistortion::intrinsics, and MEM_callocN().

Referenced by local_merge(), and storage_copy().

MovieDistortion* BKE_tracking_distortion_create ( void  ) [read]

Definition at line 2727 of file tracking.c.

References MEM_callocN().

Referenced by BKE_tracking_distort(), BKE_tracking_undistort(), exec(), and proxy_startjob().

void BKE_tracking_distortion_destroy ( MovieDistortion distortion)

Definition at line 2820 of file tracking.c.

References MovieDistortion::intrinsics, and MEM_freeN().

Referenced by BKE_tracking_free(), local_merge(), proxy_startjob(), and storage_free().

ImBuf* BKE_tracking_distortion_exec ( MovieDistortion distortion,
MovieTracking tracking,
ImBuf ibuf,
int  width,
int  height,
float  overscan,
int  undistort 
) [read]
void BKE_tracking_distortion_update ( MovieDistortion distortion,
MovieTracking tracking,
int  width,
int  height 
)
MovieTrackingMarker* BKE_tracking_ensure_marker ( MovieTrackingTrack track,
int  framenr 
) [read]
MovieTrackingMarker* BKE_tracking_exact_marker ( MovieTrackingTrack track,
int  framenr 
) [read]
int BKE_tracking_finish_reconstruction ( MovieReconstructContext context,
MovieTracking tracking 
)
void BKE_tracking_free ( MovieTracking tracking)
void BKE_tracking_free_clipboard ( void  )

Definition at line 601 of file tracking.c.

References BKE_tracking_free_track(), MEM_freeN(), MovieTrackingTrack::next, and tracking_clipboard.

Referenced by WM_exit_ext().

void BKE_tracking_free_track ( MovieTrackingTrack track)
MovieTrackingObject* BKE_tracking_get_camera_object ( MovieTracking tracking) [read]
void BKE_tracking_get_interpolated_camera ( MovieTracking tracking,
MovieTrackingObject object,
int  framenr,
float  mat[4][4] 
)
MovieTrackingMarker* BKE_tracking_get_marker ( MovieTrackingTrack track,
int  framenr 
) [read]
ImBuf* BKE_tracking_get_pattern_imbuf ( ImBuf ibuf,
MovieTrackingTrack track,
MovieTrackingMarker marker,
int  margin,
int  anchored,
float  pos[2],
int  origin[2] 
) [read]
MovieReconstructedCamera* BKE_tracking_get_reconstructed_camera ( MovieTracking tracking,
MovieTrackingObject object,
int  framenr 
) [read]
MovieTrackingReconstruction* BKE_tracking_get_reconstruction ( MovieTracking tracking) [read]
ImBuf* BKE_tracking_get_search_imbuf ( ImBuf ibuf,
MovieTrackingTrack track,
MovieTrackingMarker marker,
int  margin,
int  anchored,
float  pos[2],
int  origin[2] 
) [read]
ListBase* BKE_tracking_get_tracks ( MovieTracking tracking) [read]
int BKE_tracking_has_marker ( MovieTrackingTrack track,
int  framenr 
)

Definition at line 393 of file tracking.c.

References BKE_tracking_exact_marker().

Referenced by put_disabled_marker().

MovieTrackingTrack* BKE_tracking_indexed_track ( MovieTracking tracking,
int  tracknr,
ListBase **  tracksbase_r 
) [read]
void BKE_tracking_init_settings ( MovieTracking tracking)
MovieTrackingMarker* BKE_tracking_insert_marker ( MovieTrackingTrack track,
MovieTrackingMarker marker 
) [read]
void BKE_tracking_invert_intrinsics ( MovieTracking tracking,
float  co[2],
float  nco[2] 
)
void BKE_tracking_join_tracks ( MovieTrackingTrack dst_track,
MovieTrackingTrack src_track 
)
MovieTrackingObject* BKE_tracking_named_object ( MovieTracking tracking,
const char *  name 
) [read]
MovieTrackingTrack* BKE_tracking_named_track ( MovieTracking tracking,
MovieTrackingObject object,
const char *  name 
) [read]
MovieTrackingObject* BKE_tracking_new_object ( MovieTracking tracking,
const char *  name 
) [read]
int BKE_tracking_next ( MovieTrackingContext context)
MovieTrackingReconstruction* BKE_tracking_object_reconstruction ( MovieTracking tracking,
MovieTrackingObject object 
) [read]
ListBase* BKE_tracking_object_tracks ( MovieTracking tracking,
MovieTrackingObject object 
) [read]
void BKE_tracking_object_unique_name ( MovieTracking tracking,
MovieTrackingObject object 
)

Definition at line 2932 of file tracking.c.

References BLI_uniquename(), MovieTrackingObject::name, and MovieTracking::objects.

Referenced by BKE_tracking_new_object().

void BKE_tracking_projection_matrix ( MovieTracking tracking,
MovieTrackingObject object,
int  framenr,
int  winx,
int  winy,
float  mat[4][4] 
)
void BKE_tracking_reconstruction_context_free ( MovieReconstructContext context)

Definition at line 1846 of file tracking.c.

References MEM_freeN(), NULL, MovieReconstructContext::tracks_map, and tracks_map_free().

Referenced by solve_camera_freejob().

MovieReconstructContext* BKE_tracking_reconstruction_context_new ( MovieTracking tracking,
MovieTrackingObject object,
int  keyframe1,
int  keyframe2,
int  width,
int  height 
) [read]
void BKE_tracking_remove_object ( MovieTracking tracking,
MovieTrackingObject object 
)
void BKE_tracking_select_track ( ListBase tracksbase,
MovieTrackingTrack track,
int  area,
int  extend 
)
void BKE_tracking_solve_reconstruction ( MovieReconstructContext context,
short *  stop,
short *  do_update,
float *  progress,
char *  stats_message,
int  message_size 
)
void BKE_tracking_stabdata_to_mat4 ( int  width,
int  height,
float  loc[2],
float  scale,
float  angle,
float  mat[4][4] 
)
void BKE_tracking_stabilization_data ( MovieTracking tracking,
int  framenr,
int  width,
int  height,
float  loc[2],
float *  scale,
float *  angle 
)
ImBuf* BKE_tracking_stabilize ( MovieTracking tracking,
int  framenr,
ImBuf ibuf,
float  loc[2],
float *  scale,
float *  angle 
) [read]
void BKE_tracking_sync ( MovieTrackingContext context)
void BKE_tracking_sync_user ( MovieClipUser user,
MovieTrackingContext context 
)

Definition at line 1305 of file tracking.c.

References MovieClipUser::framenr, and MovieTrackingContext::sync_frame.

Referenced by clip_main_area_draw().

int BKE_tracking_test_join_tracks ( MovieTrackingTrack dst_track,
MovieTrackingTrack src_track 
)
void BKE_tracking_track_flag ( MovieTrackingTrack track,
int  area,
int  flag,
int  clear 
)
ImBuf* BKE_tracking_undistort ( MovieTracking tracking,
ImBuf ibuf,
int  width,
int  height,
float  overscan 
) [read]
static void calculate_stabdata ( MovieTracking tracking,
int  framenr,
float  width,
float  height,
float  firstmedian[2],
float  median[2],
float  loc[2],
float *  scale,
float *  angle 
) [static]
static void disable_imbuf_channels ( ImBuf ibuf,
MovieTrackingTrack track,
int  grayscale 
) [static]
static MovieTrackingTrack* duplicate_track ( MovieTrackingTrack track) [static]
static ImBuf* get_area_imbuf ( ImBuf ibuf,
MovieTrackingTrack track,
MovieTrackingMarker marker,
float  min[2],
float  max[2],
int  margin,
int  anchored,
float  pos[2],
int  origin[2] 
) [static]
static void put_disabled_marker ( MovieTrackingTrack track,
MovieTrackingMarker ref_marker,
int  before,
int  overwrite 
) [static]
static int reconstruction_camera_index ( MovieTrackingReconstruction reconstruction,
int  framenr,
int  nearest 
) [static]
static void scale_reconstructed_camera ( MovieTrackingObject object,
float  mat[4][4] 
) [static]
static float stabilization_auto_scale_factor ( MovieTracking tracking,
int  width,
int  height 
) [static]
static int stabilization_median_point ( MovieTracking tracking,
int  framenr,
float  median[2] 
) [static]
static ImBuf* stabilize_alloc_ibuf ( ImBuf cacheibuf,
ImBuf srcibuf,
int  fill 
) [static]
static void track_context_free ( void *  customdata) [static]

Definition at line 979 of file tracking.c.

References MEM_freeN().

Referenced by BKE_tracking_context_free().

static void tracking_object_free ( MovieTrackingObject object) [static]
static void tracking_objects_free ( ListBase objects) [static]
static void tracking_reconstruction_free ( MovieTrackingReconstruction reconstruction) [static]

Definition at line 550 of file tracking.c.

References MovieTrackingReconstruction::cameras, and MEM_freeN().

Referenced by BKE_tracking_free(), and tracking_object_free().

static void tracking_tracks_free ( ListBase tracks) [static]
static void tracks_map_free ( TracksMap map,
void(*)(void *customdata)  customdata_free 
) [static]
static void tracks_map_get ( TracksMap map,
int  index,
MovieTrackingTrack **  track,
void **  customdata 
) [static]

Definition at line 693 of file tracking.c.

References TracksMap::customdata, TracksMap::customdata_size, and TracksMap::tracks.

Referenced by BKE_tracking_next().

static void tracks_map_insert ( TracksMap map,
MovieTrackingTrack track,
void *  customdata 
) [static]
static void tracks_map_merge ( TracksMap map,
MovieTracking tracking 
) [static]
static TracksMap* tracks_map_new ( const char *  object_name,
int  is_camera,
int  num_tracks,
int  customdata_size 
) [static]
static int tracks_map_size ( TracksMap map) [static]

Definition at line 688 of file tracking.c.

References TracksMap::num_tracks.

Referenced by BKE_tracking_next().


Variable Documentation

struct { ... } tracking_clipboard [static]

Definition at line 74 of file tracking.c.

Referenced by tracks_map_merge().