Return to the main page of the project...

DETAILED HOWTO FOR Scan3D, version 0.1

This howto is very detailed. Don't get frightened for its length!


INDEX

A. INSTALL THE SOFTWARE
  1. Download Scan3D and nuages
  2. Install Scan3D
  3. Install nuages
B. TAKE THE PHOTOS
  1. Prepare the environment
  2. What should you do?
    What do you need?
    How can you carry out a fixed angle rotation?
    How can you use s3d-disc to obtain a graduated disc?
    How should you use your digital camera?
    How can you reduce prospective-effects?
    Other suggestions?
  3. Take the photos
C. USE THE SOFTWARE
  1. Create the directory tree
  2. Create the project file
  3. Filtering the photos
  4. Obtaining sections from profiles
  5. Using nuages to obtain the final surface
SUMMARY OF COMMANDS
HOW TO CREATE THE PROJECT-FILE WITH A BASH SCRIPT
NOTES ABOUT NUAGES


A. INSTALL THE SOFTWARE

  1. Download the files 'scan3d-0.1.tar.gz' and 'nuages-4.1.tar.gz'. See the notes at the bottom of the page for more informations about the program Nuages, written by Bernhard Geiger.
  2. INSTALL Scan3D: untar, configure and compile it with the commands:

    > tar xzvf scan3d-0.1.tar.gz
    > cd scan3d-0.1
    > ./configure
    > make

    If configure returns with error, probably you should install some program needed to compile Scan3D. In particular you should install Image Magick. For example, I was able to compile Scan3D, after the following command:

    > rpm -ivh \
    ImageMagick-devel-6.0.7.1-4.i386.rpm \
    ImageMagick-c++-6.0.7.1-4.i386.rpm \
    ImageMagick-c++-devel-6.0.7.1-4.i386.rpm \
    libexif-devel-0.5.12-3.i386.rpm

    This was done on a Fedora 3 linux distribution. If you encounter problems at this stage send me a mail. Now you should login as root to install the binaries of the program:

    > su

    Enter root password, then:

    > make install
    > exit
  3. INSTALL nuages in a similar way, with

    > tar xzvf nuages-4.1.tar.gz
    > cd nuages-4.1
    > ./configure
    > make
    > su
    > make install
    > exit

B. TAKE THE PHOTOS

  1. First of all you should prepare the environment needed to take photos.

    What should you do? You should take a great number of photos of the object while it rotates around a fixed axis. The procedure is as follows: You should take several dozen of photos (50-100 photos).

    What do you need? You need:

    How can you carry out a fixed angle rotation? I wrote a simple program for this purpose. The program lets you use your printer to obtain a graduated disc. You should stick the graduated disc over the rotating disc, as in figure 1.

    Figure 1a-1b: obtained with: s3d-disc -r173 -n -o disc.


    In this figure you can see how I used a piece of polystyrene and a pin to realize a reference pointer. I sticked the piece of polystyrene on the table with bi-adhesive tape.

    How can you use s3d-disc to obtain a graduated disc? If your disc has radius = 123 millimeters, you can use:

    > s3d-disc -r 123 -n -o disc

    The program will create the file 'disc0.eps'. You should convert it to a PDF file with:

    > epstopdf disc0.eps

    and print the file 'disc0.pdf' with your printer. If your disc is too big to be printed on a single sheet (as in figure 1), s3d-disc will generate several files: 'disc0.eps', 'disc1.eps', ...
    Convert them with the command epstopdf, print, clip and glue them together. If you don't use the A4 format, you can specify the dimension of your paper with '-p 180x250'. For more details use "s3d-disc --help".
    NOTE: all lengths must be given in millimeters.

    How should you use your digital camera? I can give some useful suggestions. You should avoid touching your camera in any way, during the rotation of the object. If you move the camera, it won't be possible for Scan3D to find the axis of rotation and this will lead to a wrong or ugly reconstruction of the surface of the object. So I give the following suggestions:

    How can you reduce prospective-effects? To reduce prospective-effects you should put your camera far from the object and use the zoom to avoid too small images.

    Other suggestions? Scan3D needs the profiles of the object for many different angles. In future maybe Scan3D will be able to use a photo of the background to better distinguish the profile of the object. However nowadays Scan3D uses only a threshold operator to obtain the profiles. This means that the colours of the object should be different and distiguishable from the colours of the background. This also means that Scan3D will have some limitations: you can't scan a transparent object and you will surely encounters many problems if you try to scan a black object on a black backround. One partial solution to this kind of problems is the following: you should construct a light-emitting screen. This will be a very simple task. Look at the following photo:

    Figure 2a-2b: inside the screen


    I put a a lamp inside a carton, and closed the box using paper. When you turn on the lamp and turn off the light you can see the dark profile of the object.

    Figure 3: the object. Figure 4: how the screen works: the profile of the object


    With this trick, even a white object will seem to be black, when you turn off the light. The only problem you could still encounter is that of reflections: in particular when the surface of the scanned object is reflective (this happens with varnished surfaces or with metal surfaces).
    NOTE: Obviously you should disable the flash-lamp of your camera, when you take the photos.
  2. Take the photos: if you followed all the given suggestions you should be able to start taking photos: put the rotating disc (with the graduated disc obtained with s3d-disc sticked on it) in a suitable position (e.g. the center of a big table). Take your digital camera (with fully charged batteries), connect it to your PC and place it in front of the rotating disc. Put the light-emitting screen behind the rotating disk and turn on the lamp inside it. Now turn off the light. Take a photo of the background (maybe one day Scan3D will be able to use it). You should use the mouse or the keyboard of the PC for that. Put the object over the rotating disc, and be sure that it stay inside of the view while you rotate the disc. Rotate the disc to the beginning of the scale. Take the first photo. Rotate the disc to the next notch in the scale. Take another photo and continue in this way until the disc gets rotated by 180 degrees.

