Home
Get Started
Documentation
Community
Google Summer of Code
FAQ
GitHub
Home
Get Started
Documentation
Community
Google Summer of Code
FAQ
GitHub
image_info.hpp
Go to the documentation of this file.
1
13
#ifndef MLPACK_CORE_DATA_IMAGE_INFO_HPP
14
#define MLPACK_CORE_DATA_IMAGE_INFO_HPP
15
16
17
#include <
mlpack/prereqs.hpp
>
18
19
#include "
extension.hpp
"
20
21
#define STB_IMAGE_STATIC
22
#define STB_IMAGE_IMPLEMENTATION
23
#include <stb_image.h>
24
25
#define STB_IMAGE_WRITE_STATIC
26
#define STB_IMAGE_WRITE_IMPLEMENTATION
27
#include <stb_image_write.h>
28
29
namespace
mlpack
{
30
namespace
data {
31
32
#ifdef HAS_STB // Compile this only if stb is present.
33
40
inline
bool
ImageFormatSupported(
const
std::string& fileName,
41
const
bool
save =
false
);
42
47
class
ImageInfo
48
{
49
public
:
59
ImageInfo(
const
size_t
width = 0,
60
const
size_t
height = 0,
61
const
size_t
channels = 3,
62
const
size_t
quality = 90);
63
65
const
size_t
& Width()
const
{
return
width; }
67
size_t
& Width() {
return
width; }
69
70
const
size_t
& Height()
const
{
return
height; }
72
size_t
& Height() {
return
height; }
73
75
const
size_t
& Channels()
const
{
return
channels; }
77
size_t
& Channels() {
return
channels; }
78
80
const
size_t
& Quality()
const
{
return
quality; }
82
size_t
& Quality() {
return
quality; }
83
84
private
:
85
// To store the image width.
86
size_t
width;
87
88
// To store the image height.
89
size_t
height;
90
91
// To store the number of channels in the image.
92
size_t
channels;
93
94
// Compression of the image if saved as jpg (0 - 100).
95
size_t
quality;
96
};
97
#else
98
class
ImageInfo
{ };
99
100
#endif // HAS_STB.
101
102
}
// namespace data
103
}
// namespace mlpack
104
105
// Include implementation of Image.
106
#include "image_info_impl.hpp"
107
108
#endif
extension.hpp
mlpack
.hpp
Definition:
add_to_po.hpp:21
mlpack::data::ImageInfo
Definition:
image_info.hpp:98
prereqs.hpp
The core includes that mlpack expects; standard C++ includes and Armadillo.