CVBpy 14.0
Image Class Reference

The Common Vision Blox image. More...

Inherits object.

Inherited by DeviceImage, PanoramicMappedImage, StreamImage, and WrappedImage.

Public Member Functions

cvb.Image clone (self)
 Creates a new image object, that is a copy of the current instance. More...
 
None copy (self, cvb.Image target_image, Optional[cvb.Rect] source_rect, Optional[cvb.Point2D] target_position)
 Copies the image data from the source rectangle of this image to the target position inside the target image. More...
 
cvb.Image create (int width, int height, Optional[int] num_planes, Optional[cvb.DataType] data_type)
 Creates an uninitialized image with the given parameters. More...
 
cvb.Image from_images (int mapping, List[cvb.Image] images)
 Create an image that is the result of concatenating a series of input images. More...
 
cvb.Image from_planes (int mapping, List[cvb.ImagePlane] planes)
 Create an image that is the result of concatenating a series of input planes. More...
 
List[float] get_pixel (self, cvb.Point2D position)
 Gets the pixel values for all planes at a give position (as float list). More...
 
cvb.Point2D image_to_pixel_coordinates (self, cvb.Point2D point)
 Convert a point from image to pixel coordinates. More...
 
cvb.Image load (str file_name)
 Loads an image with the given file name. More...
 
cvb.Image map (self, cvb.Rect source_rect, Optional[cvb.Size2D] target_size)
 Creates a mapped image of the region of that image scaled to the size. More...
 
cvb.Point2D pixel_to_image_coordinates (self, cvb.Point2D point)
 Convert a point from pixel to image coordinates. More...
 
None raise_pixel_content_changed (self, cvb.Rect rect)
 Inform clients listening to the pixel content changed event, that the image data has been updated in the given rectangle. More...
 
cvb.EventCookie register_event_pixel_content_changed (self, Callable[[cvb.Image, cvb.Rect], None] handler)
 Register a listener to the pixel content changed event. More...
 
None save (self, str file_name)
 Write the current content of the image into a file. More...
 
None unregister_event_pixel_content_changed (self, cvb.EventCookie event_cookie)
 Manually unregister a listener from the pixel content changed event. More...
 

Properties

 bounds = property
 cvb.Rect: Bounding rectangle of the image in pixels.
 
 color_model = property
 int: Color model realized by this image (see cvb.ColorModel).
 
 coordinate_system = property
 cvb.AffineMatrix2D: Gets or sets the coordinate system of the image.
 
 height = property
 int: Height of the image in pixels.
 
 plane_data_types_identical = property
 bool: Check if all planes have the same data type.
 
 planes = property
 List[cvb.ImagePlane]: Access all planes for this image.
 
 size = property
 cvb.Size2D: Size of the image in pixels.
 
 width = property
 int: Width of the image in pixels.
 

Detailed Description

The Common Vision Blox image.

Supports the same arguments as cvb.Image.create or cvb.Image.load.

Parameters

*args : Any Parameters like cvb.Image.create or cvb.Image.load.

**kwargs : Any Parameters like cvb.Image.create or cvb.Image.load.

Member Function Documentation

◆ clone()

cvb.Image clone (   self)

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 cvb.Image without any driver interfaces.

Returns

cvb.Image A new image object that is a deep copy of this image data.

◆ copy()

