morchinese.blogg.se

Pgm viewer
Pgm viewer











pgm viewer pgm viewer pgm viewer

On a side note, the "foo.pgm" file you pointed to in your comment appears to specify the wrong number of rows in the header. Image = np.fromfile(infile, dtype=np.uint16).reshape((height, width)) You'll need to use infile.readline() instead of next(infile). fromfile will start at whatever position the file pointer you pass to it is at, so you can simply seek (or read) to the end of the header, and then use fromfile to read the rest in. I'm not terribly familar with the PGM format, but generally speaking you'd just use omfile.













Pgm viewer