本文整理汇总了Java中ij.gui.Plot.DEFAULT_FLAGS属性的典型用法代码示例。如果您正苦于以下问题:Java Plot.DEFAULT_FLAGS属性的具体用法?Java Plot.DEFAULT_FLAGS怎么用?Java Plot.DEFAULT_FLAGS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ij.gui.Plot
的用法示例。
在下文中一共展示了Plot.DEFAULT_FLAGS属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPlot
public static Plot createPlot(double [] yValues, String title, String xLabel, String yLabel){
double [] xValues = new double [yValues.length];
double min = Double.MAX_VALUE;
double max = -Double.MAX_VALUE;
for (int i = 0; i < xValues.length; i ++){
min = (yValues[i] < min) ? yValues[i] : min;
max = (yValues[i] > max) ? yValues[i] : max;
xValues[i] = i + 1;
}
if (min == max){
max++;
}
Plot plot = new Plot(title, xLabel, yLabel, xValues, yValues, Plot.DEFAULT_FLAGS);
plot.setLimits(1, xValues.length, min, max);
return plot;
}
示例2: createScatterPlot
public static Plot createScatterPlot(String title, double [] xCoords, double [] yCoords, Function func){
double margin = 0.15;
int scale = 200;
func.fitToPoints(xCoords, yCoords);
float [] xVals = new float[scale];
float [] yVals = new float[scale];
double [] stats = DoubleArrayUtil.minAndMaxOfArray(xCoords);
double range = (stats[1] - stats[0]) * (1+(2*margin));
for (int i=0;i<scale;i++){
double x = stats[0] - (range * margin) + ((i + 0.0) / scale) * range;
xVals[i] = (float) x;
yVals[i] = (float) func.evaluate(x);
}
double avg = 0;
for (int i=0;i<xCoords.length;i++){
double other = func.evaluate(xCoords[i]);
avg += Math.pow(other - yCoords[i],2);
}
avg /= xCoords.length;
avg = Math.sqrt(avg);
Plot plot = new Plot(title + " (r = "+DoubleArrayUtil.correlateDoubleArrays(xCoords, yCoords)+" SSIM: " + DoubleArrayUtil.computeSSIMDoubleArrays(xCoords, yCoords) + ") Model: " + func.toString() + " standard deviation along model: " + avg, "X", "Y", xVals, yVals, Plot.DEFAULT_FLAGS);
plot.addPoints(xCoords, yCoords, Plot.CIRCLE);
return plot;
}
示例3: createPlot
public static Plot createPlot(double [] xValues, double [] yValues, String title, String xLabel, String yLabel){
double miny = Double.MAX_VALUE;
double maxy = -Double.MAX_VALUE;
double minx = Double.MAX_VALUE;
double maxx = -Double.MAX_VALUE;
for (int i = 0; i < xValues.length; i ++){
miny = (yValues[i] < miny) ? yValues[i] : miny;
maxy = (yValues[i] > maxy) ? yValues[i] : maxy;
minx = (xValues[i] < minx) ? xValues[i] : minx;
maxx = (xValues[i] > maxx) ? xValues[i] : maxx;
}
if (miny == maxy){
maxy++;
}
if (minx == maxx){
maxx++;
}
Plot plot = new Plot(title, xLabel, yLabel, xValues, yValues, Plot.DEFAULT_FLAGS);
plot.setLimits(minx, maxx, miny, maxy);
return plot;
}
示例4: main
public static void main(String[] args){
// Define Point Cloud
SimpleMatrix p_k = new SimpleMatrix(4,2);
SimpleMatrix q_k = new SimpleMatrix(4,2);
p_k.setRowValue(0, new SimpleVector(1,2));
p_k.setRowValue(1, new SimpleVector(3,6));
p_k.setRowValue(2, new SimpleVector(4,6));
p_k.setRowValue(3, new SimpleVector(3,4));
q_k.setRowValue(0, new SimpleVector(-0.7, 2.1));
q_k.setRowValue(1, new SimpleVector(-2.1, 6.4));
q_k.setRowValue(2, new SimpleVector(-1.4, 7.1));
q_k.setRowValue(3, new SimpleVector(-0.7, 4.9));
// Plot Point Cloud
Plot plot = new Plot("Regression Line", "X", "Y", Plot.DEFAULT_FLAGS);
plot.setLimits(-10, 10, -10, 10);
plot.addPoints(p_k.getCol(0).copyAsDoubleArray(), p_k.getCol(1).copyAsDoubleArray(), Plot.BOX);
plot.addPoints(q_k.getCol(0).copyAsDoubleArray(), q_k.getCol(1).copyAsDoubleArray(), Plot.CIRCLE);
// Calculate registration parameter
Registration1 reg = new Registration1();
SimpleVector parameter = reg.registrationUsingPointCorrespondences(p_k, q_k);
// Rotation and translation
double phi = parameter.getElement(0);
SimpleVector translation = new SimpleVector(parameter.getElement(1), parameter.getElement(2));
// Transform points
SimpleMatrix transformedPoints = reg.applyTransform(q_k, phi, translation);
// Add transformed point cloud to the plot
plot.addPoints(transformedPoints.getCol(0).copyAsDoubleArray(), transformedPoints.getCol(1).copyAsDoubleArray(), Plot.CROSS);
plot.show();
}
示例5: main
public static void main(String[] args) {
//
RANSAC ransac = new RANSAC();
//
// The point cloud is defined
//
SimpleMatrix pts = new SimpleMatrix(7,2);
pts.setRowValue(0, new SimpleVector(0,0));
pts.setRowValue(1, new SimpleVector(1,1));
pts.setRowValue(2, new SimpleVector(2,2));
pts.setRowValue(3, new SimpleVector(3,3));
pts.setRowValue(4, new SimpleVector(3.2,1.9));
pts.setRowValue(5, new SimpleVector(4,4));
pts.setRowValue(6, new SimpleVector(10,1.8));
//
// Regression Line
//
// Create a scatter plot of the point cloud and fit a regression line
Plot scatterPlot = new Plot("Regression Line", "X", "Y", Plot.DEFAULT_FLAGS);
scatterPlot.setLimits(0, 11, 0, 5);
scatterPlot.addPoints(pts.getCol(0).copyAsDoubleArray(), pts.getCol(1).copyAsDoubleArray(), Plot.BOX);
scatterPlot.show();
// Calculate the regression line through the given point cloud
SimpleVector regressionLine = ransac.fitline(pts);
// Add the regression line
double y11 = regressionLine.getElement(0) * 11 + regressionLine.getElement(1);
double y0 = regressionLine.getElement(0) * 0 + regressionLine.getElement(1);
scatterPlot.drawLine(0, y0, 11, y11);
//
// RANSAC
//
// Parameters for RANSAC
double p_opt = 0.9999; // probability how likely it is to pick the right mn points
double p_out = 0.2; // probability of an outlier
int min_number = 2; // minimum number of datapoints required to build the model
// Create a scatter plot of the point cloud and fit a RANSAC line
Plot ransac_plot = new Plot("Ransac Line", "X", "Y", Plot.DEFAULT_FLAGS);
ransac_plot.setLimits(0, 11, 0, 5);
ransac_plot.addPoints(pts.getCol(0).copyAsDoubleArray(), pts.getCol(1).copyAsDoubleArray(), Plot.BOX);
// Compute a line using the RANSAC algorithm and plot it
SimpleVector ransacLine = ransac.commonRansac(pts, min_number, p_opt, p_out);
double y1 = ransacLine.getElement(0) * 0 + ransacLine.getElement(1);
double y2 = ransacLine.getElement(0) * 11 + ransacLine.getElement(1);
ransac_plot.drawLine(0, y1, 11, y2);
ransac_plot.show();
}