Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2011 Blender Foundation. 00019 * All rights reserved. 00020 * 00021 * Contributor(s): Blender Foundation, 00022 * Sergey Sharybin 00023 * 00024 * ***** END GPL LICENSE BLOCK ***** 00025 */ 00026 00027 #ifndef BKE_TRACKING_H 00028 #define BKE_TRACKING_H 00029 00035 struct bGPDlayer; 00036 struct ImBuf; 00037 struct ListBase; 00038 struct MovieReconstructContext; 00039 struct MovieTrackingTrack; 00040 struct MovieTrackingMarker; 00041 struct MovieTracking; 00042 struct MovieTrackingContext; 00043 struct MovieTrackingObject; 00044 struct MovieClipUser; 00045 struct MovieDistortion; 00046 struct Camera; 00047 struct Object; 00048 struct Scene; 00049 00050 void BKE_tracking_init_settings(struct MovieTracking *tracking); 00051 void BKE_tracking_clamp_track(struct MovieTrackingTrack *track, int event); 00052 void BKE_tracking_track_flag(struct MovieTrackingTrack *track, int area, int flag, int clear); 00053 00054 struct MovieTrackingTrack *BKE_tracking_add_track(struct MovieTracking *tracking, struct ListBase *tracksbase, 00055 float x, float y, int framenr, int width, int height); 00056 struct MovieTrackingMarker *BKE_tracking_insert_marker(struct MovieTrackingTrack *track, 00057 struct MovieTrackingMarker *marker); 00058 void BKE_tracking_delete_marker(struct MovieTrackingTrack *track, int framenr); 00059 00060 struct MovieTrackingMarker *BKE_tracking_get_marker(struct MovieTrackingTrack *track, int framenr); 00061 struct MovieTrackingMarker *BKE_tracking_ensure_marker(struct MovieTrackingTrack *track, int framenr); 00062 struct MovieTrackingMarker *BKE_tracking_exact_marker(struct MovieTrackingTrack *track, int framenr); 00063 int BKE_tracking_has_marker(struct MovieTrackingTrack *track, int framenr); 00064 00065 void BKE_tracking_free_track(struct MovieTrackingTrack *track); 00066 00067 void BKE_tracking_clear_path(struct MovieTrackingTrack *track, int ref_frame, int action); 00068 00069 int BKE_tracking_test_join_tracks(struct MovieTrackingTrack *dst_track, struct MovieTrackingTrack *src_track); 00070 void BKE_tracking_join_tracks(struct MovieTrackingTrack *dst_track, struct MovieTrackingTrack *src_track); 00071 void BKE_tracking_free(struct MovieTracking *tracking); 00072 00073 struct ImBuf *BKE_tracking_get_pattern_imbuf(struct ImBuf *ibuf, struct MovieTrackingTrack *track, 00074 struct MovieTrackingMarker *marker, int margin, int anchored, float pos[2], int origin[2]); 00075 struct ImBuf *BKE_tracking_get_search_imbuf(struct ImBuf *ibuf, struct MovieTrackingTrack *track, 00076 struct MovieTrackingMarker *marker, int margin, int anchored, float pos[2], int origin[2]); 00077 00078 void BKE_track_unique_name(struct ListBase *tracksbase, struct MovieTrackingTrack *track); 00079 00080 struct MovieTrackingTrack *BKE_tracking_named_track(struct MovieTracking *tracking, struct MovieTrackingObject *object, const char *name); 00081 struct MovieTrackingTrack *BKE_tracking_indexed_track(struct MovieTracking *tracking, int tracknr, struct ListBase **tracksbase_r); 00082 00083 void BKE_tracking_camera_shift(struct MovieTracking *tracking, int winx, int winy, float *shiftx, float *shifty); 00084 void BKE_tracking_camera_to_blender(struct MovieTracking *tracking, struct Scene *scene, struct Camera *camera, int width, int height); 00085 00086 void BKE_get_tracking_mat(struct Scene *scene, struct Object *ob, float mat[4][4]); 00087 void BKE_tracking_projection_matrix(struct MovieTracking *tracking, struct MovieTrackingObject *object, 00088 int framenr, int winx, int winy, float mat[4][4]); 00089 00090 struct ListBase *BKE_tracking_get_tracks(struct MovieTracking *tracking); 00091 struct MovieTrackingReconstruction *BKE_tracking_get_reconstruction(struct MovieTracking *tracking); 00092 00093 struct MovieTrackingTrack *BKE_tracking_active_track(struct MovieTracking *tracking); 00094 struct MovieTrackingObject *BKE_tracking_active_object(struct MovieTracking *tracking); 00095 struct MovieTrackingObject *BKE_tracking_get_camera_object(struct MovieTracking *tracking); 00096 struct ListBase *BKE_tracking_object_tracks(struct MovieTracking *tracking, struct MovieTrackingObject *object); 00097 struct MovieTrackingReconstruction *BKE_tracking_object_reconstruction(struct MovieTracking *tracking, 00098 struct MovieTrackingObject *object); 00099 00100 void BKE_tracking_disable_imbuf_channels(struct ImBuf *ibuf, int disable_red, int disable_green, int disable_blue, int grayscale); 00101 00102 /* clipboard */ 00103 void BKE_tracking_free_clipboard(void); 00104 void BKE_tracking_clipboard_copy_tracks(struct MovieTracking *tracking, struct MovieTrackingObject *object); 00105 int BKE_tracking_clipboard_has_tracks(void); 00106 void BKE_tracking_clipboard_paste_tracks(struct MovieTracking *tracking, struct MovieTrackingObject *object); 00107 00108 /* 2D tracking */ 00109 struct MovieTrackingContext *BKE_tracking_context_new(struct MovieClip *clip, struct MovieClipUser *user, 00110 short backwards, short sequence); 00111 void BKE_tracking_context_free(struct MovieTrackingContext *context); 00112 void BKE_tracking_sync(struct MovieTrackingContext *context); 00113 void BKE_tracking_sync_user(struct MovieClipUser *user, struct MovieTrackingContext *context); 00114 int BKE_tracking_next(struct MovieTrackingContext *context); 00115 00116 /* Camera solving */ 00117 int BKE_tracking_can_reconstruct(struct MovieTracking *tracking, struct MovieTrackingObject *object, 00118 char *error_msg, int error_size); 00119 00120 struct MovieReconstructContext* BKE_tracking_reconstruction_context_new(struct MovieTracking *tracking, 00121 struct MovieTrackingObject *object, int keyframe1, int keyframe2, int width, int height); 00122 void BKE_tracking_reconstruction_context_free(struct MovieReconstructContext *context); 00123 void BKE_tracking_solve_reconstruction(struct MovieReconstructContext *context, 00124 short *stop, short *do_update, float *progress, char *stats_message, int message_size); 00125 int BKE_tracking_finish_reconstruction(struct MovieReconstructContext *context, struct MovieTracking *tracking); 00126 00127 struct MovieReconstructedCamera *BKE_tracking_get_reconstructed_camera(struct MovieTracking *tracking, 00128 struct MovieTrackingObject *object, int framenr); 00129 void BKE_tracking_get_interpolated_camera(struct MovieTracking *tracking, 00130 struct MovieTrackingObject *object, int framenr, float mat[4][4]); 00131 00132 /* Feature detection */ 00133 void BKE_tracking_detect_fast(struct MovieTracking *tracking, struct ListBase *tracksbase, struct ImBuf *imbuf, 00134 int framenr, int margin, int min_trackness, int min_distance, struct bGPDlayer *layer, 00135 int place_outside_layer); 00136 00137 /* 2D stabilization */ 00138 void BKE_tracking_stabilization_data(struct MovieTracking *tracking, int framenr, int width, int height, float loc[2], float *scale, float *angle); 00139 struct ImBuf *BKE_tracking_stabilize(struct MovieTracking *tracking, int framenr, struct ImBuf *ibuf, float loc[2], float *scale, float *angle); 00140 void BKE_tracking_stabdata_to_mat4(int width, int height, float loc[2], float scale, float angle, float mat[4][4]); 00141 00142 /* Distortion/Undistortion */ 00143 void BKE_tracking_apply_intrinsics(struct MovieTracking *tracking, float co[2], float nco[2]); 00144 void BKE_tracking_invert_intrinsics(struct MovieTracking *tracking, float co[2], float nco[2]); 00145 00146 struct MovieDistortion *BKE_tracking_distortion_create(void); 00147 struct MovieDistortion *BKE_tracking_distortion_copy(struct MovieDistortion *distortion); 00148 struct ImBuf *BKE_tracking_distortion_exec(struct MovieDistortion *distortion, struct MovieTracking *tracking, 00149 struct ImBuf *ibuf, int width, int height, float overscan, int undistort); 00150 void BKE_tracking_distortion_destroy(struct MovieDistortion *distortion); 00151 00152 struct ImBuf *BKE_tracking_undistort(struct MovieTracking *tracking, struct ImBuf *ibuf, int width, int height, float overscan); 00153 struct ImBuf *BKE_tracking_distort(struct MovieTracking *tracking, struct ImBuf *ibuf, int width, int height, float overscan); 00154 00155 /* Object tracking */ 00156 struct MovieTrackingObject *BKE_tracking_new_object(struct MovieTracking *tracking, const char *name); 00157 void BKE_tracking_remove_object(struct MovieTracking *tracking, struct MovieTrackingObject *object); 00158 void BKE_tracking_object_unique_name(struct MovieTracking *tracking, struct MovieTrackingObject *object); 00159 struct MovieTrackingObject *BKE_tracking_named_object(struct MovieTracking *tracking, const char *name); 00160 00161 /* Select */ 00162 void BKE_tracking_select_track(struct ListBase *tracksbase, struct MovieTrackingTrack *track, int area, int extend); 00163 void BKE_tracking_deselect_track(struct MovieTrackingTrack *track, int area); 00164 00165 #define TRACK_SELECTED(track) ((((track)->flag&TRACK_HIDDEN)==0) && ((track)->flag&SELECT || (track)->pat_flag&SELECT || (track)->search_flag&SELECT)) 00166 #define TRACK_AREA_SELECTED(track, area) ((((track)->flag&TRACK_HIDDEN)==0) && ((area)==TRACK_AREA_POINT?(track)->flag&SELECT : ((area)==TRACK_AREA_PAT?(track)->pat_flag&SELECT:(track)->search_flag&SELECT))) 00167 #define TRACK_VIEW_SELECTED(sc, track) ((TRACK_AREA_SELECTED(track, TRACK_AREA_POINT) || (((sc)->flag&SC_SHOW_MARKER_PATTERN && TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))) || (((sc)->flag&SC_SHOW_MARKER_SEARCH && TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))))) 00168 00169 #define MARKER_VISIBLE(sc, marker) (((marker)->flag&MARKER_DISABLED)==0 || ((sc)->flag&SC_HIDE_DISABLED)==0) 00170 00171 #define TRACK_CLEAR_UPTO 0 00172 #define TRACK_CLEAR_REMAINED 1 00173 #define TRACK_CLEAR_ALL 2 00174 00175 #define CLAMP_PAT_DIM 1 00176 #define CLAMP_PAT_POS 2 00177 #define CLAMP_SEARCH_DIM 3 00178 #define CLAMP_SEARCH_POS 4 00179 #define CLAMP_PYRAMID_LEVELS 5 00180 00181 #define TRACK_AREA_NONE -1 00182 #define TRACK_AREA_POINT 1 00183 #define TRACK_AREA_PAT 2 00184 #define TRACK_AREA_SEARCH 4 00185 00186 #define TRACK_AREA_ALL (TRACK_AREA_POINT|TRACK_AREA_PAT|TRACK_AREA_SEARCH) 00187 00188 #endif