10 std::ifstream in(input);
28 }
else if (!(c ==
' ' || c ==
'\t' || c ==
'\n' || c ==
'\r')) {
43 if (magicValue ==
"P2") {
45 }
else if (magicValue ==
"P5") {
49 "PortableGraymapReader::readHeader",
"Unknown magic value: '" + magicValue +
"'");
54 std::istringstream conv;
61 std::istringstream conv;
68 std::istringstream conv;
90 unsigned int numPixels = 0;
93 for (
unsigned int row = 0; row <
height_m; ++row) {
94 for (
unsigned int col = 0; col <
width_m; ++col) {
98 const uint16_t* val =
reinterpret_cast<const uint16_t*
>(&c[0]);
111 const unsigned int printWidth = 5;
112 for (
unsigned int i = 0; i <
height_m; ++i) {
113 for (
unsigned int j = 0; j <
width_m; ++j) {
114 unsigned int idx =
getIdx(i, j);
115 std::cout <<
" " << std::setw(printWidth) <<
pixels_m[idx];
117 std::cout << std::endl;
std::vector< unsigned short > pixels_m
std::string getNextPart(std::istream &in)
void print(std::ostream &out) const
void readImageBinary(std::istream &in)
unsigned int getIdx(unsigned int h, unsigned int w) const
void readHeader(std::istream &in)
void readImageAscii(std::istream &in)
PortableGraymapReader(const std::string &input)