[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd/cvd vision.h
From: |
Olaf Kähler |
Subject: |
[libcvd-members] libcvd/cvd vision.h |
Date: |
Mon, 29 Mar 2010 13:26:06 +0000 |
CVSROOT: /sources/libcvd
Module name: libcvd
Changes by: Olaf Kähler <ok245> 10/03/29 13:26:05
Modified files:
cvd : vision.h
Log message:
added flipHorizontal()
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/vision.h?cvsroot=libcvd&r1=1.34&r2=1.35
Patches:
Index: vision.h
===================================================================
RCS file: /sources/libcvd/libcvd/cvd/vision.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- vision.h 1 Oct 2009 11:34:54 -0000 1.34
+++ vision.h 29 Mar 2010 13:26:05 -0000 1.35
@@ -24,6 +24,7 @@
#include <vector>
#include <memory>
+#include <algorithm>
#include <cvd/vision_exceptions.h>
#include <cvd/image.h>
@@ -435,6 +436,26 @@
}
}
+/// flips an image horizontally in place.
+template <class T> void flipHorizontal( Image<T> & in )
+{
+ int w = in.size().x;
+ int h = in.size().y;
+ std::auto_ptr<T> buffer_auto(new T[w]);
+ T* buffer = buffer_auto.get();
+ T * left = in.data();
+ T * right = left + w;
+ int row = 0;
+ while(row < h)
+ {
+ std::copy(left, right, buffer);
+ std::reverse_copy(buffer, buffer+w-1, left);
+ row++;
+ left += w;
+ right += w;
+ }
+}
+
namespace median {
template <class T> inline T median3(T a, T b, T c) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libcvd-members] libcvd/cvd vision.h,
Olaf Kähler <=