Blender  V3.3
tracking_solver.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. All rights reserved. */
3 
10 #include <limits.h>
11 
12 #include "MEM_guardedalloc.h"
13 
14 #include "DNA_anim_types.h"
15 #include "DNA_movieclip_types.h"
16 
17 #include "BLI_listbase.h"
18 #include "BLI_math.h"
19 #include "BLI_string.h"
20 #include "BLI_utildefines.h"
21 
22 #include "BLT_translation.h"
23 
24 #include "BKE_fcurve.h"
25 #include "BKE_movieclip.h"
26 #include "BKE_tracking.h"
27 
28 #include "RNA_access.h"
29 #include "RNA_prototypes.h"
30 
31 #include "libmv-capi.h"
32 #include "tracking_private.h"
33 
34 typedef struct MovieReconstructContext {
39 
41 
43  bool is_camera;
44  short motion_flag;
45 
47 
49 
51 
52  int sfra, efra;
53 
54  /* Details about reconstruction error, reported by Libmv. */
55  char error_message[1024];
57 
58 typedef struct ReconstructProgressData {
59  short *stop;
60  short *do_update;
61  float *progress;
65 
66 /* Create new libmv Tracks structure from blender's tracks list. */
68  ListBase *tracksbase,
69  int width,
70  int height)
71 {
72  int tracknr = 0;
73  MovieTrackingTrack *track;
75 
76  track = tracksbase->first;
77  while (track) {
78  FCurve *weight_fcurve = id_data_find_fcurve(
79  &clip->id, track, &RNA_MovieTrackingTrack, "weight", 0, NULL);
80 
81  for (int a = 0; a < track->markersnr; a++) {
82  MovieTrackingMarker *marker = &track->markers[a];
83 
84  if ((marker->flag & MARKER_DISABLED) == 0) {
85  float weight = track->weight;
86 
87  if (weight_fcurve) {
88  int scene_framenr = BKE_movieclip_remap_clip_to_scene_frame(clip, marker->framenr);
89  weight = evaluate_fcurve(weight_fcurve, scene_framenr);
90  }
91 
93  marker->framenr,
94  tracknr,
95  (marker->pos[0] + track->offset[0]) * width,
96  (marker->pos[1] + track->offset[1]) * height,
97  weight);
98  }
99  }
100 
101  track = track->next;
102  tracknr++;
103  }
104 
105  return tracks;
106 }
107 
108 /* Retrieve refined camera intrinsics from libmv to blender. */
110  MovieTracking *tracking)
111 {
112  struct libmv_Reconstruction *libmv_reconstruction = context->reconstruction;
114  libmv_reconstruction);
115 
116  libmv_CameraIntrinsicsOptions camera_intrinsics_options;
117  libmv_cameraIntrinsicsExtractOptions(libmv_intrinsics, &camera_intrinsics_options);
118 
119  tracking_trackingCameraFromIntrinscisOptions(tracking, &camera_intrinsics_options);
120 }
121 
122 /* Retrieve reconstructed tracks from libmv to blender.
123  * Actually, this also copies reconstructed cameras
124  * from libmv to movie clip datablock.
125  */
127  MovieTracking *tracking)
128 {
129  struct libmv_Reconstruction *libmv_reconstruction = context->reconstruction;
131  MovieReconstructedCamera *reconstructed;
132  MovieTrackingTrack *track;
133  ListBase *tracksbase = NULL;
134  int tracknr = 0;
135  bool ok = true;
136  bool origin_set = false;
137  int sfra = context->sfra, efra = context->efra;
138  float imat[4][4];
139 
140  if (context->is_camera) {
141  tracksbase = &tracking->tracks;
142  reconstruction = &tracking->reconstruction;
143  }
144  else {
145  MovieTrackingObject *object = BKE_tracking_object_get_named(tracking, context->object_name);
146 
147  tracksbase = &object->tracks;
148  reconstruction = &object->reconstruction;
149  }
150 
151  unit_m4(imat);
152 
153  track = tracksbase->first;
154  while (track) {
155  double pos[3];
156 
157  if (libmv_reprojectionPointForTrack(libmv_reconstruction, tracknr, pos)) {
158  track->bundle_pos[0] = pos[0];
159  track->bundle_pos[1] = pos[1];
160  track->bundle_pos[2] = pos[2];
161 
162  track->flag |= TRACK_HAS_BUNDLE;
163  track->error = libmv_reprojectionErrorForTrack(libmv_reconstruction, tracknr);
164  }
165  else {
166  track->flag &= ~TRACK_HAS_BUNDLE;
167  ok = false;
168 
169  printf("Unable to reconstruct position for track #%d '%s'\n", tracknr, track->name);
170  }
171 
172  track = track->next;
173  tracknr++;
174  }
175 
176  if (reconstruction->cameras) {
177  MEM_freeN(reconstruction->cameras);
178  }
179 
180  reconstruction->camnr = 0;
181  reconstruction->cameras = NULL;
182  reconstructed = MEM_callocN((efra - sfra + 1) * sizeof(MovieReconstructedCamera),
183  "temp reconstructed camera");
184 
185  for (int a = sfra; a <= efra; a++) {
186  double matd[4][4];
187 
188  if (libmv_reprojectionCameraForImage(libmv_reconstruction, a, matd)) {
189  float mat[4][4];
190  float error = libmv_reprojectionErrorForImage(libmv_reconstruction, a);
191 
192  /* TODO(sergey): Use transpose utility. */
193  for (int i = 0; i < 4; i++) {
194  for (int j = 0; j < 4; j++) {
195  mat[i][j] = matd[i][j];
196  }
197  }
198 
199  /* Ensure first camera has got zero rotation and transform.
200  * This is essential for object tracking to work -- this way
201  * we'll always know object and environment are properly
202  * oriented.
203  *
204  * There's one weak part tho, which is requirement object
205  * motion starts at the same frame as camera motion does,
206  * otherwise that;' be a Russian roulette whether object is
207  * aligned correct or not.
208  */
209  if (!origin_set) {
210  invert_m4_m4(imat, mat);
211  unit_m4(mat);
212  origin_set = true;
213  }
214  else {
215  mul_m4_m4m4(mat, imat, mat);
216  }
217 
218  copy_m4_m4(reconstructed[reconstruction->camnr].mat, mat);
219  reconstructed[reconstruction->camnr].framenr = a;
220  reconstructed[reconstruction->camnr].error = error;
221  reconstruction->camnr++;
222  }
223  else {
224  ok = false;
225  printf("No camera for frame %d\n", a);
226  }
227  }
228 
229  if (reconstruction->camnr) {
230  int size = reconstruction->camnr * sizeof(MovieReconstructedCamera);
231  reconstruction->cameras = MEM_mallocN(size, "reconstructed camera");
232  memcpy(reconstruction->cameras, reconstructed, size);
233  }
234 
235  if (origin_set) {
236  track = tracksbase->first;
237  while (track) {
238  if (track->flag & TRACK_HAS_BUNDLE) {
239  mul_v3_m4v3(track->bundle_pos, imat, track->bundle_pos);
240  }
241 
242  track = track->next;
243  }
244  }
245 
246  MEM_freeN(reconstructed);
247 
248  return ok;
249 }
250 
251 /* Retrieve all the libmv data from context to blender's side data blocks. */
253 {
254  /* take the intrinsics back from libmv */
256 
257  return reconstruct_retrieve_libmv_tracks(context, tracking);
258 }
259 
260 /* Convert blender's refinement flags to libmv's. */
262  MovieTrackingObject *object)
263 {
264  int refine = tracking->settings.refine_camera_intrinsics;
265  int flags = 0;
266 
267  if ((object->flag & TRACKING_OBJECT_CAMERA) == 0) {
268  return 0;
269  }
270 
271  if (refine & REFINE_FOCAL_LENGTH) {
272  flags |= LIBMV_REFINE_FOCAL_LENGTH;
273  }
274 
275  if (refine & REFINE_PRINCIPAL_POINT) {
277  }
278 
279  if (refine & REFINE_RADIAL_DISTORTION) {
281  }
282 
283  if (refine & REFINE_TANGENTIAL_DISTORTION) {
285  }
286 
287  return flags;
288 }
289 
290 /* Count tracks which has markers at both of keyframes. */
292  MovieTrackingObject *object)
293 {
294  ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object);
295  int tot = 0;
296  int frame1 = object->keyframe1, frame2 = object->keyframe2;
297  MovieTrackingTrack *track;
298 
299  track = tracksbase->first;
300  while (track) {
303  tot++;
304  }
305  }
306 
307  track = track->next;
308  }
309 
310  return tot;
311 }
312 
314  MovieTrackingObject *object,
315  char *error_msg,
316  int error_size)
317 {
318  if (tracking->settings.motion_flag & TRACKING_MOTION_MODAL) {
319  /* TODO: check for number of tracks? */
320  return true;
321  }
323  /* automatic keyframe selection does not require any pre-process checks */
324  if (reconstruct_count_tracks_on_both_keyframes(tracking, object) < 8) {
325  BLI_strncpy(error_msg,
326  N_("At least 8 common tracks on both keyframes are needed for reconstruction"),
327  error_size);
328 
329  return false;
330  }
331  }
332 
333 #ifndef WITH_LIBMV
334  BLI_strncpy(error_msg, N_("Blender is compiled without motion tracking library"), error_size);
335  return false;
336 #endif
337 
338  return true;
339 }
340 
342  MovieTrackingObject *object,
343  int keyframe1,
344  int keyframe2,
345  int width,
346  int height)
347 {
348  MovieTracking *tracking = &clip->tracking;
350  "MovieReconstructContext data");
351  ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object);
352  float aspy = 1.0f / tracking->camera.pixel_aspect;
353  int num_tracks = BLI_listbase_count(tracksbase);
354  int sfra = INT_MAX, efra = INT_MIN;
355  MovieTrackingTrack *track;
356 
357  BLI_strncpy(context->object_name, object->name, sizeof(context->object_name));
358  context->is_camera = object->flag & TRACKING_OBJECT_CAMERA;
359  context->motion_flag = tracking->settings.motion_flag;
360 
361  context->select_keyframes = (tracking->settings.reconstruction_flag &
363 
365  tracking, width, height, &context->camera_intrinsics_options);
366 
367  context->tracks_map = tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
368 
369  track = tracksbase->first;
370  while (track) {
371  int first = 0, last = track->markersnr - 1;
372  MovieTrackingMarker *first_marker = &track->markers[0];
373  MovieTrackingMarker *last_marker = &track->markers[track->markersnr - 1];
374 
375  /* find first not-disabled marker */
376  while (first <= track->markersnr - 1 && first_marker->flag & MARKER_DISABLED) {
377  first++;
378  first_marker++;
379  }
380 
381  /* find last not-disabled marker */
382  while (last >= 0 && last_marker->flag & MARKER_DISABLED) {
383  last--;
384  last_marker--;
385  }
386 
387  if (first <= track->markersnr - 1) {
388  sfra = min_ii(sfra, first_marker->framenr);
389  }
390 
391  if (last >= 0) {
392  efra = max_ii(efra, last_marker->framenr);
393  }
394 
395  tracks_map_insert(context->tracks_map, track, NULL);
396 
397  track = track->next;
398  }
399 
400  context->sfra = sfra;
401  context->efra = efra;
402 
403  context->tracks = libmv_tracks_new(clip, tracksbase, width, height * aspy);
404  context->keyframe1 = keyframe1;
405  context->keyframe2 = keyframe2;
406  context->refine_flags = reconstruct_refine_intrinsics_get_flags(tracking, object);
407 
408  context->error_message[0] = '\0';
409 
410  return context;
411 }
412 
414  const char *error_message)
415 {
416  if (context->error_message[0]) {
417  /* Only keep initial error message, the rest are inducted ones. */
418  return;
419  }
420  BLI_strncpy(context->error_message, error_message, sizeof(context->error_message));
421 }
422 
424 {
425  return context->error_message;
426 }
427 
429 {
430  if (context->reconstruction) {
431  libmv_reconstructionDestroy(context->reconstruction);
432  }
433 
434  libmv_tracksDestroy(context->tracks);
435 
436  tracks_map_free(context->tracks_map, NULL);
437 
439 }
440 
441 /* Callback which is called from libmv side to update progress in the interface. */
442 static void reconstruct_update_solve_cb(void *customdata, double progress, const char *message)
443 {
444  ReconstructProgressData *progressdata = customdata;
445 
446  if (progressdata->progress) {
447  *progressdata->progress = progress;
448  *progressdata->do_update = true;
449  }
450 
451  BLI_snprintf(
452  progressdata->stats_message, progressdata->message_size, "Solving camera | %s", message);
453 }
454 
455 /* Fill in reconstruction options structure from reconstruction context. */
458 {
459  reconstruction_options->select_keyframes = context->select_keyframes;
460 
461  reconstruction_options->keyframe1 = context->keyframe1;
462  reconstruction_options->keyframe2 = context->keyframe2;
463 
464  reconstruction_options->refine_intrinsics = context->refine_flags;
465 }
466 
468  short *stop,
469  short *do_update,
470  float *progress,
471  char *stats_message,
472  int message_size)
473 {
474  float error;
475 
476  ReconstructProgressData progressdata;
477 
478  libmv_ReconstructionOptions reconstruction_options;
479 
480  progressdata.stop = stop;
481  progressdata.do_update = do_update;
482  progressdata.progress = progress;
483  progressdata.stats_message = stats_message;
484  progressdata.message_size = message_size;
485 
486  reconstructionOptionsFromContext(&reconstruction_options, context);
487 
488  if (context->motion_flag & TRACKING_MOTION_MODAL) {
489  context->reconstruction = libmv_solveModal(context->tracks,
490  &context->camera_intrinsics_options,
491  &reconstruction_options,
493  &progressdata);
494  }
495  else {
496  context->reconstruction = libmv_solveReconstruction(context->tracks,
497  &context->camera_intrinsics_options,
498  &reconstruction_options,
500  &progressdata);
501 
502  if (context->select_keyframes) {
503  /* store actual keyframes used for reconstruction to update them in the interface later */
504  context->keyframe1 = reconstruction_options.keyframe1;
505  context->keyframe2 = reconstruction_options.keyframe2;
506  }
507  }
508 
509  error = libmv_reprojectionError(context->reconstruction);
510 
511  context->reprojection_error = error;
512 }
513 
515 {
517  MovieTrackingObject *object;
518 
519  if (!libmv_reconstructionIsValid(context->reconstruction)) {
521  context, "Failed to solve the motion: most likely there are no good keyframes");
522  return false;
523  }
524 
525  tracks_map_merge(context->tracks_map, tracking);
527 
528  object = BKE_tracking_object_get_named(tracking, context->object_name);
529 
530  if (context->is_camera) {
531  reconstruction = &tracking->reconstruction;
532  }
533  else {
534  reconstruction = &object->reconstruction;
535  }
536 
537  /* update keyframe in the interface */
538  if (context->select_keyframes) {
539  object->keyframe1 = context->keyframe1;
540  object->keyframe2 = context->keyframe2;
541  }
542 
543  reconstruction->error = context->reprojection_error;
545 
546  if (!reconstruct_retrieve_libmv(context, tracking)) {
547  return false;
548  }
549 
550  return true;
551 }
552 
553 static void tracking_scale_reconstruction(ListBase *tracksbase,
555  const float scale[3])
556 {
557  float first_camera_delta[3] = {0.0f, 0.0f, 0.0f};
558 
559  if (reconstruction->camnr > 0) {
560  mul_v3_v3v3(first_camera_delta, reconstruction->cameras[0].mat[3], scale);
561  }
562 
563  for (int i = 0; i < reconstruction->camnr; i++) {
565  mul_v3_v3(camera->mat[3], scale);
566  sub_v3_v3(camera->mat[3], first_camera_delta);
567  }
568 
569  LISTBASE_FOREACH (MovieTrackingTrack *, track, tracksbase) {
570  if (track->flag & TRACK_HAS_BUNDLE) {
571  mul_v3_v3(track->bundle_pos, scale);
572  sub_v3_v3(track->bundle_pos, first_camera_delta);
573  }
574  }
575 }
576 
577 void BKE_tracking_reconstruction_scale(MovieTracking *tracking, float scale[3])
578 {
579  LISTBASE_FOREACH (MovieTrackingObject *, object, &tracking->objects) {
580  ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object);
582  object);
583 
584  tracking_scale_reconstruction(tracksbase, reconstruction, scale);
585  }
586 }
float evaluate_fcurve(struct FCurve *fcu, float evaltime)
Definition: fcurve.c:2135
struct FCurve * id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, const char *prop_name, int index, bool *r_driven)
Definition: fcurve.c:201
float BKE_movieclip_remap_clip_to_scene_frame(const struct MovieClip *clip, float framenr)
struct MovieTrackingReconstruction * BKE_tracking_object_get_reconstruction(struct MovieTracking *tracking, struct MovieTrackingObject *object)
Definition: tracking.c:2131
bool BKE_tracking_track_has_enabled_marker_at_frame(struct MovieTrackingTrack *track, int framenr)
Definition: tracking.c:727
void BKE_tracking_dopesheet_tag_update(struct MovieTracking *tracking)
Definition: tracking.c:3411
struct MovieTrackingObject * BKE_tracking_object_get_named(struct MovieTracking *tracking, const char *name)
Definition: tracking.c:2077
struct ListBase * BKE_tracking_object_get_tracks(struct MovieTracking *tracking, struct MovieTrackingObject *object)
Definition: tracking.c:2112
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:259
void unit_m4(float m[4][4])
Definition: rct.c:1090
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1287
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:77
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
Definition: math_matrix.c:739
MINLINE void mul_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define MAX_NAME
Definition: DNA_defs.h:48
@ TRACKING_OBJECT_CAMERA
struct MovieReconstructedCamera MovieReconstructedCamera
@ REFINE_PRINCIPAL_POINT
@ REFINE_TANGENTIAL_DISTORTION
@ REFINE_RADIAL_DISTORTION
@ REFINE_FOCAL_LENGTH
@ TRACKING_RECONSTRUCTED
@ MARKER_DISABLED
@ TRACKING_MOTION_MODAL
@ TRACK_HAS_BUNDLE
@ TRACKING_USE_KEYFRAME_SELECTION
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
Read Guarded memory(de)allocation.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
uint pos
void libmv_cameraIntrinsicsExtractOptions(const libmv_CameraIntrinsics *libmv_intrinsics, libmv_CameraIntrinsicsOptions *camera_intrinsics_options)
struct libmv_CameraIntrinsics libmv_CameraIntrinsics
libmv_Reconstruction * libmv_solveReconstruction(const libmv_Tracks *libmv_tracks, const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, libmv_ReconstructionOptions *libmv_reconstruction_options, reconstruct_progress_update_cb progress_update_callback, void *callback_customdata)
double libmv_reprojectionErrorForImage(const libmv_Reconstruction *libmv_reconstruction, int image)
libmv_CameraIntrinsics * libmv_reconstructionExtractIntrinsics(libmv_Reconstruction *libmv_reconstruction)
double libmv_reprojectionError(const libmv_Reconstruction *libmv_reconstruction)
void libmv_reconstructionDestroy(libmv_Reconstruction *libmv_reconstruction)
int libmv_reconstructionIsValid(libmv_Reconstruction *libmv_reconstruction)
int libmv_reprojectionCameraForImage(const libmv_Reconstruction *libmv_reconstruction, int image, double mat[4][4])
libmv_Reconstruction * libmv_solveModal(const libmv_Tracks *libmv_tracks, const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, const libmv_ReconstructionOptions *libmv_reconstruction_options, reconstruct_progress_update_cb progress_update_callback, void *callback_customdata)
int libmv_reprojectionPointForTrack(const libmv_Reconstruction *libmv_reconstruction, int track, double pos[3])
double libmv_reprojectionErrorForTrack(const libmv_Reconstruction *libmv_reconstruction, int track)
@ LIBMV_REFINE_TANGENTIAL_DISTORTION
@ LIBMV_REFINE_FOCAL_LENGTH
@ LIBMV_REFINE_RADIAL_DISTORTION
@ LIBMV_REFINE_PRINCIPAL_POINT
struct libmv_Tracks libmv_Tracks
Definition: intern/tracks.h:11
const ProjectiveReconstruction & reconstruction
Definition: intersect.cc:198
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
static void error(const char *str)
Definition: meshlaplacian.c:51
static unsigned a[3]
Definition: RandGen.cpp:78
void * first
Definition: DNA_listBase.h:31
struct MovieTracking tracking
struct libmv_Tracks * tracks
struct libmv_Reconstruction * reconstruction
char object_name[MAX_NAME]
libmv_CameraIntrinsicsOptions camera_intrinsics_options
MovieTrackingMarker * markers
struct MovieTrackingTrack * next
MovieTrackingReconstruction reconstruction
MovieTrackingCamera camera
MovieTrackingSettings settings
void libmv_tracksDestroy(libmv_Tracks *)
Definition: stub.cc:95
libmv_Tracks * libmv_tracksNew(void)
Definition: stub.cc:83
void libmv_tracksInsert(libmv_Tracks *, int, int, double, double, double)
Definition: stub.cc:87
ListBase tracks
Definition: tracking.c:60
struct ReconstructProgressData ReconstructProgressData
static void reconstruct_update_solve_cb(void *customdata, double progress, const char *message)
static struct libmv_Tracks * libmv_tracks_new(MovieClip *clip, ListBase *tracksbase, int width, int height)
void BKE_tracking_reconstruction_context_free(MovieReconstructContext *context)
static void reconstruct_retrieve_libmv_intrinsics(MovieReconstructContext *context, MovieTracking *tracking)
bool BKE_tracking_reconstruction_finish(MovieReconstructContext *context, MovieTracking *tracking)
static int reconstruct_count_tracks_on_both_keyframes(MovieTracking *tracking, MovieTrackingObject *object)
void BKE_tracking_reconstruction_report_error_message(MovieReconstructContext *context, const char *error_message)
static bool reconstruct_retrieve_libmv_tracks(MovieReconstructContext *context, MovieTracking *tracking)
static int reconstruct_refine_intrinsics_get_flags(MovieTracking *tracking, MovieTrackingObject *object)
static int reconstruct_retrieve_libmv(MovieReconstructContext *context, MovieTracking *tracking)
void BKE_tracking_reconstruction_scale(MovieTracking *tracking, float scale[3])
const char * BKE_tracking_reconstruction_error_message_get(const MovieReconstructContext *context)
bool BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObject *object, char *error_msg, int error_size)
void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short *stop, short *do_update, float *progress, char *stats_message, int message_size)
static void tracking_scale_reconstruction(ListBase *tracksbase, MovieTrackingReconstruction *reconstruction, const float scale[3])
MovieReconstructContext * BKE_tracking_reconstruction_context_new(MovieClip *clip, MovieTrackingObject *object, int keyframe1, int keyframe2, int width, int height)
struct MovieReconstructContext MovieReconstructContext
static void reconstructionOptionsFromContext(libmv_ReconstructionOptions *reconstruction_options, MovieReconstructContext *context)
void tracking_cameraIntrinscisOptionsFromTracking(MovieTracking *tracking, int calibration_width, int calibration_height, libmv_CameraIntrinsicsOptions *camera_intrinsics_options)
void tracks_map_free(TracksMap *map, void(*customdata_free)(void *customdata))
void tracking_trackingCameraFromIntrinscisOptions(MovieTracking *tracking, const libmv_CameraIntrinsicsOptions *camera_intrinsics_options)
void tracks_map_insert(TracksMap *map, MovieTrackingTrack *track, void *customdata)
Definition: tracking_util.c:94
TracksMap * tracks_map_new(const char *object_name, bool is_camera, int num_tracks, int customdata_size)
Definition: tracking_util.c:51
void tracks_map_merge(TracksMap *map, MovieTracking *tracking)
#define N_(msgid)