本文整理汇总了C++中Image2D::GetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ Image2D::GetLength方法的具体用法?C++ Image2D::GetLength怎么用?C++ Image2D::GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image2D
的用法示例。
在下文中一共展示了Image2D::GetLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
Raw2D Image2D2Raw2D(Image2D &src)
{
PIXTYPE *data= new PIXTYPE[src.GetLength()];
if (src.PixelType==1)
{
unsigned char* datSrc = (unsigned char*)(src.data);
//PIXTYPE *data= new PIXTYPE[src.GetLength()];
for (int i=0;i<src.GetLength();i++)
{
data[i]=datSrc[i];
}
}
else if (src.PixelType == 2)
{
unsigned short * datSrc = (unsigned short *)(src.data);
//PIXTYPE *data= new PIXTYPE[src.GetLength()];
for (int i=0;i<src.GetLength();i++)
{
data[i]=datSrc[i];
}
}
else if (src.PixelType == 3 )
{
short* datSrc = (short*)(src.data);
for (int i=0;i<src.GetLength();i++)
{
data[i]=datSrc[i];
}
}
//src.Data=data;
Raw2D *ret=new Raw2D(src.width,src.height,data);
return *ret;
}
示例2: if
void * Raw2D2Image2D(Raw2D &src,long long type)
{
PIXTYPE *data= new PIXTYPE[src.size()];
if (type==1)
{
unsigned char* datSrc = new unsigned char [src.size()];//(unsigned char*)(src.data);
//PIXTYPE *data= new PIXTYPE[src.GetLength()];
for (long long i=0;i<src.size();i++)
{
datSrc[i]=(unsigned char)src.getXY(i);
}
//void * ret= (void *)datSrc;
Image2D * ret = new Image2D(src.getXsize(),src.getYsize(),type);
memcpy(ret->data,datSrc,ret->GetLength());
unsigned char *dat =(unsigned char*)ret->data;
void *res =(void *)ret;
return res;
}
else if (type == 2)
{
unsigned short * datSrc = new unsigned short [src.size()];//(unsigned short *)(src.data);
//PIXTYPE *data= new PIXTYPE[src.GetLength()];
for (long long i=0;i<src.size();i++)
{
datSrc[i]=src.getXY(i);
}
void * ret=(void *)datSrc;
return datSrc;
}
else
{
float* datSrc = new float [src.size()]; //(short*)(src.data);
for (long long i=0;i<src.size();i++)
{
datSrc[i]=src.getXY(i);
}
void *ret =(void *)datSrc;
return datSrc;
}
}