How to I populate .mat database in matlab - matlab

How do I train images and make a .mat file?
I am trying the following simple matlab program :
http://in.mathworks.com/matlabcentral/fileexchange/22030-image-retrieval-query-by-example-demo
Documentation
https://ece.uwaterloo.ca/~nnikvand/Coderep/imQuery/documentation.html
Now, this zip package already includes a .mat file which has histograms of all the sample images provided for querying.I want to query over my own sample-set of images.
I figured out that I need that getimagehist function to calculate the histogram and populate a database of my images in .mat format. but how exactly do i do it? I am a newbie in matlab that's why i have no idea. A little guidance/help will be greatly appreciated.

In Matlab, the .mat format is used for saving Matlab workspaces. You can create .mat files with
save(filename,variables)
It is documented here: http://se.mathworks.com/help/matlab/ref/save.html
If you need help in creating the histograms from images, check imhist: http://se.mathworks.com/help/images/ref/imhist.html
As an example of saving a histogram in .mat file
myHistogram = imhist(image);
save('myMatFile', 'myHistogram');

Related

Read a .pfm file in Matlab?

I am currently working on a disparity map estimation project in Matlab. I am using the middlebury datasets including ground-truth disparities in PFM format. I don't know how to load this particular format in Matlab. Could anyone help me? Thanks
I have tried a simple load and then read in the documentation that the load function does not support the pfm format.

Can .cnt file be converted to spectrogram images in matlab? if yes then how to do it?

I have an EEG signal with .cnt and .fdt files. I have to obtain images to use it as input to a cnn. Is it possible to convert the file to images? Someone please help me with this. If possible then specify how to do it.
You should download EEG tollbox such as EEGlab or FieldTrip. I prefer fieldtrip because it is script based while EEGlab is more about GUI. Here you can see fieldtrip's function ft_read_header that can deal with your files, and here is a basic script to read cnt files with fieldtrip functions

Plot netcdf file with matlab

I want to plot a netcdf file in matlab that I have already analyze it as a .mat archive. I have to plot it with a map background with coastlines and degrees of longitude and latitude I want. Can anyone help me?
You could plot your data on a map using the m_map package found here. There's also examples there for reading in netcdf and hdf5 data and using .mat archive should then be straightforward.

How to transfer Nifti file into .mat Matlab file?

I have a Nifti file, the size of which is 62*62*38. How can I transfer the Nifti file to .mat Matlab file?
Most medical imaging data can be manipulated effectively using some kind of toolbox, such as SPM. However, if you need to gain access to the raw matrix I've always used NIfTI tools from the Mathworks file exchange site (here).
There are two functions that are relevant here: load_nii and load_untouched_nii. The first function load_nii takes care of situations where the header in the NiFTI contains transformations that haven't been applied to the underlying data matrix. If you know that no such transformations exist, you can use load_untouched_nii to avoid the reslicing being done. Both functions return a structure, and the data matrix is located in the img field of the returned structure.
This can read NIFTI as well as many other medical image file types into MATLAB arrays, which you can then save as .mat files.
FreeSurfer has a MATLAB function called "MRIread". It can read NIFTI (.nii, .nii.gz) files into a MATLAB structure, which can then be saved to a MAT file if so desired.

extracting an output matrix from matlab

I am working on a small iris recognition system using matlab, my matlab code after several steps and algorithms gives me a 9600 bit matrix as an output, and I was wondering how can I take this matrix to process it using a Windows Forms application using C#?
There are some standard formats that you can work with them both in MATLAB and C#.
For example, you can use csvwrite function in MATLAB to save it as a comma-separated value file. The in C# there are standard ways to read a csv file. Here it is discussed how to read a CSV file in C#.
Another option is to save in a .txt file and read it in C#. HDF5 files are another type that are supported with some libraries in both (see here). You can even save your file as a regular .mat file and load it in C# using a specific API (discussed here)