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;
//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; };

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 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,

View File

@ -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) {

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_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"

View File

@ -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);

View File

@ -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;i<curline->Tracker->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 );
}
}

View File

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