This program is designed to automate the process of locating the highlight sphere in Cultural Heritage Imaging's RTIBuilder software. This project is a proof-of-concept. It demonstrates that it is indeed possible to completely automate the sphere-finding process.
This program will recognize a special pattern, found in Pattern.pdf, in an image that you provide. You simply glue the sphere onto the center of the pattern (where the X is) and take your pictures as you normally would.
- Print out the pattern in Pattern.pdf
- Feel free to scale the picture down appropriately for smaller sphere sizes. The program is capable of detecting the pattern even when it's very small.
- Glue this pattern onto something solid such as a piece of cardboard
- Attach the sphere directly on the X in the image.
- Take your pictures (At least 3 of the patterns need to visible in an image to locate the sphere)
- If needed, convert your images to .jpg format
- Download program from "Releases" section
- There are two ways to run the program:
- Drag-and-drop method:
- Select your images and drag-and-drop them onto the executable (detect_sphere.exe). The images must be in the same directory as detect_sphere.exe
- A window should open, run the pattern detection, and close
- Command-line method:
- cd into the directory containing the program
- Run as: detect_sphere.exe image1.jpg image2.jpg image3.jpg
- Drag-and-drop method:
- You will now see a file output.csv. This file will contain the detected location (center) of the sphere for each image. It will also contain the location of each pattern (A,B,D, and G). The last line contains the average center if multiple images were used.
- If the program failed to detect patterns in an image the location will show up as 0,0
The program detects patterns consistently. As long as at least 3 patterns are visible, the sphere's center is usually located within 1-2 pixels.
- Pattern detection may fail on large images with the message "Marker detection (arDetectMarker) failed on example_image.jpg. Skipping this image...". The exact cause has not been identified, but it may be due to embedded color profiles. It is recommended to simply try opening the image with Photoshop or GIMP, discard the embedded color profile, and re-save the image.
This project is 'self-contained'. The Windows version of the libs, dll's, and headers for the ARToolkit the SDL libraries are included. You should be able to 'git clone' this repository, open the .sln file with Visual Studio (we used 2013), and compile without any issues.
Both ARToolkit and SDL have MAC and Linux versions. Although we have not tested it, the program should compile on these platforms given you have set up the includes and linking properly. Note: in order to support large images we increased the buffer size in ARToolkit to 5000x5000 and recompiled the ARToolkit libs. You will need to do this for the MAC and Linux versions. Edit the variables in the file /lib/SRC/AR/arLabeling.c like so:
#define HARDCODED_BUFFER_WIDTH 5000
#define HARDCODED_BUFFER_HEIGHT 5000
And recompile the libs.
- Skylar Brown
- Michael Grijalva
- Wallace Luk