diff --git a/stim/image/image.h b/stim/image/image.h index 9e43730..0177578 100644 --- a/stim/image/image.h +++ b/stim/image/image.h @@ -408,6 +408,22 @@ public: return result; } + /// Add a border of width w with the given value around the image + /// @param w specifies the total size of the border + /// @param T is the pixel value (all channels will be the same) + image border(size_t w, T value = 0) { + image result(width() + w * 2, height() + w * 2, channels()); //create an output image + result = value; //assign the border value to all pixels in the new image + for (size_t y = 0; y < height(); y++) { //for each pixel in the original image + for (size_t x = 0; x < width(); x++) { + size_t n = (y + w) * (width() + w * 2) + x + w; //calculate the index of the corresponding pixel in the result image + size_t n0 = idx(x,y); //calculate the index for this pixel in the original image + result.data()[n] = img[n0]; // copy the original image to the result image afer the border area + } + } + return result; + } + /// Copy the given data to the specified channel /// @param c is the channel number that the data will be copied to diff --git a/stim/math/filters/gauss2.cuh b/stim/math/filters/gauss2.cuh index 2734385..7e50ece 100644 --- a/stim/math/filters/gauss2.cuh +++ b/stim/math/filters/gauss2.cuh @@ -18,8 +18,8 @@ namespace stim { ///@param nstds specifies the number of standard deviations of the Gaussian that will be kept in the kernel template stim::image cpu_gauss2(const stim::image& in, K stdx, K stdy, size_t nstds = 3) { - size_t kx = stdx * nstds * 2; //calculate the kernel sizes - size_t ky = stdy * nstds * 2; + size_t kx = stdx * nstds * 2 + 1; //calculate the kernel sizes + size_t ky = stdy * nstds * 2 + 1; size_t X = in.width() - kx + 1; //calculate the size of the output image size_t Y = in.height() - ky + 1; stim::image r(X, Y, in.channels()); //create an output image diff --git a/stim/parser/arguments.h b/stim/parser/arguments.h index bd61cfc..7a84ce3 100644 --- a/stim/parser/arguments.h +++ b/stim/parser/arguments.h @@ -9,10 +9,6 @@ #include #include -#ifdef _WIN32 -#include -#endif - /**The arglist class implements command line arguments. Example: -- libgit2 0.21.4