Camera tracking integration
=========================== - 32 bit linux compilation should be fixed now. - Camrea reconstruction data should be better now when there's no reconstructed cameras. - Implemented "Set Origin" operator - Added "Specials" W-key menu for SpaceClip. Supports such operators: * Enable track * Disable track * Set origin
This commit is contained in:
125
extern/libmv/ChangeLog
vendored
125
extern/libmv/ChangeLog
vendored
@@ -1,9 +1,59 @@
|
||||
commit 86356bd988b1b937082d56330f18a20e4cb26c19
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Fri Jul 8 10:19:30 2011 +0200
|
||||
|
||||
add QCompleter with QFileSystemModel to choose source image folder easily.
|
||||
|
||||
commit 209983a5e74c8b328d22d17668b3ad20d6e87f7a
|
||||
Merge: 0396ccf 7bef9ca
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Fri Jul 8 10:17:05 2011 +0200
|
||||
|
||||
Merge branch 'master' of git://github.com/libmv/libmv
|
||||
|
||||
commit 0396ccf81dee87c3e7a06aa15f05bcaad8dd6ac3
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Thu Jul 7 18:35:12 2011 +0200
|
||||
|
||||
calibration: Compute intrinsincs, undistort image and corners, output custom XML file.
|
||||
|
||||
commit 540a48b1e9f9d4e28fe6b1ef56decf1b29b4811f
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Thu Jul 7 11:18:25 2011 +0200
|
||||
|
||||
Detect calibration checkerboard using OpenCV Calib3D.
|
||||
|
||||
commit d8113dbac2f2156cdfebb5070102f29c26ba9776
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Wed Jul 6 22:36:12 2011 +0200
|
||||
|
||||
Initial implementation of OpenCV Qt Calibration Tool
|
||||
|
||||
commit dae6fae16ec4abbaa9826f944c6ae16cc17ba051
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Wed Jul 6 16:01:41 2011 +0200
|
||||
|
||||
Fix build.
|
||||
|
||||
commit 8cdf7aa54f16bf4fb0f0f824c7b5874373831019
|
||||
Merge: b8d02b5 df1d54e
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Tue Jul 5 09:51:01 2011 +0200
|
||||
|
||||
Merge branch 'master' of git://github.com/keir/libmv
|
||||
|
||||
commit df1d54efd23530891851d3573a5126094acea840
|
||||
Author: Keir Mierle <mierle@gmail.com>
|
||||
Date: Mon Jul 4 13:12:53 2011 -0700
|
||||
|
||||
Fix include ordering.
|
||||
|
||||
commit b8d02b551bca95f4a228a85188f12078cc3bd2f4
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Mon Jul 4 16:34:04 2011 +0200
|
||||
|
||||
Remove momentum in scene view.
|
||||
|
||||
commit 67433907db5537a2e32893ef558c63ab336f59c1
|
||||
Merge: 0049521 b027af4
|
||||
Author: Keir Mierle <mierle@gmail.com>
|
||||
@@ -222,6 +272,24 @@ Date: Tue Jun 21 10:35:51 2011 -0700
|
||||
|
||||
Rework multiview.h doxygen comments.
|
||||
|
||||
commit 7bef9cac601f4407eab576906442dba70396ed89
|
||||
Merge: 7a996a2 56f49b5
|
||||
Author: Keir Mierle <mierle@gmail.com>
|
||||
Date: Tue Jun 21 10:04:20 2011 -0700
|
||||
|
||||
Merge pull request #5 from nathanwiegand/master
|
||||
|
||||
Howdy, Keir.
|
||||
|
||||
commit 7a996a2f8153eed6c6ae784b5a17aee59c65d45f
|
||||
Merge: 1b20b39 7aceb96
|
||||
Author: Keir Mierle <mierle@gmail.com>
|
||||
Date: Tue Jun 21 10:03:01 2011 -0700
|
||||
|
||||
Merge pull request #7 from JulienMichot/master
|
||||
|
||||
Fixed issue 26: Error 'REG_RIP' was not declared in this scope
|
||||
|
||||
commit fb1c93590a67ba95d550f351c1d297699cdceffb
|
||||
Author: Keir Mierle <mierle@gmail.com>
|
||||
Date: Tue Jun 21 09:26:17 2011 -0700
|
||||
@@ -389,6 +457,12 @@ Date: Wed Jun 15 21:58:35 2011 +0200
|
||||
|
||||
This new implementation now display all selected markers.
|
||||
|
||||
commit 7aceb964db6843fcf91bf641adde0646817db305
|
||||
Author: Julien Michot <julien.michot.fr@gmail.com>
|
||||
Date: Wed Jun 15 21:51:04 2011 +0200
|
||||
|
||||
Fixed issue 26.
|
||||
|
||||
commit 9e339a46668e4a8d2330598a66ee855e5cd26f9c
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Wed Jun 15 19:23:21 2011 +0200
|
||||
@@ -673,54 +747,3 @@ Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Wed Jun 8 11:17:47 2011 +0200
|
||||
|
||||
fix Google cosmetics, fix seek slider
|
||||
|
||||
commit e3504fb4b90ef20360f31e11f87967c49eaf73c0
|
||||
Author: Keir Mierle <mierle@gmail.com>
|
||||
Date: Wed Jun 8 00:53:33 2011 -0700
|
||||
|
||||
Add a way to remove the markers for a track from the tracks object.
|
||||
|
||||
commit bcc09c55dd5f3dfd07f60c24bfb932c2973859a5
|
||||
Author: Keir Mierle <mierle@gmail.com>
|
||||
Date: Wed Jun 8 00:04:50 2011 -0700
|
||||
|
||||
Fix various bugs in qt-tracker, and restore style.
|
||||
|
||||
This fixes the track showing and hiding which was broken in the previous
|
||||
version. This also restores libmv style to the file.
|
||||
|
||||
commit 9b3dee7a90419b6995050f87196195b808071a5f
|
||||
Author: Keir Mierle <mierle@gmail.com>
|
||||
Date: Wed Jun 8 00:04:36 2011 -0700
|
||||
|
||||
Formatting in tracks.h.
|
||||
|
||||
commit c9bc9ca74cedc1705165ae10106fdbc792e2d31c
|
||||
Author: Keir Mierle <mierle@gmail.com>
|
||||
Date: Wed Jun 8 00:04:10 2011 -0700
|
||||
|
||||
Relax constraints when downsampling by 2.
|
||||
|
||||
commit 316481f3e42a15143ef52d8f742d85171b4337d5
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Wed Jun 8 00:57:58 2011 +0200
|
||||
|
||||
Better API names, Support track editing (i.e move markers), Usability improvements.
|
||||
|
||||
commit bf01ecfa93afe348a79af6dc04a8b0dfe0720257
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Tue Jun 7 21:22:06 2011 +0200
|
||||
|
||||
Optimize for large reconstructions (i.e many tracks) with relatively few visible tracks per frame.
|
||||
|
||||
Concretely, this means intersecting visible sets instead of indexing an array of Track x Frame.
|
||||
|
||||
commit 324ca444a8baa41e5c7e3228564681044116ce92
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Tue Jun 7 20:29:24 2011 +0200
|
||||
|
||||
Implement TrackItem selections and zoom view.
|
||||
|
||||
Make selections behave correctly (introduce TrackItem which stay selected on frame changes).
|
||||
Add a dock widget which will hold details on the currently selected marker.
|
||||
Add a View to the detail dock which stay zoomed on the current selection.
|
||||
|
||||
3
extern/libmv/bundle.sh
vendored
3
extern/libmv/bundle.sh
vendored
@@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
BRANCH="keir"
|
||||
#BRANCH="keir"
|
||||
BRANCH="Matthias-Fauconneau"
|
||||
|
||||
repo="git://github.com/${BRANCH}/libmv.git"
|
||||
tmp=`mktemp -d`
|
||||
|
||||
3
extern/libmv/libmv/base/vector.h
vendored
3
extern/libmv/libmv/base/vector.h
vendored
@@ -39,6 +39,9 @@ namespace libmv {
|
||||
// - doesn't support iterators.
|
||||
// - impede compatibility with code using STL.
|
||||
// - the STL already provide support for custom allocators
|
||||
// it could be replaced with a simple
|
||||
// template <T> class vector : std::vector<T, aligned_allocator> {} declaration
|
||||
// provided it doesn't break code relying on libmv::vector specific behavior
|
||||
template <typename T,
|
||||
typename Allocator = Eigen::aligned_allocator<T> >
|
||||
class vector {
|
||||
|
||||
@@ -131,7 +131,11 @@
|
||||
#define PACKAGE_VERSION "0.3.1"
|
||||
|
||||
/* How to access the PC from a struct ucontext */
|
||||
#define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP]
|
||||
#if defined(_M_X64) || defined(__amd64__)
|
||||
#define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP]
|
||||
#else
|
||||
#define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_EIP]
|
||||
#endif
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
|
||||
@@ -124,6 +124,7 @@ class CLIP_PT_tools(bpy.types.Panel):
|
||||
col.label(text="Reconstruction:")
|
||||
col.operator("clip.solve_camera")
|
||||
col.operator("clip.clear_reconstruction")
|
||||
col.operator("clip.set_origin")
|
||||
else:
|
||||
layout.operator('clip.open')
|
||||
|
||||
@@ -371,5 +372,19 @@ class CLIP_MT_select(bpy.types.Menu):
|
||||
layout.operator("clip.select_all", text="Select/Deselect all")
|
||||
layout.operator("clip.select_all", text="Inverse").action = 'INVERT'
|
||||
|
||||
class CLIP_MT_tracking_specials(bpy.types.Menu):
|
||||
bl_label = "Specials"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.space_data.clip
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("clip.disable_markers", text="Enable Markers").action = 'ENABLE'
|
||||
layout.operator("clip.disable_markers", text="Disable markers").action = 'DISABLE'
|
||||
layout.operator("clip.set_origin")
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
@@ -750,6 +750,7 @@ static void retrive_libmv_reconstruct(MovieClip *clip, struct libmv_Reconstructi
|
||||
MEM_freeN(camera->reconstructed);
|
||||
|
||||
camera->reconnr= 0;
|
||||
camera->reconstructed= NULL;
|
||||
reconstructed= MEM_callocN((efra-sfra+1)*sizeof(MovieReconstructedCamera), "temp reconstructed camera");
|
||||
|
||||
for(a= sfra; a<=efra; a++) {
|
||||
@@ -764,8 +765,10 @@ static void retrive_libmv_reconstruct(MovieClip *clip, struct libmv_Reconstructi
|
||||
}
|
||||
}
|
||||
|
||||
camera->reconstructed= MEM_callocN(camera->reconnr*sizeof(MovieReconstructedCamera), "reconstructed camera");
|
||||
memcpy(camera->reconstructed, reconstructed, camera->reconnr*sizeof(MovieReconstructedCamera));
|
||||
if(camera->reconnr) {
|
||||
camera->reconstructed= MEM_callocN(camera->reconnr*sizeof(MovieReconstructedCamera), "reconstructed camera");
|
||||
memcpy(camera->reconstructed, reconstructed, camera->reconnr*sizeof(MovieReconstructedCamera));
|
||||
}
|
||||
|
||||
MEM_freeN(reconstructed);
|
||||
}
|
||||
|
||||
@@ -73,6 +73,9 @@ void CLIP_OT_clear_reconstruction(struct wmOperatorType *ot);
|
||||
|
||||
void CLIP_OT_clear_track_path(struct wmOperatorType *ot);
|
||||
|
||||
void CLIP_OT_disable_markers(struct wmOperatorType *ot);
|
||||
void CLIP_OT_set_origin(struct wmOperatorType *ot);
|
||||
|
||||
void CLIP_OT_track_to_fcurves(struct wmOperatorType *ot);
|
||||
|
||||
/* clip_draw.c */
|
||||
|
||||
@@ -212,6 +212,9 @@ static void clip_operatortypes(void)
|
||||
WM_operatortype_append(CLIP_OT_solve_camera);
|
||||
WM_operatortype_append(CLIP_OT_clear_reconstruction);
|
||||
|
||||
WM_operatortype_append(CLIP_OT_disable_markers);
|
||||
WM_operatortype_append(CLIP_OT_set_origin);
|
||||
|
||||
WM_operatortype_append(CLIP_OT_clear_track_path);
|
||||
|
||||
WM_operatortype_append(CLIP_OT_track_to_fcurves);
|
||||
@@ -287,6 +290,8 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
|
||||
kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0);
|
||||
RNA_string_set(kmi->ptr, "data_path", "space_data.lock_selection");
|
||||
|
||||
WM_keymap_add_menu(keymap, "CLIP_MT_tracking_specials", WKEY, KM_PRESS, 0, 0);
|
||||
|
||||
transform_keymap_for_space(keyconf, keymap, SPACE_CLIP);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,28 @@ static int space_clip_frame_poll(bContext *C)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int space_clip_frame_act_bundle_poll(bContext *C)
|
||||
{
|
||||
SpaceClip *sc= CTX_wm_space_clip(C);
|
||||
|
||||
if(sc) {
|
||||
MovieClip *clip= ED_space_clip(sc);
|
||||
|
||||
if(clip) {
|
||||
if (BKE_movieclip_has_frame(clip, &sc->user)) {
|
||||
int sel_type;
|
||||
MovieTrackingTrack *sel;
|
||||
BKE_movieclip_last_selection(clip, &sel_type, (void**)&sel);
|
||||
|
||||
if(sel_type == MCLIP_SEL_TRACK)
|
||||
return sel->flag&TRACK_HAS_BUNDLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/********************** add marker operator *********************/
|
||||
|
||||
static void add_marker(SpaceClip *sc, float x, float y)
|
||||
@@ -933,7 +955,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
static int track_marekrs_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
|
||||
static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
|
||||
{
|
||||
/* no running blender, remove handler and pass through */
|
||||
if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
|
||||
@@ -960,7 +982,7 @@ void CLIP_OT_track_markers(wmOperatorType *ot)
|
||||
ot->exec= track_markers_exec;
|
||||
ot->invoke= track_markers_invoke;
|
||||
ot->poll= space_clip_frame_poll;
|
||||
ot->modal= track_marekrs_modal;
|
||||
ot->modal= track_markers_modal;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
@@ -1111,6 +1133,114 @@ void CLIP_OT_clear_track_path(wmOperatorType *ot)
|
||||
|
||||
}
|
||||
|
||||
/********************** disable markers operator *********************/
|
||||
|
||||
static int disable_markers_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceClip *sc= CTX_wm_space_clip(C);
|
||||
MovieClip *clip= ED_space_clip(sc);
|
||||
MovieTracking *tracking= &clip->tracking;
|
||||
MovieTrackingTrack *track= tracking->tracks.first;
|
||||
int action= RNA_enum_get(op->ptr, "action");
|
||||
|
||||
while(track) {
|
||||
if(TRACK_SELECTED(track)) {
|
||||
MovieTrackingMarker *marker= BKE_tracking_exact_marker(track, sc->user.framenr);
|
||||
|
||||
if(action==0) marker->flag|= MARKER_DISABLED;
|
||||
else if(action==1) marker->flag&= ~MARKER_DISABLED;
|
||||
else marker->flag^= MARKER_DISABLED;
|
||||
}
|
||||
|
||||
track= track->next;
|
||||
}
|
||||
|
||||
DAG_id_tag_update(&clip->id, 0);
|
||||
|
||||
WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void CLIP_OT_disable_markers(wmOperatorType *ot)
|
||||
{
|
||||
static EnumPropertyItem actions_items[] = {
|
||||
{0, "DISABLE", 0, "Disable", "Disable selected markers"},
|
||||
{1, "ENABLE", 0, "Enable", "Enable selected markers"},
|
||||
{2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "Disable Markers";
|
||||
ot->description= "Disable/enable selected markers";
|
||||
ot->idname= "CLIP_OT_disable_markers";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= disable_markers_exec;
|
||||
ot->poll= space_clip_frame_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Disable action to execute");
|
||||
}
|
||||
|
||||
/********************** set origin operator *********************/
|
||||
|
||||
static int set_origin_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
SpaceClip *sc= CTX_wm_space_clip(C);
|
||||
MovieClip *clip= ED_space_clip(sc);
|
||||
MovieTracking *tracking= &clip->tracking;
|
||||
MovieTrackingTrack *track= tracking->tracks.first;
|
||||
MovieTrackingTrack *sel;
|
||||
MovieTrackingCamera *camera= &clip->tracking.camera;
|
||||
MovieReconstructedCamera *cur= camera->reconstructed;
|
||||
int a, sel_type;
|
||||
float origin[3];
|
||||
|
||||
BKE_movieclip_last_selection(clip, &sel_type, (void**)&sel);
|
||||
copy_v3_v3(origin, sel->bundle_pos);
|
||||
|
||||
/* translate bundkes */
|
||||
while(track) {
|
||||
sub_v3_v3(track->bundle_pos, origin);
|
||||
|
||||
track= track->next;
|
||||
}
|
||||
|
||||
/* translate cameras */
|
||||
for(a= 0; a<camera->reconnr; a++, cur++) {
|
||||
cur->mat[3][0]-= origin[0];
|
||||
cur->mat[3][1]-= origin[1];
|
||||
cur->mat[3][2]-= origin[2];
|
||||
}
|
||||
|
||||
DAG_id_tag_update(&clip->id, 0);
|
||||
|
||||
WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
|
||||
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void CLIP_OT_set_origin(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Set Origin";
|
||||
ot->description= "Set active marker as origin";
|
||||
ot->idname= "CLIP_OT_set_origin";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= set_origin_exec;
|
||||
ot->poll= space_clip_frame_act_bundle_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/********************** track to fcurves opertaotr *********************/
|
||||
|
||||
static int track_to_fcurves_poll(bContext *C)
|
||||
|
||||
Reference in New Issue
Block a user