本文整理汇总了C++中YARPImageOf类的典型用法代码示例。如果您正苦于以下问题:C++ YARPImageOf类的具体用法?C++ YARPImageOf怎么用?C++ YARPImageOf使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了YARPImageOf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialise
YARPOrientation::YARPOrientation(const YARPImageOf<YarpPixelMono> &image)
{
nAng = image.GetHeight() ;
nEcc = image.GetWidth() ;
rfMin = 0.31 ;
initialise() ;
}
示例2: ReconstructGrays
int YARPLogpolar::ReconstructGrays (const YARPImageOf<YarpPixelMono>& in, YARPImageOf<YarpPixelMono>& out)
{
using namespace _logpolarParams;
Reconstruct_Grays((unsigned char *)out.GetRawBuffer(), (unsigned char *)in.GetRawBuffer(), _srho, _stheta, _img.padding, _weightsMap, _img.Pix_Numb);
return YARP_OK;
}
示例3: Segment
//
// only find object_no.
//
int YARPObjectContainer::Segment (int object_no, YARPImageOf<YarpPixelBGR>& scan, YARPImageOf<YarpPixelBGR>& out, int& xx, int& yy)
{
if (!m_active)
{
printf ("YARPObjectContainer: need to update stats first\n");
out.PeerCopy(scan);
xx = yy = 0;
return -1;
}
double x, y, quality;
m_locator[object_no].BackProject (scan, m_backp[object_no]);
double ex, ey;
m_locator[object_no].GetExtent (ex, ey);
ex *= SCALE;
ey *= SCALE;
bool valid = false;
if (m_locator[object_no].Find (ex, ey, x, y, quality) >= 0)
{
double mean = 0, stddev = 0;
const double THR = 4.0; // it was 2.0
m_locator[object_no].GetExpectancy (mean, stddev);
valid = (fabs(quality - mean) < stddev * THR) ? true : false;
#ifdef _DEBUG
printf ("object: %d location: %lf %lf q: %lf\n", object_no, x, y, quality);
#endif
}
if (valid)
{
YarpPixelBGR red;
red.r = 255;
red.g = red.b = 0;
double betterx = x;
double bettery = y;
AddRectangle (m_backp[object_no], red, int(betterx+.5), int(bettery+.5), int (ex/2+.5), int (ey/2+.5));
//AddCircleOutline (m_backp[object_no], red, int(max_x+.5), int(max_y+.5), 10);
AddCircle (m_backp[object_no], red, int(betterx+.5), int(bettery+.5), 5);
// return processed image.
out.PeerCopy (m_backp[object_no]);
xx = int (betterx + .5);
yy = int (bettery + .5);
}
else
{
xx = yy = 0;
}
return (valid) ? 0 : -1;
}
示例4: GetShiftedImage
void YARPLpShifter::GetShiftedImage(const YARPImageOf<YarpPixelRGB>& im1, YARPImageOf<YarpPixelRGB>& dst, double * shift)
{
unsigned char **src1p0 = (unsigned char **)im1.GetArray();
unsigned char **src2p0 = (unsigned char **)dst.GetArray();
// shift (xi, eta);
int xi = int (shift[0] + .5);
int eta = int (shift[1] + .5);
assert (xi >= 0 && xi < lut_size && eta >= 0 && eta < nAng);
int i,j,i1,j1,jt;
for(i=0; i<nEcc; i++)
for(j=0; j<nAng; j++)
{
jt = (j + eta) % nAng;
i1 = lut[xi][i][jt].ecc;
j1 = lut[xi][i][jt].ang;
j1=(j1 + nAng - eta) % nAng;
if (i1>=0)
{
src2p0[j][i*3] = src1p0[j1][i1*3];
src2p0[j][i*3+1] = src1p0[j1][i1*3+1];
src2p0[j][i*3+2] = src1p0[j1][i1*3+2];
}
else
{
src2p0[j][i*3] = 0;
src2p0[j][i*3+1] = 0;
src2p0[j][i*3+2] = 0;
}
}
}
示例5: int
int
YARPFlowTracker::CenterOfMass (YARPImageOf<YarpPixelMono>& in, int& x, int& y)
{
double xx = 0, yy = 0;
int count = 0;
for (int i = 0; i < in.GetHeight(); i++)
for (int j = 0; j < in.GetWidth(); j++)
{
if (in(j, i) != 0)
{
xx += j;
yy += i;
count ++;
}
}
if (count != 0)
{
x = int(xx / count + .5);
y = int(yy / count + .5);
}
else
{
x = in.GetWidth()/2;
y = in.GetHeight()/2;
}
return 0;
}
示例6:
int YARPLogpolar::Uniform2Sawt(const YARPImageOf<YarpPixelBGR>& in, YARPImageOf<YarpPixelBGR>& out)
{
using namespace _logpolarParams;
uniform2Sawt((unsigned char *)out.GetRawBuffer(), (unsigned char *)in.GetRawBuffer(), &_img, _padMap);
return YARP_OK;
}
示例7: Apply
void YARPImageTrackTool::Apply(YARPImageOf<YarpPixelBGR>& src)
{
YARPImageOf<YarpPixelBGR> nextImg, blah;
int ox, oy;
if (src.GetWidth() != IMG_W || src.GetHeight() != IMG_H)
{
printf("Image tracking code is old, and specific to %dx%d images\n", IMG_W, IMG_H);
exit(1);
}
nextImg.Refer(src);
if (first)
{
first = 0;
ResetXY();
prevImg3.PeerCopy(nextImg);
delta = 0;
}
else
{
ox = tx;
oy = ty;
ImgInt3& ii1 = *((ImgInt3 *)prevImg3.GetRawBuffer());
ImgInt3& ii2 = *((ImgInt3 *)src.GetRawBuffer());
Apply(ii1, ii2, tx, ty);
if (ox != tx || oy != ty || delta)
{
prevImg3.PeerCopy(nextImg);
delta = 0;
}
}
}
示例8: Apply
void YARPLpHistoSegmentation::Apply(YARPImageOf<YarpPixelHSV> &src)
{
int i;
int j;
unsigned char *h;
unsigned char *s;
unsigned char *v;
for(i = 0; i < src.GetHeight(); i++)
{
h = (unsigned char *) src.GetArray()[i];
s = h+1;
v = h+2;
double w = pSize(1, i);
for(j = 0; j < src.GetWidth(); j++)
{
if (_checkThresholds(*h,*s,*v))
YARP3DHistogram::Apply(*h, *s, 0, w);
h += 3;
s += 3;
v += 3;
}
}
}
示例9: main
int main(int argc, const char *argv[])
{
const char *name = DEFAULT_NAME;
char buf[256];
if (argc>1)
{
name = argv[1];
}
sprintf(buf, "%s/i:img", name);
in_img.Register(buf);
sprintf(buf, "%s/o:img", name);
out_img.Register(buf);
sprintf(buf, "%s/i:mix", name);
in_mix.Register(buf);
sprintf(buf, "%s/o:box", name);
out_data.Register(buf);
box_thread.Begin();
while(1)
{
in_img.Read();
YARPImageOf<YarpPixelBGR> in;
YARPImageOf<YarpPixelBGR> out;
in.Refer(in_img.Content());
out_img.Content().SetID(YARP_PIXEL_BGR);
SatisfySize(in,out_img.Content());
out.Refer(out_img.Content());
Filter(in,out);
out_img.Write();
// YARPTime::DelayInSeconds(1000000);
}
return 0;
}
示例10:
//
// helper.
int
YARPFlowTracker::GrowMask (const YARPImageOf<YarpPixelMono>& src, YARPImageOf<YarpPixelMono>& dest)
{
// block filter 7x7
const int w = segmentation_mask.GetWidth();
const int h = segmentation_mask.GetHeight();
unsigned char *ss = (unsigned char *)src.GetRawBuffer();
dest.Zero();
// save in +2,+2...
unsigned char *s[7];
for (int ll = 0; ll < 7; ll++)
s[ll] = ss+ll*w;
int accum = 0;
for (int i = 0; i < h-7; i++)
{
for (int j = 0; j < w-7; j++)
{
accum = 0;
for (int k = 0; k < 7; k++)
{
accum += s[0][k];
accum += s[1][k];
accum += s[2][k];
accum += s[3][k];
accum += s[4][k];
accum += s[5][k];
accum += s[6][k];
}
accum /= 49;
accum = (accum >= 64) ? 255 : 0;
dest (j+3, i+3) = accum;
s[0] ++;
s[1] ++;
s[2] ++;
s[3] ++;
s[4] ++;
s[5] ++;
s[6] ++;
}
ss += w;
s[0] = ss;
s[1] = s[0]+w;
s[2] = s[1]+w;
s[3] = s[2]+w;
s[4] = s[3]+w;
s[5] = s[4]+w;
s[6] = s[5]+w;
}
return 0;
}
示例11: PasteInto
void YARPImageUtils::PasteInto (const YARPImageOf<YarpPixelMono>& src, int x, int y, int zoom, YARPImageOf<YarpPixelMono>& dst)
{
char *bs = dst.GetRawBuffer ();
IplImage *ipl = src.GetIplPointer ();
const int dh = ipl->height;
const int dw = ipl->width;
char *dsY = ipl->imageData;
int depth = dst.GetPixelSize ();
ACE_ASSERT (depth == ipl->nChannels); // same # of chan.
const int h = dst.GetHeight();
ACE_ASSERT (h >= dh); // same height.
const int w = dst.GetWidth();
ACE_ASSERT (w >= dw); // same width.
const int rem_w = w - dw;
// crude limit check.
ACE_ASSERT (dw * zoom + x < w);
ACE_ASSERT (dh * zoom + y < h);
if (zoom == 1)
{
bs += (y * w);
for (int i = 0; i < dh; i++)
{
memcpy (bs + x, dsY, dw);
bs += w;
dsY += dw;
}
}
else
{
bs += (y * w);
for (int i = 0; i < dh; i++)
{
char * st_row = bs;
bs += x;
for (int j = 0; j < dw; j++)
{
for (int k = 0; k < zoom; k++)
{
*bs++ = *dsY;
}
dsY++;
}
for (int k = 1; k < zoom; k++)
memcpy (st_row + x + w * k, st_row + x, dw * zoom);
bs = st_row + w * zoom;
}
}
}
示例12: Apply
void YARPGaussianFeatures::Apply (const YARPImageOf<YarpPixelMono>& in)
{
assert (in.GetPadding() == 0);
for (int i = 1; i <= m_sigmas; i++)
{
m_features(i) = SpecialConvolveX (m_coeffs[i-1], (const unsigned char *)in.GetAllocatedArray());
m_features(i+m_sigmas) = SpecialConvolveY (m_coeffs[i-1], (const unsigned char *)in.GetAllocatedArray());
}
}
示例13: Resize
int YARPOrientation::Resize(const YARPImageOf<YarpPixelMono> &image)
{
cleanup() ;
nEcc = image.GetWidth() ;
nAng = image.GetHeight() ;
initialise() ;
return true ;
}
示例14: FindCentroid
bool FindCentroid (YARPImageOf<YarpPixelMono>& img, int *x, int *y)
{
char *ptri = img.GetRawBuffer ();
const int w = img.GetWidth ();
const int h = img.GetHeight ();
unsigned char max = 0;
unsigned char *tmp = (unsigned char *)ptri;
for (int i = 0; i < w * h; i++, tmp++)
if (*tmp > max)
{
max = *tmp;
}
int count = 0;
*x = 0;
*y = 0;
for (i = 0; i < h; i++)
{
unsigned char *row = (unsigned char *)ptri + i * w;
for (int j = 0; j < w; j++, row++)
{
if (*row == max)
{
*x += j;
*y += i;
count ++;
}
}
}
if (count != 0)
{
*x /= count;
*y /= count;
}
else
{
*x = img.GetWidth() / 2;
*y = img.GetHeight() / 2;
}
if (max > 0)
return true;
else
return false;
}
示例15: Filter
void Filter(YARPImageOf<YarpPixelBGR>& src,
YARPImageOf<YarpPixelBGR>& dest)
{
FiveBoxesInARow& boxes = out_data.Content();
YARPImageOf<YarpPixelMono> mono;
mono.CastCopy(src);
dest.PeerCopy(src);
trackers.Update(mono,dest,boxes);
out_data.Write();
/*
static ImgTrackTool track;
dest.PeerCopy(src);
track.Apply(dest);
*/
}