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

Thermal Camera Image Acquisition Toolbox Setup

All,

I will list the steps that I have taken to adjust the settings of my Mac to make the FLIR thermal camera work with Matlab Image Acquisition Toolbox. I will also try to lead other platform users to important websites.
  1. (For Mac users) Make sure you have the R2011b version on your Mac which is already available via CMU computing services. This is the only version that supports Image Acquisition Toolbox for Mac.
    Similarly Windows users can check the system requirements here.
  2. Make sure you have the latest version of the Matlab Image Acquisition Toolbox.
    If you have used CMU computing services to obtain the latest copy of Matlab and followed the suggested steps you should be good to go. The toolbox will be automatically installed on your platform.
  3. The FLIR Thermal camera supports GigE . So we have to install the GigE vision drivers. A good tutorial is given here. For troubleshooting you can also consult here.
  4. When you are done with setting up the GigE drivers, type imaqhwinfo in Matlab command window and check the available adapters list. You should see 'gige' in the list.
  • Note for Mac users: If you do not have the development tools or you cannot access ~/.MacOSX/environment.plist while configuring GenICam environment variables, here is the workaround:
    -Open up a terminal window and type sudo vi /etc/launchd.conf
    -Add the following lines to launchd.conf and save.
  • setenv GENICAM_CACHE_V2_2 /Users/username/.GenICam/xml/cache
  • setenv GENICAM_LOG_CONFIG_V2_2/Applications/GenICam/V2_2_0/log/config_unix/DefaultLogging.properties
  • setenv GENICAM_ROOT_V2_2 /Applications/GenICam/V2_2_0
      • -Finally type export to see if the environment variables are set correctly, you should see these three variables within the output.

        Let me know if you face any troubles.

        Thanks,
        Emre

        GigE working through Matlab

        All,
        I have managed to use the thermal camera with the Data Acquisition Toolbox.
        Also I have modified a simple GUI by Mathworks to obtain live data stream.
        Once we obtain the transfer function I will rescale the colorbar to represent the actual temperature. I will also share the code through a more detailed post.

        Cheers,

        Emre