None copy (   self,
cvb.Image  target_image,
Optional[cvb.Rect source_rect,
Optional[cvb.Point2D target_position 
)

Copies the image data from the source rectangle of this image to the target position inside the target image.

Parameters

target_image : cvb.Image Image to copy to.

source_rect : Optional[cvb.Rect] Source rectangle in pixels to copy from (defaults to the entire image).

target_position : Optional[cvb.Point2D] Position in the target image in pixels to copy to (defaults to 0,0).

◆ create()

cvb.Image create ( int  width,
int  height,
Optional[int]  num_planes,
Optional[cvb.DataType data_type 
)

Creates an uninitialized image with the given parameters.

Parameters

width : int Width of the image in pixels.

height : int Height of the image in pixels.

num_planes : Optional[int] Number of (color) planes (default 1).

data_type : Optional[cvb.DataType] Pixel data type (None means 8 bit).

Returns

cvb.Image The created image.

Creates an uninitialized image with the given parameters.

Parameters

size : cvb.Size2D Size of the image in pixels.

num_planes : Optional[int] Number of (color) planes (default 1).

data_type : Optional[cvb.DataType] Pixel data type (None means 8 bit).

Returns

cvb.Image The created image.

◆ from_images()

cvb.Image from_images ( int  mapping,
List[cvb.Image images 
)

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

Parameters

mapping : int Selects the relationship between the result image and the input images (see cvb.MappingOption).

images : List[cvb.Image] Images to be concatenated. All images in the input array must have equal size.

Returns

cvb.Image A concatenated image.

◆ from_planes()

cvb.Image from_planes ( int  mapping,
List[cvb.ImagePlane planes 
)

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

Parameters

mapping : int Selects the relationship between the result image and the input images (see cvb.MappingOption).

planes : List[cvb.ImagePlane] Planes to be concatenated. All planes in the input array must have equal size.

Returns

cvb.Image A concatenated image.

◆ get_pixel()

List[float] get_pixel (   self,
cvb.Point2D  position 
)

Gets the pixel values for all planes at a give position (as float list).

Parameters

position : cvb.Point2D Pixel position.

Returns

List[float] A list containing all pixel values.

◆ image_to_pixel_coordinates()

cvb.Point2D image_to_pixel_coordinates (   self,
cvb.Point2D  point 
)

Convert a point from image to pixel coordinates.

Parameters

point : cvb.Point2D Point in image coordinates.

Returns

cvb.Point2D Same point in pixel coordinates.

Convert an area from image to pixel coordinates.

Parameters

area : cvb.Area2D Area in image coordinates.

Returns

cvb.Area2D Same area in pixel coordinates.

◆ load()

cvb.Image load ( str  file_name)

Loads an image with the given file name.

Parameters

file_name : str The file name to load.

Returns

cvb.Image The loaded image.

◆ map()

cvb.Image map (   self,
cvb.Rect  source_rect,
Optional[cvb.Size2D target_size 
)

Creates a mapped image of the region of that image scaled to the size.

Parameters

source_rect : cvb.Rect Region to create the map from.

target_size : Optional[cvb.Size2D] Target size of the mapped image (defaults to source_rect.size).

Returns

cvb.Image The mapped image.

◆ pixel_to_image_coordinates()

cvb.Point2D pixel_to_image_coordinates (   self,
cvb.Point2D  point 
)

Convert a point from pixel to image coordinates.

Parameters

point : cvb.Point2D Point in pixel coordinates.

Returns

cvb.Point2D Same point in image coordinates.

Convert an area from pixel to image coordinates.

Parameters

area : cvb.Point2D Area in pixel coordinates.

Returns

cvb.Point2D Same area in image coordinates.

◆ raise_pixel_content_changed()

None raise_pixel_content_changed (   self,
cvb.Rect  rect 
)

Inform clients listening to the pixel content changed event, that the image data has been updated in the given rectangle.

Parameters

rect : cvb.Rect Affected area.

◆ register_event_pixel_content_changed()

cvb.EventCookie register_event_pixel_content_changed (   self,
Callable[[cvb.Image, cvb.Rect], None]  handler 
)

Register a listener to the pixel content changed event.

Parameters

handler : Callable[[cvb.Image, cvb.Rect], None] Listener to pixel content changed event.

Returns

cvb.EventCookie Event cookie to manually unregister the listener.

◆ save()

None save (   self,
str  file_name 
)

Write the current content of the image into a file.

The file format to be used is determined by the extension of the file name.

Parameters

file_name : str File name into which to save the image.

◆ unregister_event_pixel_content_changed()

None unregister_event_pixel_content_changed (   self,
cvb.EventCookie  event_cookie 
)

Manually unregister a listener from the pixel content changed event.

Parameters

event_cookie : cvb.EventCookie Event cookie obtained from registering the listener.