Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Header only Spectral Binary Format reader & writter .spb

License

NotificationsYou must be signed in to change notification settings

D-K-E/spbparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Header only Spectral Binary Format utils.

Just include header of the required file fromìnclude folder. All files areprovided withspb namespace.

WARNING

The parser is tested in a little endian machine. Though we check if the caseis otherwise for a given machine before proceeding further, it is not heavilytested.

The specification of spb format does not allow heterogeneous spds to beserialized. Resampling of your original spds might be necessary beforeproceeding with serialization.

Dependency

  • None. We are not even using STL or vectors. Probably can be ported to C witha little work.

  • Should be mostly C++98 compliant as well.

Features

  • Reader
  • Writer

SPectral Binary Specification Summary

File sectionBytes
File identifier ’SPB’3
Header Part
Image width x4
Image height y4
Number of spectral channels n4
First wavelength4
Wavelength Resolution4
Last Wavelength4
Image Datax*y*n*4

Image data is written to the file in column order and valuesare stored in little endian form.Dimensions (x,y and n) are stored in uint32-formatand wavelength values in float32-format. Spectral imagevalues are reflectance values stored as float32.

Usage

To read an spb file:

c++#include <spb/spbreader.hpp>const char *path = "path/to/my/file.spb";uint32_t width, height, nb_channels;float first_wavelength, wavelength_resolution;float last_wavelength;spb::read_header(path, width, height, nb_channels,                 first_wavelength, wavelength_resolution,                 last_wavelength);float *data = new float[width * height * nb_channels];spb::read_file(path, width, height, nb_channels, data);

To write an spb file:

c++#include <spb/spbwriter.hpp>const char *path = "path/to/my/outfile.spb";MyCustomSpd spectrum();/**some operations ......*/uint32_t width = spectrum.image_width();uint32_t height = spectrum.image_height();uint32_t nb_spectral_channels =  spectrum.nb_channels();float first_wavelength = spectrum.first_wavelength();float wavelength_resolution = spectrum.wavelength_resolution();float last_wavelength = spectrum.last_wavelength();float *data = new float[width * height * nb_spectral_channels];spectrum.put_data(data);spb::write_file(path, width, height, nb_channels,                first_wavelength, wavelength_resolution,                last_wavelength, data);

About

Header only Spectral Binary Format reader & writter .spb

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp