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


C++ DoubleArray::begin方法代码示例

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


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

示例1: applyMask

/*
This has a funny way of dealing with edges. In case of a Gaussian blur, divides by the sum of all of the numbers in the mask by definition. Might prove harsh on edges. In all other cases, divides by 8 no matter what, so that can equalize at edges. Also, when one of the pixels needed in the mask calculation is off the bounds of the image, the center pixel value is substituted, so that there is less difference. This doesnt pick up as many stray lines on edges, but also proves to often not pick up enough lines. 
*/
DoubleArray Mask::applyMask(DoubleArray array){
	ICoord size = array.size();
	DoubleArray newarray = DoubleArray(size);
	width = (int)maskArray.size()(0)/2; /* in case the maskArray was edited */
	for (DoubleArray::iterator i = array.begin();i !=array.end(); ++i){
		ICoord curr = i.coord();
		double num = 0;
		double c = 0;
		int d = 1;
		for (int i = -width; i <= width; ++i){ // scans through the mask
			for (int j = -width; j <= width; ++j){
				ICoord a = ICoord(i,j);
				if (pixelInBounds(curr + a, size)){
					num = num + array[curr+a]*maskArray[ICoord(i + width, j + width)];
					c = c + maskArray[ICoord(i + width, j + width)];
				}
				else{
					num = num + array[curr]*maskArray[ICoord(i + width, j + width)]; /* if pixel needed for mask is out of the image, then substitute the center pixel */
					d = d + 1; /* count number of pixels out of bounds */
				}
			}
		}
		if (type == GAUSSIAN_MASK)
			newarray[curr] = num/159;
		else if (type == SMALL_GAUSSIAN_MASK)
			newarray[curr] = num/99;
		else
			newarray[curr] = num/8;
	}
	return newarray;
}
开发者ID:anilkunwar,项目名称:OOF2,代码行数:34,代码来源:mask.C


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