Exemplo n.º 1
0
 public void TryFillHoles(Matrix <float> normalizedImageMatrix, IBoundarySearcher boundarySearcher, ColorInterpolatorBase colorInterpolator)
 {
     m_missingPixels.All(missingPixel =>
     {
         normalizedImageMatrix[missingPixel.Row, missingPixel.Column] = ImageColorsService.InterpolateColor(missingPixel, boundarySearcher.BoundaryPixels, colorInterpolator);
         return(true);
     });
 }
Exemplo n.º 2
0
 private void InitializeImageMatrix()
 {
     using (Image <Gray, float> image = new Image <Gray, float>(m_imageUri))
     {
         m_normalizedImageMatrix = new Matrix <float>(image.Height, image.Width);
         ImageRegion             = new ImageRegion(image.Height, image.Width);
         image.CopyTo(m_normalizedImageMatrix);
     }
     FindHolesAndBoundaries();
     ImageColorsService.ScaleColorsDown(m_normalizedImageMatrix);
 }
Exemplo n.º 3
0
        public async Task <Image <Gray, float> > MarkBoundaries()
        {
            Image <Gray, float> result = null;

            await Task.Run(() =>
            {
                result = new Image <Gray, float>(m_normalizedImageMatrix.Cols, m_normalizedImageMatrix.Rows);

                using (Matrix <float> imageWithMarkedBoundariesMatrix = new Matrix <float>(m_normalizedImageMatrix.Rows, m_normalizedImageMatrix.Cols))
                {
                    m_normalizedImageMatrix.CopyTo(imageWithMarkedBoundariesMatrix);
                    ImageColorsService.ScaleColorsUp(imageWithMarkedBoundariesMatrix);
                    m_boundarySearher.TryMarkBoundaryPixels(imageWithMarkedBoundariesMatrix);
                    m_missingPixelsService.TryMarkMissingPixels(imageWithMarkedBoundariesMatrix);
                    imageWithMarkedBoundariesMatrix.CopyTo(result);
                }
            });

            return(result);
        }
Exemplo n.º 4
0
        public async Task <Image <Gray, float> > FillHoles(ColorInterpolatorBase colorInterpolator, bool markBoundary)
        {
            Image <Gray, float> result = null;

            await Task.Run(() =>
            {
                result = new Image <Gray, float>(m_normalizedImageMatrix.Cols, m_normalizedImageMatrix.Rows);

                using (Matrix <float> filledImageMatrix = new Matrix <float>(m_normalizedImageMatrix.Rows, m_normalizedImageMatrix.Cols))
                {
                    m_normalizedImageMatrix.CopyTo(filledImageMatrix);
                    m_missingPixelsService.TryFillHoles(filledImageMatrix, m_boundarySearher, colorInterpolator);
                    ImageColorsService.ScaleColorsUp(filledImageMatrix);
                    if (markBoundary)
                    {
                        m_boundarySearher.TryMarkBoundaryPixels(filledImageMatrix);
                    }
                    filledImageMatrix.CopyTo(result);
                }
            });

            return(result);
        }