For Pre-Installation, You MUST install camlimages! Also, please navigate to ~/.ocamlinit and make sure you delete any reference to Core.Std, as having the standard libraries will actually interfere with our program.
To run Moosaic:
- Open up main.ml in Emacs
- In a Utop terminal within Emacs, run the following command: #require "camlimages"
- Compile main.ml using ctrl c ctrl b
- Put the image you want to make a mosaic out of in the same folder as main.ml. Make sure the file is of type BMP. We've provided some sample images in the sample bmps folder
- Run the command masterpiece n "image name" where n is the number of tiles you would like your photo-mosaic to be comprised of, and image_name is the filename of the image you would like to create a mosaic out of
The three files that we worked in are kdtrees.ml, kdtest.ml, and pixels.ml. kdtrees.ml is the structure for the kd tree we used to store images--including the nearest neighbor function that is the heart of the program. In kdtest.ml are the tests we wrote along the way to make sure everything was working, and pixels.ml creates the photo-mosaic and is the main integration with camlimages.
How we installed camlimages (after lots of trial and error):
-
Download and install camlimages and make via “sudo opam install camlimages”
-
Unlock appropriate permissions
-
Camlimages package should now appear in utop when you run #list “camlimages”;;