Briefly, in this method loose berries are placed onto a glass-bottomed tray, which is then placed onto a flatbed scanner, and an image is made of the berries; this image will show the individual berries against a background of contrasting color. An image analysis software program is then used to count how many berries appear in the image. It takes much longer to explain it than to do it; the instructions below may look confusing at first, but once you become accustomed to the method it goes very quickly.
Note that the method as described works well with green berries; some modifications will likely be needed if counts of dark berries are done. As I begin to have access to more mature fruit, I will update this site with more information.
Equipment required:
- A computer (Windows or Mac), preferably a later model with a high speed processor;
- A common flatbed scanner; in my work I use a Canon “Canoscan LiDe 90”
- A homemade berry tray and cover;
- ImageJ software, downloaded for free from http://rsb.info.nih.gov/ij/
Setting up the equipment:
1) Install the scanner software on the computer according to manufacturer’s instructions
2) Remove scanner lid (optional, but makes it easier to work; on the Canon the lid pops off quite easily)
Making a berry tray:
The removable berry tray serves as a convenient tool to transfer berry samples to and from the scanner; while it may be possible to place berries directly on the platen of the scanner (the glass or plexiglass surface), this is not very practical. The berry tray is simply a sheet of flat clear glass, approximately 1/8” (3mm) thick. The glass is cut to a rectangular shape roughly the same size as the platen of the scanner. In this example, the glass was cut to dimensions of 8 ½” x 12” (21.6cm x 30.5 cm). A border is then glued on one side of the glass plate, around the edge; this forms an enclosed area, which keeps the berries from rolling off of the glass plate and also supports the cover which will be placed on the berry tray when scanning. In this example, I used ¾” aluminum angle stock to make the border; other materials will also work. The underside of the berry tray directly beneath the border was covered with black electrical tape, to block the aluminum from the view of the scanner optics; this may not be necessary.
3) Cover the glass frame with a dark-colored flat board; this provides the dark background in the initial scanned image;
6) With the above settings, scan the berry sample;
7) If you want to see the scanned image, open it in a program such as “Microsoft Office Picture Manager”, or the picture management software which came with your scanner (your scanner software may open the image automatically). You should see an image of light-colored berries on a dark background.

Counting the berries using the ImageJ program:


4) In the "Threshold" window there are two horizontal bars; you can use the mouse cursor to drag the top bar to the left to make the berries become fuller, if necessary; compare the picture below to the one above to see the results. This step may not be necessary, but if the scanned image does not have a distinct color difference between the berries and background this step is helpful. Some berries will now touch; this will be corrected later. Close the "Threshold" window.

5) You should now have a black & white (binary) image showing black berries on a white background. Depending on the design of the berry tray you are using, you will also see some dark patches around the border of the image which are not berries, as in the image below.

6) Choose PROCESS>>BINARY>>WATERSHED

7) Using the mouse cursor, select a square around the berry sample portion of the image; this shows up as a yellow box in the image below. The analysis in the next step will only evaluate the portion of the image within the yellow box; thus if your berry tray produces a black border in the binary image, this is an easy way to not include that section in the analysis.

8) Choose ANALYZE>>ANALYZE PARTICLES to bring up the dialog box shown below. In this dialog box, place a check in the SUMMARIZE box. For SIZE (PIXEL^2), enter 500-8000; this means that the software will only count those particles which have an area between 500 and 8000 pixels. If this selection is kept with the default setting of 0-INFINITY, the very smallest particles in the image, such as those made by tiny bits of debris, will be counted as berries and will lead to very inaccurate measurements. A value of 500 is roughly equivalent to a 1/8” diameter berry, while 8000 is about ½” diameter; adjust these range values accordingly if the sizes of the berries you are measuring are outside these limits. Note that these settings are for an image scanned with a resolution of 200 dpi; if you scan with a different resolution, you will need to change these pixel size boundaries. See the chart at the bottom of this article for the relationship between square pixels and berry diameter for different scanner resolutions.


In practice, if you are counting berries from a large number of clusters, you will probably find it faster to first do all the scanning as a group, and then follow this with all the image analysis using ImageJ.
This is a new method which is still undergoing testing and development; please check back to this page for updates, tips, suggestions and modifications.
If you try out the method and have any feedback on how it works for you, and suggestions for improvement, I'd like to hear about it. Please email me at mcbattany@ucdavis.edu

Tips
Mike and Andrew at French Camp Vineyard use a small cardboard square tube to help keep the berries in the center of the berry tray. The empty tray is first placed on the scanner, the tube is then placed in the middle of the tray, and then the berries poured into the tube and the tube removed. (the tube is shown in the foreground of the photo below).
Berry size distribution
A separate page describing how to use the method to estimate berry size distribution is located at this website:
http://cesanluisobispo.ucdavis.edu/Viticulture/Berry_size_distribution.htm