Solved by eqy in post #2 
              
              
                This might not be the root cause of the problem but I think you might want to change the data dtypes to something like int or long before running your computation. The issue is that you will likely overflow int8 if the original data is in 8-bit RGB, and this becomes even more likely during the accum…