Example #1
0
/**
 * Integrate the SDDE model forward for a given period.
 * \param[in]  length   Duration of the integration.
 * \param[in]  Spinup   Initial integration period to remove.
 * \param[in]  sampling Time step at which to save states.
 * \return              Matrix to record the states.
 */
gsl_matrix *
modelSDDE::integrateForward(const double length, const double spinup,
			const size_t sampling)
{
  size_t nt = length / scheme->getTimeStep();
  size_t ntSpinup = spinup / scheme->getTimeStep();
  gsl_matrix *data = gsl_matrix_alloc((size_t) ((nt - ntSpinup) / sampling), dim);
  gsl_vector_view presentState;

  // Get spinup
  for (size_t i = 1; i <= ntSpinup; i++)
    {
      // Integrate one step forward
      stepForward();
    }
  
  // Get record
  for (size_t i = ntSpinup+1; i <= nt; i++)
    {
      // Integrate one step forward
      stepForward();

      // Save present state
      if (i%sampling == 0)
	{
	  presentState = gsl_matrix_row(currentState, 0);
	  gsl_matrix_set_row(data, (i - ntSpinup) / sampling - 1,
			     &presentState.vector);
	}
    }

  return data;
}
Example #2
0
//////////////////////////////////
//Required Functionality
void reqFunctionality(){
	_delay_cycles(4000000);
	stepForward();
	lookForLeftCorner();
	pivotForwardLeft();
	stepForward();
}
Example #3
0
////////////////////////////////////
////B Functionality
void bFunctionality(){
	_delay_cycles(4000000);
	stepForward();
	lookForLeftCorner();
	_delay_cycles(1000000);
	pivotForwardLeft();

	stepForward();
	lookForRightCorner();
	pivotForwardRight();
	goForward();
	_delay_cycles(1000000);
	stop();
}
Example #4
0
void MainWindow::makeConnections()
{
    connect(pt_videocapture, SIGNAL(positionUpdated(int)), ui->positionSlider, SLOT(setValue(int)));
    connect(ui->positionSlider, SIGNAL(sliderPressed()), pt_videocapture, SLOT(pause()));
    connect(ui->positionSlider, SIGNAL(sliderReleased(int)), pt_videocapture, SLOT(setPosition(int)));
    connect(ui->positionSlider, SIGNAL(sliderReleased(int)), pt_videocapture, SLOT(resume()));
    connect(pt_videocapture, SIGNAL(framesInFile(int)), ui->positionSlider, SLOT(setMaxValue(int)));

    connect(ui->resumeButton, SIGNAL(pressed()), pt_resumeAct, SLOT(trigger()));
    connect(ui->pauseButton, SIGNAL(pressed()), pt_pauseAct, SLOT(trigger()));
    connect(ui->backwardButton, SIGNAL(pressed()), pt_backwardAct, SLOT(trigger()));
    connect(ui->forwardButton, SIGNAL(pressed()), pt_forwardAct, SLOT(trigger()));
    connect(ui->speeddownButton, SIGNAL(pressed()), pt_speeddownAct, SLOT(trigger()));
    connect(ui->speedupButton, SIGNAL(pressed()), pt_speedupAct, SLOT(trigger()));

    connect(pt_videocapture, SIGNAL(positionUpdated(int)), ui->frameLCD, SLOT(display(int)));
    connect(pt_videocapture, SIGNAL(framesInFile(int)), ui->totalframesLCD, SLOT(display(int)));

    connect(pt_stasm, SIGNAL(frametimeUpdated(double)), ui->frametimeLCD, SLOT(display(double)));

    connect(pt_opencv, SIGNAL(snrUpdated(double)), ui->snrLCD, SLOT(display(double)));
    connect(pt_opencv, SIGNAL(contrastUpdated(double)), ui->contrastLCD, SLOT(display(double)));
    connect(pt_stasm, SIGNAL(eyesdistanceUpdated(double)), ui->eyesLCD, SLOT(display(double)));   
    qRegisterMetaType<cv::Rect>("cv::Rect");
    connect(pt_stasm, SIGNAL(facerectUpdated(cv::Rect)), ui->display, SLOT(updateSelection(cv::Rect)));

    //seriesanalyzer part
    connect(ui->dataseriaW, SIGNAL(stateChanged(bool)), this, SLOT(dataanalysconnection(bool)));
    connect(pt_seriesanalyzer, SIGNAL(seriesFound(DataSeria,uint,uint)), ui->dataseriaW, SLOT(updateSeries(DataSeria,uint,uint)));
    connect(ui->dataseriaW, SIGNAL(moveBackward()), pt_seriesanalyzer, SLOT(stepBackward()));
    connect(ui->dataseriaW, SIGNAL(moveForward()), pt_seriesanalyzer, SLOT(stepForward()));
    connect(ui->dataseriaW, SIGNAL(clearHistory()), pt_seriesanalyzer, SLOT(clearSeriesHistory()));
}
Example #5
0
VideoControls::VideoControls(QWidget *parent) : QFrame (parent) {
    setEnabled(false);
    m_isTracking = false;
    m_isPlaying = false;
    m_autoHide = false;

    m_hbox = new QHBoxLayout(this);
    m_hbox->setSizeConstraint(QLayout::SetMinimumSize);
    m_hbox->setContentsMargins(0,0,0,0);
    m_hbox->setSpacing(4);
    
    m_prevButton = new QToolButton(this);
    m_hbox->addWidget(m_prevButton);
    m_prevButton->setFixedSize(24, 24);
    m_prevButton->setAutoRaise(true);
    m_prevButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaSeekBackward));
	m_prevButton->setAutoRepeat(true);
	m_prevButton->setAutoRepeatInterval(1000/50); 

    m_playButton = new QToolButton(this);;
    m_hbox->addWidget(m_playButton);
    m_playButton->setFixedSize(24, 24);
    m_playButton->setAutoRaise(true);
    m_playButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaPlay));

    m_nextButton = new QToolButton(this);;
    m_hbox->addWidget(m_nextButton);
    m_nextButton->setFixedSize(24, 24);
    m_nextButton->setAutoRaise(true);
    m_nextButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaSeekForward));
	m_nextButton->setAutoRepeat(true);
	m_nextButton->setAutoRepeatInterval(1000/50); 

    m_frameSlider = new QSlider(this);
    m_hbox->addWidget(m_frameSlider);
    m_frameSlider->setMinimumHeight(24);
    m_frameSlider->setRange(0,0);
    m_frameSlider->setFocusPolicy(Qt::NoFocus);
    m_frameSlider->setOrientation(Qt::Horizontal);
    m_frameSlider->setTracking(false);

    m_frameEdit = new QSpinBox(this);
    m_hbox->addWidget(m_frameEdit);
    m_frameEdit->setMinimumHeight(24);
    m_frameEdit->setRange(0,0);
    m_frameEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
    m_frameEdit->setAlignment(Qt::AlignCenter);
    m_frameEdit->setKeyboardTracking(false);

    connect(m_prevButton, SIGNAL(clicked()), this, SIGNAL(stepBack()));
    connect(m_playButton, SIGNAL(clicked()), this, SLOT(toogle()));
    connect(m_nextButton, SIGNAL(clicked()), this, SIGNAL(stepForward()));

    connect(m_frameSlider, SIGNAL(valueChanged(int)), this, SIGNAL(currentFrameChanged(int)));
    connect(m_frameSlider, SIGNAL(sliderMoved(int)), this, SIGNAL(currentFrameTracked(int)));
    connect(m_frameSlider, SIGNAL(sliderPressed()), this, SLOT(handleSliderPressed()));
    connect(m_frameSlider, SIGNAL(sliderReleased()), this, SLOT(handleSliderReleased()));

    connect(m_frameEdit, SIGNAL(valueChanged(int)), this, SIGNAL(currentFrameChanged(int)));
}
Example #6
0
void lookForRightCorner(){
	while(true){
		//checkSideSensors();
		if(isRightActive(290) == false)
			break;
		stepForward();
	}
}
Example #7
0
void lookForLeftCorner(){
	while(true){
		//checkSideSensors();
		if(isLeftActive(325) == false)
			break;
		stepForward();
	}
}
Example #8
0
//
// Bresenham's line algorithm
//
//void draw2d(int x0, int y0, int x1, int y1)
void draw2d(s16 gotoX, s16 gotoY)
{
    s16 xNow = posX;
    s16 yNow = posY;
    int dx = abs(gotoX - xNow), sx = xNow < gotoX ? 1 : -1;
    int dy = abs(gotoY - yNow), sy = yNow < gotoY ? 1 : -1; 
    int err = (dx>dy ? dx : -dy)/2, e2;


    //int limit;
    //for(limit = 0; limit < 20; limit++)
    for(;;)
    {
        //STEPSTRING(StrNow);
        //uart_send_u16(xNow);
        //uart_send_buffered(':');
        //uart_send_u16(yNow);
        //uart_send_buffered(' ');

        //STEPSTRING(StrGoto);
        //uart_send_u16(gotoX);
        //uart_send_buffered(':');
        //uart_send_u16(gotoY);
        //uart_send_buffered(' ');

        //stepReportAxes();
        while (xNow > posX)
        {
            stepRight();
        }

        while (xNow < posX)
        {
            stepLeft();
        }

        while (yNow > posY)
        {
            stepForward();
        }
        
        while (yNow < posY)
        {
            stepBack();
        }

        if (posX == gotoX && posY == gotoY)
        {
            break;
        }


        e2 = err;
        if (e2 >-dx) { err -= dy; xNow += sx; }
        if (e2 < dy) { err += dx; yNow += sy; }
    }
}
Example #9
0
void SortEngine::handleSigUsr()
{
  _snUsr->setEnabled(false);
  char tmp;
  int r=::read(_sigusrFd[1], &tmp, sizeof(tmp));
  if(r<0)
    std::cerr<<"Write error"<<std::endl;  
  stepForward();
  _snUsr->setEnabled(true);
}
Example #10
0
// slot
void Animation::playbackTimeout()
{
//  qDebug("Animation::playbackTimeout()");

  currentPlayTime+=PLAYBACK_RESOLUTION/1000.0;

  while(currentPlayTime>=frameTime())
  {
//    qDebug("Animation::playbackTimeout(%lx): !!! currentPlayTime=%f frameTime=%f",this,currentPlayTime,frameTime);
    currentPlayTime-=frameTime();
    stepForward();
  }
}
Example #11
0
void GLWidget::keyPressEvent(QKeyEvent *event)
{
    int key = event->key();
    Qt::KeyboardModifiers mod = event->modifiers();

    if (key == Qt::Key_Right) {
        stepForward();
    } else if (key == Qt::Key_F) {
        frame();
    }
        
    m_camera.apply();
    updateGL();
}
Example #12
0
/**
 * Integrate the model forward for a given period.
 * \param[in]  length   Duration of the integration.
 * \param[in]  spinup   Initial integration period to remove.
 * \param[in]  sampling Time step at which to save states.
 * \return              Matrix to record the states.
 */
