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).

175 questions
0
votes
3 answers

How to read .pgm file and allocate memory using malloc?

I am new to compiling in linux environment. Anyway, I have a source code in C which is suppose to read a sequence of .pgm image files, compress them and write the compressed file to a new .pgm file. However, when I compile I get the following error…
skyjuice
  • 1
  • 2
-1
votes
2 answers

How are these PGM files encoded?

I exported a grayscale image as PGM using MATLAB (and OpenCV) and got this file as an output. im = imread(src); im = rgb2gray(im); imwrite(im, dst); According to the PGM Specification the header contains the "magic number", the width,…
user11909399
  • 49
  • 1
  • 7
-1
votes
1 answer

Issue when reading a matrix from a PGM file C

I want to read a PGM file (without # comments) and export just the image data(matrix) to a new text file.So far I did managed to write the code,but not very well I think. My issue is that when I fprintf the matrix from memory to a text file it give…
B. Parker
  • 41
  • 5
-1
votes
2 answers

Reading and Writing a PGM file

As a homework assignment we are supposed to read in a .pgm file and then draw a square in by changing the pixel values, and then output the new image. After I go through and change the pixels I print them all to a .txt as a way to check that they…
John
  • 1,808
  • 7
  • 28
  • 57
-1
votes
1 answer

How to Create Histogram from PGM Image

I need to create a single greyscale histogram of a PGM image for a class project. I already have the code to read the PGM image. However I don't completely understand how to count the unique pixel values. I don't need to output a graph or anything…
richieboy89
  • 1
  • 1
  • 2
-1
votes
1 answer

Looping through a table to store the position of a cell

I have a question regarding looping through a table of data but not storing the data in a table; instead, I would like to store the location of a certain piece of data in the table. What I am working with now is a table of pgm pixel values which are…
user2517142
  • 321
  • 1
  • 2
  • 5
-3
votes
1 answer

C Argument number to create PGM images

I have to do a task for university in C. The program creates images in PGM format.The program compiles successfully, however, I can't run the program correctly. At the beginning of the main function the if operator needs 2 argc, but every time I try…
Darkess
  • 3
  • 1
-3
votes
1 answer

How to convert .pgm file to .mat file in Matlab?

I have to convert 'Yale' dataset whose format is .pgm to .mat file, I searched about this issue but couldn't find anything. I appreciate any help.
Samaneh Rezaei
  • 73
  • 2
  • 11
-3
votes
1 answer

Wrong image result after 2d FFT

I have a problem when I try a FFT filter on an image . The input is the pgm file format (b&w). The result image ain’t correct . The right one should look like this this . Don't mind the colors :) For more detail please see the code. It ain’t clean…
Tiana987642
  • 696
  • 2
  • 10
  • 28
-4
votes
1 answer

Open a pgm image 16 bpp

i need to convert a pgm image 16 bit per pixel to a pgm image 8 bit per pixel but i have problem to read a pgm image 16 bpp and i don't understand what i'm doing wrong. here the code: #include "pgm.h" #include #include…
1 2 3
11
12