DavidBrainard / RenderToolbox3

Matlab toolbox for managing graphics rendering for psychophysics
MIT License
11 stars 4 forks source link

Sensor Image utilities #24

Closed benjamin-heasly closed 11 years ago

benjamin-heasly commented 11 years ago

Currently, BatchRender() produces multi-spectral data, and MakeMontage() produces sRGB images. It would be useful to produce other kinds of image, based on other color matching functions.

Two utilities would be nice:

sensorImage = MultispectralToSensorImage(multi-spectral-data, data-S, matching-function, matching-S) Would be similar to the existing MultispectralToSRGB(). It would take multi-spectral data and the corresponding spectral sampling, "S". It would also take a color matching function in the form of a matrix, and its associated sampling, "S". An alternate form could take the string name of a Psychtoolbox color matching function .mat file, and dig out the color matching matrix and "S".

sensorImage would be a matrix with size determined by the input data and matching function.

outFiles = MakeSensorImages(inFiles, matchingFunctions, hints) Would be somewhat similar to the existing MakeMontage(). It would take a list of multi-spectral data files, as produced by BatchRender. It would also take a list of matching functions to pass to MultispectralToSensorImage(). Each list element could be a matrix-S pair, or the name of a Psychtoolbox .mat file. It should also take hints, so it knows where two write new files.

Each outFile name could resemble an inFile, plus a suffix to indicate which matching function was used.

benjamin-heasly commented 11 years ago

Note that we need to "multiply in" to Psychtoolbox functions, since renderers use units of Power per Unit Wavelength, and Psychtoolbox expects Power per Wavelength Band.

benjamin-heasly commented 11 years ago

b0b25b71bc70249c47545daee0145575e9a4c5a7 contains new MultispectralToSensorImage(). It's used in MakeMontage() and MultispectralToSRGB(). It works in preliminary testing.

benjamin-heasly commented 11 years ago

e24d6966ff70eb549b25114696bcdfb763fba346 contains new MakeSensorImages(). MakeMaterialSphere.m demonstrates usage of MakeSensorImages().