本文整理汇总了C++中Point2D::distance方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2D::distance方法的具体用法?C++ Point2D::distance怎么用?C++ Point2D::distance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2D
的用法示例。
在下文中一共展示了Point2D::distance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
}
if (ofs->becameVoid())
{
LINFO("quitting because output stream was closed or became void");
break;
}
if (p.checkPause())
continue;
const FrameState is = ifs->updateNext();
if (is == FRAME_COMPLETE) break; // done receiving frames
Image< PixRGB<byte> > input = ifs->readRGB();
if(frame == 0)
{
uint width = input.getWidth();
uint height = input.getHeight();
win.reset(new XWinManaged(Dims(width, height), 0, 0, "GT"));
}
// empty image signifies end-of-stream
if (!input.initialized()) break;
Image<byte> lum = luminance(input);
Point2D<float> pshift(0.0,0.0);
if(step != 0)
{
// calculate planar shift using SIFT
lum = calculateShift(lum,prevLum, ofs);
}
if( manager.numExtraArgs() > 0)
lum = getImage(stimuli, args, fd, step);
// for saving videos
prevImage2 = prevImage;
prevImage = input;
if (!lum.initialized()) break; step++;
// compute the focus of expansion (FOE)
Point2D<int> foe = fd->getFoe(lum, FOE_METHOD_TEMPLATE, false);
//Point2D<int> foe = fd->getFoe(lum, FOE_METHOD_AVERAGE);
LINFO("[%d]Foe: %d %d", frame, foe.i, foe.j);
// illustration of the size of the receptive field
if(!stimuli.compare("ShowRF"))
{
uint rfI = 44;
uint rfJ = 152;
lum.setVal(rfI, rfJ, 300.0F);
drawRect(lum, Rectangle::tlbrI(144,36,159,51), byte(255));
drawRect(lum, Rectangle::tlbrI(148,40,155,47), byte(255));
drawRect(lum, Rectangle::tlbrI(rfJ-8, rfI-8, rfJ+8, rfI+8), byte(255));
drawRect(lum, Rectangle::tlbrI(rfJ-16,rfI-16,rfJ+16,rfI+16), byte(255));
}
ofs->writeGrayLayout(fd->getMTfeaturesDisplay(lum), "MT Features",
FrameInfo("motion energy output images", SRC_POS));
// write the file
if(frame >= 4)
{
float err = foe.distance(gt[frame-2]);
totalErr += err;
LINFO("Foe: %d %d: GT: %d %d --> %f --> avg: %f",
foe.i, foe.j, gt[frame-2].i, gt[frame-2].j,
err, totalErr/(frame-3));
Image<PixRGB<byte> > simg = prevImage2;
drawCross(simg, foe , PixRGB<byte>(0,255,0), 10, 2);
drawCross(simg, gt[frame-2], PixRGB<byte>(255,0,0), 10, 2);
win->drawImage(simg,0,0);
//Raster::WriteRGB(simg, sformat("%s_STnPS_%06d.ppm", prefix.c_str(), frame-2));
}
//ofs->writeGrayLayout
// (lum, "test-FOE Main", FrameInfo("foe output", SRC_POS));
const FrameState os = ofs->updateNext();
//LINFO("frame[%d]: %8.3f %8.3f", frame, pshift.i, pshift.j);
Raster::waitForKey();
if (os == FRAME_FINAL)
break;
prevLum = lum;
frame++;
}
LINFO("%d frames in %gs (%.2ffps)\n",
frame, timer.getSecs(), frame / timer.getSecs());
// stop all our ModelComponents
manager.stop();
// all done!
return 0;
}