Skip to content

Add the ability to read floating point data files #21

@bzigon

Description

@bzigon

Hello, I would like to suggest an enhancement to Neural2D. Add the ability to read floating point data files instead of just BMP files. Keep it simple. Assume the files have an extension of .DAT.
The header could look like this.

  1. 4 byte integer magic number -- to identify the file
  2. 4 byte integer -- the width of the data
  3. 4 byte integer -- the height of the data
  4. 4 byte integer -- the number of channels (numbered 0, 1 , 2, etc)
  5. 1 byte character -- S or D to signify the data is single or double precision data (4 bytes or 8 bytes)
  6. a stream of width x height x channels x (4 or 8) bytes

Example. A 640 x 480 matrix of floats with R, G, and B "channels" would look something like

0000 0000 F00D FACE ! 4 byte magic number
0000 0000 0000 0280 ! hex for 640
0000 0000 0000 01E0 ! hex for 480
0000 0000 0000 0003 ! hex for 3
0053 ! ascii for 'S'
.... 1,228,800 bytes for channel 1 in row major format
.... 1,228,800 bytes for channel 2 in row major format
.... 1,228,800 bytes for channel 3 in row major format

Note : 640 x 480 x 4 = 1,228,800

Ideally my inputData.txt file could now look like this ...

images/thumbnails/test-1234.dat -1 -1 -1 -1 1
images/thumbnails/test-1235.dat 1 -1 -1 -1 -1
images/thumbnails/test-1236.dat -1 1 -1 -1 -1

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions