CVB.Net 14.0
Image Class Reference

The Common Vision Blox image. More...

Inherits INativeHandle, and ICloneable.

Inherited by DeviceImage, StreamImage, FileImage, FftImage, MappedImage, PanoramicMappedImage, and WrappedImage.

Public Member Functions

 Image (int width, int height)
 Creates an uninitialized image with the given width and height . More...
 
 Image (Size2D size)
 Creates an uninitialized image with the given size . More...
 
 Image (int width, int height, int numPlanes)
 Creates an uninitialized image with the given width and height , numPlanes infos. More...
 
 Image (Size2D size, int numPlanes)
 Creates an uninitialized image with the given size and numPlanes . More...
 
 Image (int width, int height, int numPlanes, PixelDataType dataType, int bitDepth)
 Creates an uninitialized image with the given width and height , numPlanes infos. More...
 
 Image (Size2D size, int numPlanes, PixelDataType dataType, int bitDepth)
 Creates an uninitialized image with the given size and numPlanes . More...
 
 Image (int width, int height, int numPlanes, DataType dataType)
 Creates an uninitialized image with the given width and height , numPlanes infos. More...
 
 Image (Size2D size, int numPlanes, DataType dataType)
 Creates an uninitialized image with the given size and numPlanes . More...
 
unsafe byte[] ToObjectBuffer ()
 Create a byte buffer with the serialized image object data. More...
 
override bool Equals (object obj)
 Equality check. More...
 
override int GetHashCode ()
 Build a suitable hash code. More...
 
double[] GetPixel (Point2D position)
 Gets the pixel values for all planes at the given position . More...
 
double[] GetPixel (int x, int y)
 Gets the pixel values for all planes at the given position. More...
 
bool Contains (Point2D pt)
 Tests if a pixel location is inside the image. More...
 
void Initialize (Area2D area, double value)
 Initialize the given area in all planes of this image to the specified value. More...
 
void Initialize (Rect area, double value)
 Initialize the given area in all planes of this image to the specified value. More...
 
void Initialize (Rect area, params double[] values)
 Initialize the given area in all planes of this image to the specified values. More...
 
void Initialize (Area2D area, params double[] values)
 Initialize the given area in all planes of this image to the specified values. More...
 
void Initialize (double value)
 Initialize all planes of this image to the specified value. More...
 
void Initialize (params double[] values)
 Initialize all planes of this image to the specified values. More...
 
virtual Image Clone ()
 Creates a new Image object that is a copy of the current instance. More...
 
virtual Image Copy ()
 Creates a new Image object that is a copy of the current instance. More...
 
void CopyTo (Image targetImage, Rect sourceRect, Point2D targetPosition)
 Copies the image data from the sourceRect of this image to the targetImage targetPosition . More...
 
void CopyTo (Image targetImage)
 Copies the image data from this image to the targetImage . More...
 
MappedImage Map (Rect rect)
 Creates a mapped image of the rect region of this image. More...
 
MappedImage Map (Rect sourceRect, Size2D targetSize)
 Creates a mapped image of the sourceRect region of this image scaled to the targetSize . More...
 
MappedImage Map (Size2D targetSize)
 Creates a mapped image of this whole image scaled to the targetSize . More...
 
Image SubImage (Rect sourceRect)
 Creates a new Image that is a copy from the given sourceRect of the image data of the current instance. More...
 
Image SubImage (Area2D sourceArea)
 Creates a new Image that is a copy from the given sourceArea of the image data of the current instance. More...
 
void Save (string fileName)
 Write the current content of the image into a file. The file format to be used is determined by the extension of the fileName . If a lossy format is selected, a default quality setting will be used (if you want to specify your own quality setting, please use the overload that allows specification of a quality value). More...
 
void Save (string fileName, double quality)
 Write the current content of the image into a file. The file format to be used is determined based on the fileName 's extension. The quality (and thereby size) of the resulting file can be adjusted using the quality parameter. When saving to a lossless file format, the quality parameter will be silently ignored. More...
 