gsl_matrix *
model::integrateForward(const double length, const double spinup,
			const size_t sampling)
{
  size_t nt = (size_t) (length / scheme->getTimeStep() + 0.1);
  size_t ntSpinup = (size_t) (spinup / scheme->getTimeStep() + 0.1);
  gsl_matrix *data = gsl_matrix_alloc((size_t) ((nt - ntSpinup) / sampling),
				      dim);
  // Get spinup
  for (size_t i = 1; i <= ntSpinup; i++)
    stepForward();

  // Get record
  for (size_t i = ntSpinup+1; i <= nt; i++)
    {
      stepForward();

      // Save state
      if (i%sampling == 0)
	gsl_matrix_set_row(data, (i - ntSpinup) / sampling - 1, currentState);
    }

  return data;
}
Example #13
0
void ofxMovieClip<ImageType>::tick()
{
    switch (playMode)
    {
    case STEP_FORWARD:
        stepForward();
        break;
    case STEP_REVERSE:
        stepReverse();
        break;
    case STEP_STOP:
        break;
    default:
        break;
    }
}
Example #14
0
void RBEC::run()
{
    initialize();
    buildMatrixStruct();

    initialValue();

    FEMFunction <double, DIM> phi2(fem_space);

    do {
       
    	stepForward();

    	for (int i = 0; i < fem_space.n_dof(); ++i)
    	    phi2(i) = phi_re(i) * phi_re(i);
    	phi2.writeOpenDXData("phi2.dx");

    	std::cout << "t  = " << t << std::endl;
    } while (t < 3);
};
Example #15
0
int main(int argc, char* argv[])
	{
	set();
	int waitTime=50;
	reset();
	printf("wait time=%d\n",waitTime);
	const int blksz=10;//(choice[2]*2+1);
	clearScreen();
	int gens=0;
	printf("while");
	while(true)
		{
		draw(SIZE);
		SDL_Delay(waitTime);
		stepForward();
		gens++;
		if (EZ_checkForExit())
			exit(0);
		}
	printf("error:%d",SDL_GetError());
	}
