Basket Hole Analysis

Quick Start

The perfect espresso shot depends on your basket, so you want to see what it's like: how many holes; how even the holes are; what % open area. So, take an image of your basket (using the tips & tricks provided) and load it into this analyzer. The app is inspired by the brilliant Robert McKeon Aloe; see Espresso Filter Baskets: Visualized and was developed with the team at Barista Hustle, who encouraged me to create this YouTube video for those who want a simple guide.

Basket Hole Analysis

Width mm
Log Plot

Background explanation

The idea is simple. Take a picture of the basket and let the computer find all the holes, count them, measure their size and give you a visual impression of their size uniformity, plus a nerdy analysis of that uniformity

It is often imagined that such an "image analysis" technique would be very difficult. In reality, there are three major difficulties that are nothing to do with fancy image analysis:

  1. Getting even lighting, with perfect white holes on a perfect black background is very hard. Any imperfection in the lighting, background makes it harder to distinguish hole from non-hole.
  2. Eliminating camera distortion which typically makes the holes in the centre look bigger than those at the edge.
  3. Calibration of the image so you know the absolute size of the holes.

On the principle of "keep it simple", the first part if the first problem is solved by providing a backlight to the basket. A laptop screen that folds flat, or a tablet - anything with a nice even white blank image on it. As any light coming from outside the basket is unwelcome, use some sort of cardboard cutout on the screen so that light only comes through the open cutout then the holes, with everything else blocked off. The second part is solved by taking the image in a darkened room so there are no reflections from the metal. Perfectionists might usea collimated light beam beneath the holes to avoid artificial widening by diffuse light.

Avoiding camera distortions is up to you - I know nothing about it other than ensuring the centre of the basket is in the centre of your image. Perfectionists might use telecentric lenses. The default image on start-up is an early attempt by Barista Hustle to image a standard IMS basket. Some of the size variation across the image is presumably due to imperfect image alignment. Don't reach any conclusions about IMS baskets from this image!

Calibration is simple - for me - but you must first do a bit of image manipulation. Crop your image exactly to the internal edge of your basket. If you know that your basket's internal diameter is is 55mm then by putting that value into the app, the program knows exactly how to scale the pixels. And while you are doing the cropping, you can change brightness/contrast to remove any stray light etc. Look carefully for any stray white pixels outside the basket area and remove them in your image editor - they can influence the results in a subtle manner.

Blocked holes

It's quite normal to have a few blocked holes. You could go to great trouble to unblock them with a super-fine needle, a compressed air blast, an ultrasonic cleaner or anything else you can think of. Or you could edit out the blockage in your image software. Or you can leave them alone. If you have 3 blocked holes with 997 unblocked ones, that's only 0.3%, which won't affect your analysis significantly.

Hole analysis

Load an image. With the Pic-only option selected you can get a good idea of the image quality. Assuming it's fine, and that you've really cropped it properly, got good contrast and you've entered the diameter, unclick Pic-only and you will see a rainbow coloured depiction of your hole sizes. Redder is larger, bluer is smaller.

To analyze the sizes it is customary to place them into "bins". Everything from 200-220μm might be in one bin, everything from 220-240μm in another etc. Here we use 24 bins as a good balance of accuracy and numerics.

The output is NHoles, the number of individual holes identified, the % Open area which is a key number in terms of flow, and MaxD the size of the largest hole. In addition, we want the "average" hole size, for which I've chosen the "mean" of the numbers in each bin (Mean), and the "standard deviation" (SD) which tells you how wide or narrow the distribution is.

Presumably, for your specific espresso machine you always use baskets of the same diameter. But if you happen to use different diameters then note that the same % Open Area gives a bigger flow from a larger basket. If (to be extreme) you had a 50mm and 60mm basket then the total area is (60/50)²larger. With the same weight of coffee, the depth of the bed will be 50/60 smaller, so the overall flow might be (60/50)³ larger! If, to be more realistic you compared a 56 with a 54 mm basket, the difference in flow rate would, all other things being equal, be ~10%. It's up to you to decide whether this is significant and whether all other things are equal.

The graph

We graph the size distribution in Number terms, how many are at each diameter (or are in the bin with that diameter range). We can also see them in Area terms which expresses how much of the surface area comes from various hole sizes. Most of us focus on N but in terms of flow, A is the important one. Then we plot them in a cumulative manner so you can readily see at which sizes interesting things happen. Some like to see them in logarithmic scale. The arithmetic of the calculations is discussed below.

Although the graph could auto-scale, it turns out to be better to have fixed it between 200 and 600 μm. It makes it much easier to compare/contrast different baskets. With a fixed scale you sometimes lose information at one end, but it's only visual information, the calculations are unaffected.

The Calculations

If your basket has nice round holes, then there's no problem interpreting the results. If the holes are some weird shape then I have a problem.

All I know after the image processing is the number of pixels making up a "blob". I can call this an area, A, so I know that if this was a circle, the radius would be given by Α=πr². Now I have the pseudo-radius, r=√(A/π), of each blob. I can then say that the open area of the hole is 4πr². This allows me, for each radius bin (though I plot it as the more comfortable diameter), to know the Number of particles in that bin, the Area of those particles.

Location Variance

For some, the ideal basket has each hole exactly the same distance from each other hole, others choose to have different spacings. For the first type, if you select the L-Variance option you should see plenty of holes in the green/yellow range that are nicely average in separation. Anything towards blue is closer to another hole than expected and anything towards red is further apart.

The colour range has been exaggerated around the average, so don't get too hung up on variations that are usually insignificant, though baskets with deliberately different spacings give a joyous riot of colours.