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
2 answers

Reading PGM Images in C

I am trying to read PGM Images using the following function: typedef struct PGMImage{ int w; int h; unsigned char* data; }GrayImage; void ReadPGMImage(char* filename,GrayImage* image) { int…
user2522981
  • 163
  • 3
  • 18
0
votes
1 answer

Converting RGBA Images in a folder and save it to another folder in '.pgm' format

I have a group of RGBA images saved in a folder, my goal is to convert these images into another folder in a pgm format, below is the code: path1 = file/path/where/image/are/stored path2 = file/path/where/pgm/images/will/be/saved list =…
Gerard
  • 518
  • 4
  • 19
0
votes
2 answers

Gstreamer video to pgm files

I'm trying to save multiple files in RAW format (PGM) from a video source by using Gstreaamer. By reading thanks to the gst-inspect tool the differents sources and sinks available for the differents plugins that I use, I can't find the right way to…
deletMe
  • 65
  • 2
  • 9
0
votes
1 answer

add AVR Studio pgm_read_byte function to MiKroc (Electronica)

I have a program in AVR Studio V4 with the following code: #include void nlcd_Putc(unsigned char c) { unsigned char i; if (c>127) c=c-64; for (i = 0; i < 5; i++ ) { …
Soheil Paper
  • 1
  • 2
  • 8
  • 25
0
votes
0 answers

Matlab wavedec2: Low pass image doesn't appear

When displaying wavelet transform, low pass image cA2 doesn't appear. No significant difference when using im2double in spite of double.Here below is my code: % Read pgm file and normalize it by hitogram equalization J =…
PingPong
  • 11
  • 3
0
votes
1 answer

read bytes of data after reading plain text pgm p5 file

I'm trying to read a .pgm version p5 file. The header is in plain text then the actual data is stored in plain bytes. The header can be an arbitrary length. I how can I start reading byte by byte after reading in the plain text line by line? int…
0
votes
0 answers

How to blur a .pgm file?

I've written this code, which is supposed to blur a .pgm file. Works perfectly on Linux, but it gives a wrong result on Windows. The program should be run like this: "filter.exe enb.pgm enb_filtered.pgm qs 3", where the 4th argument can be…
G Eazy
  • 5
  • 2
0
votes
1 answer

PGM File Reader Doesn't Read Asymmetric Files

I'm writing a simple PGM file reader for a basic CV idea, and I'm having a weird issue. My method seems to work alright for symmetric files (255 x 255, for example), but when I try to read an asymmetric file (300 x 246), I get some weird input. One…
0
votes
1 answer

how to write and read pgm p5 file in java

I want to read pgm file. I kept image content in byte array. When I accessed pixels, I see that some values are negative. So, I applied "& 0xFF" each byte. I hope it is ok but when I write to file, it isn't same as original image. How can i read…
Gokhan
  • 55
  • 1
  • 6
0
votes
4 answers

How do I save a BufferedImage to a pgm file?

I looked through the internet but I could not find an answer. I have a pgm file which I use as a BufferedImage to do a convolution (I use JAI for that) but I am having trouble in saving it back to a pgm file. So far I used following code to…
Staniel
  • 1
  • 1
  • 5
0
votes
2 answers

Having different values between Java and Matlab when Reading a .pgm image

I have to perpare a Trainging set for my Machine Learning Course, in which for a given face image it gives you an answer representing the side of the head ( straight , left , right , up ) For this purpose i need to read a .pgm image file in java and…
AliSmart
  • 185
  • 2
  • 2
  • 14
0
votes
5 answers

Horizontally flipping an array?

I am trying to take a pgm file [just a matrix of pixels, set rows and set columns] into an array, flip it horizontally, and output it again. This is how I'm reading it in: bool PgmPicture::readPgmFile(string inputFile) { stringstream ss; …
amantonas
  • 39
  • 2
  • 6
0
votes
2 answers

Android parse base64Binary pgm to Bitmap

I need to convert a base64Binary-string in the format pgm to a bitmap in android. So I don't have an usual base64-encoded Bitmap. The base64binary-string came from a xml file
TrantSteel
  • 225
  • 1
  • 2
  • 10
0
votes
0 answers

Changing PPM files in python

Hi guys i have a PGM i have created, and would like to read in to python line by line is there a quick and easy way to do this, as i want to alter the LSB for each say purple pixel there is Thanks Edit Ok guys the input image is a PNG file, of our…
user4017041
  • 113
  • 1
  • 1
  • 8
0
votes
1 answer

DevIL library: save gray scale image in three matrices instead one

I need to make a program that convert a RGB image to a GRAYSCALE image and save it in PGM format. I use DevIL library, but when I save the image, I obtain always a 3D image (3 matrix), in grayscale but, if I load it in MATLAB, I have 3 matrices…
volperossa
  • 1,339
  • 20
  • 33