RSLightFields
Disparity map estimator from 3D light fields
Functions
rslf_io.hpp File Reference

Implement i/o functions (read, write matrices). More...

#include <rslf_types.hpp>
#include <opencv2/highgui/highgui.hpp>
Include dependency graph for rslf_io.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

Mat rslf::read_img_from_file (std::string path_to_folder, std::string name_we, std::string extension, int cv_read_mode=CV_LOAD_IMAGE_UNCHANGED, bool transpose=false, bool rotate_180=false)
 
std::vector< Mat > rslf::read_imgs_from_folder (std::string path_to_folder, std::string extension, int cv_read_mode=CV_LOAD_IMAGE_UNCHANGED, bool transpose=false, bool rotate_180=false)
 
void rslf::write_mat_to_yml (Mat img, std::string path_to_folder, std::string name_we, std::string extension="yml")
 
void rslf::write_mat_to_imgfile (Mat img, std::string path_to_folder, std::string name_we, std::string extension="png", std::vector< int > compression_params=std::vector< int >())
 
Mat rslf::read_mat_from_yml (std::string path_to_folder, std::string name_we, std::string extension="yml")
 
Mat rslf::build_row_epi_from_imgs (Vec< Mat > imgs, int row, bool transpose=false, bool rotate_180=false)
 Assume we have a set of rectified images such that the epipolar planes are on the lines. Build the EPI along the given row. More...
 
Vec< Mat > rslf::build_epis_from_imgs (Vec< Mat > imgs, bool transpose=false, bool rotate_180=false)
 Assume we have a set of rectified images such that the epipolar planes are on the lines. Build the EPIs along the given row. More...
 
Mat rslf::build_row_epi_from_path (std::string path_to_folder, std::string extension, int row, int cv_read_mode=CV_LOAD_IMAGE_UNCHANGED, bool transpose=false, bool rotate_180=false)
 Assume we have a set of rectified images such that the epipolar planes are on the lines in a folder. Build the EPI along the given row. Images are supposed to be ordered in alphanumerical order. More...
 

Detailed Description

Implement i/o functions (read, write matrices).

Function Documentation

◆ build_epis_from_imgs()

rslf::Vec< rslf::Mat > rslf::build_epis_from_imgs ( Vec< Mat imgs,
bool  transpose = false,
bool  rotate_180 = false 
)

Assume we have a set of rectified images such that the epipolar planes are on the lines. Build the EPIs along the given row.

Parameters
imgsThe set of images from which to build the EPIs.
transposeIndicates whether the algorithm should transpose the images (epipolar lines should be horizontal)
Returns
The requested EPIs.

◆ build_row_epi_from_imgs()

rslf::Mat rslf::build_row_epi_from_imgs ( Vec< Mat imgs,
int  row,
bool  transpose = false,
bool  rotate_180 = false 
)

Assume we have a set of rectified images such that the epipolar planes are on the lines. Build the EPI along the given row.

Parameters
imgsThe set of images from which to build the EPI.
rowThe row along which the EPI will be built.
transposeIndicates whether the algorithm should transpose the images (epipolar lines should be horizontal)
Returns
The requested EPI.

◆ build_row_epi_from_path()

rslf::Mat rslf::build_row_epi_from_path ( std::string  path_to_folder,
std::string  extension,
int  row,
int  cv_read_mode = CV_LOAD_IMAGE_UNCHANGED,
bool  transpose = false,
bool  rotate_180 = false 
)

Assume we have a set of rectified images such that the epipolar planes are on the lines in a folder. Build the EPI along the given row. Images are supposed to be ordered in alphanumerical order.

Parameters
path_to_folderThe path containing the images. Should end with '/' (but the function will correct if not the case).
extensionThe extension of the images to be read. Should not start with '.' (but the algorithm will correct if not the case).
rowThe row along which the EPI will be built.
cv_read_modeThe mode with which OpenCV will read the files.
transposeIndicates whether the algorithm should transpose the images (epipolar lines should be horizontal).
Returns
The requested EPI.

◆ read_img_from_file()

rslf::Mat rslf::read_img_from_file ( std::string  path_to_folder,
std::string  name_we,
std::string  extension,
int  cv_read_mode = CV_LOAD_IMAGE_UNCHANGED,
bool  transpose = false,
bool  rotate_180 = false 
)

Reads an image from the given path, name and extension.

Parameters
path_to_folderPath to the folder containing the file. Should end with '/' (but the function will correct if not the case).
name_weName of the file without path or extension.
extensionThe extension of the file. Should not start with '.' (but the algorithm will correct if not the case).
cv_read_modeThe mode with which OpenCV will read the file.
Returns
The requested image in Mat format.

◆ read_imgs_from_folder()

rslf::Vec< rslf::Mat > rslf::read_imgs_from_folder ( std::string  path_to_folder,
std::string  extension,
int  cv_read_mode = CV_LOAD_IMAGE_UNCHANGED,
bool  transpose = false,
bool  rotate_180 = false 
)

Reads all images with requested extension in requested folder.

Parameters
path_to_folderPath to the folder containing the files. Should end with '/' (but the function will correct if not the case).
extensionThe extension of the files. Should not start with '.' (but the algorithm will correct if not the case).
cv_read_modeThe mode with which OpenCV will read the files.
Returns
The requested images in a vector of Mat.

◆ read_mat_from_yml()

rslf::Mat rslf::read_mat_from_yml ( std::string  path_to_folder,
std::string  name_we,
std::string  extension = "yml" 
)

Reads the given .yml file in the given folder to a Mat.

Parameters
path_to_folderPath to the folder where to read the file.
name_weName of the file without path or extension.
extensionThe extension of the file.
Returns
A Mat containing the image

◆ write_mat_to_imgfile()

void rslf::write_mat_to_imgfile ( Mat  img,
std::string  path_to_folder,
std::string  name_we,
std::string  extension = "png",
std::vector< int >  compression_params = std::vector< int >() 
)

Writes the given Mat to an image in the given folder.

Parameters
imgThe Mat to save.
path_to_folderPath to the folder where to save the file. Should end with '/' (but the function will correct if not the case).
name_weName of the file without path or extension.
extensionThe extension of the file. Should not start with '.' (but the algorithm will correct if not the case).
compression_paramsCompression parameters.

◆ write_mat_to_yml()

void rslf::write_mat_to_yml ( Mat  img,
std::string  path_to_folder,
std::string  name_we,
std::string  extension = "yml" 
)

Writes the given Mat to a .yml file in the given folder.

Parameters
imgThe Mat to save.
path_to_folderPath to the folder where to save the file. Should end with '/' (but the function will correct if not the case).
name_weName of the file without path or extension.
extensionThe extension of the file. Should not start with '.' (but the algorithm will correct if not the case).