Terms and conditions
Preamble:
This Agreement, signed on Jun 10, 2012 [hereinafter: Effective Date] governs the relationship between the Enduser, a private person, (hereinafter: Licensee) and Paul N...
If you think the Android project Operation-Valkyrie listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package org.opencv.core;
//www.java2s.com/**
* <p>Template class defining termination criteria for iterative algorithms.</p>
*
* @see <a href="http://docs.opencv.org/modules/core/doc/basic_structures.html#termcriteria">org.opencv.core.TermCriteria</a>
*/publicclass TermCriteria {
/**
* the maximum number of iterations or elements to compute
*/publicstaticfinalint COUNT = 1;
/**
* the maximum number of iterations or elements to compute
*/publicstaticfinalint MAX_ITER = COUNT;
/**
* the desired accuracy or change in parameters at which the iterative algorithm stops
*/publicstaticfinalint EPS = 2;
publicint type;
publicint maxCount;
publicdouble epsilon;
/**
* Termination criteria in iterative algorithms
*
* @param type
* the type of termination criteria: COUNT, EPS or COUNT + EPS
* @param maxCount
* the maximum number of iterations/elements
* @param epsilon
* the desired accuracy
*/public TermCriteria(int type, int maxCount, double epsilon) {
this.type = type;
this.maxCount = maxCount;
this.epsilon = epsilon;
}
/**
* Termination criteria in iterative algorithms
*/public TermCriteria() {
this(0, 0, 0.0);
}
public TermCriteria(double[] vals) {
set(vals);
}
publicvoid set(double[] vals) {
if (vals != null) {
type = vals.length > 0 ? (int) vals[0] : 0;
maxCount = vals.length > 1 ? (int) vals[1] : 0;
epsilon = vals.length > 2 ? (double) vals[2] : 0;
} else {
type = 0;
maxCount = 0;
epsilon = 0;
}
}
public TermCriteria clone() {
returnnew TermCriteria(type, maxCount, epsilon);
}
@Override
publicint hashCode() {
finalint prime = 31;
int result = 1;
long temp;
temp = Double.doubleToLongBits(type);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(maxCount);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(epsilon);
result = prime * result + (int) (temp ^ (temp >>> 32));
return result;
}
@Override
publicboolean equals(Object obj) {
if (this == obj) return true;
if (!(obj instanceof TermCriteria)) return false;
TermCriteria it = (TermCriteria) obj;
return type == it.type && maxCount == it.maxCount && epsilon == it.epsilon;
}
@Override
public String toString() {
if (this == null) return"null";
return"{ type: " + type + ", maxCount: " + maxCount + ", epsilon: " + epsilon + "}";
}
}