Commit 48966d30a4b9531bdbb39a35aaa818ea4acc0b93
Merge branch 'master' of https://git.stim.ee.uh.edu/codebase/stimlib
Showing
3 changed files
with
18 additions
and
6 deletions
Show diff stats
stim/image/image.h
@@ -407,6 +407,22 @@ public: | @@ -407,6 +407,22 @@ public: | ||
407 | return result; | 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 | /// Copy the given data to the specified channel | 426 | /// Copy the given data to the specified channel |
411 | 427 | ||
412 | /// @param c is the channel number that the data will be copied to | 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,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 |