Struct Scalar
A container for one-,two-,three- or four-tuples of doubles. Scalar is always represented as a four-tuple.
Implements
Namespace: OpenCV.Net
Assembly: OpenCV.Net.dll
Syntax
public struct Scalar : IEquatable<Scalar>
Constructors
| Improve this Doc View SourceScalar(Double, Double, Double, Double)
Initializes a new instance of the Scalar structure from the specified values.
Declaration
public Scalar(double val0, double val1 = null, double val2 = null, double val3 = null)
Parameters
Type | Name | Description |
---|---|---|
Double | val0 | The first value of the scalar tuple. |
Double | val1 | The optional second value of the scalar tuple. |
Double | val2 | The optional third value of the scalar tuple. |
Double | val3 | The optional fourth value of the scalar tuple. |
Fields
| Improve this Doc View SourceVal0
The first value of the scalar tuple.
Declaration
public double Val0
Field Value
Type | Description |
---|---|
Double |
Val1
The second value of the scalar tuple.
Declaration
public double Val1
Field Value
Type | Description |
---|---|
Double |
Val2
The third value of the scalar tuple.
Declaration
public double Val2
Field Value
Type | Description |
---|---|
Double |
Val3
The fourth value of the scalar tuple.
Declaration
public double Val3
Field Value
Type | Description |
---|---|
Double |
Methods
| Improve this Doc View SourceAll(Double)
Initializes a new Scalar instance where all the values of the tuple are initialized to the same scalar value.
Declaration
public static Scalar All(double val0123)
Parameters
Type | Name | Description |
---|---|---|
Double | val0123 | The scalar value from which to initialize all tuple scalars. |
Returns
Type | Description |
---|---|
Scalar | A new Scalar instance where all the values of the tuple are initialized to the specified scalar value. |
Equals(Scalar)
Returns a value indicating whether this instance has the same tuple values as a specified Scalar structure.
Declaration
public bool Equals(Scalar other)
Parameters
Type | Name | Description |
---|---|---|
Scalar | other | The Scalar structure to compare to this instance. |
Returns
Type | Description |
---|---|
Boolean | true if |
Equals(Object)
Tests to see whether the specified object is a Scalar structure with the same tuple values as this Scalar structure.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The |
Returns
Type | Description |
---|---|
Boolean | true if |
GetHashCode()
Returns a hash code for this Scalar structure.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | An integer value that specifies a hash value for this Scalar structure. |
PackedColor(Double, Int32)
Initializes a new Scalar instance from a packed color value.
Declaration
public static Scalar PackedColor(double color, int arrayType)
Parameters
Type | Name | Description |
---|---|---|
Double | color | The packed color value. |
Int32 | arrayType | The type of array elements. If the depth of the elements is not
8-bit, the first channels of the returned Scalar
are set to the same value as |
Returns
Type | Description |
---|---|
Scalar | A new Scalar instance where the values of the tuple are initialized to represent the unpacked color. |
Real(Double)
Initializes a new Scalar instance representing a single scalar value.
Declaration
public static Scalar Real(double val0)
Parameters
Type | Name | Description |
---|---|---|
Double | val0 | The scalar value. |
Returns
Type | Description |
---|---|
Scalar | A new Scalar instance representing a single scalar value. |
Rgb(Double, Double, Double)
Initializes a new Scalar instance representing a color pixel value.
Declaration
public static Scalar Rgb(double r, double g, double b)
Parameters
Type | Name | Description |
---|---|---|
Double | r | The red component of the color. |
Double | g | The green component of the color. |
Double | b | The blue component of the color. |
Returns
Type | Description |
---|---|
Scalar | A new Scalar instance where the values of the tuple are initialized to the specified color components. |
ToString()
Creates a
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A |
Operators
| Improve this Doc View SourceEquality(Scalar, Scalar)
Tests whether two Scalar structures are equal.
Declaration
public static bool operator ==(Scalar left, Scalar right)
Parameters
Type | Name | Description |
---|---|---|
Scalar | left | The Scalar structure on the left of the equality operator. |
Scalar | right | The Scalar structure on the right of the equality operator. |
Returns
Type | Description |
---|---|
Boolean | true if |
Inequality(Scalar, Scalar)
Tests whether two Scalar structures are different.
Declaration
public static bool operator !=(Scalar left, Scalar right)
Parameters
Type | Name | Description |
---|---|---|
Scalar | left | The Scalar structure on the left of the inequality operator. |
Scalar | right | The Scalar structure on the right of the inequality operator. |
Returns
Type | Description |
---|---|
Boolean | true if |