C. USE THE SOFTWARE

  1. Create a directory for the new project. Inside this directory create another directory with the name 'original' and put all the images of the object inside it. Create also another directory with the name 'filtered': it will be useful in the following steps.
  2. Now you should create a project file: a text-file containing the list and descriptions of all the photos of the object. You should put this file in the main directory of the project. This is an example:

    ##Scan3D##
    # Input directory
    i original
    # Output directory
    o filtered
    # Original images of the profiles
    s 0.0 duck_001.JPG
    s 2.5 duck_002.JPG
    ...
    ...

    The project file contains various information about the project: The project file contains all Scan3D need to know about the scanned object. You can also create the file automatically, see the notes at the bottom of the page.
  3. You can start the filtering stage: in this stage you should apply the appropriate filters to all the photos you previously took. At the end you must obtain black and white images of the profiles of the object. The following figure give an example of what you should be able to do:

    Figure 5: the black and white photo of the profile obtained from figure 4


    To obtain the black-and-white image from the original photo, the following command was used:

    > s3d-filters -1 -i original/duck_001.JPG -o bw.bmp -t 24000

    An explanation of this command is given above (try also 's3d-filters --help') I suggest to begin with '-1' and with '-t 20000'. If you obtain a too dark image, then decrease gradually the threshold number until you obtain a clear profile with definite contours. In the opposite case you should increase the threshold number, obviously.
    You can also cut the image in this way:

    > s3d-filters -1 -i original/duck_001.JPG -o bw.bmp -t 24000 -p 300x410 -s 1700x930

    the option '-p' specifies the position of the upper-left angle of the square selection while '-s' specifies the size of the square selection.

    Figure 6: the black and white photo of the cutted profile


    When you obtain satisfactory results, you can try to apply the filter-operators to all the images of the project:

    > s3d-filters -i duck.prj -o duck_flt.prj -t 24000 -p 300x410 -s 1700x930

    duck.prj is the project file you previously created. If needed give the finishing touch to the chosen threshold value and square selection.
    NOTE: the format for the final images should be MS-bitmap, 1 bit per pixel.
  4. Now you should obtain sections from profiles, using the program s3d-sects:

    > s3d-sects -i duck_flt.prj -o duck.cnt -s 5 -f 0.1

    With '-i' you specify the input project, with '-o' the file which will contain the contours of the object, with '-f' you specify that the object should be scaled by the given factor, with '-s' you specify that not all the contours available should be used to construct the surface of the object: only one every five contours should be used (I reccomend to use '-sN', with N not less than 3: try with '-s10', first). If you want to see what the program calculated, use:

    > s3d-sects -i duck_flt.prj -x duck.fig -s 5 -f 0.1
    > xfig duck.fig

    (You should have installed xfig before!)
    For other help use 's3d-sects --help'.
  5. This is the final step: now you can obtain the surface from the contours.

    > nuages duck.cnt -vrml2 -tri duck.wrl

    You can visulize your results with FreeWRL, dune or other programs. Here we obtained a VRML 2.0 file, but you can use other formats: see the man page of 'repros2visu'. For other help see also the man page of the program 'nuages'.

SUMMARY OF COMMANDS:

find a suitable [VALUE] for the '-t' filter with:

> s3d-filters -1 -i original/duck_001.JPG -o bw.bmp -t 20000

then:

> s3d-filters -i duck.prj -o duck_flt.prj -t [VALUE] -p 300x410 -s 1700x930
> s3d-sects -i duck_flt.prj -o duck.cnt -s 5 -f 0.1
> nuages duck.cnt -vrml2 -tri duck.wrl

HOW TO CREATE THE PROJECT-FILE WITH A BASH SCRIPT:

Search into the main directory of Scan3D. There you can find a simple script which tries to generate a project file, given a set of images. Its name is s3d-project. You should copy this file into the directory containing the images, give it the execution permission ('chmod +x s3d-project') and execute it:

> s3d-project my_project.prj image1.jpg image2.jpg ...

For example: If the name of the images are: duck_001.jpg duck_002.jpg, etc use:

> s3d-project duck.prj duck_*.jpg

This command will create the file 'duck.prj'into the directory ../
Check that this file is correct, before using it!

NOTES ABOUT NUAGES:

Note that Nuages was written by Bernhard Geiger (see the copyright notice under the main directory of the program, the file 'COPYRIGHT'). Nuages was modified by me to support VRML 2.0 and was packaged using autoconf and automake. You can download the original program clicking here.
Return to the main page of the project...