Live Fourier transform

During some recent presentations, I have used a small matlab program giving me a live Fourier transform of the laptop camera input. It can be used in combination with some printed “structures” to show what we would see on a SAXS or WAXS detector.

The idea is not mine, I heard that it was used by dr. Henrik Lemke for his Ph.D. defense to show the effects of lattice strain on the diffraction pattern.

It turns out to be quite popular with the audience so far, so I will post the code for Matlab running on a macbook Pro here. Feel fee to use the code. I will also make a short movie showing one example of how to use it. I am sure you can think of many other useful purposes for it!

The package is here: FT_cam_package

Since it is so specific in its application, there is no documentation. Also, run “FTcamdemo” and the rest should be quite self-explanatory in the GUI that comes up. This package uses (and comes with) camera image capture code (Java) by Kalle Kempe and Ikkjin Ahn.

9 Comments

  1. Hi Brian,

    I really enjoyed some of your comments/discussions on SAXS. I am a first year phD student studying membrane protein structure and hoping to employ SAXS/SANS. I really liked this FT demo video and would like to get it up and running on my laptop as well. I have matlab, but am running on a windows 7 system. It seems like I am close to having it work, but I get the following error message:

    ??? Error using ==> javaObject
    No class SuperISightCapture can be located on Java class path

    Error in ==> iSightInit at 4
    retObj=javaObject(‘SuperISightCapture’,size(1),size(2));
    Error in ==> FTcamdemo at 58
    handles.cam=iSightInit([480 480]);

    It seems as though there is a problem calling up the javaObject video display. I have limited matlab and programming experience, recognize that you are probably really busy with multiple other projects, but is there any way you could offer some advice or point me in the right direction perhaps?

    Thanks,
    Ryan

  2. Hi Ryan,

    The problem lies in the capturing of the camera image from your laptop camera. You will have to search around (perhaps at the “matlab central file exchange” website) to get a small matlab program capable of extracting an image from your camera. If you can get that image extraction to work, and if you let me know how, I may be able to assist further.

    Of course, you could always convince your boss to buy you a mac :).

    Cheers,

    Brian.

  3. Hi,
    I have the same issue, using Matlab 7.1 and Windows XP.
    However, I can access to the webcam with the commands:
    vidobj = videoinput(‘winvideo’,1);
    preview(vid)

    Perhaps the information in this page is relevant to solve the issue experienced by Brian and myself:
    http://www.mathworks.com/help/toolbox/imaq/obj2mfile.html

    However, I don’t know what to change in order to make the FTcamdemo program to work.

    Hope this helps.

  4. Hi Brian,
    I would like first to thank you very much for the great information about SAXS.
    I have a question about Live Fourier Transform, I would like to download it to use it on my defense presentation. I tried to do that but it seems that the link for the download
    is not activated. My computer is mac and I can work either on mat- lab or yorick.
    Would you please help me to download it.
    Thanks
    Ria

  5. Hey Brian,

    thanks for the FT demo. It is a great program to transport the idea of the Fourier Transformation to us. I have a MacBookPro. Unfortunately, the program does not
    work.

    The computer gave me the following error messages:

    Error using javaObject
    Java exception occurred:
    java.lang.UnsatisfiedLinkError: quicktime.QTSession.Gestalt(I[I)S
    at quicktime.QTSession.Gestalt(Native Method)
    at quicktime.QTSession.gestalt(QTSession.java:935)
    at quicktime.QTSession.open(QTSession.java:641)
    at quicktime.QTSession.open(QTSession.java:608)
    at SuperISightCapture.(SuperISightCapture.java:49)

    Error in iSightInit (line 4)
    retObj=javaObject(‘SuperISightCapture’,size(1),size(2));
    Error in FTcamdemo (line 58)
    handles.cam=iSightInit([480 480]);

    What do I need else to run your program?

    Thank you in advance,

    Jens

  6. Hi Jens,

    There seems to be a problem in the Lion iSight capture hooks. I have not looked into it recently, I found that that problem “somehow” went away after some updates. You might try installing quicktime player 7, which should still be available from Apple as an additional package.

    If you find out more, please let me know. Sorry for not being able to help more.

    Cheers,

    Brian.

  7. Hi Brian,
    I would like to use your FT software to best understand the inverse space features. However I have the same problems of Ryan Oliver: when I start the program it gets

    ??? Error using ==> javaObject
    No class SuperISightCapture can be located on Java class path

    Error in ==> iSightInit at 4
    retObj=javaObject(‘SuperISightCapture’,size(1),size(2));
    Error in ==> FTcamdemo at 58
    handles.cam=iSightInit([480 480]);

    I have no glue on what to change into the program, however I thing it could be a little thing, since I can see the screens.

    Francesco

  8. Hello Brian!

    If I want to do a live FFT of a video file, what should I change in your code?

    Matt

  9. That is interesting, but hard to give a specific answer to. I guess the starting point would be to get a python module for video read-in, and then to FFT every subsequent image. I doubt there would be much use adjusting the liveFT code to do this, since pretty much everything about it would be changed.

    I’m sorry, but there is no easy answer!

1 Trackback / Pingback

  1. Live Fourier Transform for Windows | Looking At Nothing - A SA(X)S Weblog

Leave a Reply

Your email address will not be published.


*


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.