Questions tagged [pgm]

PGM is a grayscale image format used by the Netpbm library and other graphics software.

Portable Gray Map (PGM) is a simple image format for grayscale images.

The format allows data to be stored in either ASCII or binary format. PGM is the native format of the Netpbm graphics library and the format is described on the Netpbm web site. It is part of a family of formats including , , and , collectively tagged (the original name for what is now the Netpbm library).

168 questions
2
votes
1 answer

Reading video and saving in pgm format images using python-openCV

Firstly, i am sorry if the question is stupid. I'm beginner with python opencv and image processing. I created a program in order to read the video as the input and save it into the pgm format. import cv2 vidcap =…
Hitokiri
  • 3,412
  • 1
  • 5
  • 21
2
votes
1 answer

Error Opening PGM file with PIL and SKIMAGE

I have following Image file: Image I used PIL and Skimage to open it but I get following errors First with PIL (tried with and without trucate option): Code: from PIL import Image, ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True img =…
algoProg
  • 577
  • 2
  • 8
  • 23
2
votes
1 answer

Implement dilation filter in PGM format files

I'm currently doing a student project which does some image processings (dilation and erosion) on greyscale pgm file. I tried to implement dilation on the image object but got weird result. I expected the image object will be larger than the…
2
votes
0 answers

Javascript/typescript how to convert pgm to png or jpg?

I'm getting a pgm data, and want to put it in canvas, but it is not working . that's why i need to convert it to png. first I decoded the pgm base64 to UTF-8 and try to drawImage put nathing happen. let base64=…
2
votes
1 answer

How to read PGM image in Python

How to read this PGM image in python? please help PGM image link I tried this import numpy as np import matplotlib.pyplot as plt def readpgm(name): with open(name) as f: lines = f.readlines() # Ignores commented lines for l…
Nafis Islam
  • 41
  • 1
  • 7
2
votes
1 answer

Writing .PGM image results in disoriented shape

I'm trying to read and re-write a PGM image, though it's resulting in disoriented shape. The right image is the original one, the left is the re-created one: This is the code I'm using: #include #include #include…
Ibrahim
  • 154
  • 2
  • 9
2
votes
1 answer

Reading from a binary file in MIPS

I have a PGM photo which I'm trying to open and read in MIPS. When the values inside the PGM file are ASCII, everything works as expected. When they are in HEX format, the syscall 14 (read) reads just couple of values and than stops and I end up…
Xersus
  • 436
  • 3
  • 14
2
votes
2 answers

How do I display a pgm/ppm file in html?

I have a simple pgm file, which I think is the same as a ppm file. P3 5 5 10 1 2 3 4 10 1 10 3 2 5 10 2 4 2 1 0 0 0 0 0 10 10 10 10 10 I want to display this file in an HTML document. Right now I have tried using the img tag and an iframe. I…
Preston Hager
  • 1,314
  • 14
  • 26
2
votes
1 answer

python create .pgm file

Well first I have to mention that I read the material on this page including : Create binary PBM/PGM/PPM I also read the page explaining the .pgm file format.pgm file format. I know that there is a difference between .pgm "raw" format and .pgm…
Sinooshka
  • 511
  • 5
  • 9
2
votes
1 answer

Reading binary PGM on C

I'm making a library for reading PGM files and I got stuck with this problem. My code can't read binary PGM images correctly, it looks like it reads the wrong values, thus generating an image with only "noise" The code is really simple: void…
2
votes
1 answer

How to read PGM images in Java?

I feel like I'm missing something simple here (as usual). I'm trying to read PGM images using Java. Matlab does it just fine - outputting the image pixels (for example, a small 32x32 image) in Matlab gives me something like this: 1 0 11 49 94 118…
Magsol
  • 4,480
  • 11
  • 40
  • 65
2
votes
1 answer

pgmpy build error Anaconda Windows

When installing `pgmpy on Anaconda under Windows, using these instructions, I get Installing coverage-3.5-script.py script to C:\Users\idf\Anaconda3\Scripts Traceback (most recent call last): File "setup.py", line 28, in "coveralls >=…
Ivan
  • 5,964
  • 9
  • 52
  • 103
2
votes
5 answers

How do I capture images in OpenCV and saving in pgm format?

I am brand new to programming in general, and am working on a project for which I need to capture images from my webcam (possibly using OpenCV), and save the images as pgm files. What's the simplest way to do this? Willow Garage provides this code…
robot
  • 21
  • 1
  • 1
  • 2
2
votes
0 answers

How to parse ASCII PGM files in data structures with Haskell?

I am completely new to functional programming and Haskell and i need to parse an ASCII PGM image into a data structure but i can't figure out how to do that. I have looked at quite a few examples (including the Graphics.Pgm module) but still don't…
Florian
  • 41
  • 4
2
votes
1 answer

Writing pixel values from pgm file to text file with latitude, longitude and depth in Perl

I am very new to Perl and have not much idea about how to go about doing this. I have come across some code that reads a .pgm file named SeaWiFS_median_depth.35N.35S.180W.180E.pgm and rescales some of the pixel values in the file into latitudes,…
Funkeh-Monkeh
  • 441
  • 5
  • 14
1
2
3
11 12