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

Read in PGM file into 2D array C

I am trying to read in a P2 PGM image into a 2D array in C. The array is 5 rows and 7 columns. When i try to read in the values from the .PGM file all i get are 0s. When i create my own .txt file with the same 5 rows and 7 columns as the image it…
mitch
  • 1
0
votes
1 answer

PGM File Processing in C

New to C, I'm trying to read an input PGM file that's either P2, P5, or P6 along with an output file from the command prompt, then read the data to a buffer, and finally write it to the output file. Everything is compiling but when I view the output…
kanedaws
  • 9
  • 1
0
votes
0 answers

C++ pgm file read defaults to 38 for every character in the middle of the read?

I'm trying to read in a 512x512 pgm file and store it in a 2d array. It prints out values between 0-255 until the 35835th unsigned character, and from then on it only prints out "38" for the other characters. Weirdly enough, when I tried to do a…
Skyler Gunn
  • 49
  • 1
  • 7
0
votes
2 answers

Reading a PGM file using structures

I am doing a project that involves writing functions to read/write and encode/decode PGM files. Im using a structure with a function to read in the PGM file. I am quite new to structures and how they are syntaxed so I am just wondering if this bit…
0
votes
1 answer

writing pgm images with cv2.imwrite()

I want to write my detected images with caffe pre-trained model in openCV and it works with jpg or other similar formats but it's showing an error SystemError: returned NULL without setting an error and here is my code…
engiAsadi
  • 3
  • 1
  • 3
0
votes
1 answer

How to flip this PGM gradient 90 degrees? (stored in vectors)

I have been working on implementing a grayscale gradient with different dithering methods, but the task calls for the gradient to be horizontal starting with black on the left. In my attempts to rotate the image horizontally I have…
0
votes
1 answer

Ghostscript does not write resolution in header of pgm files

I like to convert many pdf to pgm picture files to prepare them for OCR with tesseract. This is the command I use: gs -dQUIET -dINTERPOLATE -dSAFER -dBATCH -dNOPAUSE -dPDFSETTINGS=/ebook -dNumRenderingThreads=4 -sDEVICE=pgmraw -r300…
Til Hund
  • 1,543
  • 5
  • 21
  • 37
0
votes
1 answer

Problem to integrate sequential code to parallel code MPI

i tried to integrate an edge-detection laplacian operator into my previous code of MPI. The problem i have now is to do the edge detection in 1d array after the data is scatter. I got the output but the colour is inverted from supposely image. Can…
arep
  • 155
  • 1
  • 2
  • 7
0
votes
1 answer

What is wrong with my code to write netbpm images?

I am currently working on a project that needs to output generated images. I have decided to the use greyscale netbpm format due to its simplicity. One of these images is a heightmap. My code to export it is as follows: #include #include…
john01dav
  • 1,842
  • 1
  • 21
  • 40
0
votes
1 answer

Minimum Filter function doesn't represent the right result

I made a minimum filter function that should work for PGM P2 images. The problem is that the output is wrong. Everything is described below. Algorithm: http://www.roborealm.com/help/Min.php and https://www.youtube.com/watch?v=Y_QF0Xq8zGM Debugging…
nop
  • 4,711
  • 6
  • 32
  • 93
0
votes
1 answer

Read .pgm in Julia v 1.0.1

How can i read/load .pgm file in julia. I am trying to read it through imread(".pgm") but compiler says that it only reads ".png" file. Is there any other command for that.
A R.
  • 313
  • 3
  • 12
0
votes
0 answers

Write PGM function overwritting existing file.

Im having problems understanding how to write a PGM file using data. This function i have overwrites the existing txt document instead of creating a PGM file. Im unsure whether my issue is lies within my Read_text function or somewhere else. Can…
Craig
  • 35
  • 2
  • 8
0
votes
2 answers

Convert .pgm file to csv file in python,

I need to find out how to convert .pgm file to .csv file in python. I have been learning python for 2 1/2 weeks so if anyone helps could you please keep my lack of knowledge in mind. I am using Pycharm on Windows 10. Here is my code that I'm stuck…
Morpheus
  • 55
  • 2
  • 8
0
votes
1 answer

Color the tiles that lead to the target using .pgm and python

import Labyrinthe laby = Labyrinthe.creer(9,13) This code will create the following array of lists: [0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 2, 1, 1, 1, 1, 1, 1, 0] [0, 0, 0, 0, 0, 1, 0, 1, 0] [0, 1, 1, 1, 1, 1, 0, 1, 0] [0, 1, 0, 0, 0, 0, 0, 0, 0] [0, 1,…
user10158754
0
votes
1 answer

PGM image not opening

I have a pgm file which is well formatted like this P2 # CREATOR: GIMP PNM Filter Version 1.1 19 19 0 71 73 74 73 73 74 73 71 70 71 74 72 69 68 71 72 66 69 70 70 74 70 69 69 69 69 71 68 70 72 66 70 71 69 65 68 69 66 72 73 74 74 73 70 73 72 66 70 68…
josyanne
  • 87
  • 6