Originally committed to SVN as r41.

This commit is contained in:
tentacle 2006-01-28 21:47:46 +00:00
parent 3d0e91c29b
commit 03ff6a4c83
11 changed files with 63 additions and 6 deletions

Binary file not shown.

Binary file not shown.

View file

@ -72,6 +72,7 @@ public:
FexTrackerConfig Cfg; FexTrackerConfig Cfg;
//work //work
void ProcessImage( float *Img, bool bFirst=0 ); //we assume grayscale image here 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 ); FexTrackingFeature* operator [] ( int i );
inline int GetCount(){ return nFeatures; }; inline int GetCount(){ return nFeatures; };

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -106,6 +106,8 @@ private:
void OnVideoStop(wxCommandEvent &event); void OnVideoStop(wxCommandEvent &event);
void OnVideoToggleScroll(wxCommandEvent &event); void OnVideoToggleScroll(wxCommandEvent &event);
void OnVideoTrackPoints(wxCommandEvent &event); void OnVideoTrackPoints(wxCommandEvent &event);
void OnVideoTrackPointAdd(wxCommandEvent &event);
void OnVideoTrackPointDel(wxCommandEvent &event);
void OnKeyDown(wxKeyEvent &event); void OnKeyDown(wxKeyEvent &event);
@ -323,6 +325,8 @@ enum {
Video_Stop, Video_Stop,
Video_Auto_Scroll, Video_Auto_Scroll,
Video_Track_Points, Video_Track_Points,
Video_Track_Point_Add,
Video_Track_Point_Del,
Menu_File_Recent = 2000, Menu_File_Recent = 2000,
Menu_Video_Recent = 2200, Menu_Video_Recent = 2200,

View file

@ -87,6 +87,8 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame)
EVT_BUTTON(Video_Stop, FrameMain::OnVideoStop) EVT_BUTTON(Video_Stop, FrameMain::OnVideoStop)
EVT_TOGGLEBUTTON(Video_Auto_Scroll, FrameMain::OnVideoToggleScroll) EVT_TOGGLEBUTTON(Video_Auto_Scroll, FrameMain::OnVideoToggleScroll)
EVT_BUTTON(Video_Track_Points, FrameMain::OnVideoTrackPoints) 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) 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 // Choose a different language
void FrameMain::OnChooseLanguage (wxCommandEvent &event) { void FrameMain::OnChooseLanguage (wxCommandEvent &event) {

View file

@ -80,6 +80,8 @@ shift_to_frame_disable BITMAP "bitmaps/shift_to_frame_disable.bmp"
button_play BITMAP "bitmaps/button_play.bmp" button_play BITMAP "bitmaps/button_play.bmp"
button_stop BITMAP "bitmaps/button_stop.bmp" button_stop BITMAP "bitmaps/button_stop.bmp"
button_track_points BITMAP "bitmaps/button_track_points.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_bold BITMAP "bitmaps/button_bold.bmp"
button_italics BITMAP "bitmaps/button_italics.bmp" button_italics BITMAP "bitmaps/button_italics.bmp"

View file

@ -61,6 +61,10 @@ VideoBox::VideoBox(wxPanel *parent) {
AutoScroll->SetValue(Options.AsBool(_T("Sync video with subs"))); 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)); wxBitmapButton *VideoTrackPointsButton = new wxBitmapButton(videoPage,Video_Track_Points,wxBITMAP(button_track_points),wxDefaultPosition,wxSize(25,-1));
VideoTrackPointsButton->SetToolTip(_("Track point movements in video")); 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 // Seek
videoSlider = new VideoSlider(videoPage,-1); videoSlider = new VideoSlider(videoPage,-1);
@ -96,6 +100,8 @@ VideoBox::VideoBox(wxPanel *parent) {
videoBottomSizer->Add(VideoPosition,1,wxLEFT|wxALIGN_CENTER,5); videoBottomSizer->Add(VideoPosition,1,wxLEFT|wxALIGN_CENTER,5);
videoBottomSizer->Add(VideoSubsPos,1,wxALIGN_CENTER,0); videoBottomSizer->Add(VideoSubsPos,1,wxALIGN_CENTER,0);
videoBottomSizer->Add(VideoTrackPointsButton,0,wxTOP|wxBOTTOM|wxALIGN_CENTER,2); 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 = new wxBoxSizer(wxVERTICAL);
VideoSizer->Add(videoDisplay,0,wxEXPAND,0); VideoSizer->Add(videoDisplay,0,wxEXPAND,0);
VideoSizer->Add(videoSliderSizer,0,wxEXPAND,0); VideoSizer->Add(videoSliderSizer,0,wxEXPAND,0);

View file

@ -232,10 +232,29 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
return; return;
} }
if( event.ButtonDown(wxMOUSE_BTN_LEFT) )
bTrackerEditing = 1;
if( event.ButtonUp(wxMOUSE_BTN_LEFT) )
bTrackerEditing = 0;
// Coords // Coords
int x = event.GetX(); int x = event.GetX();
int y = event.GetY(); 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 // Text of current coords
int sw,sh; int sw,sh;
GetScriptSize(sw,sh); GetScriptSize(sw,sh);
@ -272,14 +291,15 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
wxMemoryDC dc; wxMemoryDC dc;
dc.SelectObject(*backbuffer); dc.SelectObject(*backbuffer);
dc.BeginDrawing(); dc.BeginDrawing();
dc.SetPen(wxPen(wxColour(255,255,255),1));
dc.SetLogicalFunction(wxINVERT);
// Draw frame // Draw frame
dc.DrawBitmap(GetFrame(frame_n),0,0); dc.DrawBitmap(GetFrame(frame_n),0,0);
// Draw the control points for FexTracker // Draw the control points for FexTracker
DrawTrackingOverlay( dc ); DrawTrackingOverlay( dc );
dc.SetPen(wxPen(wxColour(255,255,255),1));
dc.SetLogicalFunction(wxINVERT);
// Current position info // Current position info
if (x >= 0 && x < w && y >= 0 && y < h) { if (x >= 0 && x < w && y >= 0 && y < h) {
// Draw cross // Draw cross
@ -333,6 +353,8 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
void VideoDisplay::OnMouseLeave(wxMouseEvent& event) { void VideoDisplay::OnMouseLeave(wxMouseEvent& event) {
if (IsPlaying) return; if (IsPlaying) return;
bTrackerEditing = 0;
RefreshVideo(); RefreshVideo();
} }
@ -545,8 +567,7 @@ void VideoDisplay::DrawTrackingOverlay( wxDC &dc )
int localframe = frame_n - StartFrame; int localframe = frame_n - StartFrame;
if( curline->Tracker->GetFrame() <= localframe ) return; if( curline->Tracker->GetFrame() <= localframe ) return;
dc.SetPen(wxPen(wxColour(255,255,255),1)); dc.SetLogicalFunction(wxCOPY);
dc.SetLogicalFunction(wxINVERT);
for( int i=0;i<curline->Tracker->GetCount();i++ ) for( int i=0;i<curline->Tracker->GetCount();i++ )
{ {
@ -559,8 +580,13 @@ void VideoDisplay::DrawTrackingOverlay( wxDC &dc )
pt.y *= provider->GetZoom(); pt.y *= provider->GetZoom();
pt.x = int(pt.x); pt.x = int(pt.x);
pt.y = int(pt.y); 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 );
} }
} }

View file

@ -104,6 +104,8 @@ public:
bool loaded; bool loaded;
bool IsPlaying; bool IsPlaying;
double fps; double fps;
double TrackerEdit;
bool bTrackerEditing;
VideoSlider *ControlSlider; VideoSlider *ControlSlider;
wxComboBox *zoomBox; wxComboBox *zoomBox;
wxTextCtrl *PositionDisplay; wxTextCtrl *PositionDisplay;