What color are tennis balls?

Alec Jacobson

November 01, 2013

weblog/

Some colleagues and I were debating this today. Of my enormous dataset so far of 6 people, 3 vote for yellow and 3 for green. Interesting the yellow votes all came from Europeans and the greens from non-Europeans. Here's a very rushed experiment to determine the average color of a tennis ball. From top to bottom: I took a screen capture of a google search for tennis ball, created a mask that mostly contains just the tennis balls, then took an average of the masked colors resulting in the solid bottom color.

tennis ball

If you ask me---and I think you should---I'll tell you that's green.

Here's the matlab script I used to create this:

im = imresize(im2double(imread('tennis-ball-google-search.png')),1.0);
ntsc = rgb2ntsc(im);
M = [ntsc(:,:,1)>0.5 & ntsc(:,:,2)>0];
avg = sum(sum(bsxfun(@times,M,im),1),2)./sum(M(:));
comp = [...
  im; ...
  repmat(M,[1 1 3]); ...
  bsxfun(@times,M,im); ...
  repmat(avg,[size(im,1) size(im,2) 1])];
imshow(comp);