maad.rois.rois_to_imblobs

maad.rois.rois_to_imblobs(im_zeros, rois)[source]

Take a matrix full of zeros and add ones in delimited regions defined by rois.

Parameters:
im_zerosndarray

matrix full of zeros with the size to the image where the rois come from.

roisDataFrame

rois must have the columns names:((min_y, min_x, max_y, max_x) which correspond to the bounding box coordinates

Returns:
im_blobsndarray

matrix with 1 corresponding to the rois and 0 elsewhere

Examples

>>> from maad import rois, util
>>> import pandas as pd
>>> import numpy as np
>>> im_zeros = np.zeros((100,300))
>>> df_rois = pd.DataFrame({'min_y': [10, 40], 'min_x': [10, 200], 'max_y': [60, 80], 'max_x': [110, 250]})
>>> im_blobs = rois.rois_to_imblobs(im_zeros, df_rois)
>>> ax, fig = util.plot2d(im_blobs)