当前位置: 首页>>代码示例>>C++>>正文


C++ AffineTransform::computeTransform方法代码示例

本文整理汇总了C++中AffineTransform::computeTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ AffineTransform::computeTransform方法的具体用法?C++ AffineTransform::computeTransform怎么用?C++ AffineTransform::computeTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AffineTransform的用法示例。


在下文中一共展示了AffineTransform::computeTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: submain

// ######################################################################
static int submain(const int argc, char** argv)
{

        MYLOGVERB = LOG_INFO;  // suppress debug messages



// Instantiate a ModelManager:
 ModelManager manager("test get eye position");

 nub::soft_ref<EyeTrackerConfigurator>
   etc(new EyeTrackerConfigurator(manager));
 manager.addSubComponent(etc);

 nub::soft_ref<EventLog> el(new EventLog(manager));
 manager.addSubComponent(el);

 nub::soft_ref<PsychoDisplay> d(new PsychoDisplay(manager));
 manager.addSubComponent(d);


 manager.setOptionValString(&OPT_EventLogFileName, "psychodata.psy");
 manager.setOptionValString(&OPT_EyeTrackerType, "ISCAN");

 // Parse command-line:
 if (manager.parseCommandLine(argc, argv, "", 0, 0) == false)
   return(1);


 // hook our various babies up and do post-command-line configs:
 nub::soft_ref<EyeTracker> et = etc->getET();
 et->setEventLog(el);

 // let's get all our ModelComponent instances started:
 manager.start();

 d->setEyeTracker(et);
 d->setEventLog(el);

 el->pushEvent(std::string("===== Trial 1:  ====="));

 //lets time stamp event log and start the eyetracker
 //et->track(true);
 //here we will start testing the get pos

 LINFO("eyescanner started going to start reading stuff");
//  int i=0;

 d->clearScreen();
 d->displayISCANcalib();
 d->waitForKey();

 Image< PixRGB<byte> > displayImage (1920,1080, ZEROS);
 drawCircle(displayImage, Point2D<int>(1920/2,1080/2), 5, PixRGB<byte>(255,0,0));

 SDL_Surface *surf = d->makeBlittableSurface(displayImage, true);
 d->displaySurface(surf, -2);

 CalibrationTransform::Data pts;
 AffineTransform a;
 Image<double> txf;
 Point2D<int> testpoint;
 Point2D<double> testpointCalib,testpointD;

     LINFO("precalib");
     pts = et->getCalibrationSet(d);
     LINFO("postcalib");
     txf = a.computeTransform(pts);
     LINFO("transform is...");
     std::cerr << txf << std::endl;
     testpoint =  et->getEyePos();
     testpointD = Point2D<double>(testpoint);
     LINFO("\n testpoint %d,%d",testpoint.i,testpoint.j);
     testpointCalib = a.getCalibrated(testpointD);
     LINFO("\n testpoint %d,%d, calibrated %f,%f",testpoint.i,testpoint.j,testpointCalib.i,testpointCalib.j);
     d->clearScreen();

   //now for a live demo of real time eyetracking
   char tmp[40];

   //SDL_Surface *surf2;

   while(d->checkForKey() < 0)
   {
     displayImage.clear();
     testpoint =  et->getEyePos();
     testpointD = Point2D<double>(testpoint);
     testpointCalib = a.getCalibrated(testpointD);
     LINFO("\n testpoint %d,%d, calibrated %f,%f",testpoint.i,testpoint.j,testpointCalib.i,testpointCalib.j);
     drawCircle(displayImage, Point2D<int>(testpointCalib), 2, PixRGB<byte>(255,0,0));
     sprintf(tmp,"(%d,%d)",(int)testpointCalib.i,(int)testpointCalib.j);
     writeText(displayImage,Point2D<int>(testpointCalib),tmp,PixRGB<byte>(255,0,0),PixRGB<byte>(0,0,0),SimpleFont::FIXED(8));
     // d->displayImage(displayImage, true, PixRGB<byte>(), -2);
      SDL_Surface *surf2 = d->makeBlittableSurface(displayImage, true);
      d->displaySurface(surf2, -2);
      SDL_FreeSurface(surf2);
//     i++;

   }
//.........这里部分代码省略.........
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:101,代码来源:testGetPos.C


注:本文中的AffineTransform::computeTransform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。