Is there a way (or piece of code) that can convert the images that are in .hdr format to .pfm format?
I have a code that reads .pfm files but i want to make it run with .hdr files.
Converting .hdr files to .pfm on photoshop and reading next unfortunately is not an option.
Thanks for any help.
The the HDR Toolbox at www.advancedhdrbook.com or https://github.com/banterle/HDR_Toolbox/ has functions for reading and writing both .hdr and .pfm
There is also a high level function for writing and reading HDR Images: hdrimwrite and hdrimread
Related
I would like to save my predicted features into .mat format and .txt format in keras for further process in Matlab. Please help me. Thanks.
For .mat, check out SciPy's File IO.
For .txt, there are many options, such as NumPy's savetxt.
Check out the CSV format as well, which is a common way to save data for cross-platform use.
I have a file that is in AVL file format from a program called ArcGIS (formerly ArcView) that I need to convert to a mat file. It contains data I need to play back. Can anybody suggest a simple way to convert the file? I have done quite a bit of searching, and it seems the AVL is not a binary, aka it is a text format, which means I could write a program to convert it, but only if I also knew the corresponding matlab MAT file format. Moreover, this could take quite a while to do, and I need to file to be converted quickly so I can use the data.
I have to analyze bio acoustic audiofiles using matlab. Eventually I want to be able to find anomalies in the audio. That's the reason I need to find a way to represent the audio in a way I can extract and compare features. I'm dealing with mp3 files up to 150 mb. These files are too large for matlab to read in to it's memory. Therefore I want to use the memmapfile() function. I used the following code and a small mp3 file to find out how it actually works.
[testR, ~] = audioread('test.mp3');
testM = memmapfile('test.mp3');
disp(testM.Data);
disp(testR);
The actual values of the testM.Data and testR are different. Audioread() returns a 7483391 x 2 matrix and memmapfile() a 4113874 x 1 matrix.
I'm not really sure how memmapfile() works, I expected this to be equal to each other. Is there a way to read mp3 files in the same format audioread() does using memmapfile()? And what does memmapfile actually return in case of an audio file? Maybe it's also usable in the vector format in the case of anomaly detection?
Thanks in advance!
NOTE: The original files were in wav IMA ADPCM format with sizes from 1.5 up to 2.5 gb. Since Matlab can't deal with that format and the size of the files I converted them to 8bit mp3 files.
I think that the problem is mammapfile by default read data in uint8 format, while audioread function read data in another way.
How you can see here you can specify the format of data when you read it with memmapfile, so try to "play" with different values. From the documentation I read that you can read data in double format, so try to modify the memmapfile data format and audioread data format.
Last thing, memmapfile always organize the data in matrix like "somenumbers x 1", so if you want the original one you need to use something like reshape.
Anyway if you work with big data I suggest you to try with something different instead memmapfile, because it is very very slow
I have a series of DICOM files that I loaded on matlab. I would need to create a YUV file from the DICOM slices.Does anybody know how to do so?
Regards,
Note sure if this answers your question, but there is some code for this on the MATLAB file exchange:
http://www.mathworks.com/matlabcentral/fileexchange/11264-matlab-movie-to-yuv-file
I know this is for movies, but I think you will be able to use this code (maybe adapted) to run it for each slice separately, if that's what you want.
I am currently working on watermarking audio files in Matlab for a mathematics research project. So far I have been able to read wav files using wavread in Matlab. However, because wav files are very large, the resulting data is also large. Therefore, in order to simplify this I would like to know how I would be able to read an mp3 file in Matlab. So far I have only tried to read an mp3 by using dsp.AudioFileReader. However, the resulting data only contains 0's and a few other numbers, which is clearly not the correct data. Would someone please be able to help me? Thank you so much!
you can use this code:
hfr = dsp.AudioFileReader('yourfile.mp3');
hplay = dsp.AudioPlayer('SampleRate',sample_rate_here);
while ~isDone(hfr)
audio = step(hfr);
step(hplay, audio);
end