Blender V4.3
tracking_solver.cc File Reference
#include <climits>
#include "MEM_guardedalloc.h"
#include "DNA_movieclip_types.h"
#include "BLI_listbase.h"
#include "BLI_math_matrix.h"
#include "BLI_math_vector.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLT_translation.hh"
#include "BKE_fcurve.hh"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
#include "RNA_prototypes.hh"
#include "libmv-capi.h"
#include "tracking_private.h"

Go to the source code of this file.

Classes

struct  MovieReconstructContext
 
struct  ReconstructProgressData
 

Functions

static libmv_Trackslibmv_tracks_new (MovieClip *clip, ListBase *tracksbase, int width, int height)
 
static void reconstruct_retrieve_libmv_intrinsics (MovieReconstructContext *context, MovieTracking *tracking)
 
static bool reconstruct_retrieve_libmv_tracks (MovieReconstructContext *context, MovieTracking *tracking)
 
static int reconstruct_retrieve_libmv (MovieReconstructContext *context, MovieTracking *tracking)
 
static int reconstruct_refine_intrinsics_get_flags (MovieTracking *tracking, MovieTrackingObject *tracking_object)
 
static int reconstruct_count_tracks_on_both_keyframes (MovieTrackingObject *tracking_object)
 
bool BKE_tracking_reconstruction_check (MovieTracking *tracking, MovieTrackingObject *tracking_object, char *error_msg, int error_size)
 
MovieReconstructContextBKE_tracking_reconstruction_context_new (MovieClip *clip, MovieTrackingObject *tracking_object, int keyframe1, int keyframe2, int width, int height)
 
void BKE_tracking_reconstruction_report_error_message (MovieReconstructContext *context, const char *error_message)
 
const char * BKE_tracking_reconstruction_error_message_get (const MovieReconstructContext *context)
 
void BKE_tracking_reconstruction_context_free (MovieReconstructContext *context)
 
static void reconstruct_update_solve_cb (void *customdata, double progress, const char *message)
 
static void reconstructionOptionsFromContext (libmv_ReconstructionOptions *reconstruction_options, MovieReconstructContext *context)
 
void BKE_tracking_reconstruction_solve (MovieReconstructContext *context, bool *stop, bool *do_update, float *progress, char *stats_message, int message_size)
 
bool BKE_tracking_reconstruction_finish (MovieReconstructContext *context, MovieTracking *tracking)
 
static void tracking_scale_reconstruction (ListBase *tracksbase, MovieTrackingReconstruction *reconstruction, const float scale[3])
 
void BKE_tracking_reconstruction_scale (MovieTracking *tracking, float scale[3])
 

Detailed Description

This file contains blender-side implementation of camera solver.

Definition in file tracking_solver.cc.

Function Documentation

◆ BKE_tracking_reconstruction_check()

bool BKE_tracking_reconstruction_check ( struct MovieTracking * tracking,
struct MovieTrackingObject * tracking_object,
char * error_msg,
int error_size )

Perform early check on whether everything is fine to start reconstruction.

Definition at line 291 of file tracking_solver.cc.

References BLI_strncpy(), N_, reconstruct_count_tracks_on_both_keyframes(), TRACKING_MOTION_MODAL, and TRACKING_USE_KEYFRAME_SELECTION.

Referenced by solve_camera_initjob().

◆ BKE_tracking_reconstruction_context_free()

void BKE_tracking_reconstruction_context_free ( struct MovieReconstructContext * context)

Free memory used by a reconstruction process.

Definition at line 401 of file tracking_solver.cc.

References libmv_reconstructionDestroy(), libmv_tracksDestroy(), MEM_freeN(), and tracks_map_free().

Referenced by solve_camera_freejob().

◆ BKE_tracking_reconstruction_context_new()

MovieReconstructContext * BKE_tracking_reconstruction_context_new ( struct MovieClip * clip,
struct MovieTrackingObject * tracking_object,
int keyframe1,
int keyframe2,
int width,
int height )

Create context for camera/object motion reconstruction. Copies all data needed for reconstruction from movie clip datablock, so editing this clip is safe during reconstruction job is in progress.

Definition at line 319 of file tracking_solver.cc.

References BLI_listbase_count(), MovieTrackingMarker::flag, MovieTrackingMarker::framenr, libmv_tracks_new(), LISTBASE_FOREACH, MARKER_DISABLED, max_ii(), min_ii(), MovieTrackingObject::name, reconstruct_refine_intrinsics_get_flags(), STRNCPY, tracking_cameraIntrinscisOptionsFromTracking(), TRACKING_USE_KEYFRAME_SELECTION, MovieTrackingObject::tracks, tracks_map_insert(), and tracks_map_new().

Referenced by solve_camera_initjob().

◆ BKE_tracking_reconstruction_error_message_get()

const char * BKE_tracking_reconstruction_error_message_get ( const MovieReconstructContext * context)

Definition at line 396 of file tracking_solver.cc.

◆ BKE_tracking_reconstruction_finish()

◆ BKE_tracking_reconstruction_report_error_message()

void BKE_tracking_reconstruction_report_error_message ( MovieReconstructContext * context,
const char * error_message )

Definition at line 386 of file tracking_solver.cc.

References STRNCPY.

Referenced by BKE_tracking_reconstruction_finish().

◆ BKE_tracking_reconstruction_scale()

void BKE_tracking_reconstruction_scale ( struct MovieTracking * tracking,
float scale[3] )

Apply scale on all reconstructed cameras and bundles, used by camera scale apply operator.

Definition at line 542 of file tracking_solver.cc.

References LISTBASE_FOREACH, and tracking_scale_reconstruction().

Referenced by blender::ed::object::apply_objects_internal().

◆ BKE_tracking_reconstruction_solve()

void BKE_tracking_reconstruction_solve ( struct MovieReconstructContext * context,
bool * stop,
bool * do_update,
float * progress,
char * stats_message,
int message_size )

Solve camera/object motion and reconstruct 3D markers position from a prepared reconstruction context.

stop is not actually used at this moment, so reconstruction job could not be stopped.

do_update, progress and stat_message are set by reconstruction callback in libmv side and passing to an interface.

Definition at line 440 of file tracking_solver.cc.

References ReconstructProgressData::do_update, error(), libmv_ReconstructionOptions::keyframe1, libmv_ReconstructionOptions::keyframe2, libmv_reprojectionError(), libmv_solveModal(), libmv_solveReconstruction(), ReconstructProgressData::message_size, ReconstructProgressData::progress, reconstruct_update_solve_cb(), reconstructionOptionsFromContext(), ReconstructProgressData::stats_message, ReconstructProgressData::stop, and TRACKING_MOTION_MODAL.

Referenced by solve_camera_startjob().

◆ libmv_tracks_new()

◆ reconstruct_count_tracks_on_both_keyframes()

◆ reconstruct_refine_intrinsics_get_flags()

◆ reconstruct_retrieve_libmv()

static int reconstruct_retrieve_libmv ( MovieReconstructContext * context,
MovieTracking * tracking )
static

◆ reconstruct_retrieve_libmv_intrinsics()

◆ reconstruct_retrieve_libmv_tracks()

◆ reconstruct_update_solve_cb()

static void reconstruct_update_solve_cb ( void * customdata,
double progress,
const char * message )
static

◆ reconstructionOptionsFromContext()

◆ tracking_scale_reconstruction()

static void tracking_scale_reconstruction ( ListBase * tracksbase,
MovieTrackingReconstruction * reconstruction,
const float scale[3] )
static