Function ouster::sdk::io::read_png

Function Documentation

core::rgb_img_t<uint8_t> ouster::sdk::io::read_png(const std::string &filename)

Read a PNG file into an 8 bit per channel image.

Palette images are expanded to RGB, transparency chunks to an alpha channel, gray images with fewer than 8 bits to 8 bits, and 16 bit images are scaled down to 8 bits. Gray images stay gray.

Parameters:

filename[in] the PNG file to read.

Throws:

std::runtime_error – if the file can’t be read or isn’t a valid PNG.

Returns:

the decoded image, with shape (height, width, channels) where channels is 1 (gray), 2 (gray, alpha), 3 (RGB) or 4 (RGBA).