Lagrange
Loading...
Searching...
No Matches
Image Module

Basic image data structure. More...

Functions

template<typename T>
std::vector< View3D< T > > split_grid (View3D< T > grid, const SplitGridOptions &options)
 

Detailed Description

Basic image data structure.

Quick links

Function Documentation

◆ split_grid()

template<typename T>
std::vector< View3D< T > > split_grid ( View3D< T > grid,
const SplitGridOptions & options )

#include <lagrange/image/split_grid.h>

Options controlling how a grid image is split by split_grid().

A value of zero on either ``rows`` or ``cols`` means "auto-detect". The resolution rules are:

/ - rows = 0, cols = 0: pick the factorization producing cells closest to square. / - rows = R, cols = 0: derive cols = num_cells / R. / - rows = 0, cols = C: derive rows = num_cells / C. / - rows = R, cols = C: validate R * C == num_cells. / / In all cases, the grid extents must be divisible by the resulting layout. / struct SplitGridOptions { / Number of cells the grid contains. size_t num_cells = 0;

/ Number of cell rows in the grid (0 = auto). size_t rows = 0;

/ Number of cell columns in the grid (0 = auto). size_t cols = 0; };

/ / Split a grid image into row-major cell views. / / The returned views share memory with the input grid image (no copy). The layout is controlled / by options; see SplitGridOptions for resolution rules. / /

Parameters
[in]gridGrid image of shape (width, height, channels) per View3D axis / ordering (note: the Python binding accepts HxWxC numpy arrays and / transposes the axes internally). /
[in]optionsOptions including num_cells and an optional explicit layout. / /
Template Parameters
TPixel element type (e.g. float, const float, uint8_t). / /
Returns
List of options.num_cells views into the grid, ordered row-major.