Plane information container.
More...
|
Image | Parent [get] |
| Image to which this descriptor refers to.
|
|
int | Plane [get] |
| Plane index in the Parent image to which this descriptor refers to.
|
|
DataType | DataType [get] |
| Data type descriptor for this plane. More...
|
|
Vpat | Vpat [get] |
| Accesses the virtual pixel access table. More...
|
|
IEnumerable< IntPtr > | AllPixels [get] |
| Gets an enumerator to enumerate all pixels of this plane. More...
|
|
Plane information container.
◆ CopyTo() [1/2]
Copies the image data from this plane to the targetPlane .
- Parameters
-
targetPlane | Plane to copy to. |
- Exceptions
-
CvbException | Copy regions or data types incompatible. |
ObjectDisposedException | If the parent image has already been disposed |
◆ CopyTo() [2/2]
Copies the image data from the sourceRect of this plane to the targetPlane targetPosition .
- Parameters
-
targetPlane | Plane to copy to. |
sourceRect | Source rectangle in pixels to copy from. |
targetPosition | Position in targetPlane in pixels to copy to. |
- Exceptions
-
CvbException | Copy regions or data types incompatible. |
ObjectDisposedException | If the parent image has already been disposed |
◆ GetAllPixelsIn() [1/2]
IEnumerable< IntPtr > GetAllPixelsIn |
( |
Area2D |
aoi | ) |
|
Gets an enumerator to enumerate all pixel values of this plane in the given aoi .
Touches every pixel in the aoi exactly once.
Attention:
no interpolation is done!
- Parameters
-
aoi | Area to scan for pixel values. |
- Returns
- Enumerator to enumerate all pixel values of this plane in the given aoi .
- Exceptions
-
ObjectDisposedException | If Parent has already been disposed |
InvalidOperationException | Thrown if the size of T and DataType.BytesPerPixel are unequal. |
◆ GetAllPixelsIn() [2/2]
IEnumerable< IntPtr > GetAllPixelsIn |
( |
Rect |
aoi | ) |
|
Gets an enumerator to enumerate all pixel values of this plane in the given aoi .
- Parameters
-
aoi | Area to scan for pixel values. |
- Returns
- Enumerator to enumerate all pixel values of this plane in the given aoi .
- Exceptions
-
ObjectDisposedException | If Parent has already been disposed |
InvalidOperationException | Thrown if the size of T and DataType.BytesPerPixel are unequal. |
◆ GetLinearAccess()
Gets linear access to the plane's pixels.
See TryGetLinearAccess. Unlike TryGetLinearAccess, GetLinearAccess
will throw an exception if linear access is not possible on this plane.
- Returns
- data structure with the values for accessing the pixels
- Exceptions
-
FormatException | If the plane's pixels are not accessible linearly |
ObjectDisposedException | If Parent has already been disposed |
◆ GetLinearAccess< T >()
Gets typed linear access to the plane's pixels.
See TryGetLinearAccess<T>(out LinearAccessData<T>). Unlike it, GetLinearAccess
will throw an exception if linear access is not possible on this plane.
Attention: Do not use reference types in T
as this will leak memory!
- Template Parameters
-
T | Structure for access a single plane's pixel. |
- Returns
- Data structure with the values for accessing the pixels
- Exceptions
-
FormatException | If the plane's pixels are not accessible linearly |
ObjectDisposedException | If Parent has already been disposed |
InvalidOperationException | Thrown if the size of T and DataType.BytesPerPixel are unequal. |
◆ GetLockedAccess()
Gets thread-locked access to the image data.
Calling this method will enter a reader/writer lock based on the specified lock mode. It is mandatory to ImageData.Dispose() the returned object when pixel access has finished. Best use the returned object in a using
block.
All other API functions do not use the reader/writer lock of the image. Thus if you want to use these on a shared image resource with some write access, you need to wrap the calls in a using
block initialized by this method.
Also by giving a hint whether you are changing the image data, the Image.PixelContentChanged event is fired when the returned object is disposed and the lockMode is ImageDataLockMode.WriteOnly or ImageDataLockMode.ReadWrite.
- Parameters
-
lockMode | Access mode hint. |
- Returns
- The image access data.
◆ GetPixel() [1/2]
double GetPixel |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Gets the pixel value at the given position.
- Parameters
-
x | Position in pixel coordinates. |
y | Position in pixel coordinates. |
- Returns
- The pixel value; double.NaN if the value could not be dereferenced.
◆ GetPixel() [2/2]
double GetPixel |
( |
Point2D |
position | ) |
|
Gets the pixel value at the given position .
- Parameters
-
position | Position in pixel coordinates. |
- Returns
- The pixel value; double.NaN if the value could not be dereferenced.
◆ GetVPATAccess< T >()
Gets typed VPAT access to the plane's pixels.
The size of T
must be equal to the DataType.BytesPerPixel.
Attention:
Do not use reference types in T
as this will leak memory!
- Template Parameters
-
T | Structure for access a single plane's pixel. |
- Returns
- Data structure with the value for accessing the pixels.
- Exceptions
-
ObjectDisposedException | If Parent has already been disposed |
InvalidOperationException | Thrown if the size of T and DataType.BytesPerPixel are unequal. |
◆ Initialize() [1/2]
void Initialize |
( |
Area2D |
area, |
|
|
double |
value |
|
) |
| |
Initialize an area of an image to a specific value.
- Parameters
-
area | area to be initialized |
value | value to initialize the area to |
- Exceptions
-
ObjectDisposedException | If the parent image has already been disposed |
◆ Initialize() [2/2]
void Initialize |
( |
double |
value | ) |
|
Initialize this plane to a specific value.
- Parameters
-
value | value to initialize the plane to |
- Exceptions
-
ObjectDisposedException | If the parent image has already been disposed |
◆ Map()
Create a map from a single image plane that shares its memory with the original plane.
- Returns
- Mapped image object.
- Exceptions
-
ObjectDisposedException | If the parent image has already been disposed |
◆ TryGetLinearAccess()
Attempt a linear access on the plane's pixels.
This function scans the image's VPAT for the possibility to access the individual pixels with linear increments in x and y direction. If either of the VPATs are jumbled, it will return false
, otherwise the values in access can be used to calculate the address of each pixel.
- Parameters
-
access | Data structure receiving the values for accessing the pixels |
- Returns
true
if linear access is possible, false
otherwise.
- Exceptions
-
ObjectDisposedException | If Parent has already been disposed |
◆ TryGetLinearAccess< T >()
Attempt a typed linear access on the plane's pixels.
This function scans the image's VPAT for the possibility to access the individual pixels with linear increments in x and y direction. If either of the VPATs are jumbled, it will return false
, otherwise the values in access can be used to calculate the address of each pixel.
Additionally the size of T
must be equal to the DataType.BytesPerPixel.
Attention:
Do not use reference types in T
as this will leak memory!
- Template Parameters
-
T | Structure for access a single plane's pixel. |
- Parameters
-
access | Data structure receiving the values for accessing the pixels |
- Returns
true
if linear access is possible, false
otherwise.
- Exceptions
-
ObjectDisposedException | If Parent has already been disposed |
InvalidOperationException | Thrown if the size of T and DataType.BytesPerPixel are unequal. |
◆ AllPixels
IEnumerable<IntPtr> AllPixels |
|
get |
Gets an enumerator to enumerate all pixels of this plane.
Enumerator to enumerate the pointers to each pixel in an image.
◆ DataType
Data type descriptor for this plane.
- Exceptions
-
ObjectDisposedException | If Parent has already been disposed |
◆ Vpat
Accesses the virtual pixel access table.
Normally this property only needs to be accessed if you want to access the underlying CVB image on the pixel level. Note that VPAT access is one of the slower access modes. If possible, linear access is preferred.