本文整理汇总了Java中org.openimaj.util.array.ArrayUtils.maxValue方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtils.maxValue方法的具体用法?Java ArrayUtils.maxValue怎么用?Java ArrayUtils.maxValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openimaj.util.array.ArrayUtils
的用法示例。
在下文中一共展示了ArrayUtils.maxValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: detect
import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
@Override
public double detect(double[] col) {
double mid = ArrayUtils.quickSelect(col, col.length/2);
if(ArrayUtils.minValue(col) == mid)
mid += Double.MIN_NORMAL;
if(ArrayUtils.maxValue(col) == mid)
mid -= Double.MIN_NORMAL;
return 0;
}
示例2: analyseImage
import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
@Override
public void analyseImage(MBFImage image) {
image.analyseWith(saliencyGenerator);
final TObjectFloatHashMap<ConnectedComponent> componentMap = saliencyGenerator.getSaliencyComponents();
final float max = ArrayUtils.maxValue(componentMap.values());
final FImage map = new FImage(image.getWidth(), image.getHeight());
final float thresh = max * alpha;
final BoundingBoxRenderer<Float> renderer = new BoundingBoxRenderer<Float>(map, 1F, true);
componentMap.forEachEntry(new TObjectFloatProcedure<ConnectedComponent>() {
@Override
public boolean execute(ConnectedComponent cc, float sal) {
if (sal >= thresh) { // note that this is reversed from the
// paper, which doesn't seem to make
// sense.
renderer.process(cc);
}
return true;
}
});
roiProportion = 0;
for (int y = 0; y < map.height; y++)
for (int x = 0; x < map.width; x++)
roiProportion += map.pixels[y][x];
roiProportion /= (map.width * map.height); // smaller simplicity means
// smaller ROI
}
示例3: logsumexp
import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
private double[] logsumexp(double[][] data) {
final double[] lse = new double[data.length];
for (int i = 0; i < data.length; i++) {
final double max = ArrayUtils.maxValue(data[i]);
for (int j = 0; j < data[0].length; j++) {
lse[i] += Math.exp(data[i][j] - max);
}
lse[i] = max + Math.log(lse[i]);
}
return lse;
}
示例4: colourTemperatureCorrection
import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
/**
* Correct colour temperature using the method documented at Tanner Helland.
* Calculated the black body colour for the given temperature and alpha
* blends that with a constant luminance with the original image at the
* given strength. Only works on RGB images. Side affects the incoming
* image.
*
* @param image
* @param colourTemperature
* The colour temperature.
* @param strength
* The strength of colour correction
*
* @see "http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/"
* @return The affected image.
*/
public static MBFImage colourTemperatureCorrection(final MBFImage image,
final double colourTemperature, final double strength)
{
if (image.colourSpace != ColourSpace.RGB)
throw new IllegalArgumentException("Colour correction only available for RGB images. " +
"Try using the colour transforms to convert to RGB.");
// Get the black body colour for the given temperature.
final double rgb[] = Transforms.kelvinToRGB(colourTemperature);
final float[] pix = new float[image.numBands()];
final float[] oPix = new float[image.numBands()];
for (int y = 0; y < image.getHeight(); y++)
{
for (int x = 0; x < image.getWidth(); x++)
{
for (int b = 0; b < image.numBands(); b++)
{
float f = image.getBand(b).pixels[y][x];
oPix[b] = f;
f = (float) (f * strength + rgb[b] * (1f - strength));
pix[b] = f;
}
// pix contains the alpha blended original pixels. Calculate HSL
Transforms.RGB_TO_HSL(pix, pix);
// subsititue the luminance of original pixels
pix[2] = (ArrayUtils.maxValue(oPix) + ArrayUtils.minValue(oPix)) / 2f;
// Transform back to RGB
Transforms.HSL_TO_RGB(pix, pix);
for (int b = 0; b < image.numBands(); b++)
image.getBand(b).pixels[y][x] = pix[b];
}
}
return image;
}
示例5: calculateThreshold
import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
/**
* Estimate the threshold for the given data.
* <p>
* Internally, the data will be min-max normalised before the histogram is
* built, and the specified number of bins will cover the entire
* <code>max-min</code> range. The returned threshold will have
* <code>min</code> added to it to return it to the original range.
*
* @param data
* the data
* @param numBins
* the number of histogram bins
* @return the estimated threshold
*/
public static float calculateThreshold(float[] data, int numBins) {
final float min = ArrayUtils.minValue(data);
final float max = ArrayUtils.maxValue(data);
final int[] histData = makeHistogram(data, numBins, min, max);
return computeThresholdFromHistogram(histData, data.length) + min;
}
示例6: calculateThresholdAndVariance
import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
/**
* Estimate the threshold and inter-class variance for the given data.
* <p>
* Internally, the data will be min-max normalised before the histogram is
* built, and the specified number of bins will cover the entire
* <code>max-min</code> range. The returned threshold will have
* <code>min</code> added to it to return it to the original range.
*
* @param data
* the data
* @param numBins
* the number of histogram bins
* @return the estimated threshold and variance
*/
public static FloatFloatPair calculateThresholdAndVariance(float[] data, int numBins) {
final float min = ArrayUtils.minValue(data);
final float max = ArrayUtils.maxValue(data);
final int[] histData = makeHistogram(data, numBins, min, max);
final FloatFloatPair result = computeThresholdAndVarianceFromHistogram(histData, data.length);
result.first += min;
return result;
}