[Solved] Open a pgm image 16 bpp [closed]

i’ve found solution to my problem. here is the right code if it can be useful for someone: #include “pgm.h” #include <iterator> #include <algorithm> #include <fstream> #include <sstream> using namespace std; bool convert16to8bit(const std::string& inFilename, mat<uint8_t>& img, const std::string& outFilename){ mat<uint16_t> imgTemp; ifstream is(inFilename, ios::binary); if (!is) return false; string magic; is >> magic; if … Read more