[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd/cvd utility.h
From: |
Edward Rosten |
Subject: |
[libcvd-members] libcvd/cvd utility.h |
Date: |
Sun, 15 Mar 2009 20:35:53 +0000 |
CVSROOT: /cvsroot/libcvd
Module name: libcvd
Changes by: Edward Rosten <edrosten> 09/03/15 20:35:53
Modified files:
cvd : utility.h
Log message:
Add fill border function
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/utility.h?cvsroot=libcvd&r1=1.8&r2=1.9
Patches:
Index: utility.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/utility.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- utility.h 21 Oct 2008 15:04:59 -0000 1.8
+++ utility.h 15 Mar 2009 20:35:53 -0000 1.9
@@ -95,6 +95,33 @@
zeroPixels(I[I.size().y-1], I.size().x);
}
+ /// Fill image borders
+ /// @param im Image fo fill borders in
+ /// @param pix Fill value
+ /// @param w border width
+ /// @ingroup gUtility
+ template<class T> void fillBorders(SubImage<T>& im, const T& pix, int w=1)
+ {
+ //Fill the top and bottom
+ for(int n=0; n < w; n++)
+ for(int x=0; i < im.size().x; x++)
+ {
+ im[n][x] = pix;
+ im[im.size().y-1-n][x] = pix;
+ }
+
+ for(int y=w; y < im.size().y - w; y++)
+ for(int n=0; n < w; n++)
+ {
+ im[y][n] = pix;
+ im[y][im.size().x - 1 - n] = pix;
+ }
+
+ }
+
+
+
+
/// Compute pointwise differences (a_i - b_i) and store in diff_i
/// This is accelerated using SIMD for some platforms and data types
(alignment is checked at runtime)
/// Do not specify template parameters explicitly so that overloading can
choose the right implementation
- [libcvd-members] libcvd/cvd utility.h,
Edward Rosten <=