image_analysis.decode package

Submodules

image_analysis.decode.extract_patches module

image_analysis.decode.extract_patches.extract_patches(mpeg_path, patch_dims, save_dir, *, n_frames=None, batch_size=250000)[source]
DESCRIPTION:
extract patches (neighborhoods) of pixels from videos in batches and save them to disk
ARGS:
save_dir:directory to save extracted patches
mpeg_path:file name for an mpeg video with one color channel
patch_dims:size of patches to extract
n_frames:number of frames to extract
batch_size:size limit for each batch
image_analysis.decode.extract_patches.get_mpeg_dims(vid_fname)[source]
ARGS:
vid_fname:file name for an mpeg video with one color channel
RETURNS:
(tuple):containing number of rows, columns, and frames of data

image_analysis.decode.video_decoder module

image_analysis.decode.video_decoder.decode_mpeg(v_path, batch_size=1, stride=1, start_idx=0, end_idx=-1, pad=True)[source]
DESCRIPTION:
Creates a list of batches of frames from an MPEG file.
ARGS:
v_path:Path to MPEG video (i.e. include the video’s name & extension)
batch_size:Number of frames in each batch
stride:Stride indicates beginning of batches, i.e. every stride’th frame (integer > 1)
start_idx:Index of first frame for first batch (integer >= 0)
end_idx:Index of last frame in the range of interest (integer >= 0)
pad:Boolean value indicating whether the last batch should be padded if it is not full after decoding the mpeg
RETURNS:
LIST of NUMPY batches of frames (length x width x channels), and if the last batch is not full, it is padded with frames of: np.zeros((frame.shape))
image_analysis.decode.video_decoder.pad_batch(batch, batch_size, frame, pad=True)[source]
DESCRIPTION:
Take in a batch, pad it with 0s if necessary and return appended batch
ARGS:
frame:a numpy array extracted from an MPEG (length x width x channel)
batch:list of frames
batch_size:number of frames per batch (integer >= 1)
RETURNS:
batch: list of a batch, batch has batch_size frames, each an ndarray: (L x W x C)

Module contents