Esempio n. 1
0
int resolveproto(const char *proto)
{
    struct protoent *protocol;
    protocol = getprotobyname(proto);
    if (!protocol) {
        LFATAL("resolveproto : getprotobyname failed for %s", proto);
        return -1;
    }

    return protocol->p_proto;
}
Esempio n. 2
0
bool loadDictionaryFromString(
    const std::string& script,
    ghoul::Dictionary& dictionary,
    lua_State* state
    )
{
    const static std::string _loggerCat = "lua_loadDictionaryFromString";

    if (state == nullptr) {
        if (_state == nullptr) {
            LDEBUG("Creating Lua state");
            _state = luaL_newstate();
            if (_state == nullptr) {
                LFATAL("Error creating new Lua state: Memory allocation error");
                return false;
            }
            LDEBUG("Open libraries");
            luaL_openlibs(_state);
        }
        state = _state;
    }

    LDEBUG("Loading dictionary script '" << script.substr(0, 12) << "[...]'");
    int status = luaL_loadstring(state, script.c_str());
    if (status != LUA_OK) {
        LERROR("Error loading script: '" << lua_tostring(state, -1) << "'");
        return false;
    }

    LDEBUG("Executing script");
    if (lua_pcall(state, 0, LUA_MULTRET, 0)) {
        LERROR("Error executing script: " << lua_tostring(state, -1));
        return false;
    }

    if (lua_isnil(state, -1)) {
        LERROR("Error in script: '" << script.substr(0, 12)
                                    << "[...]'. Script did not return anything.");
        return false;
    }

    if (!lua_istable(state, -1)) {
        LERROR("Error in script: '" << script.substr(0, 12)
                                    << "[...]'. Script did not return a table.");
        return false;
    }

    luaDictionaryFromState(state, dictionary);

    // Clean up after ourselves by cleaning the stack
    lua_settop(state, 0);

    return true;
}
Esempio n. 3
0
// ######################################################################
std::string convertToString(const MapCombineType typ)
{
  switch (typ)
    {
    case MAPCOMBINE_SUM: return "Sum"; break;
    case MAPCOMBINE_MAX: return "Max"; break;
    }

  LFATAL("invalid MapCombineType '%d'", int(typ));
  /* can't happen */ return std::string();
}
ForegroundDetectionChannel::ForegroundDetectionChannel(OptionManager& mgr) :
  SingleChannel(mgr, "ForegroundDetectionChannel", "ForegroundDetectionChannel", FOREGROUND, rutz::shared_ptr<PyrBuilder<float> >()),
  itsMap(),
  itsLevelSpec(&OPT_LevelSpec, this)
{
#ifdef HAVE_OPENCV
  itsStatModel_cv = NULL;
#else
  LFATAL("OpenCV is needed for Foreground Detection Channel!");
#endif
}
// ######################################################################
Dims ForegroundDetectionChannel::getMapDims() const
{
  if (!this->hasInput())
    LFATAL("Oops! I haven't received any input yet");

  const Dims indims = this->getInputDims();

  return Dims(indims.w() >> itsLevelSpec.getVal().mapLevel(),
              indims.h() >> itsLevelSpec.getVal().mapLevel());

}
Esempio n. 6
0
// ######################################################################
void QuickTimeGrabber::start1()
{
  FrameIstream::start1();

#ifndef HAVE_QUICKTIME_QUICKTIME_H
  LFATAL("you must have QuickTime installed to use QuickTimeGrabber");
#else
  ASSERT(rep == 0);
  rep = new Impl(itsDims.getVal());
#endif
}
Esempio n. 7
0
bool CLCommandQueue::initialize(cl_context context, cl_device_id device) {
    int err = 0;
    _commands = std::make_shared<cl_command_queue>(clCreateCommandQueue(context, device, 0, &err));
    
    if (err != CL_SUCCESS) {
        LFATAL("Could not create program queue: " << getErrorString(err));
        _commands = 0;
        return false;
    }
    return true;
}
Esempio n. 8
0
cl_event CLCommandQueue::enqueueReleaseGLObjects(std::vector<cl_mem> glObjects) {
	int err = 0;
	cl_event event = 0;

	if (glObjects.size() > 0) {
		err = clEnqueueReleaseGLObjects(*_commands, glObjects.size(), &glObjects[0], 0, NULL, &event);
		if (err != 0) {
			LFATAL("Could not aquire GL object: " << getErrorString(err));
		}
	}
	return event;
}
Esempio n. 9
0
int socketaddr_host(struct sockaddr_in *socketaddr, const char *host)
{
    struct hostent *hostaddr;
    hostaddr = gethostbyname(host);
    if (!hostaddr) {
        LFATAL("socketaddr_host: gethostbyname failed for %s", host);
        return -1;
    }

    memcpy(&socketaddr->sin_addr, hostaddr->h_addr, hostaddr->h_length);
    return 0;
}
Esempio n. 10
0
// ######################################################################
void DirectFeedChannel::doInput(const InputFrame& inframe)
{
  if (inframe.grayFloat().initialized()) LINFO("using bwimg");
  else if (inframe.colorFloat().initialized()) LINFO("using colimg");
  else LFATAL("Need to have either colimg or bwimg as input!");

  itsInputTime = inframe.time();

  LDEBUG("itsInputTime: %fms", itsInputTime.msecs());

  if (itsInputTime != itsPyrTime)
    LFATAL("I don't have any direct-feed input for time=%fms "
           "(last input was at time=%fms)",
           itsInputTime.msecs(), itsPyrTime.msecs());

  const float fac = pow(0.5f,float(itsMapLevel.getVal()));
  itsMapDims = Dims(int(this->getInputDims().w()*fac),
                    int(this->getInputDims().h()*fac));
  LDEBUG("itsMapDims = %s; itsInputDims = %s",toStr(itsMapDims).c_str(),
        toStr(this->getInputDims()).c_str());
}
Esempio n. 11
0
void NeuralSimModule<T>::update(const SimTime& time)
{
  //reset module if its currently not valid
  if (!itsStructure.is_valid())
    LFATAL("The module must recieve input before it updated.");
  
  for (uint ii = 0; ii < itsInput.size(); ++ii)
    if (itsInput.getImage(ii).initialized())
      itsStructure->input(itsInput.getImage(ii)*itsInputGain[ii], ii - 1); 
  
  itsStructure->evolve(time);
}
Esempio n. 12
0
// ######################################################################
Rectangle BitObject::getBoundingBox(const BitObject::Coords coords) const
{
  switch(coords)
    {
    case OBJECT: return Rectangle::tlbrI(0, 0, itsBoundingBox.height() - 1,
                                  itsBoundingBox.width() - 1);
    case IMAGE: return itsBoundingBox;
    default: LFATAL("Unknown Coords type - don't know what to do.");
    }
  //this is never reached but we have to make the compiler happy
  return Rectangle();
}
Esempio n. 13
0
// ######################################################################
void EyeTrackerEyeLink::setBackgroundColor(nub::soft_ref<PsychoDisplay> d)
{
#ifndef HAVE_EYELINK
  LFATAL("Proprietary EyeLink developer API not installed");
#else
	SDL_Color bgcolor = { d->getGrey().red(), d->getGrey().green(), d->getGrey().blue()};
	SDL_Color fgcolor = { 192, 192, 192};
	
	set_calibration_colors(&fgcolor, &bgcolor);
	LINFO("RGB: %i %i %i", d->getGrey().red(), d->getGrey().green(), d->getGrey().blue());
#endif
}
Esempio n. 14
0
// ######################################################################
void TaskRelevanceMapGistClassify::
getPCAMatrix()
{
  FILE* itsFile = fopen(itsPCAMatrixName.getVal().c_str(), "rb");
  ASSERT(itsFile != 0);

  int gistDims = 0;
  if(fread(&gistDims, sizeof(int), 1, itsFile) != 1) LFATAL("fread failed");

  Image<float> matrixTmp(gistDims, itsPCADims.getVal(), NO_INIT);
  size_t sz = itsPCADims.getVal()*gistDims;
  if(fread(matrixTmp.beginw(), sizeof(float), sz, itsFile) != sz) LFATAL("fread failed"); 

  itsPCAMatrix = transpose(matrixTmp);

  LDEBUG("itsPCAMatrix first 5 num: %f, %f, %f, %f, %f", itsPCAMatrix.getVal(0,0),
        itsPCAMatrix.getVal(1,0), itsPCAMatrix.getVal(2,0),
        itsPCAMatrix.getVal(3,0), itsPCAMatrix.getVal(4,0));

  fclose(itsFile);
}
// ######################################################################
void SaccadeControllerEyeConfigurator::
paramChanged(ModelParamBase* const param,
             const bool valueChanged,
             ParamClient::ChangeStatus* status)
{
  ModelComponent::paramChanged(param, valueChanged, status);

  // was that a change of our baby's name?
  if (param == &itsSacCtrlType) {
    // if we had one, let's unregister it (when we later reset() the
    // nub::ref, the current SaccadeController will unexport its
    // command-line options):
    removeSubComponent(*itsSC);

    // instantiate a controller of the appropriate type:
    if (itsSacCtrlType.getVal().compare("None") == 0 ||
        itsSacCtrlType.getVal().compare("Stub") == 0)
      itsSC.reset(new StubSaccadeController(getManager(),
                                            SaccadeBodyPartEye));
    else if (itsSacCtrlType.getVal().compare("Trivial") == 0)
      itsSC.reset(new TrivialSaccadeController(getManager(),
                                               SaccadeBodyPartEye));
    else if (itsSacCtrlType.getVal().compare("Fixed") == 0)
      itsSC.reset(new FixedSaccadeController(getManager(),
                                             SaccadeBodyPartEye));
    else if (itsSacCtrlType.getVal().compare("Friction") == 0)
      itsSC.reset(new FrictionSaccadeController(getManager(),
                                                SaccadeBodyPartEye));
    else if (itsSacCtrlType.getVal().compare("Threshold") == 0)
      itsSC.reset(new ThresholdSaccadeController(getManager(),
                                                 SaccadeBodyPartEye));
    else if (itsSacCtrlType.getVal().compare("Threshfric") == 0)
      itsSC.reset(new ThresholdFrictionSaccadeController(getManager(),
                                                         SaccadeBodyPartEye));
    else
      LFATAL("Unknown eye SaccadeController type %s",
             itsSacCtrlType.getVal().c_str());

    // add our baby as a subcomponent of us so that it will become
    // linked to the manager through us (hopefully we are registered
    // with the manager), which in turn will allow it to export its
    // command-line options and get configured:

    addSubComponent(itsSC);

    // tell the controller to export its options:
    itsSC->exportOptions(MC_RECURSE);

    // some info message:
    LINFO("Selected Eye SC of type %s", itsSacCtrlType.getVal().c_str());
  }
}
Esempio n. 16
0
compr *lzo_decompress(unsigned char *buf, int buflen)
{
    int r;
    lzo_bytep in;
    lzo_bytep out;
    lzo_bytep wrkmem;
    lzo_uint out_len = 0;
    lzo_uint in_len = 0;
    compr *retdata;

    FUNC;

    pthread_mutex_lock(&lzo_mutex);
    retdata = s_malloc(sizeof(compr));
 
    in_len = buflen-1;
    in = (lzo_bytep) &buf[1];
    out = (lzo_bytep) lzo_malloc(BLKSIZE);
    wrkmem = (lzo_bytep) lzo_malloc(LZO1A_MEM_COMPRESS);        //FASTER
    if (in == NULL || out == NULL || wrkmem == NULL) {
        LFATAL("out of memory\n");
        exit(3);
    }

    r = lzo1a_decompress(in, in_len, out, &out_len, NULL);
    if (r != LZO_E_OK) {
        /* this should NEVER happen */
        LFATAL("internal error - decompression failed: %d\n", r);
        exit(22);
    }

    retdata->data = s_malloc(out_len);
    retdata->size = out_len;
    memcpy(retdata->data, out, out_len);
    lzo_free(wrkmem);
    lzo_free(out);
    pthread_mutex_unlock(&lzo_mutex);
    return retdata;
}
Esempio n. 17
0
// ######################################################################
void BeoWebServer::writeToLogFile(std::string line)
{
    its_logFilename_mutex.lock();
    FILE *rFile = fopen(itsLogFilename.c_str(), "at");
    if (rFile != NULL)
    {
        fputs(line.c_str(), rFile);
        fclose (rFile);
    }
    else LFATAL("can't append to file: %s", itsLogFilename.c_str());

    its_logFilename_mutex.unlock();
}
Esempio n. 18
0
lua_State* createNewLuaState() {
    const std::string _loggerCat = "createNewLuaState";
    lua_State* s;
    LDEBUG("Creating Lua state");
    s = luaL_newstate();
    if (s == nullptr) {
        LFATAL("Error creating new Lua state: Memory allocation error");
        return nullptr;
    }
    LDEBUG("Open libraries");
    luaL_openlibs(s);
    return s;
}
Esempio n. 19
0
//// ######################################################################
bool Bayes::load(const char *filename)
{
  int fd;

  if ((fd = open(filename, 0644)) == -1) {
    printf("Can not open %s for reading\n", filename);
    return false;
  }

  itsNumClasses = 0;
  itsNumFeatures = 0;
  //read the #  Features and Classes
  if(read(fd, &itsNumFeatures, sizeof(uint)) != sizeof(uint)) LFATAL("Failed to read from: %s", filename);
  if(read(fd, &itsNumClasses, sizeof(uint)) != sizeof(uint)) LFATAL("Failed to read from: %s", filename);

  //read the class freq
  itsClassFreq.clear();
  itsClassFreq.resize(itsNumClasses);
  itsClassNames.resize(itsNumClasses);

  for(uint i=0; i<itsNumClasses; i++)
  {
    if(read(fd, &itsClassFreq[i], sizeof(uint64)) != sizeof(uint64)) LFATAL("Failed to read from: %s", filename);

    uint clsNameLength;
    if(read(fd, &clsNameLength, sizeof(uint)) != sizeof(uint)) LFATAL("Failed to read from: %s", filename);
    char clsName[clsNameLength];
    int sz = sizeof(char)*clsNameLength;
    if(read(fd, &clsName, sz) != sz) LFATAL("Failed to read from: %s", filename);
    itsClassNames[i] = std::string(clsName);
  }


  //Write the mean and stdev
  itsMean.clear();
  itsMean.resize(itsNumClasses, std::vector<double>(itsNumFeatures,0));

  itsStdevSq.clear();
  itsStdevSq.resize(itsNumClasses, std::vector<double>(itsNumFeatures,0));

  for(uint cls=0; cls<itsNumClasses; cls++)
  {
    for (uint i=0; i<itsNumFeatures; i++) //get the posterior prob
    {
      if(read(fd, &itsMean[cls][i], sizeof(double)) != sizeof(double)) LFATAL("Failed to read from: %s", filename);
      if(read(fd, &itsStdevSq[cls][i], sizeof(double)) != sizeof(double)) LFATAL("Failed to read from: %s", filename);
    }
  }

  close(fd);

  return true;
}
Esempio n. 20
0
// ######################################################################
void EyeTrackerEyeLink::openSDL()
{
#ifdef HAVE_EYELINK
  // set the display characteristics:
	DISPLAYINFO di;
  di.width = itsDims.getVal().w(); di.height = itsDims.getVal().h();
  di.left = 0; di.top = 0; di.right = di.width-1; di.bottom = di.height-1;
  di.bits = 24; di.palsize = 0; di.pages = 0; di.refresh = 60.0F;
  di.winnt = 0;

  // open the display with our wishes:
  if (init_expt_graphics(NULL, &di))
    LFATAL("Cannot open display");

  // see what we actually got:
  get_display_information(&di);
  LINFO("DISPLAYINFO: [%dx%d}: (%d,%d)-(%d,%d) %dbpp %.1fHz",
        int(di.width), int(di.height), int(di.left), int(di.top),
        int(di.right), int(di.bottom), int(di.bits), di.refresh);
  if (di.palsize) LFATAL("Paletized color modes not supported");

  // Prepare for calibration and other settings:
  set_target_size(10, 2);
  set_calibration_colors(&target_foreground_color, &target_background_color);
  set_cal_sounds(const_cast<char*>(""), const_cast<char*>(""), const_cast<char*>(""));
  set_dcorr_sounds(const_cast<char*>(""), const_cast<char*>("off"), const_cast<char*>("off"));

  // Setup calibration type:
  eyecmd_printf(const_cast<char*>("calibration_type = HV9"));

  // Configure tracker for display:
  eyecmd_printf(const_cast<char*>("screen_pixel_coords = %ld %ld %ld %ld"),
                di.left, di.top, di.right, di.bottom);

        if (di.refresh > 40.0F)
    eyemsg_printf(const_cast<char*>("FRAMERATE %1.2f Hz."), di.refresh);
#endif
}
Esempio n. 21
0
// ##############################################################################################################
void jevois::VideoDisplay::send(jevois::RawImage const & img)
{
  // OpenCV uses BGR color for display:
  cv::Mat imgbgr;

  // Convert the image to openCV and to BGR:
  switch (img.fmt)
  {
  case V4L2_PIX_FMT_YUYV:
  {
    cv::Mat imgcv(img.height, img.width, CV_8UC2, img.buf->data());
    cv::cvtColor(imgcv, imgbgr, CV_YUV2BGR_YUYV);
  }
  break;

  case V4L2_PIX_FMT_GREY:
  {
    cv::Mat imgcv(img.height, img.width, CV_8UC1, img.buf->data());
    cv::cvtColor(imgcv, imgbgr, CV_GRAY2BGR);
  }
  break;

  case V4L2_PIX_FMT_SRGGB8:
  {
    cv::Mat imgcv(img.height, img.width, CV_8UC1, img.buf->data());
    cv::cvtColor(imgcv, imgbgr, CV_BayerBG2BGR);
  }
  break;

  case V4L2_PIX_FMT_RGB565:
  {
    cv::Mat imgcv(img.height, img.width, CV_8UC2, img.buf->data());
    cv::cvtColor(imgcv, imgbgr, CV_BGR5652BGR);
  }
  break;

  default: LFATAL("Unsupported video format");
  }
      
  // Display image:
  cv::imshow(itsName, imgbgr);

  // OpenCV needs this to actually update the display. Delay is in millisec:
  cv::waitKey(1);

  // Just push the buffer back into our queue. Note: we do not bother clearing the data or checking that the image is
  // legit, i.e., matches one that was obtained via get():
  itsImageQueue.push(img);
  LDEBUG("Empty image " << img.bufindex << " ready for filling in by application code");
}
Esempio n. 22
0
// ######################################################################
void PrimaryMotorCortexI::updateMessage(const RobotSimEvents::EventMessagePtr& eMsg,
    const Ice::Current&)
{
  if(eMsg->ice_isA("::RobotSimEvents::ActionMessage"))
  {
    RobotSimEvents::ActionMessagePtr actionMsg = RobotSimEvents::ActionMessagePtr::dynamicCast(eMsg);

    if (!itsRobot)
      LFATAL("Invalid robot proxy");

    itsRobot->setSteering(actionMsg->rotVel);
    itsRobot->setSpeed(actionMsg->transVel);
  }
}
Esempio n. 23
0
int clientconnect(const char *host, const char *port, const char *proto)
{
    struct sockaddr_in socketaddr;
    int sockid;

    socketaddr_init(&socketaddr);
    socketaddr_service(&socketaddr, port, proto);
    socketaddr_host(&socketaddr, host);

    sockid = socket(PF_INET, prototype(proto), resolveproto(proto));
    if (sockid < 0) {
        LFATAL("clientconnect socket failed, %s", strerror(errno));
        return -1;
    }

    if (connect
        (sockid, (struct sockaddr *) &socketaddr,
         sizeof(socketaddr)) < 0) {
        LFATAL("clientconnect connect failed, %s", strerror(errno));
        return -1;
    }
    return sockid;
}
Esempio n. 24
0
// ######################################################################
void TaskRelevanceMapConfigurator::
paramChanged(ModelParamBase* const param,
             const bool valueChanged,
             ParamClient::ChangeStatus* status)
{
  ModelComponent::paramChanged(param, valueChanged, status);

  // was that a change of our baby's name?
  if (param == &itsTRMtype) {
    // if we had one, let's unregister it (when we later reset() the
    // nub::ref, the current TaskRelevanceMap will unexport its
    // command-line options):
    removeSubComponent(*itsTRM);

    // instantiate a SM of the appropriate type:
    if (itsTRMtype.getVal().compare("None") == 0 ||
        itsTRMtype.getVal().compare("Stub") == 0) // no TRM
      itsTRM.reset(new TaskRelevanceMapStub(getManager()));
    else if (itsTRMtype.getVal().compare("Std") == 0)          // standard
      itsTRM.reset(new TaskRelevanceMapStd(getManager()));
    else if (itsTRMtype.getVal().compare("KillStatic") == 0)   // kill-static
      itsTRM.reset(new TaskRelevanceMapKillStatic(getManager()));
    else if (itsTRMtype.getVal().compare("KillN") == 0)        // kill-n
      itsTRM.reset(new TaskRelevanceMapKillN(getManager()));
    else if (itsTRMtype.getVal().compare("GistClassify") == 0) // gist-classify
      itsTRM.reset(new TaskRelevanceMapGistClassify(getManager()));
    else if (itsTRMtype.getVal().compare("Tigs") == 0) // Tigs
      itsTRM.reset(new TaskRelevanceMapTigs(getManager()));
    else if (itsTRMtype.getVal().compare("Tigs2") == 0) // Tigs(gist and pca image)
      itsTRM.reset(new TaskRelevanceMapTigs2(getManager()));
    else if (itsTRMtype.getVal().compare("Social") == 0) // Social(requires XML of data)
      itsTRM.reset(new TaskRelevanceMapSocial(getManager()));
    else
      LFATAL("Unknown TRM type %s", itsTRMtype.getVal().c_str());

    // add our baby as a subcomponent of us so that it will become
    // linked to the manager through us (hopefully we are registered
    // with the manager), which in turn will allow it to export its
    // command-line options and get configured:

    addSubComponent(itsTRM);

    // tell the controller to export its options:
    itsTRM->exportOptions(MC_RECURSE);

    // some info message:
    LINFO("Selected TRM of type %s", itsTRMtype.getVal().c_str());
  }
}
Esempio n. 25
0
// ######################################################################
Image<float> mapCombine(const MapCombineType typ,
                        const Image<float>& a, const Image<float>& b)
{
  // a+[] -> a; []+b -> b
  if (!a.initialized())
    return b;
  else if (!b.initialized())
    return a;

  if (a.getDims() != b.getDims())
    LFATAL("can't combine images of unequal dimensions "
           "%dx%d and %dx%d",
           a.getWidth(), a.getHeight(), b.getWidth(), b.getHeight());

  switch (typ)
    {
    case MAPCOMBINE_SUM: return a + b; break;
    case MAPCOMBINE_MAX: return takeMax(a, b); break;
    }

  LFATAL("invalid MapCombineType '%d'", int(typ));

  /* can't happen */ return Image<float>();
}
Esempio n. 26
0
static void load_data() {
    int error;
    FILE *input = 0;
    LINFO("loading from the file: '%s'", config.worker.data_file);
    if ((input = fopen(config.worker.data_file, "r"))) {
        if (!rooms_deserialize(&config.rooms, input, 10000)) {
            LFATAL("deserialization failure, probably disk error/version mismatch;\n"
                   "please rename or remove the data file to start from scratch");
        }
        fclose(input);
    } else {
        error = errno;
        LERRNO("failed to load data", error);
    }
}
Esempio n. 27
0
int main(int argc, const char* argv[])
{
   MYLOGVERB = LOG_INFO ; // suppress debug messages
   try
   {
      ContextBasedSimulation S("train-gecb Model") ;
      S.parse_command_line(argc, argv) ;
      S.run() ;
   }
   catch (std::exception& e)
   {
     LFATAL("%s", e.what()) ;
      return 1 ;
   }
   return 0 ;
}
Esempio n. 28
0
void GUI::handleButtonPress() {
    // Get the QObject that triggered this signal
    QObject* sender = QObject::sender();

    // Determine which callback to call with which parameters
    if (sender == _sourcePointButton)
        _sourceAddedCallback(SourceType::Point, sourcePosition(), sourceValue());
    else if (sender == _sourceConeButton)
        _sourceAddedCallback(SourceType::Cone, sourcePosition(), sourceValue());
    else if (sender == _effectGravityButton)
        _effectAddedCallback(EffectType::Gravity, effectPosition(), effectValue());
    else if (sender == _effectWindButton)
        _effectAddedCallback(EffectType::Wind, effectPosition(), effectValue());
    else
        LFATAL("Missing handler for button press");
}
Esempio n. 29
0
// ######################################################################
void convertFromString(const std::string& str1, RescaleType& ftype)
{
  const std::string str = toLowerCase(str1);

  if      (str.compare("nointerp") == 0) ftype = RESCALE_SIMPLE_NOINTERP;
  else if (str.compare("bilinear") == 0) ftype = RESCALE_SIMPLE_BILINEAR;
  else if (str.compare("box") == 0)      ftype = RESCALE_FILTER_BOX     ;
  else if (str.compare("triangle") == 0) ftype = RESCALE_FILTER_TRIANGLE;
  else if (str.compare("bell") == 0)     ftype = RESCALE_FILTER_BELL    ;
  else if (str.compare("bspline") == 0)  ftype = RESCALE_FILTER_BSPLINE ;
  else if (str.compare("hermite") == 0)  ftype = RESCALE_FILTER_HERMITE ;
  else if (str.compare("lanczos3") == 0) ftype = RESCALE_FILTER_LANCZOS3;
  else if (str.compare("mitchell") == 0) ftype = RESCALE_FILTER_MITCHELL;
  else
    LFATAL("invalid rescale type '%s'", str1.c_str());
}
Esempio n. 30
0
// ######################################################################
void EyeTrackerEyeLink::manualDriftCorrection(Point2D<double> eyepos, 
								                              Point2D<double> targetpos)
{
#ifndef HAVE_EYELINK
  LFATAL("Proprietary EyeLink developer API not installed");
#else
	char message[256];
	eyecmd_printf(const_cast<char*>("drift_correction %ld %ld %ld %ld"), 
									                 targetpos.i-eyepos.i, targetpos.j-eyepos.j,
																	 targetpos.i, targetpos.j);

	// Get drift correction result
	eyelink_cal_message(message);
	eyemsg_printf(message);
#endif
}