Is there a way to read a .pf file also known as picture floatmap file?

15 Ansichten (letzte 30 Tage)
Hello, I am new to matlab and I am trying to open and visualize a .pf file as image but I was unable to do so. Is there a way to read .pf file and visualize it as a image.
I link fot the pf file https://drive.google.com/file/d/1BNML47BAD1hHogjxytxaVpOc4LJqvim-/view?usp=sharing. As for the file I cannot see or oopen it.
Any help is appreciated and Thank you so much in advance.
  4 Kommentare
Cris LaPierre
Cris LaPierre am 26 Mär. 2021
Bearbeitet: Cris LaPierre am 26 Mär. 2021
All files are from some software. What software created this file?
Aravind Poolla
Aravind Poolla am 26 Mär. 2021
Hello I dont know from which software the file is from but all I know is it is a measurement file.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Cris LaPierre
Cris LaPierre am 26 Mär. 2021
Bearbeitet: Cris LaPierre am 26 Mär. 2021
I found this document, which suggests your file is not a valid pfm file.
Specifically
  • The PFM header is 3 consecutive "lines" of ASCII text. Your file has 5 lines
  • The identifier line contains the characters "PF" or "Pf". PF means it's a color PFM. Pf means it's a grayscale PFM. You don't appear to have this line.
  • The dimensions line contains two positive decimal integers, separated by a blank. The first is the width of the image; the second is the height. Both are in pixels. You file places the values on separate lines.
  • The Scale Factor / Endianness line indicates if the numbers are stored in little endian or big endian format. Your file doesn't have this line.
However, with that information, it is possible to turn it into a valid pfm file format and use the function Walter pointed to to load it. BTW, your file uses big endian format. So you just need to replace your header
  • Typ=Pic98::TPlane<float>
  • Lines=750
  • Columns=1125
  • FirstLine=0
  • FirstColumn=0
With a valid header. I didn't know the scale factor so I used 1.
  • Pf
  • 1125 750
  • s1
Once you've made those changes to your file, you can load and visualize it with the following code. I've attached your file updated to a pfm format. I had to change the extension to txt to be able to attach it here.
img = read_pfm("PF_file.txt", false)
imagesc(img)

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 26 Mär. 2021
Bearbeitet: Walter Roberson am 26 Mär. 2021
  4 Kommentare
Walter Roberson
Walter Roberson am 26 Mär. 2021
As suspected, you failed to quote the file name.
img = read_pfm('simulation.pfm', 'bPhotoshopCompatibility')

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by