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


Java ArrayUtils.maxIndex方法代码示例

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


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

示例1: extract

import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
@Override
public FeatureVector extract(MBFImage image, FImage mask) {
	final FeatureVector fv = super.extract(image, mask);
	final double[] vals = fv.asDoubleVector();
	final int index = ArrayUtils.maxIndex(vals);
	return new FloatFV(hm.colourAverage(index));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:8,代码来源:MaxHistogramExtractor.java

示例2: calculateRegularBoundingBox

import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
@Override
public Rectangle calculateRegularBoundingBox() {

	// Differentiate the parametrics form of the ellipse equation to get
	// tan(t) = -semiMinor * tan(rotation) / semiMajor (which gives us the
	// min/max X)
	// tan(t) = semiMinor * cot(rotation) / semiMajor (which gives us the
	// min/max Y)
	//
	// We find a value for t, add PI to get another value of t, we use this
	// to find our min/max x/y

	final double[] minmaxx = new double[2];
	final double[] minmaxy = new double[2];
	final double tanrot = Math.tan(rotation);
	final double cosrot = Math.cos(rotation);
	final double sinrot = Math.sin(rotation);

	double tx = Math.atan(-minor * tanrot / major);
	double ty = Math.atan(minor * (1 / tanrot) / major);

	minmaxx[0] = x + (major * Math.cos(tx) * cosrot - minor * Math.sin(tx) * sinrot);
	tx += Math.PI;
	minmaxx[1] = x + (major * Math.cos(tx) * cosrot - minor * Math.sin(tx) * sinrot);
	minmaxy[0] = y + (major * Math.cos(ty) * sinrot + minor * Math.sin(ty) * cosrot);
	ty += Math.PI;
	minmaxy[1] = y + (major * Math.cos(ty) * sinrot + minor * Math.sin(ty) * cosrot);

	double minx, miny, maxx, maxy;
	minx = minmaxx[ArrayUtils.minIndex(minmaxx)];
	miny = minmaxy[ArrayUtils.minIndex(minmaxy)];
	maxx = minmaxx[ArrayUtils.maxIndex(minmaxx)];
	maxy = minmaxy[ArrayUtils.maxIndex(minmaxy)];

	return new Rectangle((float) minx, (float) miny, (float) (maxx - minx), (float) (maxy - miny));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:37,代码来源:Ellipse.java

示例3: processImage

import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
@Override
public void processImage(FImage image) {
	final SummedAreaTable sat = new SummedAreaTable(image);
	final FImage output = new FImage(image.width, image.height);

	for (int vote = 0; vote < maxVotes; vote++) {
		// First step
		int widthR = (int) Math.pow(2, rng.nextIntFromTo(rangeMin, rangeMax));
		int heightR = (int) Math.pow(2, rng.nextIntFromTo(rangeMin, rangeMax));
		int xR = rng.nextIntFromTo(0, image.width - widthR);
		int yR = rng.nextIntFromTo(0, image.height - heightR);

		// Second step
		while (widthR > 2 && heightR > 2) {
			final int hw = widthR / 2;
			final int hh = heightR / 2;

			final float[] r = {
					sat.calculateArea(xR, yR, xR + hw, yR + hh),
					sat.calculateArea(xR + hw, yR, xR + widthR, yR + hh),
					sat.calculateArea(xR, yR + hh, xR + hw, yR + heightR),
					sat.calculateArea(xR + hw, yR + hh, xR + widthR, yR + heightR),
			};

			final int[] f = ArrayUtils.indexSort(r);
			if (r[f[3]] == r[f[2]])
				break;

			final int maxIdx = ArrayUtils.maxIndex(r);

			widthR = hw;
			heightR = hh;
			if (maxIdx == 1) {
				xR = xR + hw;
			} else if (maxIdx == 2) {
				yR = yR + hh;
			} else if (maxIdx == 3) {
				xR = xR + hw;
				yR = yR + hh;
			}
		}

		// Third step
		final int xLoc = Math.round(xR + widthR / 2);
		final int yLoc = Math.round(yR + heightR / 2);
		output.pixels[yLoc][xLoc]++;
	}

	output.processInplace(new FGaussianConvolve(sigma));
	image.internalAssign(output.normalise());
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:52,代码来源:BrightnessClusteringTransform.java

示例4: predict

import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
/**
 * Predict the class (the index of the most-probable gaussian) to which the
 * given data point belongs.
 * 
 * @param data
 *            the data point
 * @return the class index
 */
public int predict(double[] data) {
	final double[] posterior = predictLogPosterior(data);
	return ArrayUtils.maxIndex(posterior);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:13,代码来源:MixtureOfGaussians.java


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