public class Mask
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static MaskData |
createCroppedMask(boolean[][] mask)
Creates a mask ROI; automatically crop to its bounding box.
|
static MaskData |
createCroppedMask(int[][] mask)
Creates a mask ROI; automatically crop to its bounding box.
|
static java.util.List<MaskData> |
createCroppedMasks(int[][] masks)
Creates mask ROIs from the given integer array where each
single mask ROI is specified by a specific integer.
|
static java.util.List<MaskData> |
createCroppedMasks(int[] masks,
int width)
Creates mask ROIs from the given integer array where each
single mask ROI is specified by a specific integer.
|
static int[][] |
fold(int[] array,
int length)
Breaks a one-dimensional array into 'length' chunks,
forming a two-dimensional array, e.g.
|
static int[] |
unfold(int[][] array)
Transforms a 2 dimensional array into a one dimensional
array; the opposite of the fold method.
|
public static MaskData createCroppedMask(int[][] mask)
mask
- The binary mask (int[width][height]) covering the whole
imagepublic static MaskData createCroppedMask(boolean[][] mask)
mask
- The binary mask (boolean[width][height]) covering the whole
imagepublic static java.util.List<MaskData> createCroppedMasks(int[][] masks)
masks
- The masks (int[width][height]) covering the whole
image.public static java.util.List<MaskData> createCroppedMasks(int[] masks, int width)
masks
- The masks covering the whole image.width
- The width of the imagepublic static int[][] fold(int[] array, int length)
int[] x = 0 1 2 3 4 5 6 7 8 9 using length = 4 will be transformed to int[][] y = [0 1 2 3] [4 5 6 7] [8 9 0 0]
array
- An int arraylength
- The length of the chunkspublic static int[] unfold(int[][] array)
int[][] y = [0 1 2 3] [4 5 6 7] [8 9 0 0] would transformed into int[] x = 0 1 2 3 4 5 6 7 8 9 0 0
array
- An int array