void RaisePixelContentChanged ()
 Inform clients listening to the PixelContentChanged event that this image data has been completely updated (full area).
 
void RaisePixelContentChanged (Rect rect)
 Inform clients listening to the PixelContentChanged event that this image data has been updated in the given rect . More...
 
void BeginPixelContentChange ()
 Starts an image update block. More...
 
void EndPixelContentChange ()
 Ends an image update block. More...
 
IDisposable StartPixelContentChangeBlock ()
 Starts an image update block to be used in a using statement. More...
 
Point2Dd ImageToPixelCoordinates (Point2Dd p)
 Convert a pixel from image to pixel coordinates. More...
 
Area2D ImageToPixelCoordinates (Area2D area)
 Convert an Area2D from image to pixel coordinates. More...
 
Point2Dd PixelToImageCoordinates (Point2Dd p)
 Convert a pixel from pixel to image coordinates. More...
 
Area2D PixelToImageCoordinates (Area2D area)
 Convert an Area2D from pixel to image coordinates. More...
 
void Dispose ()
 IDisposable implementation. More...
 
void Close ()
 Alias of the Dispose() method. More...
 

Static Public Member Functions

static Image FromHandle (IntPtr nativeHandle)
 Create a Image from a native handle. More...
 
static Image FromHandle (IntPtr nativeHandle, ShareObject doShare)
 Create a Image from a native handle and potentially increment the unmanaged reference count on the native handle. More...
 
static Image FromHandle (IntPtr nativeHandle, ShareObject doShare, UseMemoryPressure useMemoryPressure)
 Create a Image from a native handle and potentially increment the unmanaged reference count on the native handle. More...
 
static Image FromHandle (IntPtr nativeHandle, ShareObject doShare, long memoryPressure)
 Create a Image from a native handle and potentially increment the unmanaged reference count on the native handle. More...
 
static unsafe Image FromObjectBuffer (byte[] arr)
 Deserialize an image object from an object buffer generated by the extension method ToObjectBuffer. More...
 
static FileImage FromFile (string fileName)
 Loads an image with the given fileName . More...
 
static Image FromPlanes (MappingOption mapping, params ImagePlane[] planes)
 Create an image that is the result of concatenating a series of input planes . More...
 
static Image FromImages (MappingOption mapping, params Image[] images)
 Create an image that is the result of concatenating a series of input images. More...
 

Protected Member Functions

 Image (IntPtr handle)
 Creates a Image object around a native handle. More...
 
 Image (IntPtr handle, ShareObject doShare, UseMemoryPressure useMemoryPressure)
 Creates a Image object around a native handle and guesses the memory pressure if useMemoryPressure indicates that. More...
 
 Image (IntPtr handle, ShareObject doShare, long memoryPressure)
 Creates a Image object around a native handle with the given memoryPressure . More...
 
void OnPixelContentChanged ()
 Inform clients listening to the PixelContentChanged event that this image data has been completely updated (full area).
 
virtual void OnPixelContentChanged (Rect rect)
 Inform clients listening to the PixelContentChanged event that this image data has been updated in the given rect . More...
 
virtual void Dispose (bool disposing)
 IDispose helper function. More...
 
void Detach ()
 Detaches this Image object from the native IMG. More...
 

Properties

bool IsDisposed [get]
 Tests if the native handle has already been disposed.
 
ImagePlaneCollection Planes [get]
 Access to the infos of the image. More...
 
Size2D Size [get]
 Size of the image. More...
 
int Width [get]
 Width of the image in pixels. More...
 
int Height [get]
 Height of the image in pixels. More...
 
bool HasOverlayMask [get]
 True if at least one of the image infos has the overlay mask bit set. More...
 
IntPtr Handle [get]
 Native CVB image handle. More...
 
ColorModel ColorModel [get]
 Color model that is realized by this image. More...
 
Rect Bounds [get]
 Retrieve the bounding rect of the Image. More...
 
AffineMatrix2D CoordinateSystem [get, set]
 Coordinate system of the image. More...
 
- Properties inherited from INativeHandle
IntPtr Handle [get]
 The native handle of the object.
 
bool IsDisposed [get]
 Possibility to check whether the object has already been disposed of.
 

Events

EventHandler< RectEventArgsPixelContentChanged
 Fired when the image data of this image was consciously updated. More...
 
EventHandler HandleChanged
 Event that is fired when the handle of this image changed.
 
NativeHandleEventDelegate ObjectDisposing
 Raised when this object is about to be disposed via the IDisposable.Dispose method. More...
 
- Events inherited from INativeHandle
NativeHandleEventDelegate ObjectDisposing
 Raised when this object is about to be disposed via the IDisposable.Dispose method.
More...
 

Detailed Description

The Common Vision Blox image.

Constructor & Destructor Documentation

◆ Image() [1/11]

Image ( int  width,
int  height 
)

Creates an uninitialized image with the given width and height .

The image has a single plane, 8 bits per pixel PixelDataType.UInt.

Parameters
widthWidth of the image in pixels.
heightHeight of the image in pixels.
Exceptions
ArgumentOutOfRangeExceptionIf width , height are negative.
InsufficientMemoryExceptionIf not enough memory is available to create the image.

◆ Image() [2/11]

Image ( Size2D  size)

Creates an uninitialized image with the given size .

Parameters
sizeSize of the image in pixels.
Exceptions
ArgumentOutOfRangeExceptionIf size width or height are negative.
InsufficientMemoryExceptionIf not enough memory is available to create the image.

◆ Image() [3/11]

Image ( int  width,
int  height,
int  numPlanes 
)

Creates an uninitialized image with the given width and height , numPlanes infos.

The image data type for all infos is 8 bits per pixel PixelDataType.UInt.

Parameters
widthWidth of the image in pixels.
heightHeight of the image in pixels.
numPlanesNumber of (color) infos.
Exceptions
ArgumentOutOfRangeExceptionIf width , height are negative or if numPlanes is smaller than one.
InsufficientMemoryExceptionIf not enough memory is available to create the image.

◆ Image() [4/11]

Image ( Size2D  size,
int  numPlanes 
)

Creates an uninitialized image with the given size and numPlanes .

Parameters
sizeSize of the image in pixels.
numPlanesNumber of (color) infos.
Exceptions
ArgumentOutOfRangeExceptionIf size width or height are negative or numPlanes is smaller than one.
InsufficientMemoryExceptionIf not enough memory is available to create the image.

◆ Image() [5/11]

Image ( int  width,
int  height,
int  numPlanes,
PixelDataType  dataType,
int  bitDepth 
)

Creates an uninitialized image with the given width and height , numPlanes infos.

This constructor defines also the all plane's pixels data format via the dataType and bitDepth .

Allowed bit depth for integer images are:

  • 8 to 64 bits

For float images:

  • 32 bits
  • 64 bits
Parameters
widthWidth of the image in pixels.
heightHeight of the image in pixels.
numPlanesNumber of (color) infos.
dataTypePixel data type.
bitDepthBits per pixel per plane.
Exceptions
ArgumentExceptionIf dataType has an invalid value.
ArgumentOutOfRangeExceptionIf width , height are negative; if numPlanes is smaller than one; or if bitDepth is out of range.
InsufficientMemoryExceptionIf not enough memory is available to create the image.

◆ Image() [6/11]

Image ( Size2D  size,
int  numPlanes,
PixelDataType  dataType,
int  bitDepth 
)

Creates an uninitialized image with the given size and numPlanes .

This constructor defines also the all plane's pixels data format via the dataType and bitDepth .

Allowed bit depth for integer images are:

  • 8 to 64 bits

For float images:

  • 32 bits
  • 64 bits
