Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Calculation of image statistics
- // We could use LINQ to get Min and Max easily but this way we do it all
- // in a single passege through image matrix
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- UInt16 tempMin = (UInt16)(Math.Pow(2, mfvm.cameras[openCamIndex].bitDepth) - 1);
- UInt16 tempMax = acquisition.frameDataShorts.AsParallel().Max();
- UInt64 tempSum = 0;
- stopWatch.Stop();
- for (int i = 0; i < acquisition.frameDataShorts.Length; i++)
- {
- if (acquisition.frameDataShorts[i] < tempMin)
- tempMin = acquisition.frameDataShorts[i];
- if (acquisition.frameDataShorts[i] > tempMax)
- tempMax = acquisition.frameDataShorts[i];
- tempSum += acquisition.frameDataShorts[i];
- }
- stopWatch.Stop();
- // Get the elapsed time as a TimeSpan value.
- TimeSpan ts = stopWatch.Elapsed;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement