COSIE.image_preprocessing
Functions
Modify a grayscale image by applying a binary mask. |
|
Create and load a pre-trained Vision Transformer (ViT-L/16) model from a HuggingFace-compatible checkpoint. |
|
Extracts both global and local visual features from an input image batch using a pretrained model. |
|
Generate a geometric transformation matrix from source to destination keypoints, using either rigid or affine transformation. |
|
Extract pixel and spatial coordinates of 16×16 superpixels whose top-left pixels fall within the white (255) region of a binary mask. |
|
Identify the center coordinates of superpixels that are entirely white (255) in a binary image. |
|
Extract image features at cell locations using a pretrained Vision Transformer (ViT) model and save the output to disk as a pickle file. |
|
Efficiently load an image file and convert it to a NumPy array. |
|
Load a Python object from a .pkl file. |
|
Create the parent directory for a given file or directory path if it does not already exist. |
|
Rescale an image by a given scale factor using skimage.transform.rescale. |
|
Convert a NumPy array into a JPEG image and save it to disk. |
|
Save a Python object to a .pkl file using the pickle module. |
|
Apply a geometric transformation matrix (e.g., from generate_homograph) to 2D coordinates. |
Classes
A PyTorch-compatible dataset for extracting 224×224 image patches centered at specified cell coordinates from a high-resolution RGB image. |