This is just a collection of software and other useful things for people in the lab.

Getting images from DVD's

First a couple of simple concepts: there are two types of DVD's - DVD's created simply as data disks (thus have a standard directory structure and standard files - just as your hard disk, memory stick etc.) and DVD's created as playable movie (i.e, the type Hollywood makes!).

For the first type, you probably have your images stored in a standard movie file format (avi for example - see below). It's the DVD movie type that becomes more complicated.

DVD movies have a complex structure due to 1) Keys and coding to enforce copyright 2) multiple shots, menus, navigation, chapters, titles etc, and 3) coding for (mpeg) compression.

You can get DVD "ripper" programs that will read the contents of the DVD and dump them as, for example, avi's on your hard disk. (Whether this is legal depends upon the copyright of the disk etc. What I am describing is how to obtain the images legally - e.g., if you recorded your home movies as a DVD). This is one possible way to go. It is slow, takes up a lot more disk space (depending upon what compression is used for your disk files when extracted), is cumbersome (sometimes it's hard to work out the sequence among the many files produced) - particularly if you only want a subset of the images (e.g., every one in 100 - or just a time range).

Here's another way: use VLC (www.videolan.org) - a freeware dvd player to extract the bits you want. VLC can be obtained to run on Linux, Windoze, and Mac OSX (amongst others - so I am describing a reasonably portable way). Suppose a disc has 4 "titles" (roughly speaking, there are 4 entries in the main menu of the disc). Suppose I want to extract every 1000th frame of the second title (I can see how many titles there are, and what they are, by loading the DVD and looking at the dvd menu):

VLC dvd:///dev/rdisk1@2 -V image --image-out-ratio=1000

will do this for me on my Mac (on a PC you would replace the /dev/rdisk1 with something like f: if that is your dvd drive)

If you want another title then replace the @2 with @4, for example.

I have had some trouble with difference versions of VLC - I can vouch that the above works on the 0.8.5-test2 version for the mac - your mileage may vary with other versions.

This produces png images which you can now do what you like with (for example convert to pgm for extracting Lowe's SIFT descriptors).

For the latter, I recommend using the netpbm package from which you can execute lines like:

pngtopnm dvd_image000000.png > dvd_image000000.ppm

and

ppmtopgm dvd_image000000.ppm > dvd_image000000.pgm

Of course - for so many files, you would want to put these in a script (shell or perl)

See the nice examples on: http://netpbm.sourceforge.net/doc/

AVI reading example code

See here

AVI writing example code

See here

Windoze exe for converting AVI to pgm files here

Windoze exe for converting AVI to ppm files here

Open CV example code

Note: since openv was built upon the intel IP library (they are moving to be independent of it) - it uses the ipl header format for images. The documentation of OpenCV is abysmal - however, by looking at the source code and by reading the IP docs and by looking at the examples, you should be able to work your way through it.

One of the common problems I have found is that most of the routines only accept 8bit single channel input data - and often the manual doesn't say anything about what is or isn't expected for the image parameters.

A simple edge detect example

Image file read/write and edge detect

A simple feature detect example

Image file read/write and feature detect

Drawing on the image

Tips

Fortran and C example code

Sample Least Squares