/* initGui must be called to initialize the structures used by the GUI */ int initGUI(int level) { int i; int n = CARD_NUMBER; char cardName[50]; if (i_initGUI) return(-1); /* check the flag of GUI initialized*/ markIndex = 0; /* mark color index*/ for (i=0; i<n; i++) { if (i<10) sprintf(cardName, "%s/0%1d.xpm", xpmdir, i); else sprintf(cardName, "%s/%2d.xpm", xpmdir, i); read_cmap(cardName, &(mycard[i])); } initLayout(level); rootColor = NULL; doColorTable(mycard, 0, n); initGraphics(); setBlack(& mycard[ EMPTY_CARD ]); initColors(); remapColor(mycard, 0, CARD_NUMBER-1); initWindow(); initImages(mycard, 0, CARD_NUMBER-1); drawMenu(); /* printf(" Nex Graphics done \n"); */ i_initGUI = 1; /* set the flag of GUI initialized*/ return(0); }
void VideoTrack::calculateHistograms(int sections) { initImages(); for( std::set< Image* >::iterator it = _images.begin(); it != _images.end(); it++ ) { (*it)->calcHistogram(sections); } }
void ofApp::changeLanguage(string language) { ofLogNotice() << "Changing language to " << language; if (language == ofApp::language) return; ofApp::language = language; initTranslations(); initImages(); setupModules(); }
void VideoTrack::proccessImagesFeatures( FeatureHandler* featureHandler ) { initImages(); for( std::set< Image* >::iterator it = _images.begin(); it != _images.end(); it++ ) { featureHandler->detect( *it ); featureHandler->computeDescriptors( *it ); } }
Truck::Truck(char *name) :NonRivalCar(name) { addImage(ImageInfo("truck", ROADFIGHTER_IMAGES_DIR, "truck.bmp", 4, 32, 64)); myType = TRUCK_CAR; init(); setWidth(32); setHeight(64); setStretchedWidth(20); setStretchedHeight(64); initMe(); setSpeed(200); initImages(); }
YellowCar::YellowCar(char *name) :NonRivalCar(name) { addImage(ImageInfo("yellowcar", ROADFIGHTER_IMAGES_DIR, "yellowcar.bmp", 4, 32)); myType = YELLOW_CAR; init(); setWidth(16); setHeight(16); setStretchedWidth(9); setStretchedHeight(16); initMe(); setSpeed(200); initImages(); }
void __CGsampler_state::initDerivedSampler(GLenum target) { glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*) &texUnit); texTarget = target; initSampler(); { PixelStoreState state; savePackPixelStoreState(state); { initImages(); } restorePackPixelStoreState(state); } }
void __CGsampler_state::initDerivedSampler(GLenum target, int unit) { initExtensionFuncs(); texUnit = unit + GL_TEXTURE0; texTarget = target; { GLint activeTexture; glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTexture); { glActiveTexture(texUnit); initSampler(); { PixelStoreState state; savePackPixelStoreState(state); { initImages(); } restorePackPixelStoreState(state); } } glActiveTexture(activeTexture); } }
// opt flow calculation CvStatus CV_STDCALL OptFlowEMD::calcOptFlowEMD ( uchar* imgA, uchar* imgB, int imgStep, CvSize imgSize, float* velocityX, float* velocityY, int velStep, float* absolute) { int imgWidth = imgSize.width; int imgHeight = imgSize.height; float HPF0, HPF1, LPF0, LPF1; float emdX, emdY, emdAbs; float factor; int step, pos; /* Checking bad arguments */ if( imgA == NULL ) return CV_NULLPTR_ERR; if( imgB == NULL ) return CV_NULLPTR_ERR; if( imgSize.width <= 0 ) return CV_BADSIZE_ERR; if( imgSize.height <= 0 ) return CV_BADSIZE_ERR; if( imgSize.width > imgStep ) return CV_BADSIZE_ERR; if( (velStep & 3) != 0 ) return CV_BADSIZE_ERR; velStep /= 4; // change buffer image sizes if image size changed if (_oldImgSize.width != imgSize.width || _oldImgSize.height != imgSize.height) initImages(imgSize); _totFlowX = 0.0f; _totFlowY = 0.0f; _totFlowAbs = 0.0f; _maxFlowPixelAbs = 0.0f; _maxFlowPixelX = 0.0f; _maxFlowPixelY = 0.0f; for(register short y = 0; y < imgSize.height - 1; y++){ step = y*imgStep; for(register short x = 0; x < imgSize.width - 1; x++){ pos = step + x; // *** x-direction *** HPF0 = (float)(imgA[pos] - imgB[pos]); HPF1 = (float)(imgA[pos + 1] - imgB[pos + 1]); LPF0 = (float)((_alpha * HPF0) + ((1.0 - _alpha) * ((float*)(_oldLPFx0->imageData + _oldLPFx0->widthStep*y))[x] )); LPF1 = (float)((_alpha * HPF1) + ((1.0 - _alpha) * ((float*)(_oldLPFx1->imageData + _oldLPFx1->widthStep*y))[x] )); // EMDOutput emdX = (LPF0*HPF1) - (LPF1*HPF0); //cout << "vel x: " << velocityX[step + x] << endl; // save the LPF's ((float*)(_oldLPFx0->imageData + _oldLPFx0->widthStep*y))[x] = LPF0; ((float*)(_oldLPFx1->imageData + _oldLPFx1->widthStep*y))[x] = LPF1; // *** y-direction *** HPF0 = (float)(imgA[pos] - imgB[pos]); HPF1 = (float)(imgA[(y+1)*imgStep + x] - imgB[(y+1)*imgStep + x]); LPF0 = (float)((_alpha * HPF0) + ((1.0 - _alpha) * ((float*)(_oldLPFy0->imageData + _oldLPFy0->widthStep*y))[x] )); LPF1 = (float)((_alpha * HPF1) + ((1.0 - _alpha) * ((float*)(_oldLPFy1->imageData + _oldLPFy1->widthStep*y))[x] )); // EMDOutput emdY = (LPF0*HPF1) - (LPF1*HPF0); // save the LPF's ((float*)(_oldLPFy0->imageData + _oldLPFy0->widthStep*y))[x] = LPF0; ((float*)(_oldLPFy1->imageData + _oldLPFy1->widthStep*y))[x] = LPF1; // ** absolute value square *** emdAbs = emdX * emdX + emdY * emdY; if (emdAbs > _thresholdSquared){ if (!_constrain){ velocityX[pos] = emdX * _scale; velocityY[pos] = emdY * _scale; if (absolute != NULL) absolute[pos] = sqrt(emdAbs) * _scale; //cout << "absFlow: " << x << " " << y << " " << sqrt(emdAbs) << endl; _totFlowX += velocityX[pos]; _totFlowY += velocityY[pos]; if (emdAbs > _maxFlowPixelAbs) _maxFlowPixelAbs = emdAbs * _scale; if (emdX > _maxFlowPixelX) _maxFlowPixelX = velocityX[pos]; if (emdY > _maxFlowPixelY) _maxFlowPixelY = velocityY[pos]; } else{ // constrain to _constrainValue emdAbs = sqrt(emdAbs) * _scale; if (emdAbs > _constrainValue){ factor = _constrainValue / emdAbs; velocityX[pos] = emdX * _scale * factor; velocityY[pos] = emdY * _scale * factor; if (absolute != NULL) absolute[pos] = _constrainValue; } else{ velocityX[pos] = emdX * _scale; velocityY[pos] = emdY * _scale; if (absolute != NULL) absolute[pos] = emdAbs; } } } else{ velocityX[pos] = 0.0f; velocityY[pos] = 0.0f; if (absolute != NULL) absolute[pos] = 0.0f; } } } _totFlowAbs = sqrt(pow(_totFlowX,2) + pow(_totFlowY,2)); _maxFlowPixelAbs = sqrt(_maxFlowPixelAbs); // buffering old image size _oldImgSize.width = imgSize.width; _oldImgSize.height = imgSize.height; return CV_OK; }
HeaterMOO::HeaterMOO ( const uint32_t width, const uint32_t height, const float k, const uint32_t blindItr, const bool omp ) : ImageMOOs ( width, height ), _k ( k ), _blindItr ( blindItr ), _omp ( omp ), _imgHeater ( 0 ), _imgInit ( 0 ), _imgA ( 0 ), _imgB ( 0 ) { initImages (); }
void ofApp::setup() { ofSetLogLevel(OF_LOG_NOTICE); ofLogNotice() << "setup()"; if (ofApp::isSemibreve()) ofLogNotice() << "Going to run Semibreve version"; if (ofApp::isOsx()) ofLogNotice() << "OSX detected"; if (ofApp::isIos()) ofLogNotice() << "iOS detected"; if (ofApp::isAndroid()) ofLogNotice() << "Android detected"; if (ofApp::isPhone()) ofLogNotice() << "Phone detected"; if (ofApp::isTablet()) ofLogNotice() << "Tablet detected"; // if (ofApp::isIphone()) ofLogNotice() << "iPhone detected"; // if (ofApp::isIpad()) ofLogNotice() << "iPad detected"; // if (ofApp::isAndroidPhone()) ofLogNotice() << "Android phone detected"; // if (ofApp::isAndroidTablet()) ofLogNotice() << "Android tablet detected"; #if defined TARGET_OSX ofLogNotice() << "Running OSX version"; ofSetDataPathRoot("../Resources/data/"); #endif #if defined TARGET_SEMIBREVE ofLogNotice() << "Running SEMIBREVE version"; oscReceiver.setup(RECEIVE_PORT); oscSender.setup(HOST, SEND_PORT); #endif #if defined TARGET_OF_IOS if (ofApp::isTablet()) { ofSetOrientation(OF_ORIENTATION_90_LEFT); swiper.setup(); ofAddListener(swiper.swipeRecognized, this, &ofApp::onSwipe); swiping = false; } else { swiper.setup(); ofAddListener(swiper.swipeRecognized, this, &ofApp::onSwipe); swiping = false; } #endif #ifndef TARGET_OSX if (isAndroid() || isIos()) { ofxAccelerometer.setup(); accelCount = 0; crop = 0; } #endif if (!ofApp::isIos()) { ofLogNotice() << "Registering for touch events if not ios"; ofRegisterTouchEvents(this); } ofSetFrameRate(FRAME_RATE); ofSetCircleResolution(CIRCLE_RESOLUTION); if (multitouch) ofHideCursor(); ofApp::language = ofApp::getSystemLanguage(); ofLogNotice() << "Language is " << ofApp::language; initTranslations(); initModules(); setupModules(); loadModuleSounds(); initImages(); appState = ABOUT; inactivityState = ACTIVE; // init global vars aboutY = 0; splashAlpha = 255; arrowDownY = ofGetHeight()/3*2; arrowDownYBase = arrowDownY; arrowDownDir = 1; showSwipeInfo = true; ofApp::maxParticleY = round(ofGetHeight() * (1-LIMIT_PARTICLE)); uint swipeFontSize; if (isTablet()) swipeFontSize = 26; else swipeFontSize = 20; swipeFont.load(UI_FONT_FACE, swipeFontSize); }