Parameters
sizeSize of the image in pixels.
numPlanesNumber of (color) infos.
dataTypePixel data type.
bitDepthBits per pixel per plane.
Exceptions
ArgumentExceptionIf dataType has an invalid value.
ArgumentOutOfRangeExceptionIf size width or height are negative or numPlanes is smaller than one; or if bitDepth is out of range.
InsufficientMemoryExceptionIf not enough memory is available to create the image.

◆ Image() [7/11]

Image ( int  width,
int  height,
int  numPlanes,
DataType  dataType 
)

Creates an uninitialized image with the given width and height , numPlanes infos.

This constructor defines also the all plane's pixels data format via the dataType .

Parameters
widthWidth of the image in pixels.
heightHeight of the image in pixels.
numPlanesNumber of (color) infos.
dataTypePixel data type.
Exceptions
ArgumentOutOfRangeExceptionIf width , height are negative; or if numPlanes is smaller than one.
InsufficientMemoryExceptionIf not enough memory is available to create the image.

◆ Image() [8/11]

Image ( Size2D  size,
int  numPlanes,
DataType  dataType 
)

Creates an uninitialized image with the given size and numPlanes .

This constructor defines also the all plane's pixels data format via the dataType .

Parameters
sizeSize of the image in pixels.
numPlanesNumber of (color) infos.
dataTypePixel data type.
Exceptions
ArgumentOutOfRangeExceptionIf size width or height are negative or numPlanes is smaller than one.
InsufficientMemoryExceptionIf not enough memory is available to create the image.

◆ Image() [9/11]

Image ( IntPtr  handle)
protected

Creates a Image object around a native handle.

Does not share the given handle , but guesses memory pressure.

Parameters
handleNative handle of the image.

◆ Image() [10/11]

Image ( IntPtr  handle,
ShareObject  doShare,
UseMemoryPressure  useMemoryPressure 
)
protected

Creates a Image object around a native handle and guesses the memory pressure if useMemoryPressure indicates that.

Parameters
handleNative handle of the image
doShareShareObject.Yes if handle is to be shared.
useMemoryPressureGuesses memory pressure if UseMemoryPressure.Yes is set.

◆ Image() [11/11]

Image ( IntPtr  handle,
ShareObject  doShare,
long  memoryPressure 
)
protected

Creates a Image object around a native handle with the given memoryPressure .

Parameters
handleNative handle of the image
doShareShareObject.Yes if handle is to be shared.
memoryPressureNumber of bytes to indicate native object size; 0 or negative values are ignored.

Member Function Documentation

◆ BeginPixelContentChange()

void BeginPixelContentChange ( )

Starts an image update block.

Normally API operations changing this image will result in an immediate PixelContentChanged event. If several updates are performed they can be grouped together so that only one event is fired after the full block.

Several blocks can also be nested. The event will then fired when the last block is closed.

◆ Clone()

virtual Image Clone ( )
virtual

Creates a new Image object that is a copy of the current instance.

This method performs a deep copy of the image data the current instance currently points to.

This means that if you clone a driver image, you receive a new plain Image without any driver interfaces!

Returns
A new Image object that is a deep copy of this image data.
Exceptions
InsufficientMemoryExceptionThe new image buffer could not be created.
CvbExceptionIf image format could not be cloned.
ObjectDisposedExceptionIf this image has already been disposed

Reimplemented in MappedImage, and WrappedImage.

◆ Close()

void Close ( )

Alias of the Dispose() method.

Call this method to release the resources allocated by this image immediately. Remember that after calling Dispose, any subsequent access to references to this image will result in an ObjectDisposedException.

◆ Contains()

bool Contains ( Point2D  pt)

Tests if a pixel location is inside the image.

Parameters
ptLocation to test
Returns
true if pt refers to a position inside the image, false otherwise.

◆ Copy()

virtual Image Copy ( )
virtual

Creates a new Image object that is a copy of the current instance.

This method performs a deep copy of the image data the current instance currently points to.

This means that if you clone a driver image, you receive a new plain Image without any driver interfaces!

Returns
A new Image object that is a deep copy of this image data.
Exceptions
InsufficientMemoryExceptionThe new image buffer could not be created.
CvbExceptionIf image format could not be cloned.
ObjectDisposedExceptionIf this image has already been disposed

◆ CopyTo() [1/2]

void CopyTo ( Image  targetImage)

Copies the image data from this image to the targetImage .

Parameters
targetImageImage to copy to.
Exceptions
CvbExceptionCopy regions or data types incompatible.
ObjectDisposedExceptionIf this image has already been disposed

◆ CopyTo() [2/2]

void CopyTo ( Image  targetImage,
Rect  sourceRect,
Point2D  targetPosition 
)

Copies the image data from the sourceRect of this image to the targetImage targetPosition .

Parameters
targetImageImage to copy to.
sourceRectSource rectangle in pixels to copy from.
targetPositionPosition in targetImage in pixels to copy to.
Exceptions
CvbExceptionCopy regions or data types incompatible.
ObjectDisposedExceptionIf this image has already been disposed

◆ Detach()

void Detach ( )
protected

Detaches this Image object from the native IMG.

This call marks this object as disposed without changing the underlying ref-count.

◆ Dispose() [1/2]

void Dispose ( )

IDisposable implementation.

Call this method to release the resources allocated by this image immediately. Remember that after calling Dispose, any subsequent access to references to this image will result in an ObjectDisposedException.

◆ Dispose() [2/2]

virtual void Dispose ( bool  disposing)
protectedvirtual

IDispose helper function.

Parameters
disposingtrue when called via IDisposable.Dispose, false when called by the finalizer.

Reimplemented in BufferImage, DeviceImage, MultiPartImage, RingBufferImage, MappedImage, and PanoramicMappedImage.

◆ EndPixelContentChange()

void EndPixelContentChange ( )

Ends an image update block.

See BeginPixelContentChange for additional information.

◆ Equals()

override bool Equals ( object  obj)

Equality check.

Parameters
objObject to which to compare.
Returns
true if this image reference is equal.

◆ FromFile()

static FileImage FromFile ( string  fileName)
static

Loads an image with the given fileName .

Parameters
fileNameFile name of image to load.
Exceptions
FileNotFoundExceptionwhen the file specified by the fileName parameter does not exist.
FileLoadExceptionIf the file specified by the fileName parameter exists, but cannot be loaded.
ArgumentNullExceptionIf fileName is null.
Returns
New FileImage object if load succeeded.

◆ FromHandle() [1/4]

static Image FromHandle ( IntPtr  nativeHandle)
static

Create a Image from a native handle.

Note that this function is not intended for general use. Providing invalid values on the nativeHandle parameter will most likely lead to severe problems in your application.

Parameters
nativeHandleNandle to create the image from.
Returns
Newly created image or null of no image could be created.

◆ FromHandle() [2/4]

static Image FromHandle ( IntPtr  nativeHandle,
ShareObject  doShare 
)
static

Create a Image from a native handle and potentially increment the unmanaged reference count on the native handle.

Note that this function is not intended for general use. Providing invalid values on the nativeHandle parameter will most likely lead to severe problems in your application.

This function will guess the memory pressure of the native image passed via the nativeHandle

Parameters
nativeHandleHandle to create the image from.
doShareShareObject.Yes if nativeHandle is to be shared.
Returns
Newly created image or null of no image could be created.

◆ FromHandle() [3/4]

static Image FromHandle ( IntPtr  nativeHandle,
ShareObject  doShare,
long  memoryPressure 
)
static

Create a Image from a native handle and potentially increment the unmanaged reference count on the native handle.

Note that this function is not intended for general use. Providing invalid values on the nativeHandle parameter will most likely lead to severe problems in your application.

Parameters
nativeHandleHandle to create the image from.
doShareShareObject.Yes if nativeHandle is to be shared.
memoryPressureGives the number of bytes the native object occupies.
Returns
Newly created image or null of no image could be created.

◆ FromHandle() [4/4]

static Image FromHandle ( IntPtr  nativeHandle,
ShareObject  doShare,
UseMemoryPressure  useMemoryPressure 
)
static

Create a Image from a native handle and potentially increment the unmanaged reference count on the native handle.

Note that this function is not intended for general use. Providing invalid values on the nativeHandle parameter will most likely lead to severe problems in your application.

This function will guess the memory pressure of the native image passed via the nativeHandle if useMemoryPressure is set to UseMemoryPressure.Yes.

Parameters
nativeHandleHandle to create the image from.
doShareShareObject.Yes if nativeHandle is to be shared.
useMemoryPressureGuesses memory pressure if UseMemoryPressure.Yes is set.
Returns
Newly created image or null of no image could be created.

◆ FromImages()

static Image FromImages ( MappingOption  mapping,
params Image[]  images 
)
static

Create an image that is the result of concatenating a series of input images.

Parameters
mappingSelects the relationship between the result Image and the input image
imagesImages to be concatenated; all images in the input array must be valid and have equal size
Returns
Concatenated image
Exceptions
ArgumentNullExceptionIf images is null
InvalidOperationExceptionIf there are no source images
FormatExceptionIf the input images do not have matching width/height

◆ FromObjectBuffer()

static unsafe Image FromObjectBuffer ( byte[]  arr)
static

Deserialize an image object from an object buffer generated by the extension method ToObjectBuffer.

Parameters
arrArray to recreate the image object from.
Returns
Recreated object.
Exceptions
ArgumentNullExceptionif the arr parameter is null

◆ FromPlanes()

static Image FromPlanes ( MappingOption  mapping,
params ImagePlane[]  planes 
)
static

Create an image that is the result of concatenating a series of input planes .

Parameters
mappingSelects the relationship between the result Image and the input image
planesPlanes to be concatenated; all images in the input array must be valid and have equal size
Returns
Concatenated image
Exceptions
ArgumentNullExceptionIf planes is null
InvalidOperationExceptionIf there are no source planes
FormatExceptionIf the input planes do not have matching width/height

◆ GetHashCode()

override int GetHashCode ( )

Build a suitable hash code.

Returns
Hash code from handle.

◆ GetPixel() [1/2]

double[] GetPixel ( int  x,
int  y 
)

Gets the pixel values for all planes at the given position.

Parameters
xPosition in pixel coordinates.
yPosition in pixel coordinates.
Returns
The pixel values; double.NaN if a value could not be dereferenced.

◆ GetPixel() [2/2]

double[] GetPixel ( Point2D  position)

Gets the pixel values for all planes at the given position .

Parameters
positionPosition in pixel coordinates.
Returns
The pixel values; double.NaN if a value could not be dereferenced.

◆ ImageToPixelCoordinates() [1/2]

Area2D ImageToPixelCoordinates ( Area2D  area)

Convert an Area2D from image to pixel coordinates.

Parameters
areaArea in image coordinates.
Returns
Same area in pixel coordinates.
Exceptions
ObjectDisposedExceptionIf this image has already been disposed of.

◆ ImageToPixelCoordinates() [2/2]

Point2Dd ImageToPixelCoordinates ( Point2Dd  p)

Convert a pixel from image to pixel coordinates.

Parameters
pPoint in image coordinates
Returns
Same point in pixel coordinates
Exceptions
ObjectDisposedExceptionIf this image has already been disposed of.

◆ Initialize() [1/6]

void Initialize ( Area2D  area,
double  value 
)

Initialize the given area in all planes of this image to the specified value.

Parameters
areaArea to be initialized
valueValue to initialize to.

◆ Initialize() [2/6]

void Initialize ( Area2D  area,
params double[]  values 
)

Initialize the given area in all planes of this image to the specified values.

Parameters
areaArea to be initialized.
valuesValues to initialize the individual planes to.
Exceptions
ArgumentNullExceptionIf values is null.

◆ Initialize() [3/6]

void Initialize ( double  value)

Initialize all planes of this image to the specified value.

Parameters
valueValue to initialize to.

◆ Initialize() [4/6]

void Initialize ( params double[]  values)

Initialize all planes of this image to the specified values.

Parameters
valuesCalues to initialize the individual planes to
Exceptions
ArgumentNullExceptionIf values is null

◆ Initialize() [5/6]

void Initialize ( Rect  area,
double  value 
)

Initialize the given area in all planes of this image to the specified value.

Parameters
areaArea to be initialized
valueValue to initialize to.

◆ Initialize() [6/6]

void Initialize ( Rect  area,
params double[]  values 
)

Initialize the given area in all planes of this image to the specified values.

Parameters
areaArea to be initialized.
valuesValue to initialize to.

◆ Map() [1/3]

MappedImage Map ( Rect  rect)

Creates a mapped image of the rect region of this image.

The result is an exact view on this image's data and no scaling is done.

Parameters
rectRegion to create map from.
Returns
Mapped image with the size of the given rect .

◆ Map() [2/3]

MappedImage Map ( Rect  sourceRect,
Size2D  targetSize 
)

Creates a mapped image of the sourceRect region of this image scaled to the targetSize .

As this is simply a view to another image no interpolation is done when the mapped pixels are accessed. Smaller sizes result in pixel skipping while larger sizes result in replicated pixels.

Parameters
sourceRectRegion to create map from.
targetSizeTarget size of the mapped image.
Returns
Mapped image.

◆ Map() [3/3]

MappedImage Map ( Size2D  targetSize)

Creates a mapped image of this whole image scaled to the targetSize .

As this is simply a view to another image no interpolation is done when the mapped pixels are accessed. Smaller sizes result in pixel skipping while larger sizes result in replicated pixels.

Parameters
targetSizeTarget size of the mapped image.
Returns
Mapped image.

◆ OnPixelContentChanged()

virtual void OnPixelContentChanged ( Rect  rect)
protectedvirtual

Inform clients listening to the PixelContentChanged event that this image data has been updated in the given rect .

Parameters
rectAffected area.

Reimplemented in MappedImage, and PanoramicMappedImage.

◆ PixelToImageCoordinates() [1/2]

Area2D PixelToImageCoordinates ( Area2D  area)

Convert an Area2D from pixel to image coordinates.

Parameters
areaArea in pixel coordinates
Returns
Same area in image coordinates
Exceptions
ObjectDisposedExceptionIf the image has already been disposed of.

◆ PixelToImageCoordinates() [2/2]

Point2Dd PixelToImageCoordinates ( Point2Dd  p)

Convert a pixel from pixel to image coordinates.

Parameters
pPoint in pixel coordinates
Returns
Same point in image coordinates
Exceptions
ObjectDisposedExceptionIf the image has already been disposed of.

◆ RaisePixelContentChanged()

void RaisePixelContentChanged ( Rect  rect)

Inform clients listening to the PixelContentChanged event that this image data has been updated in the given rect .

Parameters
rectAffected area.

◆ Save() [1/2]

void Save ( string  fileName)

Write the current content of the image into a file. The file format to be used is determined by the extension of the fileName . If a lossy format is selected, a default quality setting will be used (if you want to specify your own quality setting, please use the overload that allows specification of a quality value).

Parameters
fileNameFile name into which to save the image
Exceptions
ObjectDisposedExceptionIf this image has already been disposed
System.IO.IOExceptionIf saving the image failed

◆ Save() [2/2]

void Save ( string  fileName,
double  quality 
)

Write the current content of the image into a file. The file format to be used is determined based on the fileName 's extension. The quality (and thereby size) of the resulting file can be adjusted using the quality parameter. When saving to a lossless file format, the quality parameter will be silently ignored.

Parameters
fileNameFile name into which to save the image
qualityQuality at which to save the image (should be in the range 0...1)
Exceptions
ObjectDisposedExceptionIf this image has already been disposed
System.IO.IOExceptionIf saving the image failed

◆ StartPixelContentChangeBlock()

IDisposable StartPixelContentChangeBlock ( )

