Galaxy Count is a computer vision tool to perform object detection and basic statistical analysis on image sets.
It is a Processing application and its user interface makes it easy to load images, filter them, count objects or "blobs" in each image, and save the computed statistics in CSV format.
A custom version of the app was used by scientists at the State University of New York in Fredonia to analyze micro plastics in global bottled water.
The story was reported in Plus Plastic by Orb Media and was featured on BBC News and CBC and was covered by the Guardian, and Gizmodo.
Galaxy Count runs on Processing 3. You can download it and follow installation instruction here.
It uses the libraries controlP5 and blobscanner.
You can install them manually by copying them from the folder libs
in this repository to the folder Processing/libraries/
on your machine or from the Processing application's menu in Sketch > Add Library
. Processing explains how to install a library in more detail here.
Copy the folder galaxyCount
to your Processing folder, and add your images to the enclosed folder data/samples/
in .jpg or .png format.
The expected image size is 2048 × 1536 px.
Open the sketch in Processing and you can select images from the dropdown.
Let's go through what the controls let's you do:
-
Threshold Value sets the value for the threshold filter
-
Filter applies a threshold filter to the current image
-
Unfilter undo the filter and show the original image
-
Count counts the number of objects or "blobs" in the image, highlights them in blue, and displays the result below
-
Filter + Count + Statistics applies filter, counts blobs, and performs basic stats on the counted blobs
-
Download Data saves the results for all the processed photos in CSV format in the folder
/data/
with the current date and time.
The Filter + Count + Statistics function displays only a sample of the calculated stats:
- the number of objects
- the average size of objects (in pixels)
- and the density which is 1000 times the ratio of the area of objects to the total image area i.e.
The saved statistics data include more measures (all in pixels)
- the standard deviation of object sizes
- the size of smallest object
- the size of biggest object
- the median size of objects
The width of the input images can be adjusted by editing galaxyCount.pde
at the line
int imgWOriginal = 2048;
but the aspect ratio of the images is a fixed landscape at 4 : 3.
To Dan Morrsion and Sherri Mason for the help in testing this code and refining it.
MIT 2018
Basically, you can do whatever you want as long as you include the original copyright and license notice in any copy of the software/source.
If you use this code in a project, I would love to hear from you. Email me at youssef.faltas@gmail.com