Assuming the balls are thrown one at a time and that the minimum ball diameter is known then a "light curtain" is worth thinking about. Have LEDs on the rim of the bin shining on photoresistors. As a ball breaks the beam or beams you can count it.The beams would need to be close enough together so that a ball cannot get through without breaking at least one. You should look for a short change in resistance as opposed to a gradual change that might occur as ambient light levels vary. Before going too far it would be worth confirming that a fast moving ball causes enough of a change in resistance for accurate counting.