Friday, March 23, 2012

Regarding .m Files in the SVN Server

All,
I have also sent you an e-mail including the checkout string and the credentials to the SVN server. For those who are not familiar with SVN clients available for their platform; here are good suggestions.
Let me know if you have any issues so that I can check the server to see if everything is working properly.

The easiest way to use the camera to acquire images & videos is to use imaqtool function, which is a GUI developed by Mathworks. You can read more about it here.

For example to collect a video simply set the Frames per trigger option under the Acquisition Parameters / General to Infinite.
Then use the Start/Stop Acquisition buttons to record a video. You can click on Export Data button to save the acquired video in .mat format. The .mat file you have saved will include a 4-D matrix. (As far as I am concerned) The first two dimensions form the resolution of the image hence they represent the pixel indexes, the third dimension represents the type of the sensor (R G B depending on the encoding selected) and the forth dimension represents the frame number.
Unfortunately/fortunately Matlab does not export the data in a video format. As I just mentioned it outputs a 4-D Matrix.
However we can create movies using the 4-D matrix outputted by the IMAQ.

Under repo/AISProject/ThermalCamera/code you will find 3 .m files, which are:

GUIdemo.m
imaqthermal.m
make_movie.m

and a .mat file which contains the data I have acquired to generate the video in one of the previous posts:

lighter_vid.mat

You can use make_movie function to create your own movie in '.avi' format from the obtained 4-D matrix. Simply type help make_movie to see the usage and required input/output parameters. An example usage is as follows:

load('lighter_vid.mat');
[A]=make_movie(lighter_vid,'trial.avi',16,75)

This will output an A matrix which is in Matlab movie format. You can read more about it here.
Also the make_movie function will output an '.avi' version of the video as 'trial.avi' in this case. You should see it in your workspace.

The imaqthermal.m is a simple function call to a GUI which I have adopted from a motion detector developed by Mathworks. You can use the GUIdemo function to create a video object and call the GUI.
Simply make sure that the camera is connected to your ethernet port and call GUIdemo.

Enjoy!

Emre

No comments:

Post a Comment