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


C++ YARPImageOf::GetWidth方法代码示例

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


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

示例1: 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;
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:30,代码来源:YARPFlowTracker.cpp

示例2:

/// out -> 256 x 256, in 152 x 256.
///
int YARPLogpolar::Logpolar2Cartesian (const YARPImageOf<YarpPixelBGR>& in, YARPImageOf<YarpPixelBGR>& out)
{
	using namespace _logpolarParams;
	ACE_ASSERT (in.GetWidth() == _stheta && in.GetHeight() == _srho);
	ACE_ASSERT (out.GetWidth() == _xsize && out.GetHeight() == _ysize);

	Remap ((unsigned char *)out.GetRawBuffer(), (unsigned char *)in.GetRawBuffer(), &_img, _remapMap);
	return YARP_OK;
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:11,代码来源:YARPLogpolar.cpp

示例3: Apply

void YARPBlobFinder::Apply(const YARPImageOf<YarpPixelRGB>& is, YARPImageOf<YarpPixelRGB>& id)
{
	// no padding enforced.
	assert (id.GetPadding() == 0);
	assert (is.GetPadding() == 0);
	assert (id.GetHeight() == is.GetHeight() && id.GetWidth() == is.GetWidth());

	// extract the saliency image.
	m_saliency.Apply (is, m_hsv_enhanced);

	_apply (is, id);
}
开发者ID:paulfitz,项目名称:poker,代码行数:12,代码来源:YARPBlobFinder.cpp

示例4: 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;
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:49,代码来源:attention.cpp

示例5: 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;
		}
	}
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:33,代码来源:ImgTrack.cpp

示例6: 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;
		}
	}
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:26,代码来源:YARPHistoSegmentation.cpp

示例7: initialise

YARPOrientation::YARPOrientation(const YARPImageOf<YarpPixelMono> &image)
{
    nAng = image.GetHeight() ;
    nEcc = image.GetWidth() ;
    rfMin = 0.31 ;
    initialise() ;
}
开发者ID:paulfitz,项目名称:poker,代码行数:7,代码来源:YARPOrientation.cpp

示例8: 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;
		}
	}
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:57,代码来源:YARPImageUtils.cpp

示例9: assert

void YARPColorConverter::RGB2Normalized (const YARPImageOf<YarpPixelRGB>& in, YARPImageOf<YarpPixelRGBFloat>& out, float threshold)
{
    assert (out.GetIplPointer() != NULL && in.GetIplPointer() != NULL);
    assert (out.GetHeight() == in.GetHeight());
    assert (out.GetWidth() == in.GetWidth());

    unsigned char *inTmp = (unsigned char *) in.GetAllocatedArray();
    unsigned char *outTmp = (unsigned char *) out.GetAllocatedArray();

    int r = 0;
    int c = 0;
    int padIn = in.GetPadding();
    int padOut = out.GetPadding();

    float lum;
    float *tmp;

    for(r = 0; r<in.GetHeight(); r++)
    {
        for(c = 0; c < in.GetWidth(); c++)
        {
            tmp = (float *) outTmp;
            lum = (float)( inTmp[0] + inTmp[1] + inTmp[2]);
            if (lum > threshold)
            {
                tmp[0] = inTmp[0]/lum;
                tmp[1] = inTmp[1]/lum;
                tmp[2] = inTmp[2]/lum;
            }
            else
            {
                tmp[0] = 0.0;
                tmp[1] = 0.0;
                tmp[2] = 0.0;
            }

            inTmp += 3;
            outTmp += 3*sizeof(float);
        }
        inTmp += padIn;
        outTmp += padOut;
    }

}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:44,代码来源:YARPColorConverter.cpp

示例10: Resize

int YARPOrientation::Resize(const YARPImageOf<YarpPixelMono> &image)
{
    cleanup() ;

    nEcc = image.GetWidth() ;
    nAng = image.GetHeight() ;

    initialise() ;

    return true ;
}
开发者ID:paulfitz,项目名称:poker,代码行数:11,代码来源:YARPOrientation.cpp

示例11: SetPlane

void SetPlane (const YARPImageOf<YarpPixelMono>& in, YARPGenericImage& out, int shift)
{
	ACE_ASSERT (in.GetIplPointer() != NULL && out.GetIplPointer() != NULL);
	ACE_ASSERT (in.GetWidth() == out.GetWidth());
	ACE_ASSERT (in.GetHeight() == out.GetHeight());

	const int width = in.GetWidth();
	const int height = in.GetHeight();

	unsigned char *src = NULL;
	unsigned char *dst = NULL;

	for (int i = 0; i < height; i++)
	{
		src = (unsigned char *)in.GetArray()[i];
		dst = (unsigned char *)out.GetArray()[i] + shift;
		for (int j = 0; j < width; j++)
		{
			*dst = *src++;
			dst += 3;
		}
	}
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:23,代码来源:YARPImageUtils.cpp

示例12: TmpFilter

void TmpFilter (YARPImageOf<YarpPixelMono>& old, YARPImageOf<YarpPixelMono>& img)
{
	char *src = img.GetRawBuffer();
	char *optr = old.GetRawBuffer();
	const int w = img.GetWidth ();
	const int h = img.GetHeight ();

	for (int i = 0; i < w * h; i++)
	{
		*optr = 0.5 * *src++ + 0.5 * *optr;
		optr++;
	}

	memcpy (img.GetRawBuffer(), old.GetRawBuffer(), w * h);
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:15,代码来源:attention.cpp

示例13: GetHash

// very very stupid hash generator.
NetInt32 YARPImageHash::GetHash(YARPImageOf<YarpPixelBGR>& src)
{
  NetInt32 key = 0;
  int y = src.GetHeight()/2;
  int ent = 0;
  for (int x=src.GetWidth()-10; x>=10 && ent<5; x--)
    {
      YarpPixelBGR& pix = src.SafePixel(x,y);
      if ((pix.r>=10 && pix.r<=200) || x<=15)
	{
	  key *= 17;
	  key += pix.r;
	  key *= 17;
	  key += pix.g;
	  key *= 17;
	  key += pix.b;
	  ent++;
	}
    }
  return key;
}
开发者ID:paulfitz,项目名称:poker,代码行数:22,代码来源:YARPImageHash.cpp

示例14: backProjection

void YARPHistoSegmentation::backProjection(YARPImageOf<YarpPixelHSV> &in, YARPImageOf<YarpPixelMono> &out)
{	
	// complete histogram backprojection
	int i;
	int j;
	YarpPixelHSV *src;
	YarpPixelMono *dst;
	for(j = 0; j < in.GetHeight(); j++)
	{
		src = (YarpPixelHSV *) in.GetArray()[j];
		dst = (YarpPixelMono *) out.GetArray()[j];

		for(i = 0; i < in.GetWidth(); i++)
		{
			if (_checkThresholds(src->h, src->s, src->v))
				*dst = (unsigned char)(YARP3DHistogram::backProjection(src->h, src->s, 0)*255 + 0.5);
			else
				*dst = 0;
			
			src++;
			dst++;
		}
	}
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:24,代码来源:YARPHistoSegmentation.cpp

示例15: Write

int YARPImageFile::Write(const char *dest, YARPGenericImage& src, int format)
{
 if (format!=YARPImageFile::FORMAT_NUMERIC)
    {
      return ImageWrite(src,dest);
    }
  YARPImageOf<YarpPixelFloat> flt;
  ofstream fout(dest);
  flt.CastCopy(src);
  for (int i=0; i<flt.GetHeight(); i++)
    {
      for (int j=0; j<flt.GetWidth(); j++)
	{
	  char buf[255];
	  sprintf(buf,"%g ", flt(j,i));
	  fout << buf << " ";
	}
      fout << endl;
    }
  return 0;

  //return ImageWrite(src,dest);
  //return 0;
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:24,代码来源:YARPImageFile.cpp


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