private void Convolve(ImageWrapper imageWrapper) { ImageWrapper imageCopy = imageWrapper.GetDeepCopy(); int halfSize = _logMatrix[0].Length / 2; int logMatrixSize = _logMatrix[0].Length; for (int i = 0; i < imageWrapper.Height; ++i) { for (int j = 0; j < imageWrapper.Width; ++j) { double value = 0.0; for (int ii = 0; ii < logMatrixSize; ++ii) { int n = i - halfSize + ii; if (n < 0 || n >= imageWrapper.Height) { continue; } for (int jj = 0; jj < logMatrixSize; ++jj) { int m = j - halfSize + jj; if (m < 0 || m >= imageWrapper.Width) { continue; } value += _logMatrix[ii][jj] * imageCopy[n, m]; } } imageWrapper[i, j] = value; } } }
public BlobDetector(IFilterBuilder filterBuilder, string path) { _filterBuilder = filterBuilder; _dataInitializer = new DataInitializer(path); _path = path; _originalImage = new ImageWrapper(new Bitmap(path)); _scaleSpace = new ScaleLevel[(int)(((FinalT - InitialT) / Step) + 1)]; }
private ImageWrapper(ImageWrapper other) { _width = other.Width; _height = other.Height; _stride = other._stride; _imageData = new double[other.Height][]; for (int i = 0; i < this.Height; ++i) { _imageData[i] = new double[other.Width]; for (int j = 0; j < this.Width; ++j) { _imageData[i][j] = other._imageData[i][j]; } } }
public ScaleLevel(IFilter filter, ImageWrapper imageWrapper) { _filter = filter; _imageWrapper = imageWrapper; _blobs = new List<Blob>(); }
public void Apply(ImageWrapper imageWrapper) { _logMatrix = _logMatrixBuilder.Build(this.Sigma); this.Convolve(imageWrapper); }