Compute Library
18.05
|
Class to load the content of a PPM file into an Image. More...
#include <Utils.h>
Public Member Functions | |
PPMLoader () | |
void | open (const std::string &ppm_filename) |
Open a PPM file and reads its metadata (Width, height) More... | |
bool | is_open () |
Return true if a PPM file is currently open. More... | |
template<typename T > | |
void | init_image (T &image, arm_compute::Format format) |
Initialise an image's metadata with the dimensions of the PPM file currently open. More... | |
template<typename T > | |
void | fill_image (T &image) |
Fill an image with the content of the currently open PPM file. More... | |
template<typename T > | |
void | fill_planar_tensor (T &tensor, bool bgr=false) |
Fill a tensor with 3 planes (one for each channel) with the content of the currently open PPM file. More... | |
unsigned int | width () const |
Return the width of the currently open PPM file. More... | |
unsigned int | height () const |
Return the height of the currently open PPM file. More... | |
|
inline |
|
inline |
Fill an image with the content of the currently open PPM file.
[in,out] | image | Image to fill (Must be allocated, and of matching dimensions with the opened PPM). |
Definition at line 318 of file Utils.h.
References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN, ARM_COMPUTE_ERROR_ON_MSG, ARM_COMPUTE_UNUSED, Window::DimX, Window::DimY, arm_compute::execute_window_loop(), arm_compute::utils::map(), Iterator::ptr(), arm_compute::RGB888, Window::set(), arm_compute::U8, and arm_compute::utils::unmap().
|
inline |
Fill a tensor with 3 planes (one for each channel) with the content of the currently open PPM file.
[in,out] | tensor | Tensor with 3 planes to fill (Must be allocated, and of matching dimensions with the opened PPM). Data types supported: U8/F32 |
[in] | bgr | (Optional) Fill the first plane with blue channel (default = false) |
Definition at line 405 of file Utils.h.
References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_ERROR_ON_MSG, ARM_COMPUTE_UNUSED, arm_compute::CHANNEL, Window::DimX, Window::DimY, Window::DimZ, arm_compute::execute_window_loop(), arm_compute::F32, arm_compute::get_data_layout_dimension_index(), arm_compute::HEIGHT, arm_compute::utils::map(), arm_compute::NCHW, Iterator::ptr(), Window::set(), arm_compute::U8, arm_compute::utils::unmap(), and arm_compute::WIDTH.
Referenced by PPMAccessor::access_tensor().
|
inline |
Return the height of the currently open PPM file.
Definition at line 507 of file Utils.h.
Referenced by PPMAccessor::access_tensor().
|
inline |
Initialise an image's metadata with the dimensions of the PPM file currently open.
[out] | image | Image to initialise |
[in] | format | Format to use for the image (Must be RGB888 or U8) |
Definition at line 301 of file Utils.h.
References ARM_COMPUTE_ERROR_ON, arm_compute::RGB888, and arm_compute::U8.
|
inline |
|
inline |
Open a PPM file and reads its metadata (Width, height)
[in] | ppm_filename | File to open |
Definition at line 270 of file Utils.h.
References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_MSG, and arm_compute::utils::parse_ppm_header().
Referenced by PPMAccessor::access_tensor().
|
inline |
Return the width of the currently open PPM file.
Definition at line 500 of file Utils.h.
Referenced by PPMAccessor::access_tensor().