29#include "RNA_prototypes.hh"
75 &clip->
id, track, &RNA_MovieTrackingTrack,
"weight", 0,
nullptr);
77 for (
int a = 0; a < track->
markersnr; a++) {
81 float weight = track->
weight;
91 (marker->
pos[0] + track->
offset[0]) * width,
92 (marker->
pos[1] + track->
offset[1]) * height,
110 libmv_reconstruction);
127 bool origin_set =
false;
128 int sfra = context->sfra, efra = context->efra;
132 context->object_name);
143 track->bundle_pos[0] =
pos[0];
144 track->bundle_pos[1] =
pos[1];
145 track->bundle_pos[2] =
pos[2];
154 printf(
"Unable to reconstruct position for track #%d '%s'\n", track_index, track->name);
163 reconstruction->
camnr = 0;
164 reconstruction->
cameras =
nullptr;
167 (efra - sfra + 1),
"temp reconstructed camera");
169 for (
int a = sfra; a <= efra; a++) {
177 for (
int i = 0; i < 4; i++) {
178 for (
int j = 0; j < 4; j++) {
179 mat[i][j] = matd[i][j];
203 &reconstructed_cameras[reconstruction->
camnr];
205 reconstructed_camera->
framenr = a;
207 reconstruction->
camnr++;
211 printf(
"No camera for frame %d\n", a);
215 if (reconstruction->
camnr) {
217 reconstruction->
cameras = MEM_cnew_array<MovieReconstructedCamera>(reconstruction->
camnr,
218 "reconstructed camera");
219 memcpy(reconstruction->
cameras, reconstructed_cameras,
size);
225 mul_v3_m4v3(track->bundle_pos, imat, track->bundle_pos);
304 N_(
"At least 8 common tracks on both keyframes are needed for reconstruction"),
312 BLI_strncpy(error_msg,
N_(
"Blender is compiled without motion tracking library"), error_size);
329 "MovieReconstructContext data");
332 int sfra = INT_MAX, efra = INT_MIN;
334 STRNCPY(context->object_name, tracking_object->
name);
341 tracking, width, height, &context->camera_intrinsics_options);
343 context->tracks_map =
tracks_map_new(context->object_name, num_tracks);
346 int first = 0, last = track->markersnr - 1;
362 if (first <= track->markersnr - 1) {
373 context->sfra = sfra;
374 context->efra = efra;
377 context->keyframe1 = keyframe1;
378 context->keyframe2 = keyframe2;
381 context->error_message[0] =
'\0';
387 const char *error_message)
389 if (context->error_message[0]) {
393 STRNCPY(context->error_message, error_message);
398 return context->error_message;
403 if (context->reconstruction) {
434 reconstruction_options->
keyframe1 = context->keyframe1;
435 reconstruction_options->
keyframe2 = context->keyframe2;
453 progressdata.
stop = stop;
463 &context->camera_intrinsics_options,
464 &reconstruction_options,
470 &context->camera_intrinsics_options,
471 &reconstruction_options,
475 if (context->select_keyframes) {
477 context->keyframe1 = reconstruction_options.
keyframe1;
478 context->keyframe2 = reconstruction_options.
keyframe2;
484 context->reprojection_error =
error;
491 context,
"Failed to solve the motion: most likely there are no good keyframes");
499 context->object_name);
503 if (context->select_keyframes) {
504 tracking_object->
keyframe1 = context->keyframe1;
505 tracking_object->
keyframe2 = context->keyframe2;
508 reconstruction->
error = context->reprojection_error;
520 const float scale[3])
522 float first_camera_delta[3] = {0.0f, 0.0f, 0.0f};
524 if (reconstruction->
camnr > 0) {
528 for (
int i = 0; i < reconstruction->
camnr; i++) {
537 sub_v3_v3(track->bundle_pos, first_camera_delta);
float evaluate_fcurve(const FCurve *fcu, float evaltime)
FCurve * id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index, bool *r_driven)
float BKE_movieclip_remap_clip_to_scene_frame(const struct MovieClip *clip, float framenr)
struct MovieTrackingObject * BKE_tracking_object_get_named(struct MovieTracking *tracking, const char *name)
bool BKE_tracking_track_has_enabled_marker_at_frame(struct MovieTrackingTrack *track, int framenr)
void BKE_tracking_dopesheet_tag_update(struct MovieTracking *tracking)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
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])
void unit_m4(float m[4][4])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void mul_v3_v3v3(float r[3], const float v1[3], const float v2[3])
#define STRNCPY(dst, src)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
@ REFINE_TANGENTIAL_DISTORTION
@ REFINE_RADIAL_DISTORTION
@ TRACKING_USE_KEYFRAME_SELECTION
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 Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture 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)
static void refine(OpenSubdiv_Evaluator *evaluator)
void libmv_cameraIntrinsicsExtractOptions(const libmv_CameraIntrinsics *libmv_intrinsics, libmv_CameraIntrinsicsOptions *camera_intrinsics_options)
struct libmv_CameraIntrinsics libmv_CameraIntrinsics
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)
double libmv_reprojectionErrorForImage(const libmv_Reconstruction *libmv_reconstruction, int image)
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_CameraIntrinsics * libmv_reconstructionExtractIntrinsics(libmv_Reconstruction *libmv_reconstruction)
int libmv_reprojectionPointForTrack(const libmv_Reconstruction *libmv_reconstruction, int track, double pos[3])
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_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
void MEM_freeN(void *vmemh)
static void error(const char *str)
struct MovieTracking tracking
char object_name[MAX_NAME]
libmv_CameraIntrinsicsOptions camera_intrinsics_options
libmv_Reconstruction * reconstruction
MovieTrackingReconstruction reconstruction
struct MovieReconstructedCamera * cameras
int refine_camera_intrinsics
MovieTrackingMarker * markers
struct MovieTrackingTrack * next
MovieTrackingCamera camera
MovieTrackingSettings settings
libmv_Tracks * libmv_tracksNew(void)
void libmv_tracksDestroy(libmv_Tracks *)
void libmv_tracksInsert(libmv_Tracks *, int, int, double, double, double)
static void reconstruct_update_solve_cb(void *customdata, double progress, const char *message)
MovieReconstructContext * BKE_tracking_reconstruction_context_new(MovieClip *clip, MovieTrackingObject *tracking_object, int keyframe1, int keyframe2, int width, int height)
void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, bool *stop, bool *do_update, float *progress, char *stats_message, int message_size)
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 libmv_Tracks * libmv_tracks_new(MovieClip *clip, ListBase *tracksbase, int width, int height)
void BKE_tracking_reconstruction_report_error_message(MovieReconstructContext *context, const char *error_message)
static int reconstruct_count_tracks_on_both_keyframes(MovieTrackingObject *tracking_object)
const char * BKE_tracking_reconstruction_error_message_get(const MovieReconstructContext *context)
static bool reconstruct_retrieve_libmv_tracks(MovieReconstructContext *context, MovieTracking *tracking)
static int reconstruct_retrieve_libmv(MovieReconstructContext *context, MovieTracking *tracking)
void BKE_tracking_reconstruction_scale(MovieTracking *tracking, float scale[3])
static int reconstruct_refine_intrinsics_get_flags(MovieTracking *tracking, MovieTrackingObject *tracking_object)
static void tracking_scale_reconstruction(ListBase *tracksbase, MovieTrackingReconstruction *reconstruction, const float scale[3])
bool BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObject *tracking_object, char *error_msg, int error_size)
static void reconstructionOptionsFromContext(libmv_ReconstructionOptions *reconstruction_options, MovieReconstructContext *context)
void tracks_map_free(TracksMap *map)
void tracking_cameraIntrinscisOptionsFromTracking(MovieTracking *tracking, const int calibration_width, const int calibration_height, libmv_CameraIntrinsicsOptions *camera_intrinsics_options)
void tracks_map_insert(TracksMap *map, MovieTrackingTrack *track)
void tracking_trackingCameraFromIntrinscisOptions(MovieTracking *tracking, const libmv_CameraIntrinsicsOptions *camera_intrinsics_options)
TracksMap * tracks_map_new(const char *object_name, int num_tracks)
void tracks_map_merge(TracksMap *map, MovieTracking *tracking)