Fixed bin calculation to correcly account for colored images