Ejemplo n.º 1
0
void WebcamCapture::run()
{

	Mat orig;
	TimerCreate();
	while (isRunning())
	{
		TimerUpdate();
		vector<unsigned char> m_status;
		vector<float>         m_error;
		vector<Point2f> trackedPts;
		if (vc->isOpened())
		{
			if (vc->read(orig))
				dh_out->WriteFrame(orig);
		}
		else
		{
			this->exit(-1);
			
		}
		
		TimerElapsed();
	}
	vc->release();
	this->exit(0);
}
Ejemplo n.º 2
0
// setup gui elements and signal/slot connections
void QmitkGibbsTrackingView::CreateQtPartControl( QWidget *parent )
{
  // build up qt view, unless already done
  if ( !m_Controls )
  {
    // create GUI widgets from the Qt Designer's .ui file
    m_Controls = new Ui::QmitkGibbsTrackingViewControls;
    m_Controls->setupUi( parent );

    AdvancedSettings();

    connect( m_TrackingTimer, SIGNAL(timeout()), this, SLOT(TimerUpdate()) );
    connect( m_Controls->m_TrackingStop, SIGNAL(clicked()), this, SLOT(StopGibbsTracking()) );
    connect( m_Controls->m_TrackingStart, SIGNAL(clicked()), this, SLOT(StartGibbsTracking()) );
    connect( m_Controls->m_SetMaskButton, SIGNAL(clicked()), this, SLOT(SetMask()) );
    connect( m_Controls->m_SetGfaButton, SIGNAL(clicked()), this, SLOT(SetGfaImage()) );
    connect( m_Controls->m_AdvancedSettingsCheckbox, SIGNAL(clicked()), this, SLOT(AdvancedSettings()) );
    connect( m_Controls->m_SaveTrackingParameters, SIGNAL(clicked()), this, SLOT(SaveTrackingParameters()) );
    connect( m_Controls->m_LoadTrackingParameters, SIGNAL(clicked()), this, SLOT(LoadTrackingParameters()) );
    connect( m_Controls->m_IterationsSlider, SIGNAL(valueChanged(int)), this, SLOT(SetIterations(int)) );
    connect( m_Controls->m_ParticleWidthSlider, SIGNAL(valueChanged(int)), this, SLOT(SetParticleWidth(int)) );
    connect( m_Controls->m_ParticleLengthSlider, SIGNAL(valueChanged(int)), this, SLOT(SetParticleLength(int)) );
    connect( m_Controls->m_InExBalanceSlider, SIGNAL(valueChanged(int)), this, SLOT(SetInExBalance(int)) );
    connect( m_Controls->m_FiberLengthSlider, SIGNAL(valueChanged(int)), this, SLOT(SetFiberLength(int)) );
    connect( m_Controls->m_ParticleWeightSlider, SIGNAL(valueChanged(int)), this, SLOT(SetParticleWeight(int)) );
    connect( m_Controls->m_StartTempSlider, SIGNAL(valueChanged(int)), this, SLOT(SetStartTemp(int)) );
    connect( m_Controls->m_EndTempSlider, SIGNAL(valueChanged(int)), this, SLOT(SetEndTemp(int)) );
  }
Ejemplo n.º 3
0
void myThread::run()
{
    QTimer timer;
    connect(&timer, SIGNAL(timeout()), this, SLOT(TimerUpdate()));
    timer.start(200); //update of each 200ms
    exec();
}
Ejemplo n.º 4
0
void WebcamCapture::run()
{
  Mat orig;

  // макрос для создания таймера
  TimerCreate();
  while (isRunning())
  {
    TimerUpdate();
    vector<unsigned char> m_status;
    vector<float>         m_error;
    vector<Point2f> trackedPts;

    // если камера инициализирована и можно считать
    // изображение, то добавляем в очередь на обработку
    if (mVideoCapture->isOpened())
    {
      if (mVideoCapture->read(orig))
        mDataHandler_out->Write(orig);
    }
    else
    {
      this->exit(-1);

    }

    TimerElapsed();
  }
  // освобождение ресурсов камеры
  mVideoCapture->release();
  this->exit(0);
}
Ejemplo n.º 5
0
Archivo: timer.c Proyecto: x893/OpenBLT
/************************************************************************************//**
** \brief     Obtains the counter value of the millisecond timer.
** \return    Current value of the millisecond timer.
**
****************************************************************************************/
blt_int32u TimerGet(void)
{
  /* updating timer here allows this function to be called in a loop with timeout
   * detection.
   */
  TimerUpdate();
  /* read and return the amount of milliseconds that passed since initialization */
  return millisecond_counter;
} /*** end of TimerGet ***/
Ejemplo n.º 6
0
/****************************************************************************************
** NAME:           BootTask
** PARAMETER:      none
** RETURN VALUE:   none
** DESCRIPTION:    Task function of the bootloader core that drives the program.
**
****************************************************************************************/
void BootTask(void)
{
  /* update the millisecond timer */
  TimerUpdate();
  /* process possibly pending communication data */
  ComTask();
  /* control the backdoor */
  BackDoorCheck();
} /*** end of BootTask ***/
Ejemplo n.º 7
0
/********************************************************************
Function name:    pboc_EPropertty_Test
Input parameters:
    
Return:
    
Function:
    
********************************************************************/
UINT8 pboc_EProperty_Test(void)
{
    UINT8 cnt = 0;
    UINT8 loopcnt = 0xFF;
    UINT8 ret = TRUE;

    IOM->GPIOOEA |= 0x02;
    if(!(IOM->GPIODRA & 0x02))
    {
        loopcnt = 0xFF;
    }
    else
    {
        loopcnt = 0x00;
    }
	
    TimerInit(T0, SCU_OSC_CLK, 1, 0xFFFF);
    printf("Test Start\r\n");

    for(cnt = 0; cnt <= loopcnt; cnt++)
    {
        if(!pboc_power_on())
        {
            printf("reset failed!\r\n");
            TimerUpdate(0x2B44C0F);
            return FALSE;
        }
        printf("Test main prot\r\n");
        if(!pboc_standard_Transaction())
        {
            printf("scc interface communicate error!\r\n");
            ret = FALSE;
        }
        Cert_Scc0Deactivate();
        printf("Deactive\r\n");
        TimerUpdate(0x2B44C0F);
        if(ret == FALSE)
        {
            break;
        }
 
    }
    return ret;
}
Ejemplo n.º 8
0
int UICanvas::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: TimerUpdate(); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
Ejemplo n.º 9
0
//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_PAINT    - Paint the main window
//  WM_DESTROY  - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
		case WM_CREATE:
			//初始化
			Init(hWnd, wParam, lParam);
			break;
		case WM_PAINT:
			//绘制
			Render(hWnd);
			break;
		case WM_KEYDOWN:
			//键盘按下事件
			if (GameStart) KeyDown(hWnd, wParam, lParam);
			break;
		case WM_KEYUP:
			//键盘松开事件
			if (GameStart && m_hero.alive) KeyUp(hWnd, wParam, lParam);
			break;
		case WM_MOUSEMOVE:
			//鼠标移动事件
			MouseMove(hWnd, wParam, lParam);
			break;
		case WM_LBUTTONDOWN:
			//左鼠标事件
			LeftKeyDown = TRUE;
			LButtonDown(hWnd, wParam, lParam);
			break;
		case WM_LBUTTONUP:
			LeftKeyDown = FALSE;
			LButtonUp(hWnd, wParam, lParam);
			break;
		case WM_TIMER:
			//定时器事件
			TimerUpdate(hWnd, wParam, lParam);
			break;
		case WM_DESTROY:
			PostQuitMessage(0);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
			break;
	}
	return 0;
}
void QmitkDiffusionRegistrationView::CreateQtPartControl( QWidget *parent )
{
  // build up qt view, unless already done
  if ( !m_Controls )
  {
    // create GUI widgets from the Qt Designer's .ui file
    m_Controls = new Ui::QmitkDiffusionRegistrationViewControls;
    m_Controls->setupUi( parent );

    AdvancedSettings();

    connect( m_RegistrationTimer, SIGNAL(timeout()), this, SLOT(TimerUpdate()) );
    connect( m_Controls->m_RegistrationStopButton, SIGNAL(clicked()), this, SLOT(StopRegistration()) );
    connect( m_Controls->m_RegistrationStartButton, SIGNAL(clicked()), this, SLOT(StartRegistration()) );
    connect( m_Controls->m_AdvancedSettingsCheckbox, SIGNAL(clicked()), this, SLOT(AdvancedSettings()) );

  }
}
Ejemplo n.º 11
0
void ProcessingThread::run()
{
	Mat orig, previmg, output, mask;
	vector<Point2f> prev_pts, orig_pts;
	vector<uchar> m_status;
	Mat m_error;

	TimerCreate();

	while (isRunning())
	{
		while (dh_in->ReadFrame(orig))
		{
			TimerUpdate();
			OpticalFlowHandle(previmg, orig, prev_pts, orig_pts);
			TimerElapsed();
		}
		yieldCurrentThread();
	}
}
Ejemplo n.º 12
0
CMainWindow::CMainWindow(QWidget* parent): QMainWindow(parent), m_timer(nullptr), m_fps(nullptr)
{
    m_ui.setupUi(this);

    m_timer = new QTimer(this);
    m_timer->start(16);

    m_fps = new QLabel(m_ui.statusBar);
    m_ui.statusBar->addWidget(m_fps);

    connect(m_timer, SIGNAL(timeout()), this, SLOT(TimerUpdate()));
    connect(m_timer, SIGNAL(timeout()), m_ui.glwidget, SLOT(updateGL()));

    // Buffering mode
    connect(m_ui.noThreading, SIGNAL(toggled(bool)), this, SLOT(UseSingleBuffer(bool)));
    connect(m_ui.tripleBuffer, SIGNAL(toggled(bool)), this, SLOT(UseTripleBuffer(bool)));
    connect(m_ui.doubleBuffer, SIGNAL(toggled(bool)), this, SLOT(UseDoubleBuffer(bool)));

    // Effect enable/disable signal
    connect(m_ui.fractalEnabled, SIGNAL(toggled(bool)), this, SLOT(EnableFractalFX(bool)));
    connect(m_ui.fluidEnabled, SIGNAL(toggled(bool)), this, SLOT(EnableFluidFX(bool)));
    connect(m_ui.pageCurlEnabled, SIGNAL(toggled(bool)), this, SLOT(EnablePageCurlFX(bool)));

    // Fractal effect signal
    connect(m_ui.animate, SIGNAL(stateChanged(int)), m_ui.glwidget, SLOT(SetAnimated(int)));
    connect(m_ui.animatePageCurl, SIGNAL(stateChanged(int)), m_ui.glwidget, SLOT(SetPageCurlAnimated(int)));
    connect(m_ui.alphaSlider, SIGNAL(valueChanged(int)), m_ui.glwidget, SLOT(ChangeAlphaValue(int)));
    connect(m_ui.alphaSlider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransparencyLabel(int)));

    // fluid effect signal
    connect(m_ui.maxWidth, SIGNAL(valueChanged(int)), m_ui.glwidget, SLOT(ChangeFluidMaxWidth(int)));
    connect(m_ui.maxHeight, SIGNAL(valueChanged(int)), m_ui.glwidget, SLOT(ChangeFluidMaxHeight(int)));
    m_ui.alphaSlider->valueChanged(50);

    // file open. connect to CMainWindow to avoid "... must be top level ..." error
    connect(m_ui.actionOpen_Video, SIGNAL(triggered()), this, SLOT(OpenVideoFile()));

    AllocConsole();
    freopen("CONOUT$", "w", stdout);
    freopen("CONOUT$", "w", stderr);
}
Ejemplo n.º 13
0
/********************************************************************
Function name:    pboc_GetECBanlance
Input parameters:
    
Return:
    
Function:
    
********************************************************************/
UINT8 pboc_GetECBanlance(void)
{
    UINT8 cnt = 0;
    UINT8 loopcnt = 0x01;
    UINT8 ret = TRUE;
    //UINT8 recvDat[261];
    //UINT16 lenth;

    TimerInit(T0, SCU_OSC_CLK, 1, 0xFFFF);

    for(cnt = 0; cnt < loopcnt; cnt++)
    {
        if(!pboc_power_on())
        {
            printf("reset failed!\r\n");
            TimerUpdate(0x2B44C0F);
            return FALSE;
        }
		
//        printf("GET ELECTRONIC BANLANCE\r\n");
//        if(SccGetECBalance(recvDat, &lenth))
//        {
//            printf("scc interface communicate error!\r\n");
//            ret = FALSE;
//        }
//        SysDebugLog(recvDat, lenth, "Amount:");

        Cert_Scc0Deactivate();

        //TimerUpdate(0x2B44C0F);
        if(ret == FALSE)
        {
            break;
        }
 
    }
    return ret;
}
Ejemplo n.º 14
0
//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_PAINT    - Paint the main window
//  WM_DESTROY  - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_CREATE:
		//初始化
		Init(hWnd, wParam, lParam);
		break;
	case WM_PAINT:
		//绘制
		Render(hWnd);
		break;
	case WM_KEYDOWN:
		//键盘按下事件
		KeyDown(hWnd, wParam, lParam);
		break;
	case WM_KEYUP:
		//键盘松开事件
		KeyUp(hWnd, wParam, lParam);
		break;
	case WM_LBUTTONDOWN:
		//左鼠标事件
		LButtonDown(hWnd, wParam, lParam);
		break;
	case WM_TIMER:
		//定时器事件
		TimerUpdate(hWnd, wParam, lParam);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
		break;
	}

	return 0;
}
Ejemplo n.º 15
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_CREATE:
		WindowInit(hWnd, wParam, lParam);
		break;
	case WM_PAINT:
		Render(hWnd);
		break;
	case WM_KEYDOWN:
		KeyDown(hWnd, wParam, lParam);
		break;
	case WM_KEYUP:
		break;
	case WM_MOUSEMOVE:
		MouseMove(hWnd, wParam, lParam);
		break;
	case WM_LBUTTONDOWN:
		LButtonDown(hWnd, wParam, lParam);
		break;
	case WM_TOUCH:
		return TouchEvent(hWnd, message, wParam, lParam);
	case WM_TIMER:
		TimerUpdate(hWnd, wParam, lParam);
		break;
	case WM_DESTROY:
		RemoveFontResource(_T("res/font/fantiquefour.ttf"));
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
		break;
	}

	return 0;
}
Ejemplo n.º 16
0
/********************************************************************
Function name:    pboc_power_on
Input parameters:
    
Return:
    
Function:
    
********************************************************************/
UINT8 pboc_power_on(void)
{
    UINT8 ret = FALSE;
	UINT16 j = 0;
    UINT16 etu = 0;
    UINT8 len;
    UINT8 atr[64];
	UINT8 atr_ts[64];
    STRUCT_SMARTCARD_SET scc0;

    memset(atr, 0, sizeof(atr));
    memset((UINT8*)&scc0, 0, sizeof(scc0));
    scc0.dma.element.chan = 0xFF;
    scc0.atr = atr;

    while(1)
    {
        if(!warm_rst)
        {
            /* scc interface initialization */
			if(ICCPlug == 0)
			{
				//API_vClearScreen_LCD();
				//API_vDisplayString_LCD("Pls Plug in IC Card:",2,3);
				while(IomGetVal(6));
				Delay(10000);
				//while(IomGetVal(6));
		        Cert_Scc0Init(FALSE, 8, 0, 0);
		        Cert_Scc0Activation();
				ICCPlug = 1;
			}
        }
        else if(warm_rst == 1)
        {
            printf("warmrest\r\n");
            #if 0
            IOM->IOMCRB |= RSTGPIOMSK;
            IomInOutSet(GP9_SCC0RST, 0) ;
            IomSetVal(GP9_SCC0RST, 0) ;
            #endif
            Scc0SyncOper(SetRegSegL(SCC0, UCR, RSTIN)) ;

            etu = ((SCC0->BPRH & SCC0_BPRH_MSK) << 8) ;
            etu = etu | SCC0->BPRL ;
            etu = (SCC0_RST_LOW_TIME / etu) + 1;
            printfdbg("rst low:%detu\r\n", etu) ;
            Scc0EtuSetStart(etu) ;

            while(!GetRegSr(SCC0, SR1, ECNTOVER)) ;
            ClearRegSr(SCC0, SR1, ECNTOVER) ;
            Scc0SyncOper(SetRegSegH(SCC0, UCR, RSTIN)) ;
        }
        else if(warm_rst == 2)
        {
            Cert_Scc0Deactivate();
            TimerUpdate(0x2B44C0F);
            warm_rst = 0;
            continue;
        }

        len = Cert_Scc0GetAtr(&scc0);
        SysDebugLog(atr, len, "ATR:");

	    for(UINT8 i = 0; i < 64; i++)
		{
			 atr_ts[i] = 0x00;
		}

		for(UINT8 i = 0; i < len; i++)
		{
			UINT8 Temp;

			//printf("0x%x ", atr[i]);
			Temp =  atr[i] >> 4;
			if(Temp < 10)
			{
				atr_ts[j++] = Temp + 0x30;
			}
			else
			{
				atr_ts[j++] = (Temp - 10) + 0x41;
			}

			Temp =  atr[i] & 0x0f;
			if(Temp < 10)
			{
				atr_ts[j++] = Temp + 0x30;
			}
			else
			{
				atr_ts[j++] = (Temp - 10) + 0x41;
			}

			atr_ts[j++] = 0x20;
		}

		//printf("\r\n");
		//API_vClearScreen_LCD();
		//API_vDisplayString_LCD("atr:",2,0);
		//API_vDisplayString_LCD(atr_ts, 2,2);
        
		if(!len)
        {
            Cert_Scc0Deactivate();
            TimerUpdate(0x2B44C0F);
            continue;
        }

        if(!Cert_Scc0DealAtr(&scc0, len))
        {
            continue;
        }

        ret = TRUE;
        break;
    }
    return ret;
}