Commit 70f0baaf0075c21fca6bdf0095f706617fd13ebc

Authored by Laila Saadatifard
1 parent 00a7e339

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

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