Introduction to Digital Image Processing

Winter 2019-20

 

Home

Announcements

Class Info

Syllabus

References

Homework

Final Projects

Software

Piazza portal

 

EE168 Software Links and Tips

How to use the AFS file system to store your SCIEN-lab files in your Leland directory

(Matlab hints) AFS and SCIEN Tutorial, with Matlab instructions

Useful Matlab Tips for EE168

(Matlab hints)PDF of useful Matlab tips for this class

Saving your matlab movies in mpg format for homework and projects

Create your movie with all frames the same size. We suggest 720x480 or 360x240 for easy conversion to video (cd/dvd) format later. Then, create your movie with each frame written twice into the movie structure. This allows for the default mpeg speed of 30 frames per second to appear the same as the matlab speed of 15 frames per second.

Sample code for doing the movie generation is in here: (Adobe Acrobat Document)Notes on making MPG files from Matlab.

You need to download this file (mpgwrite.mexglx or mpgwrite.mexa64 to your linux box, mpgwrite.dll for Windows, and mpgwrite.mexmac for Mac, and if you've got other Unix systems you're dealing with, you can either look for binaries or recompile the source code from the Matlab file exchange site, it's decently documented and pretty straightforward). Save the file to disk in your matlab directory with your movie files, just like you would any other *.m file you want to execute. You call it using mpgwrite() just like you would any other function.

Obtaining the mpgwrite function for use in Matlab:

For Linux Matlab on the lab machines

For Linux Matlab Service Pack 2 (look at About --> Matlab to make sure you're SP2 and rename this file to simply mpgwrite.mexglx without the extra .okcrash on the end - but it does crash upon a successful exit)

For Windows

For Mac

Here are some more instructions on calling the mpgwrite routine: download instructions.

If you are unable to use one of the above pre-compiled files,either download the source files in a zip archive here (for zip archive) , (or click here to download the entire package from Mathworks ) and recompile it on your local Matlab. (If link dies, just search for "Matlab file exchange mpgwrite"). Ask the TA if you need advice recompiling (by using the mex command within Matlab).


Thanks to David Foti and Mathworks for the source code. If you want an mpegread routine, there is an analogue available by the same author on the Matlab filesharing site.

The mplayer mp3 player for use on lab machines

An mp3 player (mplayer) that runs on the lab machines is available here. Right click to download to your lab computer. Run your mp3 file as "mplayer file.mpg", where file.mpg is your mp3 file.

You should be able to execute it by typing: ./mplayer filename.mpg in the directory you download it in. You may need to chmod on mplayer before you can execute it, so type chmod a+x mplayer to do that first.

MATLAB Notes

We recommend that you start with the document "Getting started."

Document or Site Description Link
Mathworks Home page of The MathWorks, Inc. www.mathworks.com

Index of Matlab documentation

Mathworks web page with Matlab documentation in PDF and HTML, including the one selected here.

HTML

Getting started

Brief introduction to Matlab.

PDF on this server

PDF on Mathworks

Using Matlab

More extensive tutorial.

PDF on this server

PDF on Mathworks

Signal Processing Toolbox Guide to signal processing commands in Matlab and the signal processing toolbox (to start it, write sptool in Matlab command window).

HTML

PDF on this server

PDF on Mathworks

 

The archived files below aren't necessarily immediately applicable to the class (i.e., haven't really been run in a while) but may be of interest.

Archived: Matlab hints for file reading and 256 level display

(Matlab hints)matlabfilereads.pdf

(Matlab code)imbytefile.m

disbytebw.m requires the colormap bw.map 
however, some browsers incorrectly download bw.map so be careful (should not be html!)

(Matlab display code)disbytebw.m
(Matlab display color table)bw.map

Archived: Fortran fft routine from Numerical Recipes

(Fortran code)fft.f
 

Archived: C fft routine from Numerical Recipes

(C code)four1.c

Archived: maketiff.m matlab function to make tiff files

(matlab code)maketiff.m

Archived: tiffbytebw.m - non-scaling version of maketiff

(matlab code)tiffbytebw.m

 

General: How to use a Stanford UNIX machine from your PC in general, and MATLAB in particular (more specifics in AFS pdf file above).

Apart from buying a student's license or going to Sweet Hall, you can use Matlab remotely from your PC if you can connect to the Stanford network -and your connection is fast enough, for instance, if you live on campus. 

First of all, we assume that you have an application to establish a TELNET connection. We recommend SecureCRT, using a Terminal on a Mac, or the older version of Samson, the standard TELNET application at Stanford, available at http://www.stanford.edu/group/itss/ess/. Recall that to access any Stanford machine you need a Leland account, that is, a Stanford Network ID (SUNetID) and a password (for details, see http://www.stanford.edu/group/itss/services/sunetid/). 

An X-Window server (like X11 for Macs, or Exceed or CygWin for Windows) is an application you may install on your PC that allows you to connect to a UNIX machine and see in your PC what you would see if you were working in front of the UNIX machine itself, including not only text, but also graphics.

To establish this connection, you usually need to:

  • Launch your X-Window server (using for instance, Exceed).
  • Launch your TELNET application and establish a connection to a UNIX machine having MATLAB installed (for instance, cardinal.stanford.edu, etc.). Your login and password are those corresponding to your Leland account.
  • In your TELNET application, you may need to write 
    • setenv DISPLAY ${REMOTEHOST}:0.0
    • xterm & (optional test, opens a graphical terminal window)
    • matlab &
  • Wait for a few seconds for MATLAB to start.

Not all UNIX machines are properly configured and contain MATLAB properly installed.

A tip. Save your files frequently in case the connection is lost. You can easily recover them later.