Example #16
0
void Ship::update(float delta)
{
	std::ostringstream os;
	os << "x: " << (int)worldX << ", y: " << (int)worldY << ", speed: " << (int)speed;
	this->lblCoords->setString(os.str());

	if (rotatingLeft) {
		this->setRotation(this->getRotation() - (100 * delta));
	}
	if (rotatingRight) {
		this->setRotation(this->getRotation() + (100 * delta));
	}
	// HACK: This has to be the wrong way to change a sprite.
	if (propellingForward) {
		this->initWithFile("Ship_fwd.png");

		stepForward(delta);
	}
	else {
		this->initWithFile("Ship.png");

		speed = 0;
	}
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void FrameAnimationControl::slotStepForward()
{
    stepForward();
}
/*!

*/
void
LogPlayerToolBar::createControls( LogPlayer * log_player,
                                  QMainWindow * main_win )
{
    // visible actions
    {
        QAction * act
            = new QAction( QIcon( QPixmap( rew_xpm ) ),
                           tr( "Rewind" ), this );
#ifdef Q_WS_MAC
        act->setShortcut( Qt::META + Qt::Key_Down );
#else
        act->setShortcut( Qt::CTRL + Qt::Key_Down );
#endif
        act->setStatusTip( tr( "Rewind the log player.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( accelerateBack() ) );
        this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( QIcon( QPixmap( rev_xpm ) ),
                           tr( "Play Backward" ), this );
        act->setShortcut( Qt::Key_Down );
        act->setStatusTip( tr( "Play backward the log player.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( playBack() ) );
        this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( QIcon( QPixmap( minus_xpm ) ),
                           tr( "Step Back" ), this );
        act->setShortcut( Qt::Key_Left );
        act->setStatusTip( tr( "One step back the log player.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( stepBack() ) );
        this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( QIcon( QPixmap( stop_xpm ) ),
                           tr( "Play/Stop" ), this );
        act->setShortcut( Qt::Key_Space );
        act->setStatusTip( tr( "Play/Stop the log player. (" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( playOrStop() ) );
        this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( QIcon( QPixmap( plus_xpm ) ),
                           tr( "Step Forward" ), this );
        act->setShortcut( Qt::Key_Right );
        act->setStatusTip( tr( "One step forward the log player. (" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( stepForward() ) );
        this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( QIcon( QPixmap( play_xpm ) ),
                           tr( "Play Forward" ), this );
        act->setShortcut( Qt::Key_Up );
        act->setStatusTip( tr( "Play forward the log player.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( playForward() ) );
        this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( QIcon( QPixmap( ff_xpm ) ),
                           tr( "Fast Forward" ), this );
#ifdef Q_WS_MAC
        act->setShortcut( Qt::META + Qt::Key_Up );
#else
        act->setShortcut( Qt::CTRL + Qt::Key_Up );
#endif
        act->setStatusTip( tr( "Fast forward the log player.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( accelerateForward() ) );
        this->addAction( act );
        main_win->addAction( act );
    }

    this->addSeparator();


    // invisible actions
    {
        QAction * act
            = new QAction( //QIcon( QPixmap( go_first_xpm ) ),
                           tr( "Go first" ), this );
        act->setShortcut( Qt::Key_Home );
        act->setStatusTip( tr( "Go to the first.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( goToFirst() ) );
        //this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( //QIcon( QPixmap( go_last_xpm ) ),
                           tr( "Go last" ), this );
        act->setShortcut( Qt::Key_End );
        act->setStatusTip( tr( "Go to the last.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( goToLast() ) );
        //this->addAction( act );
        main_win->addAction( act );
    }
}
Example #19
0
 void operator ++(){ stepForward(); }
Example #20
0
void MainWindow::createActions()
{
    pt_fileAct = new QAction(tr("&File"), this);
    pt_fileAct->setStatusTip(tr("Open video file"));
    connect(pt_fileAct, SIGNAL(triggered()), this, SLOT(callFileSelectDialog()));

    pt_resumeAct = new QAction(tr("&Resume"), this);
    pt_resumeAct->setStatusTip("Resume");
    connect(pt_resumeAct, SIGNAL(triggered()), pt_videocapture, SLOT(resume()));

    pt_pauseAct = new QAction(tr("&Pause"), this);
    pt_pauseAct->setStatusTip("Pause");
    connect(pt_pauseAct, SIGNAL(triggered()), pt_videocapture, SLOT(pause()));

    pt_backwardAct = new QAction(this);
    connect(pt_backwardAct, SIGNAL(triggered()), pt_videocapture, SLOT(stepBackward()));

    pt_forwardAct = new QAction(this);
    connect(pt_forwardAct, SIGNAL(triggered()), pt_videocapture, SLOT(stepForward()));

    pt_speedupAct = new QAction(tr("Speedx2.0"), this);
    pt_speedupAct->setStatusTip("Increase speed of playback by two times");
    connect(pt_speedupAct, SIGNAL(triggered(bool)), pt_videocapture, SLOT(speedUp()));

    pt_speeddownAct = new QAction(tr("Speedx0.5"), this);
    pt_speeddownAct->setStatusTip("Decrease speed of playback by two times");
    connect(pt_speeddownAct, SIGNAL(triggered(bool)), pt_videocapture, SLOT(speedDown()));

    pt_aboutAct = new QAction(tr("&About"), this);
    pt_aboutAct->setStatusTip("Show about");
    connect(pt_aboutAct, SIGNAL(triggered()), this, SLOT(about()));

    pt_helpAct = new QAction(tr("&Help"), this);
    pt_helpAct->setStatusTip("Show help");
    connect(pt_helpAct, SIGNAL(triggered()), this, SLOT(help()));

    pt_numAct = new QAction(tr("&Numbers"), this);
    pt_numAct->setStatusTip("Toogle show numbers");
    pt_numAct->setCheckable(true);
    pt_numAct->setChecked(true);
    connect(pt_numAct, SIGNAL(triggered(bool)), ui->display, SLOT(setNumbersVisualization(bool)));

    pt_imageAct = new QAction(tr("&Image"), this);
    pt_imageAct->setStatusTip("Toogle show image");
    pt_imageAct->setCheckable(true);
    pt_imageAct->setChecked(true);
    connect(pt_imageAct, SIGNAL(triggered(bool)), ui->display, SLOT(setImageVisualization(bool)));

    pt_selectionAct = new QAction(tr("&Select"), this);
    pt_selectionAct->setStatusTip("Toogle show selection");
    pt_selectionAct->setCheckable(true);
    pt_selectionAct->setChecked(true);
    connect(pt_selectionAct, SIGNAL(triggered(bool)), ui->display, SLOT(setSelectionVisualization(bool)));

    pt_deviceAct = new QAction(tr("&Device"),this);
    pt_deviceAct->setStatusTip(tr("Open video device"));
    connect(pt_deviceAct, SIGNAL(triggered()), this, SLOT(callDeviceSelectDialog()));

    pt_plotAct = new QAction(tr("&Plot"),this);
    pt_plotAct->setStatusTip(tr("New plot"));
    connect(pt_plotAct, SIGNAL(triggered()), this, SLOT(addPlot()));

    pt_writeAct = new QAction(tr("&Video"), this);
    pt_writeAct->setStatusTip(tr("Write processed frames to a file"));
    pt_writeAct->setCheckable(true);
    pt_writeAct->setChecked(false);
    connect(pt_writeAct, SIGNAL(triggered(bool)), this, SLOT(callVideoWriteDialog(bool)));

    pt_dsAct = new QAction(tr("DSdialog"), this);
    pt_dsAct->setStatusTip(tr("Call DirectShow device settings dialog"));
    connect(pt_dsAct, SIGNAL(triggered()), this, SLOT(callDSDialog()));

    pt_saveWFAct = new QAction(tr("Waterfall"), this);
    pt_saveWFAct->setStatusTip(tr("Save waterfall image on disk"));
    connect(pt_saveWFAct, SIGNAL(triggered()), this, SLOT(saveFileDialog()));
}
Example #21
0
	void AnimatedImage::runTimerEvent() {
		stepForward();
	}
Example #22
0
MainWindow::MainWindow() {
    setupUi(this);
    m_dirty = false;

    m_logWindow->setVisible(false);
    m_imageView->setFocus();
    m_imageView->setHandler(this);

    ParamGroup *g, *gg;

    new ParamChoice(this, "output", "edges", "edges|fill|fill+edges", &output);
    new ParamChoice(this, "input_gamma", "linear-rgb", "srgb|linear-rgb", &input_gamma);

    g = new ParamGroup(this, "structure_tensor");
    new ParamChoice(g, "st_type", "scharr-lab", "central-diff|sobel-rgb|sobel-lab|sobel-L|scharr-rgb|scharr-lab|gaussian-deriv|etf-full|etf-xy", &st_type);
    new ParamDouble(g, "sigma_c", 2.28, 0, 20, 0.1, &sigma_c);
    new ParamDouble(g, "precision_sigma_c", sqrt(-2*log(0.05)), 1, 10, 1, &precision_sigma_c);
    new ParamInt   (g, "etf_N", 3, 0, 10, 1, &etf_N);

    g = new ParamGroup(this, "bilateral_filter", false, &enable_bf);
    new ParamChoice(g, "type", "xy", "oa|xy|fbl|full", &filter_type);
    new ParamInt   (g, "n_e",     1, 0, 20, 1, &n_e);
    new ParamInt   (g, "n_a",     4, 0, 20, 1, &n_a);
    new ParamDouble(g, "sigma_dg", 3, 0, 20, 0.05, &sigma_dg);
    new ParamDouble(g, "sigma_dt", 3, 0, 20, 0.05, &sigma_dt);
    new ParamDouble(g, "sigma_rg", 4.25, 0, 100, 0.05, &sigma_rg);
    new ParamDouble(g, "sigma_rt", 4.25, 0, 100, 0.05, &sigma_rt);
    new ParamDouble(g, "bf_alpha", 0, 0, 10000, 1, &bf_alpha);
    new ParamDouble(g, "precision_g", 2, 1, 10, 1, &precision_g);
    new ParamDouble(g, "precision_t", 2, 1, 10, 1, &precision_t);

    g = new ParamGroup(this, "dog");
    ParamGroup* dog_group = g;
    connect(g, SIGNAL(dirty()), SLOT(dogChanged()));

    new ParamChoice(g, "type", "flow-based", "isotropic|flow-based", &dog_type);
    new ParamDouble(g, "sigma_e", 1.4, 0, 20, 0.005, &sigma_e);
    new ParamDouble(g, "dog_k", 1.6, 1, 10, 0.01, &dog_k);
    new ParamDouble(g, "precision_e", 3, 1, 5, 0.1, &precision_e);
    new ParamDouble(g, "sigma_m", 4.4, 0, 20, 1, &sigma_m);
    new ParamDouble(g, "precision_m", 2, 1, 5, 0.1, &precision_m);
    new ParamDouble(g, "step_m", 1, 0.01, 2, 0.1, &step_m);

    new ParamChoice(g, "adj_func", "smoothstep", "smoothstep|tanh", &dog_adj_func);
    new ParamBool  (g, "dog_reparam", true, &dog_reparam);
    gg = new ParamGroup(g, "", true);
    dog_tau_g = gg;
    dog_eps_ptr = new ParamDouble(gg, "epsilon", 3.50220, -100, 100, 0.005, &dog_eps);
    dog_tau_ptr = new ParamDouble(gg, "tau", 0.95595, 0, 2, 0.005, &dog_tau);
    dog_phi_ptr = new ParamDouble(gg, "phi", 0.3859, 0, 1e32, 0.1, &dog_phi);

    gg = new ParamGroup(g, "", false);
    dog_p_g = gg;
    dog_p_ptr     = new ParamDouble(gg, "p", 21.7, 0, 1e6, 1, &dog_p);
    dog_eps_p_ptr = new ParamDouble(gg, "epsilon_p", 79.5, -1e32, 1e32, 0.5, &dog_eps_p);
    dog_phi_p_ptr = new ParamDouble(gg, "phi_p", 0.017, -1e32, 1e32, 0.05, &dog_phi_p);

    new ParamChoice(g, "dog_fgauss", "euler", "euler|rk2-nn|rk2|rk4", &dog_fgauss);

    g = new ParamGroup(this, "quantization", false, &quantization);
    new ParamChoice(g, "quant_type", "adaptive", "fixed|adaptive", &quant_type);
    new ParamInt   (g, "nbins", 8, 1, 255, 1, &nbins);
    new ParamDouble(g, "phi_q", 2, 0, 100, 0.025, &phi_q);
    new ParamDouble(g, "lambda_delta", 0, 0, 100, 1, &lambda_delta);
    new ParamDouble(g, "omega_delta", 2, 0, 100, 1, &omega_delta);
    new ParamDouble(g, "lambda_phi", 0.9, 0, 100, 1, &lambda_phi);
    new ParamDouble(g, "omega_phi", 1.6, 0, 100, 1, &omega_phi);

    g = new ParamGroup(this, "warp_sharp", false, &warp_sharp);
    new ParamDouble(g, "sigma_w", 1.5, 0, 20, 1, &sigma_w);
    new ParamDouble(g, "precision_w", 2, 1, 5, 0.1, &precision_w);
    new ParamDouble(g, "phi_w", 2.7, 0, 100, 0.025, &phi_w);

    g = new ParamGroup(this, "final_smooth", true, &final_smooth);
    new ParamChoice(g, "type", "flow-nearest", "3x3|5x5|flow-nearest|flow-linear", &final_type);
    new ParamDouble(g, "sigma_a", 1.0, 0, 10, 1, &sigma_a);

    QScrollArea *sa = new QScrollArea(this);
    QWidget *parea = new QWidget(sa);
    sa->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
    sa->setFixedWidth(300);
    sa->setWidget(parea);
    sa->setFrameStyle(QFrame::NoFrame);
    sa->setFocusPolicy(Qt::NoFocus);
    sa->setWidgetResizable(true);
    sa->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    m_vbox1->addWidget(sa);

    m_paramui = new ParamUI(parea, this);
    QVBoxLayout *pbox = new QVBoxLayout(parea);
    pbox->setContentsMargins(4,4,4,4);
    pbox->addWidget(m_paramui);
    pbox->addStretch(0);

    connect(m_select, SIGNAL(currentIndexChanged(int)), this, SLOT(onIndexChanged(int)));

    m_player = new VideoPlayer(this, ":/test.png");
    connect(m_player, SIGNAL(videoChanged(int)), this, SLOT(onVideoChanged(int)));
    connect(m_player, SIGNAL(currentFrameChanged(int)), this, SLOT(setDirty()));
    connect(m_player, SIGNAL(outputChanged(const QImage&)), m_imageView, SLOT(setImage(const QImage&)));
    connect(this, SIGNAL(imageChanged(const QImage&)), m_player, SLOT(setOutput(const QImage&)));

    m_videoControls->setFrameStyle(QFrame::NoFrame);
    m_videoControls->setAutoHide(true);
    connect(m_videoControls, SIGNAL(stepForward()), m_player, SLOT(stepForward()));
    connect(m_videoControls, SIGNAL(stepBack()), m_player, SLOT(stepBack()));
    connect(m_videoControls, SIGNAL(currentFrameTracked(int)), m_player, SLOT(setCurrentFrame(int)));
    connect(m_videoControls, SIGNAL(playbackChanged(bool)), m_player, SLOT(setPlayback(bool)));
    connect(m_videoControls, SIGNAL(trackingChanged(bool)), this, SLOT(setDirty()));

    connect(m_player, SIGNAL(videoChanged(int)), m_videoControls, SLOT(setFrameCount(int)));
    connect(m_player, SIGNAL(playbackChanged(bool)), m_videoControls, SLOT(setPlayback(bool)));
    connect(m_player, SIGNAL(currentFrameChanged(int)), m_videoControls, SLOT(setCurrentFrame(int)));
}