Example #1
0
        /// <summary>
        /// Calculate mean image of sequene (every pixel contains mean of corresponding pixels values from sequence).
        /// </summary>
        /// <param name="sequecne">
        /// Sequence to calculate mean. Every images have to have same dimensions.
        /// </param>
        /// <returns>
        /// Mean of sequence.
        /// </returns>
        public static FloatMatrix SequenceMean(IEnumerable<FloatMatrix> sequecne)
        {
            FloatMatrix result = new FloatMatrix(new DataMatrix<float>(sequecne.First().Dimensions));
            int num = 0;

            foreach (FloatMatrix bias in sequecne)
            {
                result.Add(bias);
                num++;
            }
            result.Divide((float)num);

            return result;
        }
Example #2
0
        private FloatMatrix CalcMeanAndShow(IEnumerable<FloatMatrix> source, string title)
        {
            FloatMatrix result = new FloatMatrix(new DataMatrix<float>(source.First().Dimensions));
            int n = 0;

            foreach (FloatMatrix image in source)
            {
                n++;
                _imageWindow.ShowImage(image);
                _imageWindow.ImgForm.Text = title + " " + n.ToString();

                result.Add(image);

                Wait(_waitOnCalibrationSource);
            }

            result.Divide((float)n);

            return result;
        }