diff --git a/FexTracker/FexTrackerRel.lib b/FexTracker/FexTrackerRel.lib index 17dbb531e..a998d6474 100644 Binary files a/FexTracker/FexTrackerRel.lib and b/FexTracker/FexTrackerRel.lib differ diff --git a/FexTracker/FexTrackerRel_Opti.lib b/FexTracker/FexTrackerRel_Opti.lib index 910ca934b..c38209731 100644 Binary files a/FexTracker/FexTrackerRel_Opti.lib and b/FexTracker/FexTrackerRel_Opti.lib differ diff --git a/core/FexTracker.h b/core/FexTracker.h index 681f22057..2af2f9d57 100644 --- a/core/FexTracker.h +++ b/core/FexTracker.h @@ -72,6 +72,7 @@ public: FexTrackerConfig Cfg; //work void ProcessImage( float *Img, bool bFirst=0 ); //we assume grayscale image here + void InfluenceFeatures( int Frame, float x, float y, float off ); FexTrackingFeature* operator [] ( int i ); inline int GetCount(){ return nFeatures; }; diff --git a/core/bitmaps/button_track_point_add.bmp b/core/bitmaps/button_track_point_add.bmp new file mode 100644 index 000000000..9feacbf62 Binary files /dev/null and b/core/bitmaps/button_track_point_add.bmp differ diff --git a/core/bitmaps/button_track_point_del.bmp b/core/bitmaps/button_track_point_del.bmp new file mode 100644 index 000000000..4757fa4c6 Binary files /dev/null and b/core/bitmaps/button_track_point_del.bmp differ diff --git a/core/frame_main.h b/core/frame_main.h index d79e2bfd9..01715bb1c 100644 --- a/core/frame_main.h +++ b/core/frame_main.h @@ -106,6 +106,8 @@ private: void OnVideoStop(wxCommandEvent &event); void OnVideoToggleScroll(wxCommandEvent &event); void OnVideoTrackPoints(wxCommandEvent &event); + void OnVideoTrackPointAdd(wxCommandEvent &event); + void OnVideoTrackPointDel(wxCommandEvent &event); void OnKeyDown(wxKeyEvent &event); @@ -323,6 +325,8 @@ enum { Video_Stop, Video_Auto_Scroll, Video_Track_Points, + Video_Track_Point_Add, + Video_Track_Point_Del, Menu_File_Recent = 2000, Menu_Video_Recent = 2200, diff --git a/core/frame_main_events.cpp b/core/frame_main_events.cpp index 90a0e8937..51dfe72c2 100644 --- a/core/frame_main_events.cpp +++ b/core/frame_main_events.cpp @@ -87,6 +87,8 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame) EVT_BUTTON(Video_Stop, FrameMain::OnVideoStop) EVT_TOGGLEBUTTON(Video_Auto_Scroll, FrameMain::OnVideoToggleScroll) EVT_BUTTON(Video_Track_Points, FrameMain::OnVideoTrackPoints) + EVT_BUTTON(Video_Track_Point_Add, FrameMain::OnVideoTrackPointAdd) + EVT_BUTTON(Video_Track_Point_Del, FrameMain::OnVideoTrackPointDel) EVT_CLOSE(FrameMain::OnCloseWindow) @@ -1168,6 +1170,20 @@ void FrameMain::OnVideoTrackPoints(wxCommandEvent &event) { } +/////////////////// +// Increase Influence +void FrameMain::OnVideoTrackPointAdd(wxCommandEvent &event) { + videoBox->videoDisplay->TrackerEdit = 1; +} + + +/////////////////// +// Decrease Influence +void FrameMain::OnVideoTrackPointDel(wxCommandEvent &event) { + videoBox->videoDisplay->TrackerEdit = -1; +} + + /////////////////////////////// // Choose a different language void FrameMain::OnChooseLanguage (wxCommandEvent &event) { diff --git a/core/res.rc b/core/res.rc index 9817a1287..d618c2011 100644 --- a/core/res.rc +++ b/core/res.rc @@ -80,6 +80,8 @@ shift_to_frame_disable BITMAP "bitmaps/shift_to_frame_disable.bmp" button_play BITMAP "bitmaps/button_play.bmp" button_stop BITMAP "bitmaps/button_stop.bmp" button_track_points BITMAP "bitmaps/button_track_points.bmp" +button_track_point_add BITMAP "bitmaps/button_track_point_add.bmp" +button_track_point_del BITMAP "bitmaps/button_track_point_del.bmp" button_bold BITMAP "bitmaps/button_bold.bmp" button_italics BITMAP "bitmaps/button_italics.bmp" diff --git a/core/video_box.cpp b/core/video_box.cpp index 3fab70338..a1ea01200 100644 --- a/core/video_box.cpp +++ b/core/video_box.cpp @@ -61,6 +61,10 @@ VideoBox::VideoBox(wxPanel *parent) { AutoScroll->SetValue(Options.AsBool(_T("Sync video with subs"))); wxBitmapButton *VideoTrackPointsButton = new wxBitmapButton(videoPage,Video_Track_Points,wxBITMAP(button_track_points),wxDefaultPosition,wxSize(25,-1)); VideoTrackPointsButton->SetToolTip(_("Track point movements in video")); + wxBitmapButton *VideoTrackPointAddButton = new wxBitmapButton(videoPage,Video_Track_Point_Add,wxBITMAP(button_track_point_add),wxDefaultPosition,wxSize(25,-1)); + VideoTrackPointAddButton->SetToolTip(_("Increase influence of tracking points")); + wxBitmapButton *VideoTrackPointDelButton = new wxBitmapButton(videoPage,Video_Track_Point_Del,wxBITMAP(button_track_point_del),wxDefaultPosition,wxSize(25,-1)); + VideoTrackPointDelButton->SetToolTip(_("Decrease influence of tracking points")); // Seek videoSlider = new VideoSlider(videoPage,-1); @@ -96,6 +100,8 @@ VideoBox::VideoBox(wxPanel *parent) { videoBottomSizer->Add(VideoPosition,1,wxLEFT|wxALIGN_CENTER,5); videoBottomSizer->Add(VideoSubsPos,1,wxALIGN_CENTER,0); videoBottomSizer->Add(VideoTrackPointsButton,0,wxTOP|wxBOTTOM|wxALIGN_CENTER,2); + videoBottomSizer->Add(VideoTrackPointAddButton,0,wxTOP|wxBOTTOM|wxALIGN_CENTER,2); + videoBottomSizer->Add(VideoTrackPointDelButton,0,wxTOP|wxBOTTOM|wxALIGN_CENTER,2); VideoSizer = new wxBoxSizer(wxVERTICAL); VideoSizer->Add(videoDisplay,0,wxEXPAND,0); VideoSizer->Add(videoSliderSizer,0,wxEXPAND,0); diff --git a/core/video_display.cpp b/core/video_display.cpp index e3c1b3cc7..a6b7fc6c2 100644 --- a/core/video_display.cpp +++ b/core/video_display.cpp @@ -232,10 +232,29 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) { return; } + if( event.ButtonDown(wxMOUSE_BTN_LEFT) ) + bTrackerEditing = 1; + if( event.ButtonUp(wxMOUSE_BTN_LEFT) ) + bTrackerEditing = 0; + // Coords int x = event.GetX(); int y = event.GetY(); + // Do tracker influence if needed + if( bTrackerEditing ) + { + AssDialogue *curline = grid->GetDialogue(grid->editBox->linen); + int StartFrame, EndFrame, localframe; + if( curline + && curline->Tracker + && (StartFrame = VFR_Output.CorrectFrameAtTime(curline->Start.GetMS(),true)) <= frame_n + && (EndFrame = VFR_Output.CorrectFrameAtTime(curline->End.GetMS(),false)) >= frame_n + && (localframe = frame_n - StartFrame) < curline->Tracker->GetFrame() + ) + curline->Tracker->InfluenceFeatures( localframe, float(x)/provider->GetZoom(), float(y)/provider->GetZoom(), TrackerEdit ); + } + // Text of current coords int sw,sh; GetScriptSize(sw,sh); @@ -272,14 +291,15 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) { wxMemoryDC dc; dc.SelectObject(*backbuffer); dc.BeginDrawing(); - dc.SetPen(wxPen(wxColour(255,255,255),1)); - dc.SetLogicalFunction(wxINVERT); // Draw frame dc.DrawBitmap(GetFrame(frame_n),0,0); // Draw the control points for FexTracker DrawTrackingOverlay( dc ); + dc.SetPen(wxPen(wxColour(255,255,255),1)); + dc.SetLogicalFunction(wxINVERT); + // Current position info if (x >= 0 && x < w && y >= 0 && y < h) { // Draw cross @@ -333,6 +353,8 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) { void VideoDisplay::OnMouseLeave(wxMouseEvent& event) { if (IsPlaying) return; + bTrackerEditing = 0; + RefreshVideo(); } @@ -545,8 +567,7 @@ void VideoDisplay::DrawTrackingOverlay( wxDC &dc ) int localframe = frame_n - StartFrame; if( curline->Tracker->GetFrame() <= localframe ) return; - dc.SetPen(wxPen(wxColour(255,255,255),1)); - dc.SetLogicalFunction(wxINVERT); + dc.SetLogicalFunction(wxCOPY); for( int i=0;iTracker->GetCount();i++ ) { @@ -559,8 +580,13 @@ void VideoDisplay::DrawTrackingOverlay( wxDC &dc ) pt.y *= provider->GetZoom(); pt.x = int(pt.x); pt.y = int(pt.y); - dc.DrawLine( pt.x-2, pt.y, pt.x+3, pt.y ); - dc.DrawLine( pt.x, pt.y-2, pt.x, pt.y+3 ); + + dc.SetPen(wxPen(wxColour(255*(1-f->Influence),255*f->Influence,0),1)); + + dc.DrawLine( pt.x-2, pt.y, pt.x, pt.y ); + dc.DrawLine( pt.x, pt.y-2, pt.x, pt.y ); + dc.DrawLine( pt.x+1, pt.y, pt.x+3, pt.y ); + dc.DrawLine( pt.x, pt.y+1, pt.x, pt.y+3 ); } } diff --git a/core/video_display.h b/core/video_display.h index 51d645077..68e44c910 100644 --- a/core/video_display.h +++ b/core/video_display.h @@ -104,6 +104,8 @@ public: bool loaded; bool IsPlaying; double fps; + double TrackerEdit; + bool bTrackerEditing; VideoSlider *ControlSlider; wxComboBox *zoomBox; wxTextCtrl *PositionDisplay;