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


C++ FlexImage::Height方法代码示例

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


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

示例1: FlexLoadBMP8u

bool FlexLoadBMP8u(const char *file, FlexImage<Im8u,1> &img) 
{
    FILE *in;
	BITMAPFILEHDR bmfh;
	BITMAPINFOHDR bmih;	

	in=fopen(file,"rb");
	if (in == NULL)
		return(false);
        //WARNING: Extra padding in bmfh causes erroneous reading into all but first field of structure
	fread(&bmfh,BFHSIZE,1,in);							//read BMP header
        ConvertBmfh(&bmfh);
	if (bmfh.bfType != 19778)							//check for valid BMP file
		return(false);
	fread(&bmih,BIHSIZE,1,in);							//read info header
        ConvertBmih(&bmih);
	if (bmih.biBitCount == 8)	
	{	fclose(in);										//load as grayscale
		return FlexLoadBMPGray(file, img);
	}
	if (bmih.biBitCount == 24)
	{	fclose(in);
		FlexImage<Im8u,3> tmp;
		bool ok = FlexLoadBMPColor(file, tmp);			//load as color image
		if (ok)
		{	img.ReallocateNE(tmp.Width(), tmp.Height());
			FlexRGBToGray(tmp, img, false);					//convert to grayscale
		}
		return ok;
	}
	fclose(in);
	return(false);										//only read 8 bit images
}
开发者ID:rossandon,项目名称:MobileTesting,代码行数:33,代码来源:FlexIO.cpp

示例2: FlexLoadBMPColor

bool FlexLoadBMPColor(const char *file, FlexImage<Im8u,3> &img) 
{
    FILE *in;
	BITMAPFILEHDR bmfh;
	BITMAPINFOHDR bmih;	

	in=fopen(file,"rb");
	if (in == NULL)
		return(false);	
        //WARNING: Extra padding in bmfh causes erroneous reading into all but first field of structure
	fread(&bmfh,BFHSIZE,1,in);							//read BMP header
        ConvertBmfh(&bmfh);
	if (bmfh.bfType != 19778)							//check for valid BMP file
		return(false);
	fread(&bmih,BIHSIZE,1,in);							//read info header
        ConvertBmih(&bmih);
	if (bmih.biBitCount != 24) 
		return(false);									//only read 8 bit images
	img.Reallocate(bmih.biWidth, abs(bmih.biHeight));	//allocate image to size

	RGBA tmp;
	for(int i = 0; i < (int)bmih.biClrUsed; i++)		//skip color info
		fread(&tmp, sizeof(RGBA), 1, in);

	int padWidth = 3 * bmih.biWidth;
	while(padWidth%4) padWidth++;						
	int dir = 1, yv = 0;
	if (bmih.biHeight > 0)
	{	dir = -1;
		yv = img.Height() - 1;
	}
	for(int y = 0; y < img.Height(); y++ )				//read in pixel data
	{	char tmp;
		fread(&img(0,yv), 1, img.Width() * 3, in);
		yv += dir;
		for(int i = 0; i < padWidth - img.Width() * 3; i++)	//skip over pad bytes
			fread(&tmp, 1, 1, in);
	}
	fclose(in);
	return(true);
}
开发者ID:rossandon,项目名称:MobileTesting,代码行数:41,代码来源:FlexIO.cpp


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