improved color key generation algorithm