Commit 8b47165640e634ff5b8bbf36f4d05427a4682860

Authored by David Mayerich
2 parents 01707489 70f0baaf

Merge branch 'ivote' into 'master'

update the image.h (add border), gauss2.cuh (change the kernel size) and argumen…

See merge request !31
stim/image/image.h
... ... @@ -407,6 +407,22 @@ public:
407 407 return result;
408 408 }
409 409  
  410 + /// Add a border of width w with the given value around the image
  411 + /// @param w specifies the total size of the border
  412 + /// @param T is the pixel value (all channels will be the same)
  413 + image<T> border(size_t w, T value = 0) {
  414 + image<T> result(width() + w * 2, height() + w * 2, channels()); //create an output image
  415 + result = value; //assign the border value to all pixels in the new image
  416 + for (size_t y = 0; y < height(); y++) { //for each pixel in the original image
  417 + for (size_t x = 0; x < width(); x++) {
  418 + size_t n = (y + w) * (width() + w * 2) + x + w; //calculate the index of the corresponding pixel in the result image
  419 + size_t n0 = idx(x,y); //calculate the index for this pixel in the original image
  420 + result.data()[n] = img[n0]; // copy the original image to the result image afer the border area
  421 + }
  422 + }
  423 + return result;
  424 + }
  425 +
410 426 /// Copy the given data to the specified channel
411 427  
412 428 /// @param c is the channel number that the data will be copied to
... ...
stim/math/filters/gauss2.cuh
... ... @@ -18,8 +18,8 @@ namespace stim {
18 18 ///@param nstds specifies the number of standard deviations of the Gaussian that will be kept in the kernel
19 19 template<typename T, typename K>
20 20 stim::image<T> cpu_gauss2(const stim::image<T>& in, K stdx, K stdy, size_t nstds = 3) {
21   - size_t kx = stdx * nstds * 2; //calculate the kernel sizes
22   - size_t ky = stdy * nstds * 2;
  21 + size_t kx = stdx * nstds * 2 + 1; //calculate the kernel sizes
  22 + size_t ky = stdy * nstds * 2 + 1;
23 23 size_t X = in.width() - kx + 1; //calculate the size of the output image
24 24 size_t Y = in.height() - ky + 1;
25 25 stim::image<T> r(X, Y, in.channels()); //create an output image
... ...
stim/parser/arguments.h
... ... @@ -9,10 +9,6 @@
9 9 #include <iterator>
10 10 #include <algorithm>
11 11  
12   -#ifdef _WIN32
13   -#include <Windows.h>
14   -#endif
15   -
16 12 /**The arglist class implements command line arguments.
17 13 Example:
18 14  
... ...