Technical Reference Manual Soil Scanner Benjamin Glover and Jack Mooney Last Revision: April 25, 2016
Table of Contents: A. Description B. Database Artifacts C. Features and References D. Web Services E. PHP Functions 1
Description Abstract Soil Color Scanner is an application designed to benefit students, employees, and consultants who must analyze, manage, and develop a soil inventory. Our goal is to reduce and alleviate the difficulty of matching a physical soil sample to the equivalent color value based on the Munsell Color System. The application priority feature is to use an algorithm to best match a soil sample based on Munsell values stored in an external database. Additionally, the application will create a local inventory of the user s previous scanned samples. Mentor: Dr. Christopher Post App Target Device This app will be featured on Android Smartphone devices that are running Android 4.4 (KitKat). 2
Database Artifacts A string is stored in the database to point to the file location of an image. A string is stored in the database to indicate a single GPS coordinate. Three separate integer values are stored in the database indicate a single Munsell color. On the phone s internal memory, an image is stored for the user locally. Internal and External Databases The external database is an exact mirror of the internal database schema. The contents of the internal database of individual users will be uploaded to an external database that will collectively store the results of previously scanned soil samples. The data collected will be used for future crowdsourcing. 3
Features Primarily the user will first be able to scan a soil sample using the Nix Sensor device, allowing the app to use the result from the scan to best match the soil sample to the equivalent Munsell match. Determining a match of the sensor results are done via an algorithm that the application will perform, by comparing the results to values stored in an external database of previously recorded Munsell values. After the best match algorithm is complete, the application will then prompt the user of the best three matches based on color equivalent accuracy and GPS surveying. Secondary features include the creation of a local inventory of previously scanned samples via an internal database. The internal database will store and display the resulting color values of the scanned sample, a timestamp of when the sample was taken, an image of the soil sample submitted by the user and their camera, and the GPS coordinates of the sample. Additionally the application will support the conversion of color value standards to different standards, specifically RGB, CMYK, CIELab, and Munsell. Technical Features Nix Sensor to scan the color of soil samples. Uses phone s Bluetooth to connect to Nix Sensor. Camera to take picture soil sample Saves geolocation data of the soil sample using GPS Makes use of an internal and external database synchronization Converts various color values standards to different standards Saves a photo of the soil sample to the local storage of the user s phone. Stores unique meta data in the saved photo: geolocation, name, size, data taken, and GPS accuracy. Technical References Using Async task to fetch data in the background Retrieve an imageview from a file. Set a bitmap to imageview. Caching Images Nix Sensor 4
Web Services HTTP POST is used to pass variables about the scanned sample to a web script for storage in the external database via the android app. PHP is the web script used to input variables into the external database. MySQL is the database language used to manage the external database. JSON is the type of variable passed from the HTTP method to the web script. 5
PHP Functions sync.php The purpose of this script is upload a single soil sample from the Soil Color Scanner app. The mobile application inserts a single soil sample into the external database by inputting a JSON variable via HTTP POST. The JSON variable is composed of the color values R,G, B, GPS coordinate, picture (Image URL), created (Date of sample). downloadmunsell.php The purpose of this script is to download the entire contents of the external database of only Munsell values. The output of this script, prints a large JSON file containing the Munsell values. uploadmunsell.php The purpose of this script is to upload a large amount of Munsell values. This script uploads a CSV file in the format of Hue, Value, and Chroma. The script then inserts each row of values into the database, replacing the previous Munsell values. tablemunsell.php The purpose of this script is to display the Munsell values stored in the external database in a dynamically created table. This allows the user to view the Munsell values in an easy to read format. uploadphoto.php The purpose of this script is to upload a photo to the external database and server. The script will request a binary file and save the file as a photo format on the server. Afterwards, the script will update the database to reflect the photo s file location. 6