Roi Class

The Roi class is used to represent a region of interest. Various functions require a ROI object to be passed.

class pyholoscope.Roi(x, y, width, height)
__init__(x, y, width, height)

Initialise ROI.

Arguments:
x, yint

x and y coordinates of top-left corner

widthint

width of ROI

heightint

height of ROI

clear_inside(img)

Set pixels in img to be zero if inside ROI.

Arguments:
imgnumpy.ndarray

input image

Returns:

numpy.ndarray : image with pixels inside ROI set to zero

clear_outside(img)

Set pixels in img to be zero if outside ROI.

Arguments:
imgnumpy.ndarray

input image

Returns:

numpy.ndarray : image with pixels outside ROI set to zero

constrain(min_x, min_y, max_x, max_y)

Stops ROI exceeding a specified size by adjusting ROI coordinates and size.

Arguments:
min_xint

minimum x coordinate

min_yint

minimum y coordinate

max_xint

maximum x coordinate

max_yint

maximum y coordinate

crop(img)

Crop and image using the ROI.

Arguments:
imgnumpy.ndarray

input image

Returns:

numpy.ndarray : cropped image