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


Java TFloatArrayList.toArray方法代码示例

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


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

示例1: runDensityCalculation

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
private int runDensityCalculation(ExecutorService threadPool, List<Future<?>> futures,
		final TFloatArrayList coordsX, final TFloatArrayList coordsY, final Statistics densityStats,
		final float radius, final Rectangle bounds, final int[] allDensity, final int allIndex)
{
	final int size = coordsX.size();
	final float[] xCoords = coordsX.toArray();
	final float[] yCoords = coordsY.toArray();
	coordsX.resetQuick();
	coordsY.resetQuick();
	futures.add(threadPool.submit(new Runnable()
	{
		public void run()
		{
			incrementProgress();
			final DensityManager dm = new DensityManager(xCoords, yCoords, bounds);
			final int[] density = dm.calculateDensity(radius, true);
			addDensity(densityStats, density);

			// Store the density for each result. This does not need to be synchronised 
			// since the indices in different threads are unique.
			for (int i = 0, index = allIndex; i < density.length; i++, index++)
				allDensity[index] = density[i];
		}
	}));
	return size;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:27,代码来源:CreateData.java

示例2: extractFeatureRaw

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
/**
 * Extract an orientation histogram and find the dominant orientations
 * by looking for peaks.
 * 
 * @param properties Properties describing the interest point in scale space.
 * @return an array of the angles of the dominant orientations [-PI to PI].
 */
@Override
public float [] extractFeatureRaw(GradientScaleSpaceImageExtractorProperties<FImage> properties) {
	//extract histogram
	float[] hist = getOriHistExtractor().extractFeatureRaw(properties);
	
	//find max
	float maxval = 0;
	for (int i = 0; i < getOriHistExtractor().numBins; i++)
		if (hist[i] > maxval)
			maxval = hist[i];

	float thresh = peakThreshold * maxval;
	
	//search for peaks within peakThreshold of the maximum
	TFloatArrayList dominantOrientations = new TFloatArrayList();
	for (int i = 0; i < getOriHistExtractor().numBins; i++) {
		float prevVal = hist[(i == 0 ? getOriHistExtractor().numBins - 1 : i - 1)];
		float nextVal = hist[(i == getOriHistExtractor().numBins - 1 ? 0 : i + 1)];
		float thisVal = hist[i];
		
		if (thisVal >= thresh && thisVal > prevVal && thisVal > nextVal) {
			//fit a parabola to the peak to find the position of the actual maximum
			float peakDelta = fitPeak(prevVal, thisVal, nextVal);
			float angle = 2.0f * (float)Math.PI * (i + 0.5f + peakDelta) / getOriHistExtractor().numBins - (float)Math.PI;
			
			dominantOrientations.add(angle);
		}
	}

	return dominantOrientations.toArray();
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:39,代码来源:DominantOrientationExtractor.java

示例3: Position

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
public Position(Portfolio portfolio, String assetName, TFloatArrayList price, int quantity, TLongArrayList priceTimeMillSec) {
	this( portfolio, assetName,  price.toArray(),  quantity,  priceTimeMillSec.toArray());
}
 
开发者ID:PortfolioEffect,项目名称:PE-HFT-Java,代码行数:4,代码来源:Position.java

示例4: getPixelsInCircle

import gnu.trove.list.array.TFloatArrayList; //导入方法依赖的package包/类
/**
 * Returns the values of pixels within a circle centres at cx, cy in the
 * image img, with a radius r.
 * 
 * @param cx
 *            The centre of the circle's x coordinate
 * @param cy
 *            The centre of the circle's y coordinate
 * @param r
 *            The radius of the circle
 * @param img
 *            The image from which to take pixels
 * @return A list of pixel values
 */
private static float[] getPixelsInCircle(int cx, int cy, double r, FImage img)
{
	final TFloatArrayList f = new TFloatArrayList();
	for (int i = (int) Math.ceil(cx - r); i < (int) Math.ceil(cx + r); i++)
	{
		final double ri = Math.sqrt(r * r - (i - cx) * (i - cx));
		for (int j = (int) Math.ceil(cy - ri); j < (int) Math.ceil(cy + ri); j++)
		{
			f.add(img.getPixel(i, j));
		}
	}
	return f.toArray();
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:SUSANEdgeDetector.java


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