org.opencv.core
public class Scalar extends java.lang.Object
Template class for a 4-element vector derived from Vec.
template
// C++ code:
public:
//! various constructors
Scalar_();
Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0);
Scalar_(const CvScalar& s);
Scalar_(_Tp v0);
//! returns a scalar with all elements set to v0
static Scalar_<_Tp> all(_Tp v0);
//! conversion to the old-style CvScalar
operator CvScalar() const;
//! conversion to another data type
template
//! per-element product
Scalar_<_Tp> mul(const Scalar_<_Tp>& t, double scale=1) const;
// returns (v0, -v1, -v2, -v3)
Scalar_<_Tp> conj() const;
// returns true iff v1 == v2 == v3 == 0
bool isReal() const;
};
typedef Scalar_
Being derived from Vec<_Tp, 4>
, Scalar_
and
Scalar
can be used just as typical 4-element vectors. In
addition, they can be converted to/from CvScalar
. The type
Scalar
is widely used in OpenCV to pass pixel values.
Modifier and Type | Field and Description |
---|---|
double[] |
val |
Constructor and Description |
---|
Scalar(double v0) |
Scalar(double[] vals) |
Scalar(double v0,
double v1) |
Scalar(double v0,
double v1,
double v2) |
Scalar(double v0,
double v1,
double v2,
double v3) |
public Scalar(double v0)
public Scalar(double[] vals)
public Scalar(double v0, double v1)
public Scalar(double v0, double v1, double v2)
public Scalar(double v0, double v1, double v2, double v3)
public static Scalar all(double v)
public Scalar clone()
clone
in class java.lang.Object
public Scalar conj()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean isReal()
public void set(double[] vals)
public java.lang.String toString()
toString
in class java.lang.Object