fixed std computation in two places

- getPixelMeanAndStd returned variance before.
- new algorithm for computing std also for clamping