imgcodecs.h
Go to the documentation of this file.
1 /*
2 * ECVL - European Computer Vision Library
3 * Version: 1.0.0
4 * copyright (c) 2021, Università degli Studi di Modena e Reggio Emilia (UNIMORE), AImageLab
5 * Authors:
6 * Costantino Grana (costantino.grana@unimore.it)
7 * Federico Bolelli (federico.bolelli@unimore.it)
8 * Michele Cancilla (michele.cancilla@unimore.it)
9 * Laura Canalini (laura.canalini@unimore.it)
10 * Stefano Allegretti (stefano.allegretti@unimore.it)
11 * All rights reserved.
12 */
13 
14 #ifndef ECVL_IMGCODECS_H_
15 #define ECVL_IMGCODECS_H_
16 
17 #include "ecvl/core/filesystem.h"
18 #include "ecvl/core/image.h"
19 
20 #include <string>
21 
22 namespace ecvl
23 {
28 enum class ImReadMode
29 {
30  UNCHANGED = -1,
31  GRAYSCALE = 0,
32  COLOR = 1,
33  //IMREAD_ANYDEPTH = 2, //!< If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit.
34  ANYCOLOR = 4,
35 };
36 
50 bool ImRead(const ecvl::filesystem::path& filename, Image& dst, ImReadMode flags = ImReadMode::ANYCOLOR);
51 
65 bool ImRead(const char* buffer, const int size, Image& dst, ImReadMode flags = ImReadMode::ANYCOLOR);
66 
77 bool ImRead(const std::vector<char>& buffer, Image& dst, ImReadMode flags = ImReadMode::ANYCOLOR);
78 
89 bool ImReadMulti(const ecvl::filesystem::path& filename, Image& dst);
90 
104 bool ImWrite(const ecvl::filesystem::path& filename, const Image& src);
105 
109 } // namespace ecvl
110 
111 #endif // !ECVL_IMGCODECS_H_
bool ImRead(const ecvl::filesystem::path &filename, Image &dst, ImReadMode flags=ImReadMode::ANYCOLOR)
Loads an image from a file.
Definition: any.h:69
If set, return the loaded image as is (with alpha channel, otherwise it gets cropped).
If set, always convert image to the 3 channel BGR color image.
bool ImWrite(const ecvl::filesystem::path &filename, const Image &src)
Saves an image into a specified file.
ImReadMode
Enum class representing the ECVL ImRead flags.
Definition: imgcodecs.h:28
If set, the image color format is deduced from file format.
bool ImReadMulti(const ecvl::filesystem::path &filename, Image &dst)
Loads a multi-page image from a file.
If set, always convert image to the single channel grayscale image (codec internal conversion).