@ -260,17 +260,13 @@ kb::viz2d::Viz2DWindow* menuWindow;
void setup_gui ( cv : : Ptr < kb : : viz2d : : Viz2D > v2d , cv : : Ptr < kb : : viz2d : : Viz2D > v2dMenu ) {
v2d - > makeCurrent ( ) ;
effectWindow = new kb : : viz2d : : Viz2DWindow ( v2d , 5 , 30 , " Effects " ) ;
v2d - > form ( ) - > set_window ( effectWindow ) ;
effectWindow = v2d - > makeWindow ( 5 , 30 , " Effects " ) ;
v2d - > makeGroup ( " Foreground " ) ;
v2d - > makeFormVariable ( " Scale " , fg_scale , 0.1f , 4.0f , true , " " , " Generate the foreground at this scale " ) ;
v2d - > makeFormVariable ( " Loss " , fg_loss , 0.1f , 99.9f , true , " % " , " On every frame the foreground loses on brightness " ) ;
v2d - > makeGroup ( " Background " ) ;
v2d - > form ( ) - > add_variable ( " Mode " , background_mode , true ) - > set_items ( { " Grey " , " Color " , " Value " , " None " } ) ;
v2d - > makeComboBox ( " Mode " , background_mode , { " Grey " , " Color " , " Value " , " None " } ) ;
v2d - > makeGroup ( " Points " ) ;
v2d - > makeFormVariable ( " Max. Points " , max_points , 10 , 1000000 , true , " " , " The theoretical maximum number of points to track which is scaled by the density of detected points and therefor is usually much smaller " ) ;
v2d - > makeFormVariable ( " Point Loss " , point_loss , 0.0f , 100.0f , true , " % " , " How many of the tracked points to lose intentionally " ) ;
@ -278,9 +274,7 @@ void setup_gui(cv::Ptr<kb::viz2d::Viz2D> v2d, cv::Ptr<kb::viz2d::Viz2D> v2dMenu)
v2d - > makeGroup ( " Optical flow " ) ;
v2d - > makeFormVariable ( " Max. Stroke Size " , max_stroke , 1 , 100 , true , " px " , " The theoretical maximum size of the drawing stroke which is scaled by the area of the convex hull of tracked points and therefor is usually much smaller " ) ;
auto * color = v2d - > form ( ) - > add_variable ( " Color " , effect_color ) ;
color - > set_tooltip ( " The primary effect color " ) ;
color - > set_final_callback ( [ ] ( const nanogui : : Color & c ) {
v2d - > makeColorPicker ( " Color " , effect_color , " The primary effect color " , [ ] ( const nanogui : : Color & c ) {
effect_color [ 0 ] = c [ 0 ] ;
effect_color [ 1 ] = c [ 1 ] ;
effect_color [ 2 ] = c [ 2 ] ;
@ -293,10 +287,8 @@ void setup_gui(cv::Ptr<kb::viz2d::Viz2D> v2d, cv::Ptr<kb::viz2d::Viz2D> v2dMenu)
kernel_size = std : : max ( int ( k % 2 = = 0 ? k + 1 : k ) , 1 ) ;
} ) ;
auto * thresh = v2d - > makeFormVariable ( " Threshold " , bloom_thresh , 1 , 255 , true , " " , " The lightness selection threshold " ) ;
auto * gain = v2d - > makeFormVariable ( " Gain " , bloom_gain , 0.1f , 20.0f , true , " " , " Intensity of the effect defined by gain " ) ;
thresh - > set_enabled ( false ) ;
gain - > set_enabled ( false ) ;
auto * thresh = v2d - > makeFormVariable ( " Threshold " , bloom_thresh , 1 , 255 , true , " " , " The lightness selection threshold " , true , false ) ;
auto * gain = v2d - > makeFormVariable ( " Gain " , bloom_gain , 0.1f , 20.0f , true , " " , " Intensity of the effect defined by gain " , true , false ) ;
enableBloom - > set_callback ( [ & , thresh , gain ] ( const bool & b ) {
if ( b ) {
thresh - > set_enabled ( true ) ;
@ -307,9 +299,8 @@ void setup_gui(cv::Ptr<kb::viz2d::Viz2D> v2d, cv::Ptr<kb::viz2d::Viz2D> v2dMenu)
}
use_bloom = b ;
} ) ;
settingsWindow = new kb : : viz2d : : Viz2DWindow ( v2d , 220 , 320 , " Settings " ) ;
v2d - > form ( ) - > set_window ( settingsWindow ) ;
settingsWindow = v2d - > makeWindow ( 220 , 320 , " Settings " ) ;
v2d - > makeGroup ( " Hardware Acceleration " ) ;
v2d - > makeFormVariable ( " Enable " , use_acceleration , " Enable or disable libva and OpenCL acceleration " ) ;
@ -317,22 +308,19 @@ void setup_gui(cv::Ptr<kb::viz2d::Viz2D> v2d, cv::Ptr<kb::viz2d::Viz2D> v2dMenu)
v2d - > makeFormVariable ( " Threshold " , scene_change_thresh , 0.1f , 1.0f , true , " " , " Peak threshold. Lowering it makes detection more sensitive " ) ;
v2d - > makeFormVariable ( " Threshold Diff " , scene_change_thresh_diff , 0.1f , 1.0f , true , " " , " Difference of peak thresholds. Lowering it makes detection more sensitive " ) ;
v2dMenu - > makeCurrent ( ) ;
menuWindow = new kb : : viz2d : : Viz2DWindow ( v2dMenu , 0 , 0 , " Display " ) ;
v2dMenu - > form ( ) - > set_window ( menuWindow ) ;
menuWindow = v2dMenu - > makeWindow ( 0 , 0 , " Display " ) ;
v2dMenu - > makeGroup ( " Display " ) ;
v2dMenu - > makeFormVariable ( " Show FPS " , show_fps , " Enable or disable the On-screen FPS display " ) ;
v2dMenu - > makeFormVariable ( " Stetch " , stretch , " Stretch the frame buffer to the window size " ) - > set_callback ( [ = ] ( const bool & s ) {
v2dMenu - > makeFormVariable ( " Stetch " , stretch , " Stretch the frame buffer to the window size " ) - > set_callback ( [ = ] ( const bool & s ) {
v2d - > setStretching ( s ) ;
} ) ;
v2dMenu - > form ( ) - > add_b utton( " Fullscreen " , [ = ] ( ) {
v2dMenu - > makeB utton( " Fullscreen " , [ = ] ( ) {
v2d - > setFullscreen ( ! v2d - > isFullscreen ( ) ) ;
} ) ;
v2dMenu - > form ( ) - > add_b utton( " Offscreen " , [ = ] ( ) {
v2d - > setOffscreen ( ! v2d - > isOffscreen ( ) ) ;
v2dMenu - > makeB utton( " Offscreen " , [ = ] ( ) {
v2d - > setOffscreen ( ! v2d - > isOffscreen ( ) ) ;
} ) ;
menuWindow - > center ( ) ;