Automatic measurement of cork stoppers