load_image.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_CORE_DATA_LOAD_IMAGE_HPP
14 #define MLPACK_CORE_DATA_LOAD_IMAGE_HPP
15 
16 #include "image_info.hpp"
17 
18 #ifdef HAS_STB
19 
20 // The definition of STB_IMAGE_IMPLEMENTATION means that the implementation will
21 // be included here directly.
22 #define STB_IMAGE_STATIC
23 #define STB_IMAGE_IMPLEMENTATION
24 #include <stb_image.h>
25 
26 #endif // HAS_STB
27 
28 namespace mlpack {
29 namespace data {
30 
44 template<typename eT>
45 bool Load(const std::string& filename,
46  arma::Mat<eT>& matrix,
47  ImageInfo& info,
48  const bool fatal = false);
49 
59 template<typename eT>
60 bool Load(const std::vector<std::string>& files,
61  arma::Mat<eT>& matrix,
62  ImageInfo& info,
63  const bool fatal = false);
64 
65 // Implementation found in load_image.hpp.
66 inline bool LoadImage(const std::string& filename,
67  arma::Mat<unsigned char>& matrix,
68  ImageInfo& info,
69  const bool fatal = false);
70 
71 } // namespace data
72 } // namespace mlpack
73 
74 // Include implementation of Load() for images.
75 #include "load_image_impl.hpp"
76 
77 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
bool LoadImage(const std::string &filename, arma::Mat< unsigned char > &matrix, ImageInfo &info, const bool fatal=false)
bool Load(const std::string &filename, arma::Mat< eT > &matrix, const bool fatal=false, const bool transpose=true, const FileType inputLoadType=FileType::AutoDetect)
Loads a matrix from file, guessing the filetype from the extension.
constexpr auto data(Container const &container) noexcept -> decltype(container.data())
Definition: iterator.hpp:79