本文整理汇总了C++中yarp::sig::ImageOf::copy方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageOf::copy方法的具体用法?C++ ImageOf::copy怎么用?C++ ImageOf::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yarp::sig::ImageOf
的用法示例。
在下文中一共展示了ImageOf::copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getImage
bool VfwGrabber::getImage(yarp::sig::ImageOf<yarp::sig::PixelRgb>& image) {
icvGrabFrameCAM_VFW(&HELPER(system_resource));
Image *img = icvRetrieveFrameCAM_VFW(&HELPER(system_resource));
//printf("image size %d %d\n", img->width(), img->height());
image.copy(*img);
_width = img->width();
_height = img->height();
return img->width()>0;
}
示例2: createTestImage
void TestFrameGrabber::createTestImage(yarp::sig::ImageOf<yarp::sig::PixelRgb>&
image) {
// to test IPreciselyTimed, make timestamps be mysteriously NNN.NNN42
double t = Time::now();
t -= ((t*1000)-(int)t)/1000;
t+= 0.00042;
stamp.update(t);
if (background.width()>0) {
image.copy(background);
} else {
image.zero();
image.resize(w,h);
}
switch (mode) {
case VOCAB_BALL:
{
addCircle(image,PixelRgb(0,255,0),bx,by,15);
addCircle(image,PixelRgb(0,255,255),bx,by,8);
if (ct%5!=0) {
rnd *= 65537;
rnd += 17;
bx += (rnd%5)-2;
rnd *= 65537;
rnd += 17;
by += (rnd%5)-2;
} else {
int dx = w/2 - bx;
int dy = h/2 - by;
if (dx>0) { bx++; }
if (dx<0) { bx--; }
if (dy>0) { by++; }
if (dy<0) { by--; }
}
}
break;
case VOCAB_GRID:
{
int ww = image.width();
int hh = image.height();
if (ww>1&&hh>1) {
for (int x=0; x<ww; x++) {
for (int y=0; y<hh; y++) {
double xx = ((double)x)/(ww-1);
double yy = ((double)y)/(hh-1);
int r = int(0.5+255*xx);
int g = int(0.5+255*yy);
bool act = (y==ct);
image.pixel(x,y) = PixelRgb(r,g,act*255);
}
}
}
}
break;
case VOCAB_LINE:
default:
{
for (int i=0; i<image.width(); i++) {
image.pixel(i,ct).r = 255;
}
}
break;
case VOCAB_RAND:
{
// from Alessandro Scalzo
static unsigned char r=128,g=128,b=128;
int ww = image.width();
int hh = image.height();
if (ww>1&&hh>1) {
for (int x=0; x<ww; x++) {
for (int y=0; y<hh; y++) {
//r+=(rand()%3)-1;
//g+=(rand()%3)-1;
//b+=(rand()%3)-1;
r += Random::uniform(-1,1);
g += Random::uniform(-1,1);
b += Random::uniform(-1,1);
image.pixel(x,y) = PixelRgb(r,g,b);
}
}
}
}
break;
case VOCAB_NONE:
break;
}
ct++;
if (ct>=image.height()) {
ct = 0;
}
if (by>=image.height()) {
by = image.height()-1;
}
if (bx>=image.width()) {
bx = image.width()-1;
}
if (bx<0) bx = 0;
if (by<0) by = 0;
//.........这里部分代码省略.........