Starts an image update block to be used in a using statement.

Calls BeginPixelContentChange. As soon as the returned object is disposed, the EndPixelContentChange is called.

using (myImage.StartPixelContentChangeBlock())
{
// perform image writing operations...
}
Returns
Disposable image update block.

◆ SubImage() [1/2]

Image SubImage ( Area2D  sourceArea)

Creates a new Image that is a copy from the given sourceArea of the image data of the current instance.

This method performs a deep copy of the image data the current instance currently points to.

This means that if you clone a driver image, you receive a new plain Image without any driver interfaces!

Parameters
sourceAreaArea2D that identifies the region to copy.
Returns
A new Image object that is a deep copy of this image data.
Exceptions
InsufficientMemoryExceptionThe new image buffer could not be created.
CvbExceptionIf image format could not be cloned.
ObjectDisposedExceptionIf this image has already been disposed

◆ SubImage() [2/2]

Image SubImage ( Rect  sourceRect)

Creates a new Image that is a copy from the given sourceRect of the image data of the current instance.

This method performs a deep copy of the image data the current instance currently points to.

This means that if you clone a driver image, you receive a new plain Image without any driver interfaces!

Parameters
sourceRectRectangle that identifies the region to copy.
Returns
A new Image object that is a deep copy of this image data.
Exceptions
InsufficientMemoryExceptionThe new image buffer could not be created.
CvbExceptionIf image format could not be cloned.
ObjectDisposedExceptionIf this image has already been disposed

◆ ToObjectBuffer()

unsafe byte[] ToObjectBuffer ( )

Create a byte buffer with the serialized image object data.

Note that this data do not directly correspond to pixel data - they are serialized object data that may be used for streaming and can be serialized by means of the FromObjectBuffer method.

Returns
Byte array with the serialized object data
Exceptions
Exceptionif serialization failed

Property Documentation

◆ Bounds

Rect Bounds
get

Retrieve the bounding rect of the Image.

Bounding rect of the Image

Exceptions
ObjectDisposedExceptionIf this image has already been disposed of

◆ ColorModel

Color model that is realized by this image.

Exceptions
ObjectDisposedExceptionIf this image has already been disposed

◆ CoordinateSystem

AffineMatrix2D CoordinateSystem
getset

Coordinate system of the image.

Exceptions
ObjectDisposedExceptionIf the image has already been disposed

◆ Handle

IntPtr Handle
get

Native CVB image handle.

It is normally not necessary to work with this handle in CVB.Net. Note that using this handle in connection with the legacy CVB managed wrappers may actually be disruptive to your application.

Implements INativeHandle.

◆ HasOverlayMask

bool HasOverlayMask
get

True if at least one of the image infos has the overlay mask bit set.

Exceptions
ObjectDisposedExceptionIf the image has already been disposed

◆ Height

int Height
get

Height of the image in pixels.

Exceptions
ObjectDisposedExceptionIf this image has already been disposed of

◆ Planes

Access to the infos of the image.

Exceptions
ObjectDisposedExceptionIf this image has already been disposed of.

◆ Size

Size2D Size
get

Size of the image.

Exceptions
ObjectDisposedExceptionIf this image has already been disposed of.

◆ Width

int Width
get

Width of the image in pixels.

Exceptions
ObjectDisposedExceptionIf this image has already been disposed of

Event Documentation

◆ ObjectDisposing

NativeHandleEventDelegate ObjectDisposing

Raised when this object is about to be disposed via the IDisposable.Dispose method.

This event is raised right before this object is disposed. The dispose itself cannot be canceled.

◆ PixelContentChanged

EventHandler<RectEventArgs> PixelContentChanged

Fired when the image data of this image was consciously updated.

This event is only fired when using methods of this CVB API. Specifically this event is not fired when you use the ImagePlane.GetLinearAccess or ImagePlane.Vpat methods as it is not known whether the image data has changed. To inform clients of image data change in this case you can either call OnPixelContentChanged() or use the ImagePlane.GetLockedAccess method.