void EyeExtractor::process() { if(Application::Signals::initiateCalibrationFrameNo == Application::Components::videoInput->frameCount) { start(); } if (Application::Components::pointTracker->isTrackingSuccessful()) { // Extract eye images using point tracker results extractEye(Application::Components::videoInput->frame); extractEyeLeft(Application::Components::videoInput->frame); // Blink detection _blinkDetector.update(eyeFloat); _blinkDetectorLeft.update(eyeFloatLeft); if (_blinkDetector.getState() >= 2 && _blinkDetectorLeft.getState() >= 2) { _isBlinking = true; } else { _isBlinking = false; } // If calibration is active, collect eye image samples, calculate averages and train the system if(Application::Components::calibrator->isActive()) { if (Application::Components::calibrator->shouldStartNextPoint()) { // Switch to next calibration point pointStart(); } else if (hasValidSample()) { // Add the valid training samples averageEye->addSample(eyeFloat.get()); averageEyeLeft->addSample(eyeFloatLeft.get()); // TODO MOVE ADD SAMPLES TO NN CODE //Application::Components::gazeTracker->addSampleToNN(Application::Components::calibrator->getActivePoint(), eyeFloat.get(), eyeGrey.get()); //Application::Components::gazeTracker->addSampleToNNLeft(Application::Components::calibrator->getActivePoint(), eyeFloatLeft.get(), eyeGreyLeft.get()); if (Application::Components::calibrator->getPointFrameNo() == Application::dwelltimeParameter - 1) { pointEnd(); // TODO : NOT NECESSARY FOR THIS COMPONENT //if (Application::Components::calibrator->isLastPoint()) // calibrationEnded(); } } } } }
void CXFMenuButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { // -[Feral]----------------------------------------------------------- // VALIDATION: ASSERT(lpDrawItemStruct != NULL); // -[Feral]----------------------------------------------------------- // Vars and Assignment CRect rect = lpDrawItemStruct->rcItem; CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC); UINT uiState = lpDrawItemStruct->itemState; CPen pen; CPen *ppenOld = NULL; // -[Feral]----------------------------------------------------------- // set the pen color based on if we are disabled or not if( (uiState&ODS_DISABLED) ) { pen.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_GRAYTEXT) ); } else { pen.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNTEXT) ); } // -[Feral]----------------------------------------------------------- // select the pen into the DC. ppenOld = pDC->SelectObject(&pen); // -[Feral]----------------------------------------------------------- // draw the border if( (uiState&ODS_SELECTED) ) { pDC->DrawFrameControl(rect, DFC_BUTTON, DFCS_BUTTONPUSH|DFCS_PUSHED); } else { pDC->DrawFrameControl(rect, DFC_BUTTON, DFCS_BUTTONPUSH); } // -[Feral]----------------------------------------------------------- // Draw the Arrow... // Something like: // X // XX // XXX // XXXX // XXX // XX // X // In the Center of the button. CSize sizeArrow(4,7); CSize sizeOffsetTop(1,+1); // size of the top stairsteps CSize sizeOffsetBottom(1,-1); // size of the bottom stairsteps CPoint pointCenter( (rect.Width()/2), (rect.Height()/2) ); CPoint pointStart( (pointCenter.x-(sizeArrow.cx/2) ), (pointCenter.y-(sizeArrow.cy/2) ) ); CPoint pointStop ( (pointStart.x), (pointStart.y+sizeArrow.cy) ); // -[Feral]----------------------------------------------------------- // start at the left and work to the right... for(int iInd=0; iInd<sizeArrow.cx; iInd++) { // -[Feral]------------------------------------------------------- // draw the lines pDC->MoveTo(pointStart); pDC->LineTo(pointStop); // -[Feral]------------------------------------------------------- // offset our points. (going right!) pointStart.Offset(sizeOffsetTop); pointStop .Offset(sizeOffsetBottom); } // -[Feral]----------------------------------------------------------- // Draw the focus rectangle if necessary. if( (uiState&ODS_FOCUS) ) { CRect rectFocus(rect); rectFocus.DeflateRect(3,3); // This looked prety close pDC->DrawFocusRect(rectFocus); } // -[Feral]----------------------------------------------------------- // Clean Up and Return pDC->SelectObject(ppenOld); // Restore the pen }
// Prepares the eye extractor for calibration void EyeExtractor::start() { pointStart(); }