|
static int | copyFromMat (Mat mat, IntPtr intPtr) |
| Copies the data from an OpenCV Mat to an IntPtr.
|
|
static int | copyFromMat (Mat mat, IntPtr intPtr, int length) |
| Copies the data from an OpenCV Mat to an IntPtr.
|
|
static int | copyFromMat< T > (Mat mat, IntPtr intPtr, int length) |
| Copies the data from an OpenCV Mat to an IntPtr.
|
|
static int | copyFromMat< T > (Mat mat, NativeArray< T > array) |
| Copies the data from an OpenCV Mat to a NativeArray.
|
|
static int | copyFromMat< T > (Mat mat, NativeArray< T > array, int length) |
| Copies the data from an OpenCV Mat to a NativeArray.
|
|
static int | copyFromMat< T > (Mat mat, Span< T > array) |
| Copies the data from an OpenCV Mat to a Span.
|
|
static int | copyFromMat< T > (Mat mat, Span< T > array, int length) |
| Copies the data from an OpenCV Mat to a Span.
|
|
static int | copyFromMat< T > (Mat mat, T[] array) |
| Copies the data from an OpenCV Mat to a managed array.
|
|
static int | copyFromMat< T > (Mat mat, T[] array, int length) |
| Copies the data from an OpenCV Mat to a managed array.
|
|
static int | copyToMat (IntPtr intPtr, Mat mat) |
| Copies the data from an IntPtr to an OpenCV Mat.
|
|
static int | copyToMat (IntPtr intPtr, Mat mat, int length) |
| Copies the data from an IntPtr to an OpenCV Mat.
|
|
static int | copyToMat< T > (IntPtr intPtr, Mat mat, int length) |
| Copies the data from an IntPtr to an OpenCV Mat.
|
|
static int | copyToMat< T > (NativeArray< T > array, Mat mat) |
| Copies the data from a NativeArray to an OpenCV Mat.
|
|
static int | copyToMat< T > (NativeArray< T > array, Mat mat, int length) |
| Copies the data from a NativeArray to an OpenCV Mat.
|
|
static int | copyToMat< T > (Span< T > array, Mat mat) |
| Copies the data from a Span to an OpenCV Mat.
|
|
static int | copyToMat< T > (Span< T > array, Mat mat, int length) |
| Copies the data from a Span to an OpenCV Mat.
|
|
static int | copyToMat< T > (T[] array, Mat mat) |
| Copies the data from a managed array to an OpenCV Mat.
|
|
static int | copyToMat< T > (T[] array, Mat mat, int length) |
| Copies the data from a managed array to an OpenCV Mat.
|
|
static int OpenCVForUnity.UnityUtils.MatUtils.copyFromMat |
( |
Mat | mat, |
|
|
IntPtr | intPtr ) |
|
static |
Copies the data from an OpenCV Mat to an IntPtr.
This method transfers the data stored in an OpenCV Mat object into an IntPtr. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data from Mats with any number of dimensions.
The entire range of data managed by the Mat will be copied to the IntPtr. If you want to specify the exact range of data to copy, please use the method that accepts a length argument.
Note: This method operates on unmanaged memory, and incorrect usage can lead to unpredictable behavior, crashes, or data corruption. Ensure that the source pointer points to a valid memory region and that the specified length does not exceed the allocated memory size for that region. Additionally, as this method involves unmanaged memory, be cautious about potential security risks. Accessing memory beyond the intended range can lead to buffer overflows and may compromise application stability and security. It is highly recommended to perform validation checks on the pointer and the specified length.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the Mat and the array. Although its functionality is more limited compared to the Mat.get
method, it offers improved performance for such operations.
- Parameters
-
mat | The source Mat from which data will be copied. The Mat must not be disposed of or null. |
intPtr | The destination IntPtr where the data will be copied. This pointer must reference a valid memory region. |
- Returns
- The number of bytes copied from the Mat to the IntPtr.
- Exceptions
-
ArgumentNullException | Thrown when mat is null. |
ArgumentException | Thrown when intPtr == IntPtr.Zero . Thrown when !mat.isContinuous() && mat.dims() > 2 . |
static int OpenCVForUnity.UnityUtils.MatUtils.copyFromMat |
( |
Mat | mat, |
|
|
IntPtr | intPtr, |
|
|
int | length ) |
|
static |
Copies the data from an OpenCV Mat to an IntPtr.
This method transfers the data stored in an OpenCV Mat object into an IntPtr. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data from Mats with any number of dimensions.
If the data size of the memory region pointed to by the IntPtr is smaller than the data size managed by the Mat, data will be copied up to the size of the IntPtr. If the data size of the memory region pointed to by the IntPtr is larger, data will be copied up to the size managed by the Mat.
Note: This method operates on unmanaged memory, and incorrect usage can lead to unpredictable behavior, crashes, or data corruption. Ensure that the source pointer points to a valid memory region and that the specified length does not exceed the allocated memory size for that region. Additionally, as this method involves unmanaged memory, be cautious about potential security risks. Accessing memory beyond the intended range can lead to buffer overflows and may compromise application stability and security. It is highly recommended to perform validation checks on the pointer and the specified length.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the Mat and the array. Although its functionality is more limited compared to the Mat.get
method, it offers improved performance for such operations.
- Parameters
-
mat | The source Mat from which data will be copied. The Mat must not be disposed of or null. |
intPtr | The destination IntPtr where the data will be copied. This pointer must reference a valid memory region. |
length | The number of elements, in terms of byte size, to copy from the source Mat to the destination IntPtr. The length represents the size in bytes, regardless of the actual type of data in the Mat or the destination. |
- Returns
- The number of bytes copied from the Mat to the IntPtr.
- Exceptions
-
ArgumentNullException | Thrown when mat is null. |
ArgumentException | Thrown when intPtr == IntPtr.Zero . Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from an OpenCV Mat to an IntPtr.
This method transfers the data stored in an OpenCV Mat object into an IntPtr. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data from Mats with any number of dimensions.
If the data size of the memory region pointed to by the IntPtr is smaller than the data size managed by the Mat, data will be copied up to the size of the IntPtr. If the data size of the memory region pointed to by the IntPtr is larger, data will be copied up to the size managed by the Mat.
Note: This method operates on unmanaged memory, and incorrect usage can lead to unpredictable behavior, crashes, or data corruption. Ensure that the source pointer points to a valid memory region and that the specified length does not exceed the allocated memory size for that region. Additionally, as this method involves unmanaged memory, be cautious about potential security risks. Accessing memory beyond the intended range can lead to buffer overflows and may compromise application stability and security. It is highly recommended to perform validation checks on the pointer and the specified length.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the Mat and the array. Although its functionality is more limited compared to the Mat.get
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements represented by the IntPtr. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
mat | The source Mat from which data will be copied. The Mat must not be disposed of or null. |
intPtr | The destination IntPtr where the data will be copied. This pointer must reference a valid memory region. |
length | The number of elements of type T to copy from the source Mat to the destination IntPtr. |
- Returns
- The number of bytes copied from the Mat to the IntPtr.
- Exceptions
-
ArgumentNullException | Thrown when mat is null. |
ArgumentException | Thrown when intPtr == IntPtr.Zero . Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from an OpenCV Mat to a NativeArray.
This method transfers the data stored in an OpenCV Mat object into a NativeArray. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data from Mats with any number of dimensions.
If the data size managed by the array is smaller than the data size managed by the Mat, data will be copied up to the size of the array. If the data size managed by the array is larger, data will be copied up to the size managed by the Mat.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the Mat and the array. Although its functionality is more limited compared to the Mat.get
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements in the NativeArray. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
mat | The source Mat from which data will be copied. The Mat must not be disposed of or null. |
array | The destination NativeArray where the data will be copied. |
- Returns
- The number of bytes copied from the Mat to the NativeArray.
- Exceptions
-
ArgumentNullException | Thrown when mat or array is null. |
ArgumentException | Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from an OpenCV Mat to a NativeArray.
This method transfers the data stored in an OpenCV Mat object into a NativeArray. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data from Mats with any number of dimensions.
If the data size managed by the array is smaller than the data size managed by the Mat, data will be copied up to the size of the array. If the data size managed by the array is larger, data will be copied up to the size managed by the Mat.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the Mat and the array. Although its functionality is more limited compared to the Mat.get
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements in the NativeArray. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
mat | The source Mat from which data will be copied. The Mat must not be disposed of or null. |
array | The destination NativeArray where the data will be copied. |
length | The number of elements of type T to copy from the source Mat to the destination managed array. |
- Returns
- The number of bytes copied from the Mat to the NativeArray.
- Exceptions
-
ArgumentNullException | Thrown when mat or array is null. |
ArgumentException | Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from an OpenCV Mat to a Span.
This method transfers the data stored in an OpenCV Mat object into a Span. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data from Mats with any number of dimensions.
If the data size managed by the array is smaller than the data size managed by the Mat, data will be copied up to the size of the array. If the data size managed by the array is larger, data will be copied up to the size managed by the Mat.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the Mat and the array. Although its functionality is more limited compared to the Mat.get
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements in the Span. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
mat | The source Mat from which data will be copied. The Mat must not be disposed of or null. |
array | The destination Span where the data will be copied. |
- Returns
- The number of bytes copied from the Mat to the Span.
- Exceptions
-
ArgumentNullException | Thrown when mat or array is null. |
ArgumentException | Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from an OpenCV Mat to a Span.
This method transfers the data stored in an OpenCV Mat object into a Span. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data from Mats with any number of dimensions.
If the data size managed by the array is smaller than the data size managed by the Mat, data will be copied up to the size of the array. If the data size managed by the array is larger, data will be copied up to the size managed by the Mat.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the Mat and the array. Although its functionality is more limited compared to the Mat.get
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements in the Span. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
mat | The source Mat from which data will be copied. The Mat must not be disposed of or null. |
array | The destination Span where the data will be copied. |
length | The number of elements of type T to copy from the source Mat to the destination Span. |
- Returns
- The number of bytes copied from the Mat to the Span.
- Exceptions
-
ArgumentNullException | Thrown when mat or array is null. |
ArgumentException | Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from an OpenCV Mat to a managed array.
This method transfers the data stored in an OpenCV Mat object into a managed array. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data from Mats with any number of dimensions.
If the data size managed by the array is smaller than the data size managed by the Mat, data will be copied up to the size of the array. If the data size managed by the array is larger, data will be copied up to the size managed by the Mat.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the Mat and the array. Although its functionality is more limited compared to the Mat.get
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements in the managed array. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
mat | The source Mat from which data will be copied. The Mat must not be disposed of or null. |
array | The destination managed array where the data will be copied. |
- Returns
- The number of bytes copied from the Mat to the managed array.
- Exceptions
-
ArgumentNullException | Thrown when mat or array is null. |
ArgumentException | Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from an OpenCV Mat to a managed array.
This method transfers the data stored in an OpenCV Mat object into a managed array. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data from Mats with any number of dimensions.
If the data size managed by the array is smaller than the data size managed by the Mat, data will be copied up to the size of the array. If the data size managed by the array is larger, data will be copied up to the size managed by the Mat.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the Mat and the array. Although its functionality is more limited compared to the Mat.get
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements in the managed array. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
mat | The source Mat from which data will be copied. The Mat must not be disposed of or null. |
array | The destination managed array where the data will be copied. |
length | The number of elements of type T to copy from the source Mat to the destination managed array. |
- Returns
- The number of bytes copied from the Mat to the managed array.
- Exceptions
-
ArgumentNullException | Thrown when mat or array is null. |
ArgumentException | Thrown when !mat.isContinuous() && mat.dims() > 2 . |
static int OpenCVForUnity.UnityUtils.MatUtils.copyToMat |
( |
IntPtr | intPtr, |
|
|
Mat | mat ) |
|
static |
Copies the data from an IntPtr to an OpenCV Mat.
This method transfers the data stored in an IntPtr to an OpenCV Mat. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data from Mats with any number of dimensions.
Data of the same size in bytes as the data managed by the Mat is copied from the IntPtr to the Mat. If you want to specify the exact range of data to copy, please use the method that accepts a length argument.
Note: This method operates on unmanaged memory, and incorrect usage can lead to unpredictable behavior, crashes, or data corruption. Ensure that the source pointer points to a valid memory region and that the specified length does not exceed the allocated memory size for that region. Additionally, as this method involves unmanaged memory, be cautious about potential security risks. Accessing memory beyond the intended range can lead to buffer overflows and may compromise application stability and security. It is highly recommended to perform validation checks on the pointer and the specified length.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the array and the Mat. Although its functionality is more limited compared to the Mat.put
method, it offers improved performance for such operations.
- Parameters
-
intPtr | The source IntPtr from which data will be copied. This pointer must reference a valid memory region. |
mat | The destination Mat where the data will be copied. The Mat must not be disposed of or null. |
- Returns
- The number of bytes copied from the IntPtr to the Mat.
- Exceptions
-
ArgumentNullException | Thrown when mat is null. |
ArgumentException | Thrown when intPtr == IntPtr.Zero . Thrown when !mat.isContinuous() && mat.dims() > 2 . |
static int OpenCVForUnity.UnityUtils.MatUtils.copyToMat |
( |
IntPtr | intPtr, |
|
|
Mat | mat, |
|
|
int | length ) |
|
static |
Copies the data from an IntPtr to an OpenCV Mat.
This method transfers the data stored in an IntPtr to an OpenCV Mat. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data from Mats with any number of dimensions.
If the data size managed by the Mat is smaller than the data size of the memory region pointed to by the IntPtr, data will be copied up to the size of the mat. If the data size managed by the Mat is larger, data will be copied up to the size of the memory region pointed to by the IntPtr.
Note: This method operates on unmanaged memory, and incorrect usage can lead to unpredictable behavior, crashes, or data corruption. Ensure that the source pointer points to a valid memory region and that the specified length does not exceed the allocated memory size for that region. Additionally, as this method involves unmanaged memory, be cautious about potential security risks. Accessing memory beyond the intended range can lead to buffer overflows and may compromise application stability and security. It is highly recommended to perform validation checks on the pointer and the specified length.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the array and the Mat. Although its functionality is more limited compared to the Mat.put
method, it offers improved performance for such operations.
- Parameters
-
intPtr | The source IntPtr from which data will be copied. This pointer must reference a valid memory region. |
mat | The destination Mat where the data will be copied. The Mat must not be disposed of or null. |
length | The number of elements, in terms of byte size, to copy from the source IntPtr to the destination Mat. The length represents the size in bytes, regardless of the actual type of data in the IntPtr or the destination. |
- Returns
- The number of bytes copied from the IntPtr to the Mat.
- Exceptions
-
ArgumentNullException | Thrown when mat is null. |
ArgumentException | Thrown when intPtr == IntPtr.Zero . Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from an IntPtr to an OpenCV Mat.
This method transfers the data stored in an IntPtr to an OpenCV Mat. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data from Mats with any number of dimensions.
If the data size managed by the Mat is smaller than the data size of the memory region pointed to by the IntPtr, data will be copied up to the size of the mat. If the data size managed by the Mat is larger, data will be copied up to the size of the memory region pointed to by the IntPtr.
Note: This method operates on unmanaged memory, and incorrect usage can lead to unpredictable behavior, crashes, or data corruption. Ensure that the source pointer points to a valid memory region and that the specified length does not exceed the allocated memory size for that region. Additionally, as this method involves unmanaged memory, be cautious about potential security risks. Accessing memory beyond the intended range can lead to buffer overflows and may compromise application stability and security. It is highly recommended to perform validation checks on the pointer and the specified length.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the array and the Mat. Although its functionality is more limited compared to the Mat.put
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements represented by the IntPtr. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
intPtr | The source IntPtr from which data will be copied. This pointer must reference a valid memory region. |
mat | The destination Mat where the data will be copied. The Mat must not be disposed of or null. |
length | The number of elements of type T to copy from the source IntPtr to the destination Mat. |
- Returns
- The number of bytes copied from the IntPtr to the Mat.
- Exceptions
-
ArgumentNullException | Thrown when mat is null. |
ArgumentException | Thrown when intPtr == IntPtr.Zero . Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from a NativeArray to an OpenCV Mat.
This method transfers the data stored in a NativeArray into an OpenCV Mat object. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data where Mats with any number of dimensions.
If the data size managed by the Mat is smaller than the data size managed by the array, data will be copied up to the size of the mat. If the data size managed by the Mat is larger, data will be copied up to the size managed by the array.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the array and the Mat. Although its functionality is more limited compared to the Mat.put
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements in the NativeArray. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
array | The source NativeArray from which data will be copied. |
mat | The destination Mat where the data will be copied. The Mat must not be disposed of or null. |
- Returns
- The number of bytes copied from the NativeArray to the Mat.
- Exceptions
-
ArgumentNullException | Thrown when array or mat is null. |
ArgumentException | Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from a NativeArray to an OpenCV Mat.
This method transfers the data stored in a NativeArray into an OpenCV Mat object. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data where Mats with any number of dimensions.
If the data size managed by the Mat is smaller than the data size managed by the array, data will be copied up to the size of the mat. If the data size managed by the Mat is larger, data will be copied up to the size managed by the array.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the array and the Mat. Although its functionality is more limited compared to the Mat.put
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements in the NativeArray. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
array | The source NativeArray from which data will be copied. |
mat | The destination Mat where the data will be copied. The Mat must not be disposed of or null. |
length | The number of elements of type T to copy from the source NativeArray to the destination Mat. |
- Returns
- The number of bytes copied from the NativeArray to the Mat.
- Exceptions
-
ArgumentNullException | Thrown when array or mat is null. |
ArgumentException | Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from a Span to an OpenCV Mat.
This method transfers the data stored in a Span into an OpenCV Mat object. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data where Mats with any number of dimensions.
If the data size managed by the Mat is smaller than the data size managed by the array, data will be copied up to the size of the mat. If the data size managed by the Mat is larger, data will be copied up to the size managed by the array.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the array and the Mat. Although its functionality is more limited compared to the Mat.put
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements in the Span. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
array | The source Span from which data will be copied. |
mat | The destination Mat where the data will be copied. The Mat must not be disposed of or null. |
- Returns
- The number of bytes copied from the Span to the Mat.
- Exceptions
-
ArgumentNullException | Thrown when array or mat is null. |
ArgumentException | Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from a Span to an OpenCV Mat.
This method transfers the data stored in a Span into an OpenCV Mat object. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data where Mats with any number of dimensions.
If the data size managed by the Mat is smaller than the data size managed by the array, data will be copied up to the size of the mat. If the data size managed by the Mat is larger, data will be copied up to the size managed by the array.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the array and the Mat. Although its functionality is more limited compared to the Mat.put
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements in the Span. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
array | The source Span from which data will be copied. |
mat | The destination Mat where the data will be copied. The Mat must not be disposed of or null. |
length | The number of elements of type T to copy from the source Span to the destination Mat. |
- Returns
- The number of bytes copied from the Span to the Mat.
- Exceptions
-
ArgumentNullException | Thrown when array or mat is null. |
ArgumentException | Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from a managed array to an OpenCV Mat.
This method transfers the data stored in a managed array into an OpenCV Mat object. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data where Mats with any number of dimensions.
If the data size managed by the Mat is smaller than the data size managed by the array, data will be copied up to the size of the mat. If the data size managed by the Mat is larger, data will be copied up to the size managed by the array.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the array and the Mat. Although its functionality is more limited compared to the Mat.put
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements in the managed array. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
array | The source managed array from which data will be copied. |
mat | The destination Mat where the data will be copied. The Mat must not be disposed of or null. |
- Returns
- The number of bytes copied from the managed array to the Mat.
- Exceptions
-
ArgumentNullException | Thrown when array or mat is null. |
ArgumentException | Thrown when !mat.isContinuous() && mat.dims() > 2 . |
Copies the data from a managed array to an OpenCV Mat.
This method transfers the data stored in a managed array into an OpenCV Mat object. It supports both continuous and non-continuous Mat objects:
- If
mat.isContinuous()
is false
and mat.dims()
exceeds 2, the method will throw an exception, as non-continuous Mats with more than 2 dimensions are unsupported.
- If
mat.isContinuous()
is true
, the method can copy data where Mats with any number of dimensions.
If the data size managed by the Mat is smaller than the data size managed by the array, data will be copied up to the size of the mat. If the data size managed by the Mat is larger, data will be copied up to the size managed by the array.
Note: This method is specialized for copying a continuous range of data regardless of differences in types between the array and the Mat. Although its functionality is more limited compared to the Mat.put
method, it offers improved performance for such operations.
- Template Parameters
-
T | The type of the elements in the managed array. This must be an unmanaged type (i.e., a type without references to managed objects) to allow for direct memory access. |
- Parameters
-
array | The source managed array from which data will be copied. |
mat | The destination Mat where the data will be copied. The Mat must not be disposed of or null. |
length | The number of elements of type T to copy from the source managed array to the destination Mat. |
- Returns
- The number of bytes copied from the managed array to the Mat.
- Exceptions
-
ArgumentNullException | Thrown when array or mat is null. |
ArgumentException | Thrown when !mat.isContinuous() && mat.dims() > 2 . |