accessor.hxx   accessor.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_ACCESSOR_HXX #ifndef VIGRA_ACCESSOR_HXX
#define VIGRA_ACCESSOR_HXX #define VIGRA_ACCESSOR_HXX
#include "vigra/metaprogramming.hxx" #include "metaprogramming.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/tuple.hxx" #include "tuple.hxx"
namespace vigra { namespace vigra {
/** \addtogroup DataAccessors Data Accessors /** \addtogroup DataAccessors Data Accessors
Basic templates to encapsulate access to the data of an iterator. Basic templates to encapsulate access to the data of an iterator.
Data accessors are used to allow for flexible access to the data Data accessors are used to allow for flexible access to the data
an interator points to. When we access the data directly, we an iterator points to. When we access the data directly, we
are bound to what <TT>operator*()</TT> returns, if this method exists a t are bound to what <TT>operator*()</TT> returns, if this method exists a t
all. Encapsulating access in an accessor enables a better all. Encapsulating access in an accessor enables a better
decoupling of data structures and algorithms. decoupling of data structures and algorithms.
<a href="documents/DataAccessors.ps">This paper</a> contains <a href="documents/DataAccessors.ps">This paper</a> contains
a detailed description of the concept. Here is a brief list of the basi c a detailed description of the concept. Here is a brief list of the basi c
accessor requirements: accessor requirements:
<p> <p>
<table border=2 cellspacing=0 cellpadding=2 width="100%"> <table border=2 cellspacing=0 cellpadding=2 width="100%">
<tr><td> <tr><td>
\htmlonly \htmlonly
 End of changes. 3 change blocks. 
5 lines changed or deleted 5 lines changed or added


 array_vector.hxx   array_vector.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2002-2004 by Ullrich Koethe */ /* Copyright 2002-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_ARRAY_VECTOR_HXX #ifndef VIGRA_ARRAY_VECTOR_HXX
#define VIGRA_ARRAY_VECTOR_HXX #define VIGRA_ARRAY_VECTOR_HXX
#include "memory.hxx"
#include <memory> #include <memory>
#include <algorithm> #include <algorithm>
#include <vigra/memory.hxx>
namespace vigra namespace vigra
{ {
/** Replacement for <tt>std::vector</tt>. /** Replacement for <tt>std::vector</tt>.
This template implements the same functionality as <tt>std::vector</tt> . This template implements the same functionality as <tt>std::vector</tt> .
However, it gives two usful guarantees, that <tt>std::vector</tt> fails However, it gives two usful guarantees, that <tt>std::vector</tt> fails
to provide: to provide:
skipping to change at line 74 skipping to change at line 74
Refer to the documentation of <tt>std::vector</tt> for a detailed Refer to the documentation of <tt>std::vector</tt> for a detailed
description of <tt>ArrayVector</tt> functionality. description of <tt>ArrayVector</tt> functionality.
<b>\#include</b> "<a href="array_vector_8hxx-source.html">vigra/array_v ector.hxx</a>"<br> <b>\#include</b> "<a href="array_vector_8hxx-source.html">vigra/array_v ector.hxx</a>"<br>
Namespace: vigra Namespace: vigra
*/ */
template <class T, class Alloc = std::allocator<T> > template <class T, class Alloc = std::allocator<T> >
class ArrayVector class ArrayVector
{ {
typedef ArrayVector<T, Alloc> this_type; typedef ArrayVector<T, Alloc> this_type;
enum { minimumCapacity = 2 };
public: public:
typedef T value_type; typedef T value_type;
typedef value_type & reference; typedef value_type & reference;
typedef value_type const & const_reference; typedef value_type const & const_reference;
typedef value_type * pointer; typedef value_type * pointer;
typedef value_type const * const_pointer; typedef value_type const * const_pointer;
typedef value_type * iterator; typedef value_type * iterator;
typedef value_type const * const_iterator; typedef value_type const * const_iterator;
typedef unsigned int size_type; typedef unsigned int size_type;
skipping to change at line 250 skipping to change at line 251
Alloc alloc_; Alloc alloc_;
size_type size_, capacity_; size_type size_, capacity_;
pointer data_; pointer data_;
}; };
template <class T, class Alloc> template <class T, class Alloc>
ArrayVector<T, Alloc>::ArrayVector() ArrayVector<T, Alloc>::ArrayVector()
: alloc_(Alloc()), : alloc_(Alloc()),
size_(0), size_(0),
capacity_(5), capacity_(minimumCapacity),
data_(reserve_raw(5)) data_(reserve_raw(minimumCapacity))
{} {}
template <class T, class Alloc> template <class T, class Alloc>
ArrayVector<T, Alloc>::ArrayVector(Alloc const & alloc) ArrayVector<T, Alloc>::ArrayVector(Alloc const & alloc)
: alloc_(alloc), : alloc_(alloc),
size_(0), size_(0),
capacity_(5), capacity_(minimumCapacity),
data_(reserve_raw(5)) data_(reserve_raw(minimumCapacity))
{} {}
template <class T, class Alloc> template <class T, class Alloc>
ArrayVector<T, Alloc>::ArrayVector( size_type size, Alloc const & alloc) ArrayVector<T, Alloc>::ArrayVector( size_type size, Alloc const & alloc)
: alloc_(alloc), : alloc_(alloc),
size_(size), size_(size),
capacity_(size), capacity_(size),
data_(reserve_raw(size)) data_(reserve_raw(size))
{ {
if(size_ > 0) if(size_ > 0)
skipping to change at line 415 skipping to change at line 416
} }
size_ = new_size; size_ = new_size;
return begin() + pos; return begin() + pos;
} }
template <class T, class Alloc> template <class T, class Alloc>
template <class InputIterator> template <class InputIterator>
typename ArrayVector<T, Alloc>::iterator typename ArrayVector<T, Alloc>::iterator
ArrayVector<T, Alloc>::insert(iterator p, InputIterator i, InputIterator ie nd) ArrayVector<T, Alloc>::insert(iterator p, InputIterator i, InputIterator ie nd)
{ {
difference_type n = iend - i; size_type n = iend - i;
difference_type pos = p - begin(); size_type pos = p - begin();
size_type new_size = size() + n; size_type new_size = size() + n;
if(new_size >= capacity_) if(new_size >= capacity_)
{ {
pointer new_data = reserve_raw(new_size); pointer new_data = reserve_raw(new_size);
std::uninitialized_copy(begin(), p, new_data); std::uninitialized_copy(begin(), p, new_data);
std::uninitialized_copy(i, iend, new_data + pos); std::uninitialized_copy(i, iend, new_data + pos);
std::uninitialized_copy(p, end(), new_data + pos + n); std::uninitialized_copy(p, end(), new_data + pos + n);
deallocate(data_, size_); deallocate(data_, size_);
capacity_ = new_size; capacity_ = new_size;
data_ = new_data; data_ = new_data;
skipping to change at line 482 skipping to change at line 483
if(size_ > 0) if(size_ > 0)
std::uninitialized_copy(data_, data_+size_, new_data); std::uninitialized_copy(data_, data_+size_, new_data);
deallocate(data_, size_); deallocate(data_, size_);
data_ = new_data; data_ = new_data;
capacity_ = new_capacity; capacity_ = new_capacity;
} }
template <class T, class Alloc> template <class T, class Alloc>
void ArrayVector<T, Alloc>::reserve() void ArrayVector<T, Alloc>::reserve()
{ {
if(size_ == capacity_) if(capacity_ == 0)
reserve(minimumCapacity);
else if(size_ == capacity_)
reserve(2*capacity_); reserve(2*capacity_);
} }
template <class T, class Alloc> template <class T, class Alloc>
void ArrayVector<T, Alloc>::resize( size_type new_size, value_type const & initial) void ArrayVector<T, Alloc>::resize( size_type new_size, value_type const & initial)
{ {
if(new_size < size_) if(new_size < size_)
erase(begin() + new_size, end()); erase(begin() + new_size, end());
else if(size_ < new_size) else if(size_ < new_size)
{ {
 End of changes. 8 change blocks. 
9 lines changed or deleted 12 lines changed or added


 basicgeometry.hxx   basicgeometry.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_BASICGEOMETRY_HXX #ifndef VIGRA_BASICGEOMETRY_HXX
#define VIGRA_BASICGEOMETRY_HXX #define VIGRA_BASICGEOMETRY_HXX
#include "vigra/error.hxx" #include "error.hxx"
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
#include "vigra/copyimage.hxx" #include "copyimage.hxx"
#include <cmath> #include <cmath>
namespace vigra { namespace vigra {
/** \addtogroup GeometricTransformations Geometric Transformations /** \addtogroup GeometricTransformations Geometric Transformations
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
/* */ /* */
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 basicimage.hxx   basicimage.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_BASICIMAGE_HXX #ifndef VIGRA_BASICIMAGE_HXX
#define VIGRA_BASICIMAGE_HXX #define VIGRA_BASICIMAGE_HXX
#include <memory> #include <memory>
#include <algorithm> #include <algorithm>
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/iteratortraits.hxx" #include "iteratortraits.hxx"
#include "vigra/accessor.hxx" #include "accessor.hxx"
namespace vigra { namespace vigra {
template <class IMAGEITERATOR> template <class IMAGEITERATOR>
class LineBasedColumnIteratorPolicy class LineBasedColumnIteratorPolicy
{ {
public: public:
typedef IMAGEITERATOR ImageIterator; typedef IMAGEITERATOR ImageIterator;
typedef typename IMAGEITERATOR::LineStartIterator LineStartIterator; typedef typename IMAGEITERATOR::LineStartIterator LineStartIterator;
typedef typename IMAGEITERATOR::value_type value_type; typedef typename IMAGEITERATOR::value_type value_type;
skipping to change at line 371 skipping to change at line 371
{ \ { \
typedef BasicImageIterator<VALUETYPE, VALUETYPE**> muta ble_iterator; \ typedef BasicImageIterator<VALUETYPE, VALUETYPE**> muta ble_iterator; \
typedef ConstBasicImageIterator<VALUETYPE, VALUETYPE**> cons t_iterator; \ typedef ConstBasicImageIterator<VALUETYPE, VALUETYPE**> cons t_iterator; \
typedef typename AccessorTraits<VALUETYPE >::default_const_accessor DefaultAccessor; \ typedef typename AccessorTraits<VALUETYPE >::default_const_accessor DefaultAccessor; \
typedef DefaultAccessor default_acces sor; \ typedef DefaultAccessor default_acces sor; \
typedef VigraTrueType hasConstantSt rides; \ typedef VigraTrueType hasConstantSt rides; \
}; };
VIGRA_DEFINE_ITERATORTRAITS(RGBValue<unsigned char>) VIGRA_DEFINE_ITERATORTRAITS(RGBValue<unsigned char>)
VIGRA_DEFINE_ITERATORTRAITS(RGBValue<short>) VIGRA_DEFINE_ITERATORTRAITS(RGBValue<short>)
VIGRA_DEFINE_ITERATORTRAITS(RGBValue<unsigned short>)
VIGRA_DEFINE_ITERATORTRAITS(RGBValue<int>) VIGRA_DEFINE_ITERATORTRAITS(RGBValue<int>)
VIGRA_DEFINE_ITERATORTRAITS(RGBValue<unsigned int>)
VIGRA_DEFINE_ITERATORTRAITS(RGBValue<float>) VIGRA_DEFINE_ITERATORTRAITS(RGBValue<float>)
VIGRA_DEFINE_ITERATORTRAITS(RGBValue<double>) VIGRA_DEFINE_ITERATORTRAITS(RGBValue<double>)
#define VIGRA_PIXELTYPE TinyVector<unsigned char, 2> #define VIGRA_PIXELTYPE TinyVector<unsigned char, 2>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE) VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE #undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<unsigned char, 3> #define VIGRA_PIXELTYPE TinyVector<unsigned char, 3>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE) VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE #undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<unsigned char, 4> #define VIGRA_PIXELTYPE TinyVector<unsigned char, 4>
skipping to change at line 393 skipping to change at line 395
#undef VIGRA_PIXELTYPE #undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<short, 2> #define VIGRA_PIXELTYPE TinyVector<short, 2>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE) VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE #undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<short, 3> #define VIGRA_PIXELTYPE TinyVector<short, 3>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE) VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE #undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<short, 4> #define VIGRA_PIXELTYPE TinyVector<short, 4>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE) VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE #undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<unsigned short, 2>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<unsigned short, 3>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<unsigned short, 4>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<int, 2> #define VIGRA_PIXELTYPE TinyVector<int, 2>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE) VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE #undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<int, 3> #define VIGRA_PIXELTYPE TinyVector<int, 3>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE) VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE #undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<int, 4> #define VIGRA_PIXELTYPE TinyVector<int, 4>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE) VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE #undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<unsigned int, 2>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<unsigned int, 3>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<unsigned int, 4>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<float, 2> #define VIGRA_PIXELTYPE TinyVector<float, 2>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE) VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE #undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<float, 3> #define VIGRA_PIXELTYPE TinyVector<float, 3>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE) VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE #undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<float, 4> #define VIGRA_PIXELTYPE TinyVector<float, 4>
VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE) VIGRA_DEFINE_ITERATORTRAITS(VIGRA_PIXELTYPE)
#undef VIGRA_PIXELTYPE #undef VIGRA_PIXELTYPE
#define VIGRA_PIXELTYPE TinyVector<double, 2> #define VIGRA_PIXELTYPE TinyVector<double, 2>
skipping to change at line 434 skipping to change at line 454
/********************************************************/ /********************************************************/
/* */ /* */
/* BasicImage */ /* BasicImage */
/* */ /* */
/********************************************************/ /********************************************************/
/** \brief Fundamental class template for images. /** \brief Fundamental class template for images.
A customized memory allocator can be specified as a templated argument A customized memory allocator can be specified as a templated argument
ans passed in the constructor. and passed in the constructor.
<b>\#include</b> "<a href="basicimage_8hxx-source.html">vigra/basicimag e.hxx</a>" <b>\#include</b> "<a href="basicimage_8hxx-source.html">vigra/basicimag e.hxx</a>"
Namespace: vigra Namespace: vigra
*/ */
template <class PIXELTYPE, class Alloc = std::allocator<PIXELTYPE> > template <class PIXELTYPE, class Alloc = std::allocator<PIXELTYPE> >
class BasicImage class BasicImage
{ {
public: public:
skipping to change at line 1187 skipping to change at line 1207
srcImageRange(BasicImage<PixelType, Alloc> const & img, Accessor a) srcImageRange(BasicImage<PixelType, Alloc> const & img, Accessor a)
{ {
return triple<typename BasicImage<PixelType, Alloc>::const_traverser, return triple<typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::const_traverser, typename BasicImage<PixelType, Alloc>::const_traverser,
Accessor>(img.upperLeft(), Accessor>(img.upperLeft(),
img.lowerRight(), img.lowerRight(),
a); a);
} }
template <class PixelType, class Accessor, class Alloc> template <class PixelType, class Accessor, class Alloc>
inline triple<typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::const_traverser, Acces
sor>
srcImageRange(BasicImage<PixelType, Alloc> const & img, Rect2D const & roi,
Accessor a)
{
vigra_precondition(roi.left() >= 0 && roi.top() >= 0 &&
roi.right() <= img.width() && roi.bottom() <= img.he
ight(),
"srcImageRange(): ROI rectangle outside image.");
return triple<typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::const_traverser,
Accessor>(img.upperLeft() + roi.upperLeft(),
img.upperLeft() + roi.lowerRight(),
a);
}
template <class PixelType, class Accessor, class Alloc>
inline pair<typename BasicImage<PixelType, Alloc>::const_traverser, Accesso r> inline pair<typename BasicImage<PixelType, Alloc>::const_traverser, Accesso r>
srcImage(BasicImage<PixelType, Alloc> const & img, Accessor a) srcImage(BasicImage<PixelType, Alloc> const & img, Accessor a)
{ {
return pair<typename BasicImage<PixelType, Alloc>::const_traverser, return pair<typename BasicImage<PixelType, Alloc>::const_traverser,
Accessor>(img.upperLeft(), a); Accessor>(img.upperLeft(), a);
} }
template <class PixelType, class Accessor, class Alloc> template <class PixelType, class Accessor, class Alloc>
inline pair<typename BasicImage<PixelType, Alloc>::const_traverser, Accesso
r>
srcImage(BasicImage<PixelType, Alloc> const & img, Point2D const & ul, Acce
ssor a)
{
vigra_precondition(img.isInside(ul),
"srcImage(): ROI rectangle outside image.");
return pair<typename BasicImage<PixelType, Alloc>::const_traverser,
Accessor>(img.upperLeft() + ul, a);
}
template <class PixelType, class Accessor, class Alloc>
inline triple<typename BasicImage<PixelType, Alloc>::traverser, inline triple<typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::traverser, Accessor> typename BasicImage<PixelType, Alloc>::traverser, Accessor>
destImageRange(BasicImage<PixelType, Alloc> & img, Accessor a) destImageRange(BasicImage<PixelType, Alloc> & img, Accessor a)
{ {
return triple<typename BasicImage<PixelType, Alloc>::traverser, return triple<typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::traverser, typename BasicImage<PixelType, Alloc>::traverser,
Accessor>(img.upperLeft(), Accessor>(img.upperLeft(),
img.lowerRight(), img.lowerRight(),
a); a);
} }
template <class PixelType, class Accessor, class Alloc> template <class PixelType, class Accessor, class Alloc>
inline triple<typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::traverser, Accessor>
destImageRange(BasicImage<PixelType, Alloc> & img, Rect2D const & roi, Acce
ssor a)
{
vigra_precondition(roi.left() >= 0 && roi.top() >= 0 &&
roi.right() <= img.width() && roi.bottom() <= img.he
ight(),
"destImageRange(): ROI rectangle outside image.");
return triple<typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::traverser,
Accessor>(img.upperLeft() + roi.upperLeft(),
img.upperLeft() + roi.lowerRight(),
a);
}
template <class PixelType, class Accessor, class Alloc>
inline pair<typename BasicImage<PixelType, Alloc>::traverser, Accessor> inline pair<typename BasicImage<PixelType, Alloc>::traverser, Accessor>
destImage(BasicImage<PixelType, Alloc> & img, Accessor a) destImage(BasicImage<PixelType, Alloc> & img, Accessor a)
{ {
return pair<typename BasicImage<PixelType, Alloc>::traverser, return pair<typename BasicImage<PixelType, Alloc>::traverser,
Accessor>(img.upperLeft(), a); Accessor>(img.upperLeft(), a);
} }
template <class PixelType, class Accessor, class Alloc> template <class PixelType, class Accessor, class Alloc>
inline pair<typename BasicImage<PixelType, Alloc>::traverser, Accessor>
destImage(BasicImage<PixelType, Alloc> & img, Point2D const & ul, Accessor
a)
{
vigra_precondition(img.isInside(ul),
"destImage(): ROI rectangle outside image.");
return pair<typename BasicImage<PixelType, Alloc>::traverser,
Accessor>(img.upperLeft() + ul, a);
}
template <class PixelType, class Accessor, class Alloc>
inline pair<typename BasicImage<PixelType, Alloc>::const_traverser, Accesso r> inline pair<typename BasicImage<PixelType, Alloc>::const_traverser, Accesso r>
maskImage(BasicImage<PixelType, Alloc> const & img, Accessor a) maskImage(BasicImage<PixelType, Alloc> const & img, Accessor a)
{ {
return pair<typename BasicImage<PixelType, Alloc>::const_traverser, return pair<typename BasicImage<PixelType, Alloc>::const_traverser,
Accessor>(img.upperLeft(), a); Accessor>(img.upperLeft(), a);
} }
template <class PixelType, class Accessor, class Alloc>
inline pair<typename BasicImage<PixelType, Alloc>::const_traverser, Accesso
r>
maskImage(BasicImage<PixelType, Alloc> const & img, Point2D const & ul, Acc
essor a)
{
vigra_precondition(img.isInside(ul),
"maskImage(): ROI rectangle outside image.");
return pair<typename BasicImage<PixelType, Alloc>::const_traverser,
Accessor>(img.upperLeft() + ul, a);
}
/****************************************************************/ /****************************************************************/
template <class PixelType, class Alloc> template <class PixelType, class Alloc>
inline triple<typename BasicImage<PixelType, Alloc>::const_traverser, inline triple<typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::const_traverser, typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::ConstAccessor> typename BasicImage<PixelType, Alloc>::ConstAccessor>
srcImageRange(BasicImage<PixelType, Alloc> const & img) srcImageRange(BasicImage<PixelType, Alloc> const & img)
{ {
return triple<typename BasicImage<PixelType, Alloc>::const_traverser, return triple<typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::const_traverser, typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::ConstAccessor>(img .upperLeft(), typename BasicImage<PixelType, Alloc>::ConstAccessor>(img .upperLeft(),
img.lowerR img
ight(), .lowerRight(),
img.access img
or()); .accessor());
}
template <class PixelType, class Alloc>
inline triple<typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::ConstAccessor>
srcImageRange(BasicImage<PixelType, Alloc> const & img, Rect2D const & roi)
{
vigra_precondition(roi.left() >= 0 && roi.top() >= 0 &&
roi.right() <= img.width() && roi.bottom() <= img.he
ight(),
"srcImageRange(): ROI rectangle outside image.");
return triple<typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::ConstAccessor>(img
.upperLeft() + roi.upperLeft(),
img
.upperLeft() + roi.lowerRight(),
img
.accessor());
} }
template <class PixelType, class Alloc> template <class PixelType, class Alloc>
inline pair< typename BasicImage<PixelType, Alloc>::const_traverser, inline pair< typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::ConstAccessor> typename BasicImage<PixelType, Alloc>::ConstAccessor>
srcImage(BasicImage<PixelType, Alloc> const & img) srcImage(BasicImage<PixelType, Alloc> const & img)
{ {
return pair<typename BasicImage<PixelType, Alloc>::const_traverser, return pair<typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::ConstAccessor>(img.u pperLeft(), typename BasicImage<PixelType, Alloc>::ConstAccessor>(img.u pperLeft(),
img.accessor img.a
()); ccessor());
}
template <class PixelType, class Alloc>
inline pair< typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::ConstAccessor>
srcImage(BasicImage<PixelType, Alloc> const & img, Point2D const & ul)
{
vigra_precondition(img.isInside(ul),
"srcImage(): ROI rectangle outside image.");
return pair<typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::ConstAccessor>(img.u
pperLeft() + ul,
img.a
ccessor());
} }
template <class PixelType, class Alloc> template <class PixelType, class Alloc>
inline triple< typename BasicImage<PixelType, Alloc>::traverser, inline triple< typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::traverser, typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::Accessor> typename BasicImage<PixelType, Alloc>::Accessor>
destImageRange(BasicImage<PixelType, Alloc> & img) destImageRange(BasicImage<PixelType, Alloc> & img)
{ {
return triple<typename BasicImage<PixelType, Alloc>::traverser, return triple<typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::traverser, typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::Accessor>(img.uppe rLeft(), typename BasicImage<PixelType, Alloc>::Accessor>(img.uppe rLeft(),
img.lowerRight( img.lowe
), rRight(),
img.accessor()) img.acce
; ssor());
}
template <class PixelType, class Alloc>
inline triple< typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::Accessor>
destImageRange(BasicImage<PixelType, Alloc> & img, Rect2D const & roi)
{
vigra_precondition(roi.left() >= 0 && roi.top() >= 0 &&
roi.right() <= img.width() && roi.bottom() <= img.he
ight(),
"destImageRange(): ROI rectangle outside image.");
return triple<typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::Accessor>(img.uppe
rLeft() + roi.upperLeft(),
img.uppe
rLeft() + roi.lowerRight(),
img.acce
ssor());
} }
template <class PixelType, class Alloc> template <class PixelType, class Alloc>
inline pair< typename BasicImage<PixelType, Alloc>::traverser, inline pair< typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::Accessor> typename BasicImage<PixelType, Alloc>::Accessor>
destImage(BasicImage<PixelType, Alloc> & img) destImage(BasicImage<PixelType, Alloc> & img)
{ {
return pair<typename BasicImage<PixelType, Alloc>::traverser, return pair<typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::Accessor>(img.upperL eft(), typename BasicImage<PixelType, Alloc>::Accessor>(img.upperL eft(),
img.accessor()); img.accessor());
} }
template <class PixelType, class Alloc> template <class PixelType, class Alloc>
inline pair< typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::Accessor>
destImage(BasicImage<PixelType, Alloc> & img, Point2D const & ul)
{
vigra_precondition(img.isInside(ul),
"destImage(): ROI rectangle outside image.");
return pair<typename BasicImage<PixelType, Alloc>::traverser,
typename BasicImage<PixelType, Alloc>::Accessor>(img.upperL
eft() + ul,
img.access
or());
}
template <class PixelType, class Alloc>
inline pair< typename BasicImage<PixelType, Alloc>::const_traverser, inline pair< typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::ConstAccessor> typename BasicImage<PixelType, Alloc>::ConstAccessor>
maskImage(BasicImage<PixelType, Alloc> const & img) maskImage(BasicImage<PixelType, Alloc> const & img)
{ {
return pair<typename BasicImage<PixelType, Alloc>::const_traverser, return pair<typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::ConstAccessor>(img.u pperLeft(), typename BasicImage<PixelType, Alloc>::ConstAccessor>(img.u pperLeft(),
img.accessor img.a
()); ccessor());
}
template <class PixelType, class Alloc>
inline pair< typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::ConstAccessor>
maskImage(BasicImage<PixelType, Alloc> const & img, Point2D const & ul)
{
vigra_precondition(img.isInside(ul),
"maskImage(): ROI rectangle outside image.");
return pair<typename BasicImage<PixelType, Alloc>::const_traverser,
typename BasicImage<PixelType, Alloc>::ConstAccessor>(img.u
pperLeft() + ul,
img.a
ccessor());
} }
} // namespace vigra } // namespace vigra
#endif // VIGRA_BASICIMAGE_HXX #endif // VIGRA_BASICIMAGE_HXX
 End of changes. 17 change blocks. 
17 lines changed or deleted 189 lines changed or added


 basicimageview.hxx   basicimageview.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_BASICIMAGEVIEW_HXX #ifndef VIGRA_BASICIMAGEVIEW_HXX
#define VIGRA_BASICIMAGEVIEW_HXX #define VIGRA_BASICIMAGEVIEW_HXX
#include "vigra/imageiterator.hxx" #include "imageiterator.hxx"
#include "vigra/initimage.hxx" #include "initimage.hxx"
namespace vigra { namespace vigra {
/********************************************************/ /********************************************************/
/* */ /* */
/* BasicImageView */ /* BasicImageView */
/* */ /* */
/********************************************************/ /********************************************************/
/** \brief BasicImage using foreign memory. /** \brief BasicImage using foreign memory.
skipping to change at line 470 skipping to change at line 470
srcImageRange(BasicImageView<PixelType> const & img, Accessor a) srcImageRange(BasicImageView<PixelType> const & img, Accessor a)
{ {
return triple<typename BasicImageView<PixelType>::const_traverser, return triple<typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::const_traverser, typename BasicImageView<PixelType>::const_traverser,
Accessor>(img.upperLeft(), Accessor>(img.upperLeft(),
img.lowerRight(), img.lowerRight(),
a); a);
} }
template <class PixelType, class Accessor> template <class PixelType, class Accessor>
inline triple<typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::const_traverser, Accessor
>
srcImageRange(BasicImageView<PixelType> const & img, Rect2D const & roi, Ac
cessor a)
{
vigra_precondition(roi.left() >= 0 && roi.top() >= 0 &&
roi.right() <= img.width() && roi.bottom() <= img.he
ight(),
"srcImageRange(): ROI rectangle outside image.");
return triple<typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::const_traverser,
Accessor>(img.upperLeft() + roi.upperLeft(),
img.upperLeft() + roi.lowerRight(),
a);
}
template <class PixelType, class Accessor>
inline pair<typename BasicImageView<PixelType>::const_traverser, Accessor> inline pair<typename BasicImageView<PixelType>::const_traverser, Accessor>
srcImage(BasicImageView<PixelType> const & img, Accessor a) srcImage(BasicImageView<PixelType> const & img, Accessor a)
{ {
return pair<typename BasicImageView<PixelType>::const_traverser, return pair<typename BasicImageView<PixelType>::const_traverser,
Accessor>(img.upperLeft(), a); Accessor>(img.upperLeft(), a);
} }
template <class PixelType, class Accessor> template <class PixelType, class Accessor>
inline pair<typename BasicImageView<PixelType>::const_traverser, Accessor>
srcImage(BasicImageView<PixelType> const & img, Point2D const & ul, Accesso
r a)
{
vigra_precondition(img.isInside(ul),
"srcImage(): ROI rectangle outside image.");
return pair<typename BasicImageView<PixelType>::const_traverser,
Accessor>(img.upperLeft() + ul, a);
}
template <class PixelType, class Accessor>
inline triple<typename BasicImageView<PixelType>::traverser, inline triple<typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::traverser, Accessor> typename BasicImageView<PixelType>::traverser, Accessor>
destImageRange(BasicImageView<PixelType> & img, Accessor a) destImageRange(BasicImageView<PixelType> & img, Accessor a)
{ {
return triple<typename BasicImageView<PixelType>::traverser, return triple<typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::traverser, typename BasicImageView<PixelType>::traverser,
Accessor>(img.upperLeft(), Accessor>(img.upperLeft(),
img.lowerRight(), img.lowerRight(),
a); a);
} }
template <class PixelType, class Accessor> template <class PixelType, class Accessor>
inline triple<typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::traverser, Accessor>
destImageRange(BasicImageView<PixelType> & img, Rect2D const & roi, Accesso
r a)
{
vigra_precondition(roi.left() >= 0 && roi.top() >= 0 &&
roi.right() <= img.width() && roi.bottom() <= img.he
ight(),
"destImageRange(): ROI rectangle outside image.");
return triple<typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::traverser,
Accessor>(img.upperLeft() + roi.upperLeft(),
img.upperLeft() + roi.lowerRight(),
a);
}
template <class PixelType, class Accessor>
inline pair<typename BasicImageView<PixelType>::traverser, Accessor> inline pair<typename BasicImageView<PixelType>::traverser, Accessor>
destImage(BasicImageView<PixelType> & img, Accessor a) destImage(BasicImageView<PixelType> & img, Accessor a)
{ {
return pair<typename BasicImageView<PixelType>::traverser, return pair<typename BasicImageView<PixelType>::traverser,
Accessor>(img.upperLeft(), a); Accessor>(img.upperLeft(), a);
} }
template <class PixelType, class Accessor> template <class PixelType, class Accessor>
inline pair<typename BasicImageView<PixelType>::traverser, Accessor>
destImage(BasicImageView<PixelType> & img, Point2D const & ul, Accessor a)
{
vigra_precondition(img.isInside(ul),
"destImage(): ROI rectangle outside image.");
return pair<typename BasicImageView<PixelType>::traverser,
Accessor>(img.upperLeft() + ul, a);
}
template <class PixelType, class Accessor>
inline pair<typename BasicImageView<PixelType>::const_traverser, Accessor> inline pair<typename BasicImageView<PixelType>::const_traverser, Accessor>
maskImage(BasicImageView<PixelType> const & img, Accessor a) maskImage(BasicImageView<PixelType> const & img, Accessor a)
{ {
return pair<typename BasicImageView<PixelType>::const_traverser, return pair<typename BasicImageView<PixelType>::const_traverser,
Accessor>(img.upperLeft(), a); Accessor>(img.upperLeft(), a);
} }
template <class PixelType, class Accessor>
inline pair<typename BasicImageView<PixelType>::const_traverser, Accessor>
maskImage(BasicImageView<PixelType> const & img, Point2D const & ul, Access
or a)
{
vigra_precondition(img.isInside(ul),
"maskImage(): ROI rectangle outside image.");
return pair<typename BasicImageView<PixelType>::const_traverser,
Accessor>(img.upperLeft() + ul, a);
}
/****************************************************************/ /****************************************************************/
template <class PixelType> template <class PixelType>
inline triple<typename BasicImageView<PixelType>::const_traverser, inline triple<typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::const_traverser, typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::ConstAccessor> typename BasicImageView<PixelType>::ConstAccessor>
srcImageRange(BasicImageView<PixelType> const & img) srcImageRange(BasicImageView<PixelType> const & img)
{ {
return triple<typename BasicImageView<PixelType>::const_traverser, return triple<typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::const_traverser, typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::ConstAccessor>(img.up perLeft(), typename BasicImageView<PixelType>::ConstAccessor>(img.up perLeft(),
img.lo img
werRight(), .lowerRight(),
img.ac img
cessor()); .accessor());
}
template <class PixelType>
inline triple<typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::ConstAccessor>
srcImageRange(BasicImageView<PixelType> const & img, Rect2D const & roi)
{
vigra_precondition(roi.left() >= 0 && roi.top() >= 0 &&
roi.right() <= img.width() && roi.bottom() <= img.he
ight(),
"srcImageRange(): ROI rectangle outside image.");
return triple<typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::ConstAccessor>(img.up
perLeft() + roi.upperLeft(),
img
.upperLeft() + roi.lowerRight(),
img
.accessor());
} }
template <class PixelType> template <class PixelType>
inline pair< typename BasicImageView<PixelType>::const_traverser, inline pair< typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::ConstAccessor> typename BasicImageView<PixelType>::ConstAccessor>
srcImage(BasicImageView<PixelType> const & img) srcImage(BasicImageView<PixelType> const & img)
{ {
return pair<typename BasicImageView<PixelType>::const_traverser, return pair<typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::ConstAccessor>(img.uppe rLeft(), typename BasicImageView<PixelType>::ConstAccessor>(img.uppe rLeft(),
img.acce img.a
ssor()); ccessor());
}
template <class PixelType>
inline pair< typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::ConstAccessor>
srcImage(BasicImageView<PixelType> const & img, Point2D const & ul)
{
vigra_precondition(img.isInside(ul),
"srcImage(): ROI rectangle outside image.");
return pair<typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::ConstAccessor>(img.uppe
rLeft() + ul,
img.a
ccessor());
} }
template <class PixelType> template <class PixelType>
inline triple< typename BasicImageView<PixelType>::traverser, inline triple< typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::traverser, typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::Accessor> typename BasicImageView<PixelType>::Accessor>
destImageRange(BasicImageView<PixelType> & img) destImageRange(BasicImageView<PixelType> & img)
{ {
return triple<typename BasicImageView<PixelType>::traverser, return triple<typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::traverser, typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::Accessor>(img.upperLe ft(), typename BasicImageView<PixelType>::Accessor>(img.upperLe ft(),
img.lowerRi img.lowe
ght(), rRight(),
img.accesso img.acce
r()); ssor());
}
template <class PixelType>
inline triple< typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::Accessor>
destImageRange(BasicImageView<PixelType> & img, Rect2D const & roi)
{
vigra_precondition(roi.left() >= 0 && roi.top() >= 0 &&
roi.right() <= img.width() && roi.bottom() <= img.he
ight(),
"destImageRange(): ROI rectangle outside image.");
return triple<typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::Accessor>(img.upperLe
ft() + roi.upperLeft(),
img.uppe
rLeft() + roi.lowerRight(),
img.acce
ssor());
} }
template <class PixelType> template <class PixelType>
inline pair< typename BasicImageView<PixelType>::traverser, inline pair< typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::Accessor> typename BasicImageView<PixelType>::Accessor>
destImage(BasicImageView<PixelType> & img) destImage(BasicImageView<PixelType> & img)
{ {
return pair<typename BasicImageView<PixelType>::traverser, return pair<typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::Accessor>(img.upperLeft (), typename BasicImageView<PixelType>::Accessor>(img.upperLeft (),
img.accessor( img.accessor());
)); }
template <class PixelType>
inline pair< typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::Accessor>
destImage(BasicImageView<PixelType> & img, Point2D const & ul)
{
vigra_precondition(img.isInside(ul),
"destImage(): ROI rectangle outside image.");
return pair<typename BasicImageView<PixelType>::traverser,
typename BasicImageView<PixelType>::Accessor>(img.upperLeft
() + ul,
img.access
or());
} }
template <class PixelType> template <class PixelType>
inline pair< typename BasicImageView<PixelType>::const_traverser, inline pair< typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::ConstAccessor> typename BasicImageView<PixelType>::ConstAccessor>
maskImage(BasicImageView<PixelType> const & img) maskImage(BasicImageView<PixelType> const & img)
{ {
return pair<typename BasicImageView<PixelType>::const_traverser, return pair<typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::ConstAccessor>(img.uppe rLeft(), typename BasicImageView<PixelType>::ConstAccessor>(img.uppe rLeft(),
img.acce img.a
ssor()); ccessor());
}
template <class PixelType>
inline pair< typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::ConstAccessor>
maskImage(BasicImageView<PixelType> const & img, Point2D const & ul)
{
vigra_precondition(img.isInside(ul),
"maskImage(): ROI rectangle outside image.");
return pair<typename BasicImageView<PixelType>::const_traverser,
typename BasicImageView<PixelType>::ConstAccessor>(img.uppe
rLeft() + ul,
img.a
ccessor());
} }
} // namespace vigra } // namespace vigra
#endif /* VIGRA_BASICIMAGEVIEW_HXX */ #endif /* VIGRA_BASICIMAGEVIEW_HXX */
 End of changes. 12 change blocks. 
17 lines changed or deleted 165 lines changed or added


 bordertreatment.hxx   bordertreatment.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 boundarytensor.hxx   boundarytensor.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2004 by Ullrich Koethe */ /* Copyright 1998-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_BOUNDARYTENSOR_HXX #ifndef VIGRA_BOUNDARYTENSOR_HXX
#define VIGRA_BOUNDARYTENSOR_HXX #define VIGRA_BOUNDARYTENSOR_HXX
#include <cmath> #include <cmath>
#include <functional> #include <functional>
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/array_vector.hxx" #include "array_vector.hxx"
#include "vigra/basicimage.hxx" #include "basicimage.hxx"
#include "vigra/combineimages.hxx" #include "combineimages.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/convolution.hxx" #include "convolution.hxx"
namespace vigra { namespace vigra {
namespace detail { namespace detail {
/***********************************************************************/ /***********************************************************************/
typedef ArrayVector<Kernel1D<double> > KernelArray; typedef ArrayVector<Kernel1D<double> > KernelArray;
void void
skipping to change at line 184 skipping to change at line 184
double sigma22 = -0.5 / std_dev / std_dev; double sigma22 = -0.5 / std_dev / std_dev;
double f = 1.0 / VIGRA_CSTD::sqrt(2.0 * M_PI) / std_dev; // norm double f = 1.0 / VIGRA_CSTD::sqrt(2.0 * M_PI) / std_dev; // norm
double a = 0.883887052922 / VIGRA_CSTD::pow(std_dev, 5); double a = 0.883887052922 / VIGRA_CSTD::pow(std_dev, 5);
for(unsigned int i=0; i<k.size(); ++i) for(unsigned int i=0; i<k.size(); ++i)
{ {
k[i].initExplicitly(-radius, radius); k[i].initExplicitly(-radius, radius);
k[i].setBorderTreatment(BORDER_TREATMENT_REFLECT); k[i].setBorderTreatment(BORDER_TREATMENT_REFLECT);
} }
double b = -1.3786348292 / VIGRA_CSTD::pow(std_dev, 3); //double b = -1.3786348292 / VIGRA_CSTD::pow(std_dev, 3);
int ix; int ix;
iterator c = k[0].center(); iterator c = k[0].center();
for(ix=-radius; ix<=radius; ++ix) for(ix=-radius; ix<=radius; ++ix)
{ {
double x = (double)ix; double x = (double)ix;
c[ix] = f * VIGRA_CSTD::exp(sigma22 * x * x); c[ix] = f * VIGRA_CSTD::exp(sigma22 * x * x);
} }
c = k[1].center(); c = k[1].center();
skipping to change at line 541 skipping to change at line 541
/* */ /* */
/* boundaryTensor */ /* boundaryTensor */
/* */ /* */
/********************************************************/ /********************************************************/
/** \brief Calculate the boundary tensor for a scalar valued image. /** \brief Calculate the boundary tensor for a scalar valued image.
These functions calculates a spatial domain approximation of These functions calculates a spatial domain approximation of
the boundary tensor as described in the boundary tensor as described in
U. K U. K&ouml;the: <a href="http://kogs-www.informatik.uni-hamburg.de/~koet he/papers/abstracts/polarfilters.html">
<i>"Integrated Edge and Junction Detection with the Boundary Tensor"</i ></a>, <i>"Integrated Edge and Junction Detection with the Boundary Tensor"</i ></a>,
in: ICCV 03, Proc. of 9th Intl. Conf. on Computer Vision, Nice 2003, v ol. 1, in: ICCV 03, Proc. of 9th Intl. Conf. on Computer Vision, Nice 2003, v ol. 1,
pp. 424-431, Los Alamitos: IEEE Computer Society, 2003 pp. 424-431, Los Alamitos: IEEE Computer Society, 2003
with the Laplacian of Gaussian as the underlying bandpass filter (see with the Laplacian of Gaussian as the underlying bandpass filter (see
\ref rieszTransformOfLOG()). The output image must have 3 bands which w ill hold the \ref rieszTransformOfLOG()). The output image must have 3 bands which w ill hold the
tensor components in the order t11, t12 (== t21), t22. The function tensor components in the order t11, t12 (== t21), t22. The function
\ref boundaryTensor1() with the same interface implements a variant of the \ref boundaryTensor1() with the same interface implements a variant of the
boundary tensor where the 0th-order Riesz transform has been dropped, s o that the boundary tensor where the 0th-order Riesz transform has been dropped, s o that the
tensor is no longer sensitive to blobs. tensor is no longer sensitive to blobs.
 End of changes. 4 change blocks. 
9 lines changed or deleted 9 lines changed or added


 codec.hxx   codec.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2001-2002 by Gunnar Kedenburg */ /* Copyright 2001-2002 by Gunnar Kedenburg */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 38 skipping to change at line 38
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
/* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */ /* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
/* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */ /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
/* Modifications by Pablo d'Angelo
* updated to vigra 1.4 by Douglas Wilkins
* as of 18 Febuary 2006:
* - Added UINT16 and UINT32 pixel types.
* - Added support for obtaining extra bands beyond RGB.
* - Added support for a position field that indicates the start of this
* image relative to some global origin.
* - Added support for x and y resolution fields.
* - Added support for ICC Profiles
*/
#ifndef VIGRA_CODEC_HXX #ifndef VIGRA_CODEC_HXX
#define VIGRA_CODEC_HXX #define VIGRA_CODEC_HXX
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "array_vector.hxx"
#include "config.hxx"
#include "diff2d.hxx"
#include "sized_int.hxx"
// possible pixel types: // possible pixel types:
// "undefined", "UINT8", "INT16", "INT32", "FLOAT", "DOUBLE" // "undefined", "UINT8", "UINT16", "INT16", "UINT32", "INT32", "FLOAT", "DO UBLE"
// possible compression types: // possible compression types:
// "undefined", "RLE", "LZW", "LOSSLESS", "JPEG" // "undefined", "RLE", "LZW", "LOSSLESS", "JPEG", "DEFLATE"
// possible file types: // possible file types:
// "undefined", "TIFF", "VIFF", "JPEG", "PNG", "PNM", "BMP", "SUN", "XPM" // "undefined", "TIFF", "VIFF", "JPEG", "PNG", "PNM", "BMP", "SUN", "XPM"
// possible name extensions: // possible name extensions:
// "undefined", "tif", "tiff", "jpg", "jpeg", "png", "pnm", "bmp", "sun", // "undefined", "tif", "tiff", "jpg", "jpeg", "png", "pnm", "bmp", "sun",
// "xpm" (also capital forms) // "xpm" (also capital forms)
namespace vigra namespace vigra
{ {
template <class T> template <class T>
struct TypeAsString struct TypeAsString
{ {
static std::string result() { return "undefined"; } static std::string result() { return "undefined"; }
}; };
template <> template <>
struct TypeAsString<unsigned char> struct TypeAsString<Int8>
{
static std::string result() { return "INT8"; }
};
template <>
struct TypeAsString<UInt8>
{ {
static std::string result() { return "UINT8"; } static std::string result() { return "UINT8"; }
}; };
template <> template <>
struct TypeAsString<short> struct TypeAsString<Int16>
{ {
static std::string result() { return "INT16"; } static std::string result() { return "INT16"; }
}; };
template <> template <>
struct TypeAsString<int> struct TypeAsString<UInt16>
{ {
static std::string result() { return "INT32"; } static std::string result() { return "UINT16"; }
}; };
template <> template <>
struct TypeAsString<long> struct TypeAsString<Int32>
{ {
static std::string result() { return "INT32"; } static std::string result() { return "INT32"; }
}; };
template <> template <>
struct TypeAsString<UInt32>
{
static std::string result() { return "UINT32"; }
};
template <>
struct TypeAsString<float> struct TypeAsString<float>
{ {
static std::string result() { return "FLOAT"; } static std::string result() { return "FLOAT"; }
}; };
template <> template <>
struct TypeAsString<double> struct TypeAsString<double>
{ {
static std::string result() { return "DOUBLE"; } static std::string result() { return "DOUBLE"; }
}; };
skipping to change at line 113 skipping to change at line 141
struct CodecDesc struct CodecDesc
{ {
std::string fileType; std::string fileType;
std::vector<std::string> pixelTypes; std::vector<std::string> pixelTypes;
std::vector<std::string> compressionTypes; std::vector<std::string> compressionTypes;
std::vector<std::vector<char> > magicStrings; std::vector<std::vector<char> > magicStrings;
std::vector<std::string> fileExtensions; std::vector<std::string> fileExtensions;
std::vector<int> bandNumbers; std::vector<int> bandNumbers;
}; };
// Decoder and Encoder are pure virtual types that define a common // Decoder and Encoder are virtual types that define a common
// interface for all image file formats impex supports. // interface for all image file formats impex supports.
struct Decoder struct Decoder
{ {
virtual ~Decoder() {}; virtual ~Decoder() {};
virtual void init( const std::string & ) = 0; virtual void init( const std::string & ) = 0;
virtual void close() = 0; virtual void close() = 0;
virtual void abort() = 0; virtual void abort() = 0;
virtual std::string getFileType() const = 0; virtual std::string getFileType() const = 0;
virtual std::string getPixelType() const = 0; virtual std::string getPixelType() const = 0;
virtual unsigned int getWidth() const = 0; virtual unsigned int getWidth() const = 0;
virtual unsigned int getHeight() const = 0; virtual unsigned int getHeight() const = 0;
virtual unsigned int getNumBands() const = 0; virtual unsigned int getNumBands() const = 0;
virtual unsigned int getNumExtraBands() const
{
return 0;
}
virtual vigra::Diff2D getPosition() const
{
return vigra::Diff2D();
}
virtual unsigned int getOffset() const = 0; virtual unsigned int getOffset() const = 0;
virtual const void * currentScanlineOfBand( unsigned int ) const = 0; virtual const void * currentScanlineOfBand( unsigned int ) const = 0;
virtual void nextScanline() = 0; virtual void nextScanline() = 0;
typedef ArrayVector<unsigned char> ICCProfile;
const ICCProfile & getICCProfile() const
{
return iccProfile_;
}
ICCProfile iccProfile_;
}; };
struct Encoder struct Encoder
{ {
virtual ~Encoder() {}; virtual ~Encoder() {};
virtual void init( const std::string & ) = 0; virtual void init( const std::string & ) = 0;
virtual void close() = 0; virtual void close() = 0;
virtual void abort() = 0; virtual void abort() = 0;
virtual std::string getFileType() const = 0; virtual std::string getFileType() const = 0;
virtual unsigned int getOffset() const = 0; virtual unsigned int getOffset() const = 0;
virtual void setWidth( unsigned int ) = 0; virtual void setWidth( unsigned int ) = 0;
virtual void setHeight( unsigned int ) = 0; virtual void setHeight( unsigned int ) = 0;
virtual void setNumBands( unsigned int ) = 0; virtual void setNumBands( unsigned int ) = 0;
virtual void setCompressionType( const std::string &, int = -1 ) = 0; virtual void setCompressionType( const std::string &, int = -1 ) = 0;
virtual void setPixelType( const std::string & ) = 0; virtual void setPixelType( const std::string & ) = 0;
virtual void finalizeSettings() = 0; virtual void finalizeSettings() = 0;
virtual void setPosition( const vigra::Diff2D & pos )
{
}
virtual void setXResolution( float xres )
{
}
virtual void setYResolution( float yres )
{
}
typedef ArrayVector<unsigned char> ICCProfile;
virtual void setICCProfile(const ICCProfile & /* data */)
{
}
virtual void * currentScanlineOfBand( unsigned int ) = 0; virtual void * currentScanlineOfBand( unsigned int ) = 0;
virtual void nextScanline() = 0; virtual void nextScanline() = 0;
struct TIFFNoLZWException {}; struct TIFFCompressionException {};
}; };
// codec factory for registration at the codec manager // codec factory for registration at the codec manager
struct CodecFactory struct CodecFactory
{ {
virtual CodecDesc getCodecDesc() const = 0; virtual CodecDesc getCodecDesc() const = 0;
virtual std::auto_ptr<Decoder> getDecoder() const = 0; virtual std::auto_ptr<Decoder> getDecoder() const = 0;
virtual std::auto_ptr<Encoder> getEncoder() const = 0; virtual std::auto_ptr<Encoder> getEncoder() const = 0;
virtual ~CodecFactory() {};
}; };
// factory functions to encapsulate the codec managers // factory functions to encapsulate the codec managers
// //
// codecs are selected according to the following order: // codecs are selected according to the following order:
// - (if provided) the FileType // - (if provided) the FileType
// - (in case of decoders) the file's magic string // - (in case of decoders) the file's magic string
// - the filename extension // - the filename extension
std::auto_ptr<Decoder> VIGRA_EXPORT std::auto_ptr<Decoder>
getDecoder( const std::string &, const std::string & = "undefined" ); getDecoder( const std::string &, const std::string & = "undefined" );
std::auto_ptr<Encoder> VIGRA_EXPORT std::auto_ptr<Encoder>
getEncoder( const std::string &, const std::string & = "undefined" ); getEncoder( const std::string &, const std::string & = "undefined" );
// functions to query the capabilities of certain codecs // functions to query the capabilities of certain codecs
std::vector<std::string> queryCodecPixelTypes( const std::string & ); VIGRA_EXPORT std::vector<std::string> queryCodecPixelTypes( const std:: string & );
bool negotiatePixelType( std::string const & codecname, VIGRA_EXPORT bool negotiatePixelType( std::string const & codecname,
std::string const & srcPixeltype, std::string & destPixelt ype); std::string const & srcPixeltype, std::string & destPixelt ype);
bool isPixelTypeSupported( const std::string &, const std::string & ); VIGRA_EXPORT bool isPixelTypeSupported( const std::string &, const std: :string & );
bool isBandNumberSupported( const std::string &, int bands ); VIGRA_EXPORT bool isBandNumberSupported( const std::string &, int bands );
} }
#endif // VIGRA_CODEC_HXX #endif // VIGRA_CODEC_HXX
 End of changes. 23 change blocks. 
16 lines changed or deleted 80 lines changed or added


 colorconversions.hxx   colorconversions.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_COLORCONVERSIONS_HXX #ifndef VIGRA_COLORCONVERSIONS_HXX
#define VIGRA_COLORCONVERSIONS_HXX #define VIGRA_COLORCONVERSIONS_HXX
#include <cmath> #include <cmath>
#include "vigra/mathutil.hxx" #include "mathutil.hxx"
#include "vigra/rgbvalue.hxx" #include "rgbvalue.hxx"
#include "vigra/functortraits.hxx" #include "functortraits.hxx"
/** \page ColorConversions Color Space Conversions /** \page ColorConversions Color Space Conversions
Convert between RGB, R'G'B', XYZ, L*a*b*, L*u*v*, Y'PbPr, Y'CbCr, Y'IQ, and Y'UV color spaces. Convert between RGB, R'G'B', XYZ, L*a*b*, L*u*v*, Y'PbPr, Y'CbCr, Y'IQ, and Y'UV color spaces.
<b>\#include</b> "<a href="colorconversions_8hxx-source.html">vigra/col orconversions.hxx</a>"<br> <b>\#include</b> "<a href="colorconversions_8hxx-source.html">vigra/col orconversions.hxx</a>"<br>
Namespace: vigra Namespace: vigra
<UL> <UL>
<LI> <b>RGB/R'G'B'</b><br> <LI> <b>RGB/R'G'B'</b><br>
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 combineimages.hxx   combineimages.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_COMBINEIMAGES_HXX #ifndef VIGRA_COMBINEIMAGES_HXX
#define VIGRA_COMBINEIMAGES_HXX #define VIGRA_COMBINEIMAGES_HXX
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/functortraits.hxx" #include "functortraits.hxx"
#include <cmath> #include <cmath>
namespace vigra { namespace vigra {
/** \addtogroup CombineAlgo Algorithms to Combine Images /** \addtogroup CombineAlgo Algorithms to Combine Images
Apply functor to calculate a pixelwise transformation depending on mult iple images. Apply functor to calculate a pixelwise transformation depending on mult iple images.
Note that the binary functors of the STL may be used with these functio ns. Note that the binary functors of the STL may be used with these functio ns.
*/ */
//@{ //@{
skipping to change at line 565 skipping to change at line 565
/** the functor's first argument type /** the functor's first argument type
*/ */
typedef ValueType first_argument_type; typedef ValueType first_argument_type;
/** the functor's second argument type /** the functor's second argument type
*/ */
typedef ValueType second_argument_type; typedef ValueType second_argument_type;
/** the functor's result type /** the functor's result type
*/ */
typedef typename NumericTraits<ValueType>::RealPromote result_type; typedef typename SquareRootTraits<typename NormTraits<ValueType>::Squar edNormType>::SquareRootResult result_type;
/** \deprecated use first_argument_type, second_argument_type, resu lt_type /** \deprecated use first_argument_type, second_argument_type, resu lt_type
*/ */
typedef ValueType value_type; typedef ValueType value_type;
/** calculate transform '<TT>sqrt(v1*v1 + v2*v2)</TT>'. /** calculate transform '<TT>sqrt(squaredNorm(v1) + squaredNorm(v2) )</TT>'.
*/ */
result_type operator()(first_argument_type const & v1, second_argument_ type const & v2) const result_type operator()(first_argument_type const & v1, second_argument_ type const & v2) const
{ {
return VIGRA_CSTD::sqrt(v1*v1 + v2*v2); return VIGRA_CSTD::sqrt(squaredNorm(v1) + squaredNorm(v2));
} }
}; };
template <class T> template <class T>
class FunctorTraits<MagnitudeFunctor<T> > class FunctorTraits<MagnitudeFunctor<T> >
: public FunctorTraitsBase<MagnitudeFunctor<T> > : public FunctorTraitsBase<MagnitudeFunctor<T> >
{ {
public: public:
typedef VigraTrueType isBinaryFunctor; typedef VigraTrueType isBinaryFunctor;
}; };
 End of changes. 5 change blocks. 
7 lines changed or deleted 7 lines changed or added


 config.hxx   config.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 104 skipping to change at line 104
#endif // CMATH_NOT_IN_STD #endif // CMATH_NOT_IN_STD
inline double abs(double v) { return fabs(v); } inline double abs(double v) { return fabs(v); }
inline float abs(float v) { return fabs(v); } inline float abs(float v) { return fabs(v); }
#ifndef CMATH_NOT_IN_STD #ifndef CMATH_NOT_IN_STD
} }
#endif // CMATH_NOT_IN_STD #endif // CMATH_NOT_IN_STD
#endif // _MSC_EXTENSIONS #endif // _MSC_EXTENSIONS
#endif // _MSC_VER < 1310 #endif // _MSC_VER < 1310
#define VIGRA_NEED_BIN_STREAMS #define VIGRA_NEED_BIN_STREAMS
#ifdef VIGRA_DLL
#define VIGRA_EXPORT __declspec(dllexport)
#elif defined(VIGRA_STATIC_LIB)
#define VIGRA_EXPORT
#else
#define VIGRA_EXPORT __declspec(dllimport)
#endif
#endif // _MSC_VER #endif // _MSC_VER
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// // // //
// gcc // // gcc //
// // // //
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
#if defined(__GNUC__) #if defined(__GNUC__)
#if __GNUC__ < 2 || ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 8)) #if __GNUC__ < 2 || ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 8))
skipping to change at line 127 skipping to change at line 135
#endif // __GNUC__ #endif // __GNUC__
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// // // //
// MingW // // MingW //
// // // //
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
#if defined(__MINGW32__) #if defined(__MINGW32__)
#define VIGRA_NEED_BIN_STREAMS #define VIGRA_NEED_BIN_STREAMS
#ifdef VIGRA_DLL
#define VIGRA_EXPORT __declspec(dllexport)
#elif defined(VIGRA_STATIC_LIB)
#define VIGRA_EXPORT
#else
#define VIGRA_EXPORT __declspec(dllimport)
#endif
#endif // __MINGW32__ #endif // __MINGW32__
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// // // //
// SGI C++ 7.2 // // SGI C++ 7.2 //
// // // //
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
#if defined(__sgi) && !defined(__GNUC__) #if defined(__sgi) && !defined(__GNUC__)
#if _COMPILER_VERSION < 720 #if _COMPILER_VERSION < 720
skipping to change at line 153 skipping to change at line 169
typedef std::exception StdException; // must be above next #def ine !! typedef std::exception StdException; // must be above next #def ine !!
} }
#define std #define std
#define NO_NAMESPACE_STD #define NO_NAMESPACE_STD
#endif // _COMPILER_VERSION #endif // _COMPILER_VERSION
#define HAS_HASH_CONTAINERS #define HAS_HASH_CONTAINERS
#endif // __sgi #endif // __sgi
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// // // //
// Sun C++ ??? //
// //
///////////////////////////////////////////////////////////
#if defined(__sun) && !defined(__GNUC__)
#define VIGRA_HAS_ERF
#endif // __sun
///////////////////////////////////////////////////////////
// //
// general // // general //
// // // //
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
#ifdef CMATH_NOT_IN_STD #ifdef CMATH_NOT_IN_STD
#define VIGRA_CSTD #define VIGRA_CSTD
#else #else
#define VIGRA_CSTD std #define VIGRA_CSTD std
#endif #endif
#ifdef NO_TYPENAME #ifdef NO_TYPENAME
#define typename #define typename
#endif #endif
#ifdef NO_EXPLICIT #ifdef NO_EXPLICIT
#define explicit #define explicit
#endif #endif
#ifndef VIGRA_EXPORT
#define VIGRA_EXPORT
#endif
namespace vigra { namespace vigra {
#ifndef SPECIAL_STDEXCEPTION_DEFINITION_NEEDED #ifndef SPECIAL_STDEXCEPTION_DEFINITION_NEEDED
typedef std::exception StdException; typedef std::exception StdException;
#endif #endif
} // namespace vigra } // namespace vigra
#endif // VIGRA_CONFIG_HXX #endif // VIGRA_CONFIG_HXX
 End of changes. 5 change blocks. 
1 lines changed or deleted 31 lines changed or added


 contourcirculator.hxx   contourcirculator.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_CONTOURCIRCULATOR_HXX #ifndef VIGRA_CONTOURCIRCULATOR_HXX
#define VIGRA_CONTOURCIRCULATOR_HXX #define VIGRA_CONTOURCIRCULATOR_HXX
#include <vigra/pixelneighborhood.hxx> #include "pixelneighborhood.hxx"
namespace vigra namespace vigra
{ {
/** \addtogroup ImageIteratorAdapters /** \addtogroup ImageIteratorAdapters
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
/* */ /* */
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 convolution.hxx   convolution.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_CONVOLUTION_HXX #ifndef VIGRA_CONVOLUTION_HXX
#define VIGRA_CONVOLUTION_HXX #define VIGRA_CONVOLUTION_HXX
#include <functional> #include <functional>
#include "vigra/stdconvolution.hxx" #include "stdconvolution.hxx"
#include "vigra/separableconvolution.hxx" #include "separableconvolution.hxx"
#include "vigra/recursiveconvolution.hxx" #include "recursiveconvolution.hxx"
#include "vigra/nonlineardiffusion.hxx" #include "nonlineardiffusion.hxx"
#include "vigra/combineimages.hxx" #include "combineimages.hxx"
/** \page Convolution Functions to Convolve Images and Signals /** \page Convolution Functions to Convolve Images and Signals
1D and 2D filters, including separable and recursive convolution, and n on-linear diffusion 1D and 2D filters, including separable and recursive convolution, and n on-linear diffusion
<b>\#include</b> "<a href="convolution_8hxx-source.html">vigra/convolut ion.hxx</a>"<br> <b>\#include</b> "<a href="convolution_8hxx-source.html">vigra/convolut ion.hxx</a>"<br>
Namespace: vigra Namespace: vigra
<DL> <DL>
<DT> <DT>
skipping to change at line 493 skipping to change at line 493
double scale) double scale)
{ {
vigra_precondition(sharpening_factor >= 0.0, vigra_precondition(sharpening_factor >= 0.0,
"gaussianSharpening(): amount of sharpening must be >= 0"); "gaussianSharpening(): amount of sharpening must be >= 0");
vigra_precondition(scale >= 0.0, vigra_precondition(scale >= 0.0,
"gaussianSharpening(): scale parameter should be >= 0."); "gaussianSharpening(): scale parameter should be >= 0.");
typedef typename NumericTraits<typename SrcAccessor::value_type>::RealP romote ValueType; typedef typename NumericTraits<typename SrcAccessor::value_type>::RealP romote ValueType;
BasicImage<ValueType> tmp(src_lr - src_ul); BasicImage<ValueType> tmp(src_lr - src_ul);
typename BasicImage<ValueType>::Accessor tmp_acc(tmp.accessor());
gaussianSmoothing(src_ul, src_lr, src_acc, tmp.upperLeft(), tmp_acc, sc ale); gaussianSmoothing(src_ul, src_lr, src_acc, tmp.upperLeft(), tmp.accesso r(), scale);
SrcIterator i_src = src_ul; SrcIterator i_src = src_ul;
DestIterator i_dest = dest_ul; DestIterator i_dest = dest_ul;
typename BasicImage<ValueType>::traverser tmp_ul = tmp.upperLeft(); typename BasicImage<ValueType>::traverser tmp_ul = tmp.upperLeft();
typename BasicImage<ValueType>::traverser i_tmp = tmp_ul; typename BasicImage<ValueType>::traverser i_tmp = tmp_ul;
typename BasicImage<ValueType>::Accessor tmp_acc = tmp.accessor();
for(; i_src.y != src_lr.y ; i_src.y++, i_dest.y++, i_tmp.y++ ) for(; i_src.y != src_lr.y ; i_src.y++, i_dest.y++, i_tmp.y++ )
{ {
for (;i_src.x != src_lr.x ; i_src.x++, i_dest.x++, i_tmp.x++ ) for (;i_src.x != src_lr.x ; i_src.x++, i_dest.x++, i_tmp.x++ )
{ {
dest_acc.set((1.0 + sharpening_factor)*src_acc(i_src) - sharpen ing_factor*tmp_acc(i_tmp), i_dest); dest_acc.set((1.0 + sharpening_factor)*src_acc(i_src) - sharpen ing_factor*tmp_acc(i_tmp), i_dest);
} }
i_src.x = src_ul.x; i_src.x = src_ul.x;
i_dest.x = dest_ul.x; i_dest.x = dest_ul.x;
i_tmp.x = tmp_ul.x; i_tmp.x = tmp_ul.x;
skipping to change at line 755 skipping to change at line 755
class DestIterator, class DestAccessor> class DestIterator, class DestAccessor>
inline void inline void
gaussianGradient(triple<SrcIterator, SrcIterator, SrcAccessor> src, gaussianGradient(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest, pair<DestIterator, DestAccessor> dest,
double scale) double scale)
{ {
gaussianGradient(src.first, src.second, src.third, gaussianGradient(src.first, src.second, src.third,
dest.first, dest.second, scale); dest.first, dest.second, scale);
} }
/** \brief Calculate the gradient magnitude by means of a 1st derivatives o
f
Gaussian filter.
This function calls gaussianGradient() and returns the pixel-wise magni
tude of
the resulting gradient vectors. If the original image has multiple band
s,
the squared gradient magnitude is computed for each band separately, an
d the
return value is the square root of the sum of these sqaured magnitudes.
<b> Declarations:</b>
pass arguments explicitly:
\code
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void gaussianGradientMagnitude(SrcIterator sul,
SrcIterator slr, SrcAccessor src,
DestIterator dupperleft, DestAccesso
r dest,
double scale);
}
\endcode
use argument objects in conjunction with \ref ArgumentObjectFactories:
\code
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
gaussianGradientMagnitude(triple<SrcIterator, SrcIterator, SrcAcces
sor> src,
pair<DestIterator, DestAccessor> dest,
double scale);
}
\endcode
<b> Usage:</b>
<b>\#include</b> "<a href="convolution_8hxx-source.html">vigra/convolut
ion.hxx</a>"
\code
vigra::FImage src(w,h), grad(w,h);
...
// calculate gradient magnitude at scale = 3.0
vigra::gaussianGradientMagnitude(srcImageRange(src), destImage(grad), 3
.0);
\endcode
*/
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void gaussianGradientMagnitude(SrcIterator sul,
SrcIterator slr, SrcAccessor src,
DestIterator dupperleft, DestAccessor dest,
double scale)
{
typedef typename NumericTraits<typename SrcAccessor::value_type>::RealP
romote TmpType;
BasicImage<TmpType> gradx(slr-sul), grady(slr-sul);
gaussianGradient(srcIterRange(sul, slr, src),
destImage(gradx), destImage(grady), scale);
combineTwoImages(srcImageRange(gradx), srcImage(grady), destIter(dupper
left, dest),
MagnitudeFunctor<TmpType>());
}
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
inline void
gaussianGradientMagnitude(triple<SrcIterator, SrcIterator, SrcAccessor> src
,
pair<DestIterator, DestAccessor> dest,
double scale)
{
gaussianGradientMagnitude(src.first, src.second, src.third,
dest.first, dest.second, scale);
}
/********************************************************/ /********************************************************/
/* */ /* */
/* laplacianOfGaussian */ /* laplacianOfGaussian */
/* */ /* */
/********************************************************/ /********************************************************/
/** \brief Filter image with the Laplacian of Gaussian operator /** \brief Filter image with the Laplacian of Gaussian operator
at the given scale. at the given scale.
This function calls \link SeparableConvolution#separableConvolveX separ ableConvolveX\endlink() and This function calls \link SeparableConvolution#separableConvolveX separ ableConvolveX\endlink() and
 End of changes. 6 change blocks. 
8 lines changed or deleted 94 lines changed or added


 copyimage.hxx   copyimage.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_COPYIMAGE_HXX #ifndef VIGRA_COPYIMAGE_HXX
#define VIGRA_COPYIMAGE_HXX #define VIGRA_COPYIMAGE_HXX
#include "vigra/utilities.hxx" #include "utilities.hxx"
namespace vigra { namespace vigra {
/** \addtogroup CopyAlgo Algorithms to Copy Images /** \addtogroup CopyAlgo Algorithms to Copy Images
Copy images or regions Copy images or regions
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
/* */ /* */
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 cornerdetection.hxx   cornerdetection.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2004 by Ullrich Koethe */ /* Copyright 1998-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_CORNERDETECTION_HXX #ifndef VIGRA_CORNERDETECTION_HXX
#define VIGRA_CORNERDETECTION_HXX #define VIGRA_CORNERDETECTION_HXX
#include <vigra/utilities.hxx> #include "utilities.hxx"
#include <vigra/numerictraits.hxx> #include "numerictraits.hxx"
#include <vigra/stdimage.hxx> #include "stdimage.hxx"
#include <vigra/combineimages.hxx> #include "combineimages.hxx"
#include <vigra/convolution.hxx> #include "convolution.hxx"
#include <vigra/functortraits.hxx> #include "functortraits.hxx"
namespace vigra { namespace vigra {
template <class SrcType> template <class SrcType>
struct CornerResponseFunctor struct CornerResponseFunctor
{ {
typedef typename NumericTraits<SrcType>::RealPromote argument_type; typedef typename NumericTraits<SrcType>::RealPromote argument_type;
typedef argument_type result_type; typedef argument_type result_type;
result_type operator()(argument_type a1, result_type operator()(argument_type a1,
 End of changes. 2 change blocks. 
7 lines changed or deleted 7 lines changed or added


 diff2d.hxx   diff2d.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2003 by Hans Meine */ /* Copyright 1998-2003 by Hans Meine */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_DIFF2D_HXX #ifndef VIGRA_DIFF2D_HXX
#define VIGRA_DIFF2D_HXX #define VIGRA_DIFF2D_HXX
#include <cmath> // for sqrt() #include <cmath> // for sqrt()
#include <iosfwd> #include <iosfwd>
#include "vigra/config.hxx" #include "config.hxx"
#include "vigra/iteratortags.hxx" #include "iteratortags.hxx"
#include "vigra/iteratortraits.hxx" #include "iteratortraits.hxx"
#include "vigra/iteratoradapter.hxx" #include "iteratoradapter.hxx"
#include "vigra/tuple.hxx" #include "tuple.hxx"
namespace vigra { namespace vigra {
template <class Diff> template <class Diff>
class Diff2DConstRowIteratorPolicy class Diff2DConstRowIteratorPolicy
{ {
public: public:
typedef Diff BaseType; typedef Diff BaseType;
typedef Diff value_type; typedef Diff value_type;
typedef typename Diff::MoveX difference_type; typedef typename Diff::MoveX difference_type;
skipping to change at line 519 skipping to change at line 519
return x; return x;
} }
/** Query the height. /** Query the height.
*/ */
int height() const int height() const
{ {
return y; return y;
} }
/** Change the width.
*/
void setWidth(int w)
{
x = w;
}
/** Change the height.
*/
void setHeight(int h)
{
y = h;
}
/** Returns width()*height(), the area of a rectangle of this size. /** Returns width()*height(), the area of a rectangle of this size.
*/ */
int area() const int area() const
{ {
return width()*height(); return width()*height();
} }
/** Copy Assigment. /** Copy Assigment.
*/ */
Size2D & operator=(Diff2D const & v) Size2D & operator=(Diff2D const & v)
 End of changes. 3 change blocks. 
6 lines changed or deleted 20 lines changed or added


 distancetransform.hxx   distancetransform.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_DISTANCETRANSFORM_HXX #ifndef VIGRA_DISTANCETRANSFORM_HXX
#define VIGRA_DISTANCETRANSFORM_HXX #define VIGRA_DISTANCETRANSFORM_HXX
#include <cmath> #include <cmath>
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
namespace vigra { namespace vigra {
/* /*
* functors to determine the distance norm * functors to determine the distance norm
* these functors assume that dx and dy are positive * these functors assume that dx and dy are positive
* (this is OK for use in internalDistanceTransform()) * (this is OK for use in internalDistanceTransform())
*/ */
// chessboard metric // chessboard metric
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 edgedetection.hxx   edgedetection.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 44 skipping to change at line 44
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_EDGEDETECTION_HXX #ifndef VIGRA_EDGEDETECTION_HXX
#define VIGRA_EDGEDETECTION_HXX #define VIGRA_EDGEDETECTION_HXX
#include <vector> #include <vector>
#include <queue> #include <queue>
#include <cmath> // sqrt(), abs() #include <cmath> // sqrt(), abs()
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
#include "vigra/stdimagefunctions.hxx" #include "stdimagefunctions.hxx"
#include "vigra/recursiveconvolution.hxx" #include "recursiveconvolution.hxx"
#include "vigra/separableconvolution.hxx" #include "separableconvolution.hxx"
#include "vigra/labelimage.hxx" #include "labelimage.hxx"
#include "vigra/mathutil.hxx" #include "mathutil.hxx"
#include "vigra/pixelneighborhood.hxx" #include "pixelneighborhood.hxx"
#include "linear_solve.hxx"
namespace vigra { namespace vigra {
/** \addtogroup EdgeDetection Edge Detection /** \addtogroup EdgeDetection Edge Detection
Edge detectors based on first and second derivatives, Edge detectors based on first and second derivatives,
and related post-processing. and related post-processing.
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
skipping to change at line 1191 skipping to change at line 1192
Edgel() Edgel()
: x(0.0f), y(0.0f), strength(0.0f), orientation(0.0f) : x(0.0f), y(0.0f), strength(0.0f), orientation(0.0f)
{} {}
Edgel(float ix, float iy, float is, float io) Edgel(float ix, float iy, float is, float io)
: x(ix), y(iy), strength(is), orientation(io) : x(ix), y(iy), strength(is), orientation(io)
{} {}
}; };
template <class Image1, class Image2> template <class Image1, class Image2, class BackInsertable>
void internalCannyFindEdgels(Image1 const & dx, void internalCannyFindEdgels(Image1 const & gx,
Image1 const & dy, Image1 const & gy,
Image2 const & magnitude, Image2 const & magnitude,
std::vector<Edgel> & edgels) BackInsertable & edgels)
{ {
typedef typename Image1::value_type PixelType; typedef typename Image1::value_type PixelType;
double t = 0.5 / VIGRA_CSTD::sin(M_PI/8.0);
PixelType zero = NumericTraits<PixelType>::zero(); for(int y=1; y<gx.height()-1; ++y)
double tan22_5 = M_SQRT2 - 1.0;
for(int y=1; y<dx.height()-1; ++y)
{ {
for(int x=1; x<dx.width()-1; ++x) for(int x=1; x<gx.width()-1; ++x)
{ {
bool maximum_found = false; PixelType gradx = gx(x,y);
Edgel edgel; PixelType grady = gy(x,y);
double mag = magnitude(x, y);
PixelType gradx = dx(x,y);
PixelType grady = dy(x,y);
// find out quadrant
if(abs(grady) < tan22_5*abs(gradx))
{
// north-south edge
PixelType m1 = magnitude(x-1, y);
PixelType m2 = magnitude(x, y);
PixelType m3 = magnitude(x+1, y);
if(m1 < m2 && m3 <= m2)
{
edgel.y = y;
// local maximum => quadratic interpolation of sub-pixe
l location
PixelType del = (m1 - m3) / 2.0;
del /= (m1 + m3 - 2.0*m2);
edgel.x = x + del;
edgel.strength = m2;
maximum_found = true;
}
}
else if(abs(gradx) < tan22_5*abs(grady))
{
// west-east edge
PixelType m1 = magnitude(x, y-1);
PixelType m2 = magnitude(x, y);
PixelType m3 = magnitude(x, y+1);
if(m1 < m2 && m3 <= m2)
{
edgel.x = x;
// local maximum => quadratic interpolation of sub-pixe int dx = (int)VIGRA_CSTD::floor(gradx*t/mag + 0.5);
l location int dy = (int)VIGRA_CSTD::floor(grady*t/mag + 0.5);
PixelType del = (m1 - m3) / 2.0;
del /= (m1 + m3 - 2.0*m2);
edgel.y = y + del;
edgel.strength = m2;
maximum_found = true; int x1 = x - dx,
} x2 = x + dx,
} y1 = y - dy,
else if(gradx*grady < zero) y2 = y + dy;
{
// north-west-south-east edge
PixelType m1 = magnitude(x+1, y-1);
PixelType m2 = magnitude(x, y);
PixelType m3 = magnitude(x-1, y+1);
if(m1 < m2 && m3 <= m2) PixelType m1 = magnitude(x1, y1);
{ PixelType m3 = magnitude(x2, y2);
// local maximum => quadratic interpolation of sub-pixe
l location
PixelType del = (m1 - m3) / 2.0;
del /= (m1 + m3 - 2.0*m2);
edgel.x = x - del;
edgel.y = y + del;
edgel.strength = m2;
maximum_found = true; if(m1 < mag && m3 <= mag)
}
}
else
{ {
// north-east-south-west edge Edgel edgel;
PixelType m1 = magnitude(x-1, y-1);
PixelType m2 = magnitude(x, y);
PixelType m3 = magnitude(x+1, y+1);
if(m1 < m2 && m3 <= m2)
{
// local maximum => quadratic interpolation of sub-pixe
l location
PixelType del = (m1 - m3) / 2.0;
del /= (m1 + m3 - 2.0*m2);
edgel.x = x + del;
edgel.y = y + del;
edgel.strength = m2;
maximum_found = true;
}
}
if(maximum_found) // local maximum => quadratic interpolation of sub-pixel lo
{ cation
PixelType del = (m1 - m3) / 2.0 / (m1 + m3 - 2.0*mag);
edgel.x = x + dx*del;
edgel.y = y + dy*del;
edgel.strength = mag;
double orientation = VIGRA_CSTD::atan2(-grady, gradx) - M_P I * 1.5; double orientation = VIGRA_CSTD::atan2(-grady, gradx) - M_P I * 1.5;
if(orientation < 0.0) if(orientation < 0.0)
orientation += 2.0*M_PI; orientation += 2.0*M_PI;
edgel.orientation = orientation; edgel.orientation = orientation;
edgels.push_back(edgel); edgels.push_back(edgel);
} }
} }
} }
} }
skipping to change at line 1329 skipping to change at line 1264
edgel position is determined by fitting a parabola edgel position is determined by fitting a parabola
to the three gradient magnitude values to the three gradient magnitude values
mentioned above. The sub-pixel location of the parabola's tip mentioned above. The sub-pixel location of the parabola's tip
and the gradient magnitude and direction are written in the newly creat ed edgel. and the gradient magnitude and direction are written in the newly creat ed edgel.
<b> Declarations:</b> <b> Declarations:</b>
pass arguments explicitly: pass arguments explicitly:
\code \code
namespace vigra { namespace vigra {
template <class SrcIterator, class SrcAccessor> template <class SrcIterator, class SrcAccessor, class BackInsertabl e>
void cannyEdgelList(SrcIterator ul, SrcIterator lr, SrcAccessor src , void cannyEdgelList(SrcIterator ul, SrcIterator lr, SrcAccessor src ,
std::vector<Edgel> & edgels, double scale); BackInsertable & edgels, double scale);
} }
\endcode \endcode
use argument objects in conjunction with \ref ArgumentObjectFactories: use argument objects in conjunction with \ref ArgumentObjectFactories:
\code \code
namespace vigra { namespace vigra {
template <class SrcIterator, class SrcAccessor> template <class SrcIterator, class SrcAccessor, class BackInsertabl e>
void void
cannyEdgelList(triple<SrcIterator, SrcIterator, SrcAccessor> src, cannyEdgelList(triple<SrcIterator, SrcIterator, SrcAccessor> src,
std::vector<Edgel> & edgels, double scale); BackInsertable & edgels, double scale);
} }
\endcode \endcode
<b> Usage:</b> <b> Usage:</b>
<b>\#include</b> "<a href="edgedetection_8hxx-source.html">vigra/edgede tection.hxx</a>"<br> <b>\#include</b> "<a href="edgedetection_8hxx-source.html">vigra/edgede tection.hxx</a>"<br>
Namespace: vigra Namespace: vigra
\code \code
vigra::BImage src(w,h); vigra::BImage src(w,h);
skipping to change at line 1368 skipping to change at line 1303
vigra::cannyEdgelList(srcImageRange(src), edgels, 0.8); vigra::cannyEdgelList(srcImageRange(src), edgels, 0.8);
\endcode \endcode
<b> Required Interface:</b> <b> Required Interface:</b>
\code \code
SrcImageIterator src_upperleft; SrcImageIterator src_upperleft;
SrcAccessor src_accessor; SrcAccessor src_accessor;
src_accessor(src_upperleft); src_accessor(src_upperleft);
BackInsertable edgels;
edgels.push_back(Edgel());
\endcode \endcode
SrcAccessor::value_type must be a type convertible to float SrcAccessor::value_type must be a type convertible to float
<b> Preconditions:</b> <b> Preconditions:</b>
\code \code
scale > 0 scale > 0
\endcode \endcode
*/ */
template <class SrcIterator, class SrcAccessor> template <class SrcIterator, class SrcAccessor, class BackInsertable>
void cannyEdgelList(SrcIterator ul, SrcIterator lr, SrcAccessor src, void cannyEdgelList(SrcIterator ul, SrcIterator lr, SrcAccessor src,
std::vector<Edgel> & edgels, double scale) BackInsertable & edgels, double scale)
{ {
int w = lr.x - ul.x; int w = lr.x - ul.x;
int h = lr.y - ul.y; int h = lr.y - ul.y;
// calculate image gradients // calculate image gradients
typedef typename typedef typename
NumericTraits<typename SrcAccessor::value_type>::RealPromote NumericTraits<typename SrcAccessor::value_type>::RealPromote
TmpType; TmpType;
BasicImage<TmpType> tmp(w,h), dx(w,h), dy(w,h); BasicImage<TmpType> tmp(w,h), dx(w,h), dy(w,h);
skipping to change at line 1410 skipping to change at line 1348
separableConvolveY(srcIterRange(ul, lr, src), destImage(tmp), kernel1d( grad)); separableConvolveY(srcIterRange(ul, lr, src), destImage(tmp), kernel1d( grad));
separableConvolveX(srcImageRange(tmp), destImage(dy), kernel1d(smooth)) ; separableConvolveX(srcImageRange(tmp), destImage(dy), kernel1d(smooth)) ;
combineTwoImages(srcImageRange(dx), srcImage(dy), destImage(tmp), combineTwoImages(srcImageRange(dx), srcImage(dy), destImage(tmp),
MagnitudeFunctor<TmpType>()); MagnitudeFunctor<TmpType>());
// find edgels // find edgels
internalCannyFindEdgels(dx, dy, tmp, edgels); internalCannyFindEdgels(dx, dy, tmp, edgels);
} }
template <class SrcIterator, class SrcAccessor> template <class SrcIterator, class SrcAccessor, class BackInsertable>
inline void inline void
cannyEdgelList(triple<SrcIterator, SrcIterator, SrcAccessor> src, cannyEdgelList(triple<SrcIterator, SrcIterator, SrcAccessor> src,
std::vector<Edgel> & edgels, double scale) BackInsertable & edgels, double scale)
{ {
cannyEdgelList(src.first, src.second, src.third, edgels, scale); cannyEdgelList(src.first, src.second, src.third, edgels, scale);
} }
/********************************************************/ /********************************************************/
/* */ /* */
/* cannyEdgeImage */ /* cannyEdgeImage */
/* */ /* */
/********************************************************/ /********************************************************/
skipping to change at line 1563 skipping to change at line 1501
GradValue grad; GradValue grad;
SimplePoint(Diff2D const & p, GradValue g) SimplePoint(Diff2D const & p, GradValue g)
: point(p), grad(g) : point(p), grad(g)
{} {}
bool operator<(SimplePoint const & o) const bool operator<(SimplePoint const & o) const
{ {
return grad < o.grad; return grad < o.grad;
} }
bool operator>(SimplePoint const & o) const
{
return grad > o.grad;
}
}; };
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
void cannyEdgeImageFromGrad(
SrcIterator sul, SrcIterator slr, SrcAccessor grad,
DestIterator dul, DestAccessor da,
GradValue gradient_threshold, DestValue edge_marker)
{
typedef typename SrcAccessor::value_type PixelType;
typedef typename NormTraits<PixelType>::SquaredNormType NormType;
NormType zero = NumericTraits<NormType>::zero();
double tan22_5 = M_SQRT2 - 1.0;
typename NormTraits<GradValue>::SquaredNormType g2thresh = squaredNorm(
gradient_threshold);
int w = slr.x - sul.x;
int h = slr.y - sul.y;
sul += Diff2D(1,1);
dul += Diff2D(1,1);
Diff2D p(0,0);
for(int y = 1; y < h-1; ++y, ++sul.y, ++dul.y)
{
SrcIterator sx = sul;
DestIterator dx = dul;
for(int x = 1; x < w-1; ++x, ++sx.x, ++dx.x)
{
PixelType g = grad(sx);
NormType g2n = squaredNorm(g);
if(g2n < g2thresh)
continue;
NormType g2n1, g2n3;
// find out quadrant
if(abs(g[1]) < tan22_5*abs(g[0]))
{
// north-south edge
g2n1 = squaredNorm(grad(sx, Diff2D(-1, 0)));
g2n3 = squaredNorm(grad(sx, Diff2D(1, 0)));
}
else if(abs(g[0]) < tan22_5*abs(g[1]))
{
// west-east edge
g2n1 = squaredNorm(grad(sx, Diff2D(0, -1)));
g2n3 = squaredNorm(grad(sx, Diff2D(0, 1)));
}
else if(g[0]*g[1] < zero)
{
// north-west-south-east edge
g2n1 = squaredNorm(grad(sx, Diff2D(1, -1)));
g2n3 = squaredNorm(grad(sx, Diff2D(-1, 1)));
}
else
{
// north-east-south-west edge
g2n1 = squaredNorm(grad(sx, Diff2D(-1, -1)));
g2n3 = squaredNorm(grad(sx, Diff2D(1, 1)));
}
if(g2n1 < g2n && g2n3 <= g2n)
{
da.set(edge_marker, dx);
}
}
}
}
} // namespace detail } // namespace detail
/********************************************************/ /********************************************************/
/* */ /* */
/* cannyEdgeImageWithThinning */ /* cannyEdgeImageWithThinning */
/* */ /* */
/********************************************************/ /********************************************************/
/** \brief Detect and mark edges in an edge image using Canny's algorithm. /** \brief Detect and mark edges in an edge image using Canny's algorithm.
This operator first calls \ref cannyEdgeImage() to generate an The input pixels of this algorithms must be vectors of length 2 (see Re
edge image. The resulting edge pixels are then subjected to topological quired Interface below).
thinning It first searches for all pixels whose gradient magnitude is larger
than the given <tt>gradient_threshold</tt> and larger than the magnitud
e of its two neighbors
in gradient direction (where these neighbors are determined by nearest
neighbor
interpolation, i.e. according to the octant where the gradient points i
nto).
The resulting edge pixel candidates are then subjected to topological t
hinning
so that the remaining edge pixels can be linked into edgel chains with a provable, so that the remaining edge pixels can be linked into edgel chains with a provable,
non-heuristic algorithm. Optionally, the outermost pixels are marked as non-heuristic algorithm. Thinning is performed so that the pixels with
edge pixels highest gradient
as well when <tt>addBorder</tt> is true. magnitude survive. Optionally, the outermost pixels are marked as edge
pixels
as well when <tt>addBorder</tt> is true. The remaining pixels will be m
arked in the destination
image with the value of <tt>edge_marker</tt> (all non-edge pixels remai
n untouched).
<b> Declarations:</b> <b> Declarations:</b>
pass arguments explicitly: pass arguments explicitly:
\code \code
namespace vigra { namespace vigra {
template <class SrcIterator, class SrcAccessor, template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor, class DestIterator, class DestAccessor,
class GradValue, class DestValue> class GradValue, class DestValue>
void cannyEdgeImageWithThinning( void cannyEdgeImageFromGradWithThinning(
SrcIterator sul, SrcIterator slr, SrcAccessor sa, SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da, DestIterator dul, DestAccessor da,
double scale, GradValue gradient_threshold, GradValue gradient_threshold,
DestValue edge_marker, bool addBorder = true); DestValue edge_marker, bool addBorder = true);
} }
\endcode \endcode
use argument objects in conjunction with \ref ArgumentObjectFactories: use argument objects in conjunction with \ref ArgumentObjectFactories:
\code \code
namespace vigra { namespace vigra {
template <class SrcIterator, class SrcAccessor, template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor, class DestIterator, class DestAccessor,
class GradValue, class DestValue> class GradValue, class DestValue>
void cannyEdgeImageWithThinning( void cannyEdgeImageFromGradWithThinning(
triple<SrcIterator, SrcIterator, SrcAccessor> src, triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest, pair<DestIterator, DestAccessor> dest,
double scale, GradValue gradient_threshold, GradValue gradient_threshold,
DestValue edge_marker, bool addBorder = true); DestValue edge_marker, bool addBorder = true);
} }
\endcode \endcode
<b> Usage:</b> <b> Usage:</b>
<b>\#include</b> "<a href="edgedetection_8hxx-source.html">vigra/edgede tection.hxx</a>"<br> <b>\#include</b> "<a href="edgedetection_8hxx-source.html">vigra/edgede tection.hxx</a>"<br>
Namespace: vigra Namespace: vigra
\code \code
vigra::BImage src(w,h), edges(w,h); vigra::BImage src(w,h), edges(w,h);
vigra::FVector2Image grad(w,h);
// compute the image gradient at scale 0.8
vigra::gaussianGradient(srcImageRange(src), destImage(grad), 0.8);
// empty edge image // empty edge image
edges = 0; edges = 0;
... // find edges gradient larger than 4.0, mark with 1, and add border
vigra::cannyEdgeImageFromGradWithThinning(srcImageRange(grad), destImag
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1, e(edges),
annd add border 4.0, 1, true);
vigra::cannyEdgeImageWithThinning(srcImageRange(src), destImage(edges),
0.8, 4.0, 1, true);
\endcode \endcode
<b> Required Interface:</b> <b> Required Interface:</b>
see also: \ref cannyEdgelList().
\code \code
// the input pixel type must be a vector with two elements
SrcImageIterator src_upperleft;
SrcAccessor src_accessor;
typedef SrcAccessor::value_type SrcPixel;
typedef NormTraits<SrcPixel>::SquaredNormType SrcSquaredNormType;
SrcPixel g = src_accessor(src_upperleft);
SrcPixel::value_type g0 = g[0];
SrcSquaredNormType gn = squaredNorm(g);
DestImageIterator dest_upperleft; DestImageIterator dest_upperleft;
DestAccessor dest_accessor; DestAccessor dest_accessor;
DestValue edge_marker; DestValue edge_marker;
dest_accessor.set(edge_marker, dest_upperleft, vigra::Diff2D(1,1)); dest_accessor.set(edge_marker, dest_upperleft, vigra::Diff2D(1,1));
\endcode \endcode
<b> Preconditions:</b> <b> Preconditions:</b>
\code \code
scale > 0
gradient_threshold > 0 gradient_threshold > 0
\endcode \endcode
*/ */
template <class SrcIterator, class SrcAccessor, template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor, class DestIterator, class DestAccessor,
class GradValue, class DestValue> class GradValue, class DestValue>
void cannyEdgeImageWithThinning( void cannyEdgeImageFromGradWithThinning(
SrcIterator sul, SrcIterator slr, SrcAccessor sa, SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da, DestIterator dul, DestAccessor da,
double scale, GradValue gradient_threshold, GradValue gradient_threshold,
DestValue edge_marker, bool addBorder) DestValue edge_marker, bool addBorder)
{ {
int w = slr.x - sul.x; int w = slr.x - sul.x;
int h = slr.y - sul.y; int h = slr.y - sul.y;
BImage edgeImage(w, h, BImage::value_type(0)); BImage edgeImage(w, h, BImage::value_type(0));
BImage::traverser eul = edgeImage.upperLeft(); BImage::traverser eul = edgeImage.upperLeft();
BImage::Accessor ea = edgeImage.accessor(); BImage::Accessor ea = edgeImage.accessor();
if(addBorder) if(addBorder)
initImageBorder(destImageRange(edgeImage), 1, 1); initImageBorder(destImageRange(edgeImage), 1, 1);
cannyEdgeImage(sul, slr, sa, eul, ea, detail::cannyEdgeImageFromGrad(sul, slr, sa, eul, ea, gradient_threshol
scale, gradient_threshold, 1); d, 1);
static bool isSimplePoint[256] = { static bool isSimplePoint[256] = {
0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1,
0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0,
0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0,
1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1,
skipping to change at line 1690 skipping to change at line 1715
1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0,
0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1,
1, 0, 1, 0 }; 1, 0, 1, 0 };
eul += Diff2D(1,1); eul += Diff2D(1,1);
sul += Diff2D(1,1); sul += Diff2D(1,1);
int w2 = w-2; int w2 = w-2;
int h2 = h-2; int h2 = h-2;
typedef detail::SimplePoint<GradValue> SP; typedef detail::SimplePoint<GradValue> SP;
std::priority_queue<SP, std::vector<SP> > pqueue; // use std::greater becaus we need the smallest gradients at the top of
the queue
std::priority_queue<SP, std::vector<SP>, std::greater<SP> > pqueue;
Diff2D p(0,0); Diff2D p(0,0);
for(; p.y < h2; ++p.y) for(; p.y < h2; ++p.y)
{ {
for(p.x = 0; p.x < w2; ++p.x) for(p.x = 0; p.x < w2; ++p.x)
{ {
BImage::traverser e = eul + p; BImage::traverser e = eul + p;
if(*e == 0) if(*e == 0)
continue; continue;
int v = detail::neighborhoodConfiguration(e); int v = detail::neighborhoodConfiguration(e);
skipping to change at line 1750 skipping to change at line 1776
} }
} }
initImageIf(destIterRange(dul, dul+Diff2D(w,h), da), initImageIf(destIterRange(dul, dul+Diff2D(w,h), da),
maskImage(edgeImage), edge_marker); maskImage(edgeImage), edge_marker);
} }
template <class SrcIterator, class SrcAccessor, template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor, class DestIterator, class DestAccessor,
class GradValue, class DestValue> class GradValue, class DestValue>
inline void cannyEdgeImageFromGradWithThinning(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
GradValue gradient_threshold,
DestValue edge_marker, bool addBorder)
{
cannyEdgeImageFromGradWithThinning(src.first, src.second, src.third,
dest.first, dest.second,
gradient_threshold, edge_marker, addBorder);
}
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
inline void cannyEdgeImageFromGradWithThinning(
SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
GradValue gradient_threshold, DestValue edge_marker)
{
cannyEdgeImageFromGradWithThinning(sul, slr, sa,
dul, da,
gradient_threshold, edge_marker, true);
}
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
inline void cannyEdgeImageFromGradWithThinning(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
GradValue gradient_threshold, DestValue edge_marker)
{
cannyEdgeImageFromGradWithThinning(src.first, src.second, src.third,
dest.first, dest.second,
gradient_threshold, edge_marker, true);
}
/********************************************************/
/* */
/* cannyEdgeImageWithThinning */
/* */
/********************************************************/
/** \brief Detect and mark edges in an edge image using Canny's algorithm.
This operator first calls \ref gaussianGradient() to compute the gradie
nt of the input
image, ad then \ref cannyEdgeImageFromGradWithThinning() to generate an
edge image. See there for more detailed documentation.
<b> Declarations:</b>
pass arguments explicitly:
\code
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
void cannyEdgeImageWithThinning(
SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
double scale, GradValue gradient_threshold,
DestValue edge_marker, bool addBorder = true);
}
\endcode
use argument objects in conjunction with \ref ArgumentObjectFactories:
\code
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
void cannyEdgeImageWithThinning(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale, GradValue gradient_threshold,
DestValue edge_marker, bool addBorder = true);
}
\endcode
<b> Usage:</b>
<b>\#include</b> "<a href="edgedetection_8hxx-source.html">vigra/edgede
tection.hxx</a>"<br>
Namespace: vigra
\code
vigra::BImage src(w,h), edges(w,h);
// empty edge image
edges = 0;
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1,
annd add border
vigra::cannyEdgeImageWithThinning(srcImageRange(src), destImage(edges),
0.8, 4.0, 1, true);
\endcode
<b> Required Interface:</b>
see also: \ref cannyEdgelList().
\code
DestImageIterator dest_upperleft;
DestAccessor dest_accessor;
DestValue edge_marker;
dest_accessor.set(edge_marker, dest_upperleft, vigra::Diff2D(1,1));
\endcode
<b> Preconditions:</b>
\code
scale > 0
gradient_threshold > 0
\endcode
*/
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
void cannyEdgeImageWithThinning(
SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
double scale, GradValue gradient_threshold,
DestValue edge_marker, bool addBorder)
{
// mark pixels that are higher than their neighbors in gradient directi
on
typedef typename NumericTraits<typename SrcAccessor::value_type>::RealP
romote TmpType;
BasicImage<TinyVector<TmpType, 2> > grad(slr-sul);
gaussianGradient(srcIterRange(sul, slr, sa), destImage(grad), scale);
cannyEdgeImageFromGradWithThinning(srcImageRange(grad), destIter(dul, d
a),
gradient_threshold, edge_marker, addBorder);
}
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
inline void cannyEdgeImageWithThinning( inline void cannyEdgeImageWithThinning(
triple<SrcIterator, SrcIterator, SrcAccessor> src, triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest, pair<DestIterator, DestAccessor> dest,
double scale, GradValue gradient_threshold, double scale, GradValue gradient_threshold,
DestValue edge_marker, bool addBorder) DestValue edge_marker, bool addBorder)
{ {
cannyEdgeImageWithThinning(src.first, src.second, src.third, cannyEdgeImageWithThinning(src.first, src.second, src.third,
dest.first, dest.second, dest.first, dest.second,
scale, gradient_threshold, edge_marker, addB order); scale, gradient_threshold, edge_marker, addB order);
} }
skipping to change at line 1787 skipping to change at line 1948
inline void cannyEdgeImageWithThinning( inline void cannyEdgeImageWithThinning(
triple<SrcIterator, SrcIterator, SrcAccessor> src, triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest, pair<DestIterator, DestAccessor> dest,
double scale, GradValue gradient_threshold, DestValue edge_marke r) double scale, GradValue gradient_threshold, DestValue edge_marke r)
{ {
cannyEdgeImageWithThinning(src.first, src.second, src.third, cannyEdgeImageWithThinning(src.first, src.second, src.third,
dest.first, dest.second, dest.first, dest.second,
scale, gradient_threshold, edge_marker, true ); scale, gradient_threshold, edge_marker, true );
} }
/********************************************************/
template <class Image1, class Image2, class BackInsertable>
void internalCannyFindEdgels3x3(Image1 const & grad,
Image2 const & mask,
BackInsertable & edgels)
{
typedef typename Image1::value_type PixelType;
typedef typename PixelType::value_type ValueType;
for(int y=1; y<grad.height()-1; ++y)
{
for(int x=1; x<grad.width()-1; ++x)
{
if(!mask(x,y))
continue;
ValueType gradx = grad(x,y)[0];
ValueType grady = grad(x,y)[1];
double mag = hypot(gradx, grady),
c = gradx / mag,
s = grady / mag;
Matrix<double> ml(3,3), mr(3,1), l(3,1), r(3,1);
l(0,0) = 1.0;
for(int yy = -1; yy <= 1; ++yy)
{
for(int xx = -1; xx <= 1; ++xx)
{
double u = c*xx + s*yy;
double v = norm(grad(x+xx, y+yy));
l(1,0) = u;
l(2,0) = u*u;
ml += outer(l);
mr += v*l;
}
}
linearSolve(ml, mr, r);
Edgel edgel;
// local maximum => quadratic interpolation of sub-pixel locati
on
ValueType del = -r(1,0) / 2.0 / r(2,0);
edgel.x = x + c*del;
edgel.y = y + s*del;
edgel.strength = mag;
double orientation = VIGRA_CSTD::atan2(-grady, gradx) - M_PI *
1.5;
if(orientation < 0.0)
orientation += 2.0*M_PI;
edgel.orientation = orientation;
edgels.push_back(edgel);
}
}
}
/********************************************************/
/* */
/* cannyEdgelList3x3 */
/* */
/********************************************************/
/** \brief Improved implementation of Canny's edge detector.
This operator first computes pixels which are crossed by the edge using
cannyEdgeImageWithThinning(). The gradient magnitude in the 3x3 neighbo
rhood of these
pixels are then projected onto the normal of the edge (as determined
by the gradient direction). The edgel's subpixel location is found by f
itting a
parabola through the 9 gradient values and determining the parabola's t
ip.
A new \ref Edgel is appended to the given vector of <TT>edgels</TT>. Si
nce the parabola
is fitted to 9 points rather than 3 points as in cannyEdgelList(), the
accuracy is higher.
<b> Declarations:</b>
pass arguments explicitly:
\code
namespace vigra {
template <class SrcIterator, class SrcAccessor, class BackInsertabl
e>
void cannyEdgelList3x3(SrcIterator ul, SrcIterator lr, SrcAccessor
src,
BackInsertable & edgels, double scale);
}
\endcode
use argument objects in conjunction with \ref ArgumentObjectFactories:
\code
namespace vigra {
template <class SrcIterator, class SrcAccessor, class BackInsertabl
e>
void
cannyEdgelList3x3(triple<SrcIterator, SrcIterator, SrcAccessor> src
,
BackInsertable & edgels, double scale);
}
\endcode
<b> Usage:</b>
<b>\#include</b> "<a href="edgedetection_8hxx-source.html">vigra/edgede
tection.hxx</a>"<br>
Namespace: vigra
\code
vigra::BImage src(w,h);
// empty edgel list
std::vector<vigra::Edgel> edgels;
...
// find edgels at scale 0.8
vigra::cannyEdgelList3x3(srcImageRange(src), edgels, 0.8);
\endcode
<b> Required Interface:</b>
\code
SrcImageIterator src_upperleft;
SrcAccessor src_accessor;
src_accessor(src_upperleft);
BackInsertable edgels;
edgels.push_back(Edgel());
\endcode
SrcAccessor::value_type must be a type convertible to float
<b> Preconditions:</b>
\code
scale > 0
\endcode
*/
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void cannyEdgelList3x3(SrcIterator ul, SrcIterator lr, SrcAccessor src,
BackInsertable & edgels, double scale)
{
int w = lr.x - ul.x;
int h = lr.y - ul.y;
typedef typename NumericTraits<typename SrcAccessor::value_type>::RealP
romote TmpType;
BasicImage<TinyVector<TmpType, 2> > grad(lr-ul);
gaussianGradient(srcIterRange(ul, lr, src), destImage(grad), scale);
UInt8Image edges(lr-ul);
cannyEdgeImageFromGradWithThinning(srcImageRange(grad), destImage(edges
),
0.0, 1, false);
// find edgels
internalCannyFindEdgels3x3(grad, edges, edgels);
}
template <class SrcIterator, class SrcAccessor, class BackInsertable>
inline void
cannyEdgelList3x3(triple<SrcIterator, SrcIterator, SrcAccessor> src,
BackInsertable & edgels, double scale)
{
cannyEdgelList3x3(src.first, src.second, src.third, edgels, scale);
}
//@} //@}
/** \page CrackEdgeImage Crack Edge Image /** \page CrackEdgeImage Crack Edge Image
Crack edges are marked <i>between</i> the pixels of an image. Crack edges are marked <i>between</i> the pixels of an image.
A Crack Edge Image is an image that represents these edges. In order A Crack Edge Image is an image that represents these edges. In order
to accomodate the cracks, the Crack Edge Image must be twice as large to accomodate the cracks, the Crack Edge Image must be twice as large
as the original image (precisely (2*w - 1) by (2*h - 1)). A Crack Edge Imag e as the original image (precisely (2*w - 1) by (2*h - 1)). A Crack Edge Imag e
can easily be derived from a binary image or from the signs of the can easily be derived from a binary image or from the signs of the
response of a Laplacean filter. Consider the following sketch, where response of a Laplacean filter. Consider the following sketch, where
 End of changes. 42 change blocks. 
137 lines changed or deleted 482 lines changed or added


 eigensystem.hxx   eigensystem.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2004 by Ullrich Koethe */ /* Copyright 2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_EIGENSYSTEM_HXX #ifndef VIGRA_EIGENSYSTEM_HXX
#define VIGRA_EIGENSYSTEM_HXX #define VIGRA_EIGENSYSTEM_HXX
#include <algorithm> #include <algorithm>
#include <complex> #include <complex>
#include "vigra/matrix.hxx" #include "matrix.hxx"
#include "array_vector.hxx"
#include "polynomial.hxx"
namespace vigra namespace vigra
{ {
namespace linalg namespace linalg
{ {
namespace detail namespace detail
{ {
 End of changes. 2 change blocks. 
2 lines changed or deleted 4 lines changed or added


 error.hxx   error.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 44 skipping to change at line 44
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_ERROR_HXX #ifndef VIGRA_ERROR_HXX
#define VIGRA_ERROR_HXX #define VIGRA_ERROR_HXX
#include <stdexcept> #include <stdexcept>
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
#include "vigra/config.hxx" #include "config.hxx"
/*! \page ErrorReporting Error Reporting /*! \page ErrorReporting Error Reporting
Exceptions and assertions provided by VIGRA Exceptions and assertions provided by VIGRA
<b>\#include</b> "<a href="error_8hxx-source.html">vigra/error.hxx</a>" <b>\#include</b> "<a href="error_8hxx-source.html">vigra/error.hxx</a>"
VIGRA defines the following exception classes: VIGRA defines the following exception classes:
\code \code
namespace vigra { namespace vigra {
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 fftw.hxx   fftw.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_FFTW_HXX #ifndef VIGRA_FFTW_HXX
#define VIGRA_FFTW_HXX #define VIGRA_FFTW_HXX
#include <cmath> #include <cmath>
#include <functional> #include <functional>
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
#include "vigra/copyimage.hxx" #include "copyimage.hxx"
#include "vigra/transformimage.hxx" #include "transformimage.hxx"
#include "vigra/combineimages.hxx" #include "combineimages.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/imagecontainer.hxx" #include "imagecontainer.hxx"
#include <fftw.h> #include <fftw.h>
namespace vigra { namespace vigra {
/********************************************************/ /********************************************************/
/* */ /* */
/* FFTWComplex */ /* FFTWComplex */
/* */ /* */
/********************************************************/ /********************************************************/
 End of changes. 2 change blocks. 
7 lines changed or deleted 7 lines changed or added


 fftw3.hxx   fftw3.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2004 by Ullrich Koethe */ /* Copyright 1998-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_FFTW3_HXX #ifndef VIGRA_FFTW3_HXX
#define VIGRA_FFTW3_HXX #define VIGRA_FFTW3_HXX
#include <cmath> #include <cmath>
#include <functional> #include <functional>
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
#include "vigra/copyimage.hxx" #include "copyimage.hxx"
#include "vigra/transformimage.hxx" #include "transformimage.hxx"
#include "vigra/combineimages.hxx" #include "combineimages.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/imagecontainer.hxx" #include "imagecontainer.hxx"
#include <fftw3.h> #include <fftw3.h>
namespace vigra { namespace vigra {
typedef double fftw_real; typedef double fftw_real;
/********************************************************/ /********************************************************/
/* */ /* */
/* FFTWComplex */ /* FFTWComplex */
/* */ /* */
skipping to change at line 1132 skipping to change at line 1132
template <class SrcImageIterator, class SrcAccessor, template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor> class DestImageIterator, class DestAccessor>
inline void moveDCToUpperLeft( inline void moveDCToUpperLeft(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src, triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest) pair<DestImageIterator, DestAccessor> dest)
{ {
moveDCToUpperLeft(src.first, src.second, src.third, moveDCToUpperLeft(src.first, src.second, src.third,
dest.first, dest.second); dest.first, dest.second);
} }
namespace detail {
template <class T>
void
fourierTransformImpl(FFTWComplexImage::const_traverser sul,
FFTWComplexImage::const_traverser slr, FFTWComplexImag
e::ConstAccessor src,
FFTWComplexImage::traverser dul, FFTWComplexImage::Acc
essor dest, T sign)
{
int w = slr.x - sul.x;
int h = slr.y - sul.y;
FFTWComplexImage sworkImage, dworkImage;
fftw_complex * srcPtr = (fftw_complex *)(&*sul);
fftw_complex * destPtr = (fftw_complex *)(&*dul);
// test for right memory layout (fftw expects a 2*width*height floats a
rray)
if (&(*(sul + Diff2D(w, 0))) != &(*(sul + Diff2D(0, 1))))
{
sworkImage.resize(w, h);
copyImage(srcIterRange(sul, slr, src), destImage(sworkImage));
srcPtr = (fftw_complex *)(&(*sworkImage.upperLeft()));
}
if (&(*(dul + Diff2D(w, 0))) != &(*(dul + Diff2D(0, 1))))
{
dworkImage.resize(w, h);
destPtr = (fftw_complex *)(&(*dworkImage.upperLeft()));
}
fftw_plan plan = fftw_plan_dft_2d(h, w, srcPtr, destPtr, sign, FFTW_EST
IMATE );
fftw_execute(plan);
fftw_destroy_plan(plan);
if (&(*(dul + Diff2D(w, 0))) != &(*(dul + Diff2D(0, 1))))
{
copyImage(srcImageRange(dworkImage), destIter(dul, dest));
}
}
} // namespace detail
/********************************************************/
/* */
/* fourierTrasform */
/* */
/********************************************************/
/** \brief Compute forward and inverse Fourier transforms.
In the forward direction, the input image may be scalar or complex, and
the output image
is always complex. In the inverse direction, both input and output must
be complex.
<b> Declarations:</b>
pass arguments explicitly:
\code
namespace vigra {
template <class SrcImageIterator, class SrcAccessor>
void fourierTransform(SrcImageIterator srcUpperLeft,
SrcImageIterator srcLowerRight, SrcAccessor s
rc,
FFTWComplexImage::traverser destUpperLeft, FF
TWComplexImage::Accessor dest);
void
fourierTransformInverse(FFTWComplexImage::const_traverser sul,
FFTWComplexImage::const_traverser slr, FFTW
ComplexImage::ConstAccessor src,
FFTWComplexImage::traverser dul, FFTWComple
xImage::Accessor dest)
}
\endcode
use argument objects in conjunction with \ref ArgumentObjectFactories:
\code
namespace vigra {
template <class SrcImageIterator, class SrcAccessor>
void fourierTransform(triple<SrcImageIterator, SrcImageIterator, Sr
cAccessor> src,
pair<FFTWComplexImage::traverser, FFTWComplex
Image::Accessor> dest);
void
fourierTransformInverse(triple<FFTWComplexImage::const_traverser,
FFTWComplexImage::const_traverser, F
FTWComplexImage::ConstAccessor> src,
pair<FFTWComplexImage::traverser, FFTWCompl
exImage::Accessor> dest);
}
\endcode
<b> Usage:</b>
<b>\#include</b> "<a href="fftw3_8hxx-source.html">vigra/fftw3.hxx</a>"
<br>
Namespace: vigra
\code
// compute complex Fourier transform of a real image
vigra::DImage src(w, h);
vigra::FFTWComplexImage fourier(w, h);
fourierTransform(srcImageRange(src), destImage(fourier));
// compute inverse Fourier transform
// note that both source and destination image must be of type vigra::F
FTWComplexImage
vigra::FFTWComplexImage inverseFourier(w, h);
fourierTransform(srcImageRange(fourier), destImage(inverseFourier));
\endcode
*/
inline void
fourierTransform(FFTWComplexImage::const_traverser sul,
FFTWComplexImage::const_traverser slr, FFTWComplexImage::C
onstAccessor src,
FFTWComplexImage::traverser dul, FFTWComplexImage::Accesso
r dest)
{
detail::fourierTransformImpl(sul, slr, src, dul, dest, FFTW_FORWARD);
}
template <class SrcImageIterator, class SrcAccessor>
void fourierTransform(SrcImageIterator srcUpperLeft,
SrcImageIterator srcLowerRight, SrcAccessor sa,
FFTWComplexImage::traverser destUpperLeft, FFTWComple
xImage::Accessor da)
{
// copy real input images into a complex one...
int w= srcLowerRight.x - srcUpperLeft.x;
int h= srcLowerRight.y - srcUpperLeft.y;
FFTWComplexImage workImage(w, h);
copyImage(srcIterRange(srcUpperLeft, srcLowerRight, sa),
destImage(workImage, FFTWWriteRealAccessor()));
// ...and call the complex -> complex version of the algorithm
FFTWComplexImage const & cworkImage = workImage;
fourierTransform(cworkImage.upperLeft(), cworkImage.lowerRight(), cwork
Image.accessor(),
destUpperLeft, da);
}
template <class SrcImageIterator, class SrcAccessor>
inline
void fourierTransform(triple<SrcImageIterator, SrcImageIterator, SrcAccesso
r> src,
pair<FFTWComplexImage::traverser, FFTWComplexImage::A
ccessor> dest)
{
fourierTransform(src.first, src.second, src.third, dest.first, dest.sec
ond);
}
inline void
fourierTransformInverse(FFTWComplexImage::const_traverser sul,
FFTWComplexImage::const_traverser slr, FFTWComplexI
mage::ConstAccessor src,
FFTWComplexImage::traverser dul, FFTWComplexImage::
Accessor dest)
{
detail::fourierTransformImpl(sul, slr, src, dul, dest, FFTW_BACKWARD);
}
inline void
fourierTransformInverse(triple<FFTWComplexImage::const_traverser,
FFTWComplexImage::const_traverser, FFTWCompl
exImage::ConstAccessor> src,
pair<FFTWComplexImage::traverser, FFTWComplexImage:
:Accessor> dest)
{
fourierTransformInverse(src.first, src.second, src.third, dest.first, d
est.second);
}
/********************************************************/ /********************************************************/
/* */ /* */
/* applyFourierFilter */ /* applyFourierFilter */
/* */ /* */
/********************************************************/ /********************************************************/
/** \brief Apply a filter (defined in the frequency domain) to an image. /** \brief Apply a filter (defined in the frequency domain) to an image.
After transferring the image into the frequency domain, it is After transferring the image into the frequency domain, it is
multiplied pixel-wise with the filter and transformed back. The multiplied pixel-wise with the filter and transformed back. The
result is always put into the given FFTWComplexImage result is put into the given destination image which must have the righ
<TT>destImg</TT> which must have the right size. Finally, the t size.
result will be normalized to compensate for the two FFTs. The result will be normalized to compensate for the two FFTs.
The input and filter images can be scalar images (more precisely, If the destination image is scalar, only the real part of the result im
<TT>SrcAccessor::value_type</TT> must be scalar) or age is
FFTWComplexImages (in this case, one conversion is saved). retained. In this case, you are responsible for choosing a filter image
which ensures a zero imaginary part of the result (e.g. use a real, eve
n symmetric
filter image, or a purely imaginary, odd symmetric on).
The DC entry of the filter must be in the upper left, which is the The DC entry of the filter must be in the upper left, which is the
position where FFTW expects it (see \ref moveDCToUpperLeft()). position where FFTW expects it (see \ref moveDCToUpperLeft()).
You can optionally pass two fftwnd_plans as last parameters, the
forward plan and the in-place backward plan. Both must have been
created for the right image size (see sample code).
<b> Declarations:</b> <b> Declarations:</b>
pass arguments explicitly: pass arguments explicitly:
\code \code
namespace vigra { namespace vigra {
template <class SrcImageIterator, class SrcAccessor, template <class SrcImageIterator, class SrcAccessor,
class FilterImageIterator, class FilterAccessor> class FilterImageIterator, class FilterAccessor,
void applyFourierFilter(SrcImageIterator srcUpperLeft, class DestImageIterator, class DestAccessor>
SrcImageIterator srcLowerRight, SrcAccessor
sa,
FilterImageIterator filterUpperLeft, Filter
Accessor fa,
FFTWComplexImage & destImg)
template <class SrcImageIterator, class SrcAccessor,
class FilterImageIterator, class FilterAccessor>
void applyFourierFilter(SrcImageIterator srcUpperLeft, void applyFourierFilter(SrcImageIterator srcUpperLeft,
SrcImageIterator srcLowerRight, SrcAccessor sa, SrcImageIterator srcLowerRight, SrcAccessor sa,
FilterImageIterator filterUpperLeft, Filter Accessor fa, FilterImageIterator filterUpperLeft, Filter Accessor fa,
FFTWComplexImage & destImg, DestImageIterator destUpperLeft, DestAccess
const fftwnd_plan & forwardPlan, const fftw or da);
nd_plan & backwardPlan)
} }
\endcode \endcode
use argument objects in conjunction with \ref ArgumentObjectFactories: use argument objects in conjunction with \ref ArgumentObjectFactories:
\code \code
namespace vigra { namespace vigra {
template <class SrcImageIterator, class SrcAccessor, template <class SrcImageIterator, class SrcAccessor,
class FilterImageIterator, class FilterAccessor> class FilterImageIterator, class FilterAccessor,
inline class DestImageIterator, class DestAccessor>
void applyFourierFilter(triple<SrcImageIterator, SrcImageIterator,
SrcAccessor> src,
pair<FilterImageIterator, FilterAccessor> f
ilter,
FFTWComplexImage &destImg)
template <class SrcImageIterator, class SrcAccessor,
class FilterImageIterator, class FilterAccessor>
inline
void applyFourierFilter(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src, void applyFourierFilter(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<FilterImageIterator, FilterAccessor> f ilter, pair<FilterImageIterator, FilterAccessor> f ilter,
FFTWComplexImage &destImg, pair<DestImageIterator, DestAccessor> dest)
const fftwnd_plan &forwardPlan, const fftwn ;
d_plan &backwardPlan)
} }
\endcode \endcode
<b> Usage:</b> <b> Usage:</b>
<b>\#include</b> "<a href="fftw3_8hxx-source.html">vigra/fftw3.hxx</a>" <br> <b>\#include</b> "<a href="fftw3_8hxx-source.html">vigra/fftw3.hxx</a>" <br>
Namespace: vigra Namespace: vigra
\code \code
// create a Gaussian filter in Fourier space // create a Gaussian filter in Fourier space
skipping to change at line 1232 skipping to change at line 1366
\endcode \endcode
For inspection of the result, \ref FFTWMagnitudeAccessor might be For inspection of the result, \ref FFTWMagnitudeAccessor might be
useful. If you want to apply the same filter repeatedly, it may be more useful. If you want to apply the same filter repeatedly, it may be more
efficient to use the FFTW functions directly with FFTW plans optimized efficient to use the FFTW functions directly with FFTW plans optimized
for good performance. for good performance.
*/ */
template <class SrcImageIterator, class SrcAccessor, template <class SrcImageIterator, class SrcAccessor,
class FilterImageIterator, class FilterAccessor, class FilterImageIterator, class FilterAccessor,
class DestImageIterator, class DestAccessor> class DestImageIterator, class DestAccessor>
inline
void applyFourierFilter(triple<SrcImageIterator, SrcImageIterator, SrcAcces
sor> src,
pair<FilterImageIterator, FilterAccessor> filter,
pair<DestImageIterator, DestAccessor> dest)
{
applyFourierFilter(src.first, src.second, src.third,
filter.first, filter.second,
dest.first, dest.second);
}
template <class SrcImageIterator, class SrcAccessor,
class FilterImageIterator, class FilterAccessor,
class DestImageIterator, class DestAccessor>
void applyFourierFilter(SrcImageIterator srcUpperLeft, void applyFourierFilter(SrcImageIterator srcUpperLeft,
SrcImageIterator srcLowerRight, SrcAccessor sa, SrcImageIterator srcLowerRight, SrcAccessor sa,
FilterImageIterator filterUpperLeft, FilterAccessor fa, FilterImageIterator filterUpperLeft, FilterAccessor fa,
DestImageIterator destUpperLeft, DestAccessor da) DestImageIterator destUpperLeft, DestAccessor da)
{ {
// copy real input images into a complex one... // copy real input images into a complex one...
int w= srcLowerRight.x - srcUpperLeft.x; int w= srcLowerRight.x - srcUpperLeft.x;
int h= srcLowerRight.y - srcUpperLeft.y; int h= srcLowerRight.y - srcUpperLeft.y;
FFTWComplexImage workImage(w, h); FFTWComplexImage workImage(w, h);
skipping to change at line 1296 skipping to change at line 1417
copyImage(srcIterRange(srcUpperLeft, srcLowerRight, sa), copyImage(srcIterRange(srcUpperLeft, srcLowerRight, sa),
destImage(workImage)); destImage(workImage));
FFTWComplexImage const & cworkImage = workImage; FFTWComplexImage const & cworkImage = workImage;
applyFourierFilterImpl(cworkImage.upperLeft(), cworkImage.lowerRigh t(), cworkImage.accessor(), applyFourierFilterImpl(cworkImage.upperLeft(), cworkImage.lowerRigh t(), cworkImage.accessor(),
filterUpperLeft, fa, filterUpperLeft, fa,
destUpperLeft, da); destUpperLeft, da);
} }
} }
template <class SrcImageIterator, class SrcAccessor,
class FilterImageIterator, class FilterAccessor,
class DestImageIterator, class DestAccessor>
inline
void applyFourierFilter(triple<SrcImageIterator, SrcImageIterator, SrcAcces
sor> src,
pair<FilterImageIterator, FilterAccessor> filter,
pair<DestImageIterator, DestAccessor> dest)
{
applyFourierFilter(src.first, src.second, src.third,
filter.first, filter.second,
dest.first, dest.second);
}
template <class FilterImageIterator, class FilterAccessor, template <class FilterImageIterator, class FilterAccessor,
class DestImageIterator, class DestAccessor> class DestImageIterator, class DestAccessor>
void applyFourierFilterImpl( void applyFourierFilterImpl(
FFTWComplexImage::const_traverser srcUpperLeft, FFTWComplexImage::const_traverser srcUpperLeft,
FFTWComplexImage::const_traverser srcLowerRight, FFTWComplexImage::const_traverser srcLowerRight,
FFTWComplexImage::ConstAccessor sa, FFTWComplexImage::ConstAccessor sa,
FilterImageIterator filterUpperLeft, FilterAccessor fa, FilterImageIterator filterUpperLeft, FilterAccessor fa,
DestImageIterator destUpperLeft, DestAccessor da) DestImageIterator destUpperLeft, DestAccessor da)
{ {
int w = srcLowerRight.x - srcUpperLeft.x; int w = srcLowerRight.x - srcUpperLeft.x;
skipping to change at line 1661 skipping to change at line 1795
// forward cosine transform == reflective boundary conditions // forward cosine transform == reflective boundary conditions
fourierTransformRealEE(srcImageRange(spatial), destImage(fourier), (fft w_real)1.0); fourierTransformRealEE(srcImageRange(spatial), destImage(fourier), (fft w_real)1.0);
// multiply with a first derivative of Gaussian in x-direction // multiply with a first derivative of Gaussian in x-direction
for(int y = 0; y < height; ++y) for(int y = 0; y < height; ++y)
{ {
for(int x = 1; x < width; ++x) for(int x = 1; x < width; ++x)
{ {
double dx = x * M_PI / (width - 1); double dx = x * M_PI / (width - 1);
double dy = y * M_PI / (height - 1); double dy = y * M_PI / (height - 1);
fourier(x-1, y) = fourier(x, y) * dx * exp(-(dx*dx + dy*dy) * s cale*scale / 2.0); fourier(x-1, y) = fourier(x, y) * dx * std::exp(-(dx*dx + dy*dy ) * scale*scale / 2.0);
} }
fourier(width-1, y) = 0.0; fourier(width-1, y) = 0.0;
} }
// inverse transform -- odd symmetry in x-direction, even in y, // inverse transform -- odd symmetry in x-direction, even in y,
// due to symmetry of the filter // due to symmetry of the filter
fourierTransformRealOE(srcImageRange(fourier), destImage(spatial), fourierTransformRealOE(srcImageRange(fourier), destImage(spatial),
(fftw_real)-4.0 * (width+1) * (height-1)); (fftw_real)-4.0 * (width+1) * (height-1));
\endcode \endcode
*/ */
 End of changes. 13 change blocks. 
59 lines changed or deleted 220 lines changed or added


 fixedpoint.hxx   fixedpoint.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2004-2005 by Ullrich Koethe */ /* Copyright 2004-2005 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_FIXEDPOINT_HXX #ifndef VIGRA_FIXEDPOINT_HXX
#define VIGRA_FIXEDPOINT_HXX #define VIGRA_FIXEDPOINT_HXX
#include "vigra/mathutil.hxx" #include "mathutil.hxx"
#include "vigra/static_assert.hxx" #include "static_assert.hxx"
#include "vigra/error.hxx" #include "error.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
namespace vigra { namespace vigra {
template <unsigned IntBits, unsigned FractionalBits> template <unsigned IntBits, unsigned FractionalBits>
class FixedPoint; class FixedPoint;
struct Error_FixedPointTraits_not_specialized_for_this_case; struct Error_FixedPointTraits_not_specialized_for_this_case;
template <class T1, class T2> template <class T1, class T2>
class FixedPointTraits class FixedPointTraits
skipping to change at line 428 skipping to change at line 428
template <> \ template <> \
struct FixedPointCast<type> \ struct FixedPointCast<type> \
{ \ { \
template <unsigned IntBits, unsigned FracBits> \ template <unsigned IntBits, unsigned FracBits> \
static type cast(FixedPoint<IntBits, FracBits> v) \ static type cast(FixedPoint<IntBits, FracBits> v) \
{ \ { \
return round(v); \ return round(v); \
} \ } \
}; };
VIGRA_FIXED_POINT_CAST(Int8); VIGRA_FIXED_POINT_CAST(Int8)
VIGRA_FIXED_POINT_CAST(UInt8); VIGRA_FIXED_POINT_CAST(UInt8)
VIGRA_FIXED_POINT_CAST(Int16); VIGRA_FIXED_POINT_CAST(Int16)
VIGRA_FIXED_POINT_CAST(UInt16); VIGRA_FIXED_POINT_CAST(UInt16)
VIGRA_FIXED_POINT_CAST(Int32); VIGRA_FIXED_POINT_CAST(Int32)
VIGRA_FIXED_POINT_CAST(UInt32); VIGRA_FIXED_POINT_CAST(UInt32)
#undef VIGRA_FIXED_POINT_CAST #undef VIGRA_FIXED_POINT_CAST
template <> template <>
struct FixedPointCast<float> struct FixedPointCast<float>
{ {
template <unsigned IntBits, unsigned FracBits> template <unsigned IntBits, unsigned FracBits>
static float cast(FixedPoint<IntBits, FracBits> v) static float cast(FixedPoint<IntBits, FracBits> v)
{ {
return (float)v.value / FixedPoint<IntBits, FracBits>::ONE; return (float)v.value / FixedPoint<IntBits, FracBits>::ONE;
 End of changes. 3 change blocks. 
11 lines changed or deleted 11 lines changed or added


 flatmorphology.hxx   flatmorphology.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_FLATMORPHOLOGY_HXX #ifndef VIGRA_FLATMORPHOLOGY_HXX
#define VIGRA_FLATMORPHOLOGY_HXX #define VIGRA_FLATMORPHOLOGY_HXX
#include <cmath> #include <cmath>
#include <vector> #include <vector>
#include "vigra/utilities.hxx" #include "utilities.hxx"
namespace vigra { namespace vigra {
/** \addtogroup Morphology Basic Morphological Operations /** \addtogroup Morphology Basic Morphological Operations
Perform erosion, dilation, and median with disc structuring functions Perform erosion, dilation, and median with disc structuring functions
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
/* */ /* */
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 functorexpression.hxx   functorexpression.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 336 skipping to change at line 336
Further information about how this mechanism works can be found in Further information about how this mechanism works can be found in
<a href="documents/FunctorFactory.ps">this paper</a> (sorry, slightly o ut of date). <a href="documents/FunctorFactory.ps">this paper</a> (sorry, slightly o ut of date).
*/ */
#ifndef DOXYGEN #ifndef DOXYGEN
#if !defined(NO_PARTIAL_TEMPLATE_SPECIALIZATION) #if !defined(NO_PARTIAL_TEMPLATE_SPECIALIZATION)
#include <cmath> #include <cmath>
#include <vigra/numerictraits.hxx> #include "numerictraits.hxx"
#include <vigra/functortraits.hxx> #include "mathutil.hxx"
#include "functortraits.hxx"
namespace vigra { namespace vigra {
namespace functor { namespace functor {
/************************************************************/ /************************************************************/
/* */ /* */
/* unary functor base template */ /* unary functor base template */
/* */ /* */
/************************************************************/ /************************************************************/
skipping to change at line 1080 skipping to change at line 1081
UnaryFunctor<EXPR2>, UnaryFunctor<EXPR2>,
UnaryFunctor<EXPR3> > >(p); UnaryFunctor<EXPR3> > >(p);
} }
/************************************************************/ /************************************************************/
/* */ /* */
/* functors for unary functions */ /* functors for unary functions */
/* */ /* */
/************************************************************/ /************************************************************/
#define MAKE_FUNCTOR_UNARY_FUNCTION(function) \ #define MAKE_FUNCTOR_UNARY_FUNCTION(function, namespc) \
using std::function; \ using ::namespc::function; \
template <class EXPR> \ template <class EXPR> \
struct Functor_##function; \ struct Functor_##function; \
\ \
template <class EXPR> \ template <class EXPR> \
struct ResultTraits0<Functor_##function<EXPR> > \ struct ResultTraits0<Functor_##function<EXPR> > \
{ \ { \
typedef typename ResultTraits0<EXPR>::Res R1; \ typedef typename ResultTraits0<EXPR>::Res R1; \
typedef typename NumericTraits<R1>::RealPromote Res; \ typedef typename NumericTraits<R1>::RealPromote Res; \
}; \ }; \
\ \
skipping to change at line 1162 skipping to change at line 1163
template <class EXPR> \ template <class EXPR> \
UnaryFunctor<Functor_##function<UnaryFunctor<EXPR> > > \ UnaryFunctor<Functor_##function<UnaryFunctor<EXPR> > > \
function(UnaryFunctor<EXPR> const & e) \ function(UnaryFunctor<EXPR> const & e) \
{ \ { \
Functor_##function<UnaryFunctor<EXPR> > p(e); \ Functor_##function<UnaryFunctor<EXPR> > p(e); \
return UnaryFunctor<Functor_##function<UnaryFunctor<EXPR> > >(p); \ return UnaryFunctor<Functor_##function<UnaryFunctor<EXPR> > >(p); \
} }
/************************************************************/ /************************************************************/
MAKE_FUNCTOR_UNARY_FUNCTION(sqrt) MAKE_FUNCTOR_UNARY_FUNCTION(sqrt, std)
MAKE_FUNCTOR_UNARY_FUNCTION(exp) MAKE_FUNCTOR_UNARY_FUNCTION(exp, std)
MAKE_FUNCTOR_UNARY_FUNCTION(log) MAKE_FUNCTOR_UNARY_FUNCTION(log, std)
MAKE_FUNCTOR_UNARY_FUNCTION(log10) MAKE_FUNCTOR_UNARY_FUNCTION(log10, std)
MAKE_FUNCTOR_UNARY_FUNCTION(sin) MAKE_FUNCTOR_UNARY_FUNCTION(sin, std)
MAKE_FUNCTOR_UNARY_FUNCTION(asin) MAKE_FUNCTOR_UNARY_FUNCTION(asin, std)
MAKE_FUNCTOR_UNARY_FUNCTION(cos) MAKE_FUNCTOR_UNARY_FUNCTION(cos, std)
MAKE_FUNCTOR_UNARY_FUNCTION(acos) MAKE_FUNCTOR_UNARY_FUNCTION(acos, std)
MAKE_FUNCTOR_UNARY_FUNCTION(tan) MAKE_FUNCTOR_UNARY_FUNCTION(tan, std)
MAKE_FUNCTOR_UNARY_FUNCTION(atan) MAKE_FUNCTOR_UNARY_FUNCTION(atan, std)
MAKE_FUNCTOR_UNARY_FUNCTION(abs) MAKE_FUNCTOR_UNARY_FUNCTION(floor, std)
MAKE_FUNCTOR_UNARY_FUNCTION(floor) MAKE_FUNCTOR_UNARY_FUNCTION(ceil, std)
MAKE_FUNCTOR_UNARY_FUNCTION(ceil) MAKE_FUNCTOR_UNARY_FUNCTION(abs, vigra)
//MAKE_FUNCTOR_UNARY_FUNCTION(norm, vigra)
//MAKE_FUNCTOR_UNARY_FUNCTION(squaredNorm, vigra)
#undef MAKE_FUNCTOR_UNARY_FUNCTION #undef MAKE_FUNCTOR_UNARY_FUNCTION
/************************************************************/ /************************************************************/
/* */ /* */
/* functors for unary operators */ /* functors for unary operators */
/* */ /* */
/************************************************************/ /************************************************************/
#define MAKE_FUNCTOR_UNARY_OPERATOR(name, op) \ #define MAKE_FUNCTOR_UNARY_OPERATOR(name, op) \
skipping to change at line 1970 skipping to change at line 1973
UnaryAnalyser<EXPR2> const & e2) UnaryAnalyser<EXPR2> const & e2)
{ {
CommaAnalyser<UnaryAnalyser<EXPR1>, CommaAnalyser<UnaryAnalyser<EXPR1>,
UnaryAnalyser<EXPR2> > p(e1, e2); UnaryAnalyser<EXPR2> > p(e1, e2);
return UnaryAnalyser<CommaAnalyser<UnaryAnalyser<EXPR1>, return UnaryAnalyser<CommaAnalyser<UnaryAnalyser<EXPR1>,
UnaryAnalyser<EXPR2> > >(p); UnaryAnalyser<EXPR2> > >(p);
} }
} // namespace functor } // namespace functor
#if defined(__GNUC__) && __GNUC__ < 3
using functor::Arg1;
using functor::Arg2;
using functor::Arg3;
using functor::Param;
#endif
template <class T> template <class T>
class FunctorTraits<functor::UnaryFunctor<T> > class FunctorTraits<functor::UnaryFunctor<T> >
: public FunctorTraitsBase<functor::UnaryFunctor<T> > : public FunctorTraitsBase<functor::UnaryFunctor<T> >
{ {
public: public:
typedef VigraTrueType isInitializer; typedef VigraTrueType isInitializer;
typedef VigraTrueType isUnaryFunctor; typedef VigraTrueType isUnaryFunctor;
typedef VigraTrueType isBinaryFunctor; typedef VigraTrueType isBinaryFunctor;
typedef VigraTrueType isTernaryFunctor; typedef VigraTrueType isTernaryFunctor;
}; };
 End of changes. 5 change blocks. 
18 lines changed or deleted 28 lines changed or added


 functortraits.hxx   functortraits.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2005 by Ullrich Koethe */ /* Copyright 1998-2005 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_FUNCTORTRAITS_HXX #ifndef VIGRA_FUNCTORTRAITS_HXX
#define VIGRA_FUNCTORTRAITS_HXX #define VIGRA_FUNCTORTRAITS_HXX
#include <functional> #include <functional>
#include <vigra/metaprogramming.hxx> #include "metaprogramming.hxx"
namespace vigra { namespace vigra {
template <class T> template <class T>
class FunctorTraitsBase class FunctorTraitsBase
{ {
public: public:
typedef T type; typedef T type;
typedef VigraFalseType isInitializer; typedef VigraFalseType isInitializer;
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 gaborfilter.hxx   gaborfilter.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2002-2004 by Ullrich Koethe and Hans Meine */ /* Copyright 2002-2004 by Ullrich Koethe and Hans Meine */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_GABORFILTER_HXX #ifndef VIGRA_GABORFILTER_HXX
#define VIGRA_GABORFILTER_HXX #define VIGRA_GABORFILTER_HXX
#include "vigra/imagecontainer.hxx" #include "imagecontainer.hxx"
#include "vigra/config.hxx" #include "config.hxx"
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
#include "vigra/copyimage.hxx" #include "copyimage.hxx"
#include "vigra/transformimage.hxx" #include "transformimage.hxx"
#include "vigra/combineimages.hxx" #include "combineimages.hxx"
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include <functional> #include <functional>
#include <vector> #include <vector>
#include <cmath> #include <cmath>
namespace vigra { namespace vigra {
/** \addtogroup GaborFilter Gabor Filter /** \addtogroup GaborFilter Gabor Filter
Functions to create or apply gabor filter (latter based on FFTW). Functions to create or apply gabor filter (latter based on FFTW).
*/ */
 End of changes. 2 change blocks. 
8 lines changed or deleted 8 lines changed or added


 gaussians.hxx   gaussians.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2004 by Ullrich Koethe */ /* Copyright 1998-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_GAUSSIANS_HXX #ifndef VIGRA_GAUSSIANS_HXX
#define VIGRA_GAUSSIANS_HXX #define VIGRA_GAUSSIANS_HXX
#include <cmath> #include <cmath>
#include "vigra/config.hxx" #include "config.hxx"
#include "vigra/mathutil.hxx" #include "mathutil.hxx"
#include "vigra/array_vector.hxx" #include "array_vector.hxx"
#include "vigra/error.hxx" #include "error.hxx"
namespace vigra { namespace vigra {
#if 0 #if 0
/** \addtogroup MathFunctions Mathematical Functions /** \addtogroup MathFunctions Mathematical Functions
*/ */
//@{ //@{
#endif #endif
/*! The Gaussian function and its derivatives. /*! The Gaussian function and its derivatives.
 End of changes. 2 change blocks. 
5 lines changed or deleted 5 lines changed or added


 gradient_energy_tensor.hxx   gradient_energy_tensor.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2004-2005 by Ullrich Koethe */ /* Copyright 2004-2005 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_GRADIENT_ENERGY_TENSOR_HXX #ifndef VIGRA_GRADIENT_ENERGY_TENSOR_HXX
#define VIGRA_GRADIENT_ENERGY_TENSOR_HXX #define VIGRA_GRADIENT_ENERGY_TENSOR_HXX
#include <cmath> #include <cmath>
#include <functional> #include <functional>
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/array_vector.hxx" #include "array_vector.hxx"
#include "vigra/basicimage.hxx" #include "basicimage.hxx"
#include "vigra/combineimages.hxx" #include "combineimages.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/convolution.hxx" #include "convolution.hxx"
namespace vigra { namespace vigra {
/** \addtogroup TensorImaging Tensor Image Processing /** \addtogroup TensorImaging Tensor Image Processing
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
/* */ /* */
/* gradientEnergyTensor */ /* gradientEnergyTensor */
 End of changes. 2 change blocks. 
7 lines changed or deleted 7 lines changed or added


 imagecontainer.hxx   imagecontainer.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_IMAGECONTAINER_HXX #ifndef VIGRA_IMAGECONTAINER_HXX
#define VIGRA_IMAGECONTAINER_HXX #define VIGRA_IMAGECONTAINER_HXX
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/array_vector.hxx" #include "array_vector.hxx"
namespace vigra { namespace vigra {
/** \addtogroup ImageContainers Image Containers /** \addtogroup ImageContainers Image Containers
Classes to manage multiple images (ImageArray..) Classes to manage multiple images (ImageArray..)
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
/* */ /* */
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added


 imageinfo.hxx   imageinfo.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2001 by Ullrich Koethe */ /* Copyright 1998-2001 by Ullrich Koethe */
/* Copyright 2001-2002 by Gunnar Kedenburg */ /* Copyright 2001-2002 by Gunnar Kedenburg */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 39 skipping to change at line 39
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
/* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */ /* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
/* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */ /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
/* Modifications by Pablo d'Angelo
* updated to vigra 1.4 by Douglas Wilkins
* as of 18 Febuary 2006:
* - Added UINT16 and UINT32 pixel types.
* - Added support for obtaining extra bands beyond RGB.
* - Added support for a position field that indicates the start of this
* image relative to some global origin.
* - Added support for x and y resolution fields.
* - Added support for ICC profiles
*/
#ifndef VIGRA_IMAGEINFO_HXX #ifndef VIGRA_IMAGEINFO_HXX
#define VIGRA_IMAGEINFO_HXX #define VIGRA_IMAGEINFO_HXX
#include <memory> #include <memory>
#include <string> #include <string>
#include "vigra/utilities.hxx" #include "config.hxx"
#include "vigra/codec.hxx" #include "error.hxx"
#include "diff2d.hxx"
#include "codec.hxx"
#include "array_vector.hxx"
namespace vigra namespace vigra
{ {
/** \addtogroup VigraImpex Image Import/Export Facilities /** \addtogroup VigraImpex Image Import/Export Facilities
supports GIF, TIFF, JPEG, BMP, PNM (PBM, PGM, PPM), PNG, SunRaster, KHO ROS-VIFF formats supports GIF, TIFF, JPEG, BMP, PNM (PBM, PGM, PPM), PNG, SunRaster, KHO ROS-VIFF formats
**/ **/
//@{ //@{
/** \brief List the image formats VIGRA can read and write. /** \brief List the image formats VIGRA can read and write.
skipping to change at line 70 skipping to change at line 84
<b> Usage:</b> <b> Usage:</b>
<b>\#include</b> "<a href="imageinfo_8hxx-source.html">vigra/imagei nfo.hxx</a>"<br> <b>\#include</b> "<a href="imageinfo_8hxx-source.html">vigra/imagei nfo.hxx</a>"<br>
Namespace: vigra Namespace: vigra
\code \code
std::cout << "supported formats: " << vigra::impexListFormats() << std::endl; std::cout << "supported formats: " << vigra::impexListFormats() << std::endl;
\endcode \endcode
**/ **/
std::string impexListFormats(); VIGRA_EXPORT std::string impexListFormats();
/** \brief List the file extension VIGRA understands. /** \brief List the file extension VIGRA understands.
This is useful for creating file dialogs that only list image files This is useful for creating file dialogs that only list image files
VIGRA can actually import. VIGRA can actually import.
<b> Usage:</b> <b> Usage:</b>
<b>\#include</b> "<a href="imageinfo_8hxx-source.html">vigra/imagei nfo.hxx</a>"<br> <b>\#include</b> "<a href="imageinfo_8hxx-source.html">vigra/imagei nfo.hxx</a>"<br>
Namespace: vigra Namespace: vigra
\code \code
std::cout << "supported extensions: " << vigra::impexListExtensions () << std::endl; std::cout << "supported extensions: " << vigra::impexListExtensions () << std::endl;
\endcode \endcode
**/ **/
std::string impexListExtensions(); VIGRA_EXPORT std::string impexListExtensions();
/** \brief Test whether a file is an image format known to VIGRA. /** \brief Test whether a file is an image format known to VIGRA.
This checks the first few bytes of the file and compares them with the This checks the first few bytes of the file and compares them with the
"magic strings" of each recognized image format. "magic strings" of each recognized image format.
<b> Usage:</b> <b> Usage:</b>
<b>\#include</b> "<a href="imageinfo_8hxx-source.html">vigra/imageinfo. hxx</a>"<br> <b>\#include</b> "<a href="imageinfo_8hxx-source.html">vigra/imageinfo. hxx</a>"<br>
Namespace: vigra Namespace: vigra
\code \code
std::cout << "is image: " << vigra::isImage("foo.bmp") << std::endl; std::cout << "is image: " << vigra::isImage("foo.bmp") << std::endl;
\endcode \endcode
**/ **/
bool isImage(char const * filename); VIGRA_EXPORT bool isImage(char const * filename);
/********************************************************/ /********************************************************/
/* */ /* */
/* ImageExportInfo */ /* ImageExportInfo */
/* */ /* */
/********************************************************/ /********************************************************/
/** \brief Argument object for the function exportImage(). /** \brief Argument object for the function exportImage().
See \ref exportImage() for usage example. This object must be used See \ref exportImage() for usage example. This object must be used
to define the properties of an image to be written to disk. to define the properties of an image to be written to disk.
skipping to change at line 128 skipping to change at line 142
**/ **/
class ImageExportInfo class ImageExportInfo
{ {
public: public:
/** Construct ImageExportInfo object. /** Construct ImageExportInfo object.
The image will be stored under the given filename. The image will be stored under the given filename.
The file type will be guessed from the extension unless overrid den The file type will be guessed from the extension unless overrid den
by \ref setFileType(). Recognized extensions: '.bmp', '.gif', by \ref setFileType(). Recognized extensions: '.bmp', '.gif',
'.jpeg', '.jpg', '.p7', '.png', '.pbm', '.pgm', '.pnm', '.ppm', '.ras', '.jpeg', '.jpg', '.p7', '.png', '.pbm', '.pgm', '.pnm', '.ppm', '.ras',
'.tif', '.tiff', '.xv'. '.tif', '.tiff', '.xv', '.hdr'.
JPEG support requires libjpeg, PNG support requires libpng, and JPEG support requires libjpeg, PNG support requires libpng, and
TIFF support requires libtiff. TIFF support requires libtiff.
**/ **/
ImageExportInfo( const char * ); VIGRA_EXPORT ImageExportInfo( const char * );
VIGRA_EXPORT ~ImageExportInfo();
const char * getFileName() const; VIGRA_EXPORT const char * getFileName() const;
/** Store image as given file type. /** Store image as given file type.
This will override any type guessed This will override any type guessed
from the file name's extension. Recognized file types: from the file name's extension. Recognized file types:
<DL> <DL>
<DT>"BMP"<DD> Microsoft Windows bitmap image file. <DT>"BMP"<DD> Microsoft Windows bitmap image file.
<DT>"GIF"<DD> CompuServe graphics interchange format; 8-bit color. <DT>"GIF"<DD> CompuServe graphics interchange format; 8-bit col
<DT>"JPEG"<DD> Joint Photographic Experts Group JFIF format; or.
compressed 24-bit color (only available if libjpeg is installed). <DT>"JPEG"<DD> Joint Photographic Experts Group JFIF format;
<DT>"PNG"<DD> Portable Network Graphic compressed 24-bit color (only available if libjpeg is installed
(only available if libpng is installed). ).
<DT>"PBM"<DD> Portable bitmap format (black and white). <DT>"PNG"<DD> Portable Network Graphic
<DT>"PGM"<DD> Portable graymap format (gray scale). (only available if libpng is installed).
<DT>"PNM"<DD> Portable anymap. <DT>"PBM"<DD> Portable bitmap format (black and white).
<DT>"PPM"<DD> Portable pixmap format (color). <DT>"PGM"<DD> Portable graymap format (gray scale).
<DT>"SUN"<DD> SUN Rasterfile. <DT>"PNM"<DD> Portable anymap.
<DT>"TIFF"<DD> Tagged Image File Format. <DT>"PPM"<DD> Portable pixmap format (color).
(only available if libtiff is installed.) <DT>"SUN"<DD> SUN Rasterfile.
<DT>"VIFF"<DD> Khoros Visualization image file. <DT>"TIFF"<DD> Tagged Image File Format.
</DL> (only available if libtiff is installed.)
<DT>"VIFF"<DD> Khoros Visualization image file.
</DL>
With the exception of TIFF and VIFF, all file types store With the exception of TIFF, VIFF, PNG, and PNM all file types s
1 byte (gray scale and mapped RGB) or 3 bytes (RGB) per tore
pixel. 1 byte (gray scale and mapped RGB) or 3 bytes (RGB) per
pixel.
TIFF and VIFF are aditionally able to store short and long PNG can store UInt8 and UInt16 values, and supports 1 and 3 cha
integers (2 or 4 bytes) and real values (32 bit float and nnel
64 bit double) without conversion. So you will need to use images. One additional alpha channel is also supported.
TIFF or VIFF if you need to store images with high
accuracy (the appropriate type to write is automatically
derived from the image type to be exported). However, many
other programs using TIFF (e.g. ImageMagick) have not
implemented support for those pixel types. So don't be
surprised if the generated TIFF is not readable in some
cases. If this happens, export the image as 'unsigned
char' or 'RGBValue\<unsigned char\>' by calling
\ref ImageExportInfo::setPixelType().
**/
ImageExportInfo & setFileType( const char * );
const char * getFileType() const;
/** Set compression type. PNM can store 1 and 3 channel images with UInt8, UInt16 and UIn
t32
values in each channel.
Recognized strings: "" (no compression), "LZW", TIFF and VIFF are aditionally able to store short and long
"RunLength", "1" ... "100". A number is interpreted as the integers (2 or 4 bytes) and real values (32 bit float and
compression quality for JPEG compression. JPEG compression is 64 bit double) without conversion. So you will need to use
supported by the JPEG and TIFF formats. "LZW" is only available TIFF or VIFF if you need to store images with high
if libtiff was installed with LZW enabled. By default, libtiff come accuracy (the appropriate type to write is automatically
s derived from the image type to be exported). However, many
with LZW disabled due to Unisys patent enforcement. In this case, other programs using TIFF (e.g. ImageMagick) have not
VIGRA stores the image uncompressed. implemented support for those pixel types. So don't be
**/ surprised if the generated TIFF is not readable in some
ImageExportInfo & setCompression( const char * ); cases. If this happens, export the image as 'unsigned
const char * getCompression() const; char' or 'RGBValue\<unsigned char\>' by calling
\ref ImageExportInfo::setPixelType().
/** Set the pixel type of the image file. Possible values are: Support to reading and writing ICC color profiles is
<DL> provided for TIFF, JPEG, and PNG images.
<DT>"UINT8"<DD> 8-bit unsigned integer (unsigned char) **/
<DT>"INT16"<DD> 16-bit signed integer (short) VIGRA_EXPORT ImageExportInfo & setFileType( const char * );
<DT>"INT32"<DD> 32-bit signed integer (long) VIGRA_EXPORT const char * getFileType() const;
<DT>"FLOAT"<DD> 32-bit floating point (float)
<DT>"DOUBLE"<DD> 64-bit floating point (double)
</DL>
<b>Usage:</b> /** Set compression type.
FImage img(w,h);
// by default, float images are exported with pixeltype float Recognized strings: "" (no compression), "LZW",
// when the target format support this type, i.e. is TIFF or VIFF. "RunLength", "1" ... "100". A number is interpreted as the
exportImage(srcImageRange(img), ImageExportInfo("asFloat.tif")); compression quality for JPEG compression. JPEG compression is
supported by the JPEG and TIFF formats. "LZW" is only available
if libtiff was installed with LZW enabled. By default, libtiff
came
with LZW disabled due to Unisys patent enforcement. In this cas
e,
VIGRA stores the image uncompressed.
// if this is not desired, force a different pixeltype Valid Compression for TIFF files:
exportImage(srcImageRange(img), ImageExportInfo("asByte.tif").setPi JPEG jpeg compression, call setQuality as well!
xelType("UINT8")); RLE runlength compression
**/ LZW lzw compression
ImageExportInfo & setPixelType( const char * ); DEFLATE deflate compression
**/
VIGRA_EXPORT ImageExportInfo & setCompression( const char * );
VIGRA_EXPORT const char * getCompression() const;
/** Get the pixel type of the image. Possible values are: /** Set the pixel type of the image file. Possible values are:
<DL> <DL>
<DT>"UINT8"<DD> 8-bit unsigned integer (unsigned char) <DT>"UINT8"<DD> 8-bit unsigned integer (unsigned char)
<DT>"INT16"<DD> 16-bit signed integer (short) <DT>"INT16"<DD> 16-bit signed integer (short)
<DT>"INT32"<DD> 32-bit signed integer (long) <DT>"UINT16"<DD> 16-bit unsigned integer (unsigned short)
<DT>"FLOAT"<DD> 32-bit floating point (float) <DT>"INT32"<DD> 32-bit signed integer (long)
<DT>"DOUBLE"<DD> 64-bit floating point (double) <DT>"UINT32"<DD> 32-bit unsigned integer (unsigned long)
</DL> <DT>"FLOAT"<DD> 32-bit floating point (float)
**/ <DT>"DOUBLE"<DD> 64-bit floating point (double)
const char * getPixelType() const; </DL>
/** Set the image resolution in horizontal direction <b>Usage:</b>
**/ FImage img(w,h);
ImageExportInfo & setXResolution( float );
float getXResolution() const;
/** Set the image resolution in vertical direction // by default, float images are exported with pixeltype float
**/ // when the target format support this type, i.e. is TIFF or VI
ImageExportInfo & setYResolution( float ); FF.
float getYResolution() const; exportImage(srcImageRange(img), ImageExportInfo("asFloat.tif"))
;
// if this is not desired, force a different pixeltype
exportImage(srcImageRange(img), ImageExportInfo("asByte.tif").s
etPixelType("UINT8"));
**/
VIGRA_EXPORT ImageExportInfo & setPixelType( const char * );
/** Get the pixel type of the image. Possible values are:
<DL>
<DT>"UINT8"<DD> 8-bit unsigned integer (unsigned char)
<DT>"INT16"<DD> 16-bit signed integer (short)
<DT>"INT32"<DD> 32-bit signed integer (long)
<DT>"FLOAT"<DD> 32-bit floating point (float)
<DT>"DOUBLE"<DD> 64-bit floating point (double)
</DL>
**/
VIGRA_EXPORT const char * getPixelType() const;
/** Set the image resolution in horizontal direction
**/
VIGRA_EXPORT ImageExportInfo & setXResolution( float );
VIGRA_EXPORT float getXResolution() const;
/** Set the image resolution in vertical direction
**/
VIGRA_EXPORT ImageExportInfo & setYResolution( float );
VIGRA_EXPORT float getYResolution() const;
/** Set the position of the upper Left corner on a global
canvas.
Currently only supported by TIFF and PNG files.
The offset is encoded in the XPosition and YPosition TIFF tags.
@param position of the upper left corner in pixels
must be >= 0
**/
VIGRA_EXPORT ImageExportInfo & setPosition(const Diff2D & pos);
/** Get the position of the upper left corner on
a global canvas.
**/
VIGRA_EXPORT Diff2D getPosition() const;
/**
ICC profiles (handled as raw data so far).
see getICCProfile()/setICCProfile()
**/
typedef ArrayVector<unsigned char> ICCProfile;
/** Returns a reference to the ICC profile.
*/
VIGRA_EXPORT const ICCProfile & getICCProfile() const;
/** Sets the ICC profile.
ICC profiles are currently supported by TIFF, PNG and JPEG imag
es.
(Otherwise, the profile data is silently ignored.)
**/
VIGRA_EXPORT ImageExportInfo & setICCProfile(const ICCProfile & profile
);
private: private:
std::string m_filename, m_filetype, m_pixeltype, m_comp; std::string m_filename, m_filetype, m_pixeltype, m_comp;
float m_x_res, m_y_res; float m_x_res, m_y_res;
Diff2D m_pos;
ICCProfile m_icc_profile;
}; };
// return an encoder for a given ImageExportInfo object // return an encoder for a given ImageExportInfo object
std::auto_ptr<Encoder> encoder( const ImageExportInfo & info ); VIGRA_EXPORT std::auto_ptr<Encoder> encoder( const ImageExportInfo & info ) ;
/********************************************************/ /********************************************************/
/* */ /* */
/* ImageImportInfo */ /* ImageImportInfo */
/* */ /* */
/********************************************************/ /********************************************************/
/** \brief Argument object for the function importImage(). /** \brief Argument object for the function importImage().
See \ref importImage() for a usage example. This object must be See \ref importImage() for a usage example. This object must be
used to read an image from disk and enquire about its properties. used to read an image from disk and enquire about its properties.
<b>\#include</b> "<a href="imageinfo_8hxx-source.html">vigra/imageinfo.hxx< /a>"<br> <b>\#include</b> "<a href="imageinfo_8hxx-source.html">vigra/imageinfo.hxx< /a>"<br>
Namespace: vigra Namespace: vigra
**/ **/
class ImageImportInfo class ImageImportInfo
{ {
public: public:
enum PixelType { UINT8, INT16, INT32, FLOAT, DOUBLE }; enum PixelType { UINT8, INT16, UINT16, INT32, UINT32, FLOAT, DOUBLE };
/** Construct ImageImportInfo object. /** Construct ImageImportInfo object.
The image with the given filename is read into memory. The image with the given filename is read into memory.
The file type will be determined by the first few bytes of the The file type will be determined by the first few bytes of the
file (magic number). Recognized file types: file (magic number). Recognized file types:
<DL> <DL>
<DT>"BMP"<DD> Microsoft Windows bitmap image file. <DT>"BMP"<DD> Microsoft Windows bitmap image file.
<DT>"JPEG"<DD> Joint Photographic Experts Group JFIF format <DT>"JPEG"<DD> Joint Photographic Experts Group JFIF format
skipping to change at line 281 skipping to change at line 348
(only available if libpng is installed). (only available if libpng is installed).
<DT>"PBM"<DD> Portable bitmap format (black and white). <DT>"PBM"<DD> Portable bitmap format (black and white).
<DT>"PGM"<DD> Portable graymap format (gray scale). <DT>"PGM"<DD> Portable graymap format (gray scale).
<DT>"PNM"<DD> Portable anymap. <DT>"PNM"<DD> Portable anymap.
<DT>"PPM"<DD> Portable pixmap format (color). <DT>"PPM"<DD> Portable pixmap format (color).
<DT>"SUN"<DD> SUN Rasterfile. <DT>"SUN"<DD> SUN Rasterfile.
<DT>"TIFF"<DD> Tagged Image File Format. <DT>"TIFF"<DD> Tagged Image File Format.
(only available if libtiff is installed.) (only available if libtiff is installed.)
<DT>"VIFF"<DD> Khoros Visualization image file. <DT>"VIFF"<DD> Khoros Visualization image file.
</DL> </DL>
**/ **/
ImageImportInfo( const char * ); VIGRA_EXPORT ImageImportInfo( const char * );
VIGRA_EXPORT ~ImageImportInfo();
const char * getFileName() const; VIGRA_EXPORT const char * getFileName() const;
/** Get the file type of the image associated with this /** Get the file type of the image associated with this
info object. info object.
See ImageImportInfo::ImageImportInfo for a list of the See ImageImportInfo::ImageImportInfo for a list of the
available file types. available file types.
**/ **/
const char * getFileType() const; VIGRA_EXPORT const char * getFileType() const;
/** Get width of the image. /** Get width of the image.
**/ **/
int width() const; VIGRA_EXPORT int width() const;
/** Get height of the image. /** Get height of the image.
**/ **/
int height() const; VIGRA_EXPORT int height() const;
/** Get the number bands in the image. /** Get the total number of bands in the image.
**/ **/
int numBands() const; VIGRA_EXPORT int numBands() const;
/** Get the number of extra (non color) bands in the image.
** Usually these are the alpha channels.
**/
VIGRA_EXPORT int numExtraBands() const;
/** Get size of the image. /** Get size of the image.
**/ **/
Size2D size() const; VIGRA_EXPORT Size2D size() const;
/** Returns true if the image is gray scale. /** Returns true if the image is gray scale.
**/ **/
bool isGrayscale() const; VIGRA_EXPORT bool isGrayscale() const;
/** Returns true if the image is colored (RGB). /** Returns true if the image is colored (RGB).
**/ **/
bool isColor() const; VIGRA_EXPORT bool isColor() const;
/** Query the pixel type of the image. /** Query the pixel type of the image.
Possible values are: Possible values are:
<DL> <DL>
<DT>"UINT8"<DD> 8-bit unsigned integer (unsigned char) <DT>"UINT8"<DD> 8-bit unsigned integer (unsigned char)
<DT>"INT16"<DD> 16-bit signed integer (short) <DT>"INT16"<DD> 16-bit signed integer (short)
<DT>"UINT16"<DD> 16-bit unsigned integer (unsigned short)
<DT>"INT32"<DD> 32-bit signed integer (long) <DT>"INT32"<DD> 32-bit signed integer (long)
<DT>"UINT32"<DD> 32-bit unsigned integer (unsigned long)
<DT>"FLOAT"<DD> 32-bit floating point (float) <DT>"FLOAT"<DD> 32-bit floating point (float)
<DT>"DOUBLE"<DD> 64-bit floating point (double) <DT>"DOUBLE"<DD> 64-bit floating point (double)
</DL> </DL>
**/ **/
const char * getPixelType() const; VIGRA_EXPORT const char * getPixelType() const;
/// deprecated: use getPixelType() /// deprecated: use getPixelType()
PixelType pixelType() const; VIGRA_EXPORT PixelType pixelType() const;
/** Returns true if the image has 1 byte per pixel (gray) or /** Returns true if the image has 1 byte per pixel (gray) or
3 bytes per pixel (RGB). 3 bytes per pixel (RGB).
**/ **/
bool isByte() const; VIGRA_EXPORT bool isByte() const;
/** Returns the layer offset of the current image, if there is one
**/
VIGRA_EXPORT Diff2D getPosition() const;
/** Returns the image resolution in horizontal direction /** Returns the image resolution in horizontal direction
**/ **/
float getXResolution() const; VIGRA_EXPORT float getXResolution() const;
/** Returns the image resolution in vertical direction /** Returns the image resolution in vertical direction
**/ **/
float getYResolution() const; VIGRA_EXPORT float getYResolution() const;
/**
ICC profiles (handled as raw data so far).
see getICCProfile()/setICCProfile()
**/
typedef ArrayVector<unsigned char> ICCProfile;
/** Returns a reference to the ICC profile.
Note: The reference will become invalid when the
ImageImportInfo object has been destroyed.
**/
VIGRA_EXPORT const ICCProfile & getICCProfile() const;
private: private:
std::string m_filename, m_filetype, m_pixeltype; std::string m_filename, m_filetype, m_pixeltype;
int m_width, m_height, m_num_bands; int m_width, m_height, m_num_bands, m_num_extra_bands;
float m_x_res, m_y_res; float m_x_res, m_y_res;
Diff2D m_pos;
ICCProfile m_icc_profile;
}; };
// return a decoder for a given ImageImportInfo object // return a decoder for a given ImageImportInfo object
std::auto_ptr<vigra::Decoder> decoder( const ImageImportInfo & info ); VIGRA_EXPORT std::auto_ptr<Decoder> decoder( const ImageImportInfo & info ) ;
} // namespace vigra } // namespace vigra
#endif // VIGRA_IMAGEINFO_HXX #endif // VIGRA_IMAGEINFO_HXX
 End of changes. 46 change blocks. 
118 lines changed or deleted 222 lines changed or added


 imageiterator.hxx   imageiterator.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_IMAGEITERATOR_HXX #ifndef VIGRA_IMAGEITERATOR_HXX
#define VIGRA_IMAGEITERATOR_HXX #define VIGRA_IMAGEITERATOR_HXX
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/accessor.hxx" #include "accessor.hxx"
#include "vigra/iteratortraits.hxx" #include "iteratortraits.hxx"
#include "vigra/metaprogramming.hxx" #include "metaprogramming.hxx"
namespace vigra { namespace vigra {
template <class IMAGEITERATOR> template <class IMAGEITERATOR>
class StridedIteratorPolicy class StridedIteratorPolicy
{ {
public: public:
typedef IMAGEITERATOR ImageIterator; typedef IMAGEITERATOR ImageIterator;
typedef typename IMAGEITERATOR::value_type value_type; typedef typename IMAGEITERATOR::value_type value_type;
typedef typename IMAGEITERATOR::difference_type::MoveY typedef typename IMAGEITERATOR::difference_type::MoveY
 End of changes. 2 change blocks. 
5 lines changed or deleted 5 lines changed or added


 imageiteratoradapter.hxx   imageiteratoradapter.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 impex.hxx   impex.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2001-2002 by Gunnar Kedenburg */ /* Copyright 2001-2002 by Gunnar Kedenburg */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 37 skipping to change at line 37
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
/* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */ /* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
/* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */ /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
/* Modifications by Pablo d'Angelo
* updated to vigra 1.4 by Douglas Wilkins
* as of 18 Febuary 2006:
* - Added import/export of UINT16 and UINT32 image types.
* Modifications by Andrew Mihal
* updated to vigra 1.4 by Douglas Wilkins
* as of 18 Febuary 2006:
* - Moved some RowIterator declarations around to avoid using default cto
rs
* (cachedfileimages do not have default ctors for row iterators).
* - Added some case-specific optimizations
*/
/*! /*!
\file impex.hxx \file impex.hxx
\brief image import and export functions \brief image import and export functions
this file provides the declarations and implementations of importImage() this file provides the declarations and implementations of importImage()
and exportImage(). the matching implementation for the given datatype is and exportImage(). the matching implementation for the given datatype is
selected by template metacode. selected by template metacode.
*/ */
#ifndef VIGRA_IMPEX_HXX #ifndef VIGRA_IMPEX_HXX
#define VIGRA_IMPEX_HXX #define VIGRA_IMPEX_HXX
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma warning (disable: 4267) #pragma warning (disable: 4267)
#endif #endif
#include "vigra/sized_int.hxx" #include "sized_int.hxx"
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
#include "vigra/tinyvector.hxx" #include "tinyvector.hxx"
#include "vigra/imageinfo.hxx" #include "imageinfo.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/codec.hxx" #include "codec.hxx"
#include "vigra/accessor.hxx" #include "accessor.hxx"
#include "vigra/inspectimage.hxx" #include "inspectimage.hxx"
#include "vigra/transformimage.hxx" #include "transformimage.hxx"
#include "vigra/copyimage.hxx" #include "copyimage.hxx"
#include "vigra/multi_array.hxx" #include "multi_array.hxx"
// TODO // TODO
// next refactoring: pluggable conversion algorithms // next refactoring: pluggable conversion algorithms
namespace vigra namespace vigra
{ {
/** \addtogroup VigraImpex /** \addtogroup VigraImpex
**/ **/
//@{ //@{
skipping to change at line 110 skipping to change at line 121
typedef typename AccessorValueType::value_type DstValueType; typedef typename AccessorValueType::value_type DstValueType;
const size_type width = dec->getWidth(); const size_type width = dec->getWidth();
const size_type height = dec->getHeight(); const size_type height = dec->getHeight();
const size_type num_bands = dec->getNumBands(); const size_type num_bands = dec->getNumBands();
vigra_precondition(num_bands == a.size(ys), vigra_precondition(num_bands == a.size(ys),
"importImage(): number of bands (color channels) in file and des tination image differ."); "importImage(): number of bands (color channels) in file and des tination image differ.");
SrcValueType const * scanline; SrcValueType const * scanline;
DstRowIterator xs; // MIHAL no default constructor available for cachedfileimages.
DstRowIterator xs = ys.rowIterator();
// iterate // iterate
if (num_bands == 4) {
// Speedup for this particular case
unsigned int offset = dec->getOffset();
SrcValueType const * scanline0;
SrcValueType const * scanline1;
SrcValueType const * scanline2;
SrcValueType const * scanline3;
for( size_type y = 0; y < height; ++y, ++ys.y ) {
dec->nextScanline();
xs = ys.rowIterator();
scanline0 = static_cast< SrcValueType const * >
(dec->currentScanlineOfBand(0));
scanline1 = static_cast< SrcValueType const * >
(dec->currentScanlineOfBand(1));
scanline2 = static_cast< SrcValueType const * >
(dec->currentScanlineOfBand(2));
scanline3 = static_cast< SrcValueType const * >
(dec->currentScanlineOfBand(3));
for( size_type x = 0; x < width; ++x, ++xs ) {
/*
a.template setComponent<SrcValueType, DstRowIterator, 0
>( *scanline0, xs );
a.template setComponent<SrcValueType, DstRowIterator, 1
>( *scanline1, xs );
a.template setComponent<SrcValueType, DstRowIterator, 2
>( *scanline2, xs );
a.template setComponent<SrcValueType, DstRowIterator, 3
>( *scanline3, xs );
*/
a.setComponent( *scanline0, xs, 0);
a.setComponent( *scanline1, xs, 1);
a.setComponent( *scanline2, xs, 2);
a.setComponent( *scanline3, xs, 3);
scanline0 += offset;
scanline1 += offset;
scanline2 += offset;
scanline3 += offset;
}
}
}
else {
// General case
for( size_type y = 0; y < height; ++y, ++ys.y ) { for( size_type y = 0; y < height; ++y, ++ys.y ) {
dec->nextScanline(); dec->nextScanline();
for( size_type b = 0; b < num_bands; ++b ) { for( size_type b = 0; b < num_bands; ++b ) {
xs = ys.rowIterator(); xs = ys.rowIterator();
scanline = static_cast< SrcValueType const * > scanline = static_cast< SrcValueType const * >
(dec->currentScanlineOfBand(b)); (dec->currentScanlineOfBand(b));
for( size_type x = 0; x < width; ++x, ++xs ) { for( size_type x = 0; x < width; ++x, ++xs ) {
a.setComponent( *scanline, xs, b ); a.setComponent( *scanline, xs, b );
scanline += dec->getOffset(); scanline += dec->getOffset();
} }
} }
} }
}
} // read_bands() } // read_bands()
/*! /*!
\brief used for reading bands after the source data type has been fig ured out. \brief used for reading bands after the source data type has been fig ured out.
<b>\#include</b> "<a href="impex_8hxx-source.html">vigra/impex.hxx< /a>"<br> <b>\#include</b> "<a href="impex_8hxx-source.html">vigra/impex.hxx< /a>"<br>
Namespace: vigra Namespace: vigra
<b> Declaration:</b> <b> Declaration:</b>
skipping to change at line 156 skipping to change at line 207
template< class ImageIterator, class Accessor, class SrcValueType > template< class ImageIterator, class Accessor, class SrcValueType >
void read_band( Decoder * dec, ImageIterator ys, Accessor a, SrcValueTy pe ) void read_band( Decoder * dec, ImageIterator ys, Accessor a, SrcValueTy pe )
{ {
typedef unsigned int size_type; typedef unsigned int size_type;
typedef typename ImageIterator::row_iterator DstRowIterator; typedef typename ImageIterator::row_iterator DstRowIterator;
typedef typename Accessor::value_type DstValueType; typedef typename Accessor::value_type DstValueType;
const size_type width = dec->getWidth(); const size_type width = dec->getWidth();
const size_type height = dec->getHeight(); const size_type height = dec->getHeight();
SrcValueType const * scanline; SrcValueType const * scanline;
DstRowIterator xs; // MIHAL no default constructor available for cachedfileimages.
DstRowIterator xs = ys.rowIterator();
for( size_type y = 0; y < height; ++y, ++ys.y ) { for( size_type y = 0; y < height; ++y, ++ys.y ) {
dec->nextScanline(); dec->nextScanline();
xs = ys.rowIterator(); xs = ys.rowIterator();
scanline = static_cast< SrcValueType const * >(dec->currentScan lineOfBand(0)); scanline = static_cast< SrcValueType const * >(dec->currentScan lineOfBand(0));
for( size_type x = 0; x < width; ++x, ++xs ) for( size_type x = 0; x < width; ++x, ++xs )
a.set( scanline[x], xs ); a.set( scanline[x], xs );
} }
} // read_band() } // read_band()
skipping to change at line 198 skipping to change at line 250
template< class ImageIterator, class Accessor > template< class ImageIterator, class Accessor >
void importVectorImage( const ImageImportInfo & info, ImageIterator ite r, Accessor a ) void importVectorImage( const ImageImportInfo & info, ImageIterator ite r, Accessor a )
{ {
std::auto_ptr<Decoder> dec = decoder(info); std::auto_ptr<Decoder> dec = decoder(info);
std::string pixeltype = dec->getPixelType(); std::string pixeltype = dec->getPixelType();
if ( pixeltype == "UINT8" ) if ( pixeltype == "UINT8" )
read_bands( dec.get(), iter, a, (UInt8)0 ); read_bands( dec.get(), iter, a, (UInt8)0 );
else if ( pixeltype == "INT16" ) else if ( pixeltype == "INT16" )
read_bands( dec.get(), iter, a, Int16() ); read_bands( dec.get(), iter, a, Int16() );
else if ( pixeltype == "UINT16" )
read_bands( dec.get(), iter, a, (UInt16)0 );
else if ( pixeltype == "INT32" ) else if ( pixeltype == "INT32" )
read_bands( dec.get(), iter, a, Int32() ); read_bands( dec.get(), iter, a, Int32() );
else if ( pixeltype == "UINT32" )
read_bands( dec.get(), iter, a, (UInt32)0 );
else if ( pixeltype == "FLOAT" ) else if ( pixeltype == "FLOAT" )
read_bands( dec.get(), iter, a, float() ); read_bands( dec.get(), iter, a, float() );
else if ( pixeltype == "DOUBLE" ) else if ( pixeltype == "DOUBLE" )
read_bands( dec.get(), iter, a, double() ); read_bands( dec.get(), iter, a, double() );
else else
vigra_precondition( false, "invalid pixeltype" ); vigra_precondition( false, "invalid pixeltype" );
// close the decoder // close the decoder
dec->close(); dec->close();
} }
skipping to change at line 242 skipping to change at line 298
template < class ImageIterator, class Accessor > template < class ImageIterator, class Accessor >
void importScalarImage( const ImageImportInfo & info, ImageIterator ite r, Accessor a ) void importScalarImage( const ImageImportInfo & info, ImageIterator ite r, Accessor a )
{ {
std::auto_ptr<Decoder> dec = decoder(info); std::auto_ptr<Decoder> dec = decoder(info);
std::string pixeltype = dec->getPixelType(); std::string pixeltype = dec->getPixelType();
if ( pixeltype == "UINT8" ) if ( pixeltype == "UINT8" )
read_band( dec.get(), iter, a, (UInt8)0 ); read_band( dec.get(), iter, a, (UInt8)0 );
else if ( pixeltype == "INT16" ) else if ( pixeltype == "INT16" )
read_band( dec.get(), iter, a, Int16() ); read_band( dec.get(), iter, a, Int16() );
else if ( pixeltype == "UINT16" )
read_band( dec.get(), iter, a, (UInt16)0 );
else if ( pixeltype == "INT32" ) else if ( pixeltype == "INT32" )
read_band( dec.get(), iter, a, Int32() ); read_band( dec.get(), iter, a, Int32() );
else if ( pixeltype == "UINT32" )
read_band( dec.get(), iter, a, (UInt32)0 );
else if ( pixeltype == "FLOAT" ) else if ( pixeltype == "FLOAT" )
read_band( dec.get(), iter, a, float() ); read_band( dec.get(), iter, a, float() );
else if ( pixeltype == "DOUBLE" ) else if ( pixeltype == "DOUBLE" )
read_band( dec.get(), iter, a, double() ); read_band( dec.get(), iter, a, double() );
else else
vigra_precondition( false, "invalid pixeltype" ); vigra_precondition( false, "invalid pixeltype" );
// close the decoder // close the decoder
dec->close(); dec->close();
} }
skipping to change at line 395 skipping to change at line 455
// complete decoder settings // complete decoder settings
const size_type width = lr.x - ul.x; const size_type width = lr.x - ul.x;
const size_type height = lr.y - ul.y; const size_type height = lr.y - ul.y;
enc->setWidth(width); enc->setWidth(width);
enc->setHeight(height); enc->setHeight(height);
const size_type num_bands = a.size(ul); const size_type num_bands = a.size(ul);
enc->setNumBands(num_bands); enc->setNumBands(num_bands);
enc->finalizeSettings(); enc->finalizeSettings();
SrcRowIterator xs;
DstValueType * scanline; DstValueType * scanline;
// iterate // iterate
ImageIterator ys(ul); ImageIterator ys(ul);
// MIHAL no default constructor available for cachedfileimages
SrcRowIterator xs = ys.rowIterator();
if (num_bands == 4) {
// Speedup for this particular case
unsigned int offset = enc->getOffset();
DstValueType * scanline0;
DstValueType * scanline1;
DstValueType * scanline2;
DstValueType * scanline3;
for( size_type y = 0; y < height; ++y, ++ys.y ) {
xs = ys.rowIterator();
scanline0 = static_cast< DstValueType * >
(enc->currentScanlineOfBand(0));
scanline1 = static_cast< DstValueType * >
(enc->currentScanlineOfBand(1));
scanline2 = static_cast< DstValueType * >
(enc->currentScanlineOfBand(2));
scanline3 = static_cast< DstValueType * >
(enc->currentScanlineOfBand(3));
for( size_type x = 0; x < width; ++x, ++xs) {
/*
*scanline0 = a.template getComponent<SrcRowIterator, 0>
( xs );
*scanline1 = a.template getComponent<SrcRowIterator, 1>
( xs );
*scanline2 = a.template getComponent<SrcRowIterator, 2>
( xs );
*scanline3 = a.template getComponent<SrcRowIterator, 3>
( xs );
*/
*scanline0 = detail::RequiresExplicitCast<DstValueType>
::cast(a.getComponent( xs, 0));
*scanline1 = detail::RequiresExplicitCast<DstValueType>
::cast(a.getComponent( xs, 1));
*scanline2 = detail::RequiresExplicitCast<DstValueType>
::cast(a.getComponent( xs, 2));
*scanline3 = detail::RequiresExplicitCast<DstValueType>
::cast(a.getComponent( xs, 3));
scanline0 += offset;
scanline1 += offset;
scanline2 += offset;
scanline3 += offset;
}
enc->nextScanline();
}
}
else {
// General case
for( size_type y = 0; y < height; ++y, ++ys.y ) { for( size_type y = 0; y < height; ++y, ++ys.y ) {
for( size_type b = 0; b < num_bands; ++b ) { for( size_type b = 0; b < num_bands; ++b ) {
xs = ys.rowIterator(); xs = ys.rowIterator();
scanline = static_cast< DstValueType * > scanline = static_cast< DstValueType * >
(enc->currentScanlineOfBand(b)); (enc->currentScanlineOfBand(b));
for( size_type x = 0; x < width; ++x, ++xs ) { for( size_type x = 0; x < width; ++x, ++xs ) {
*scanline = detail::RequiresExplicitCast<DstValueType>: :cast(a.getComponent( xs, b )); *scanline = detail::RequiresExplicitCast<DstValueType>: :cast(a.getComponent( xs, b ));
scanline += enc->getOffset(); scanline += enc->getOffset();
} }
} }
enc->nextScanline(); enc->nextScanline();
} }
}
} // write_bands() } // write_bands()
template< class MArray, class DstValueType > template< class MArray, class DstValueType >
void write_bands( Encoder * enc, MArray const & array, DstValueType) void write_bands( Encoder * enc, MArray const & array, DstValueType)
{ {
typedef unsigned int size_type; typedef unsigned int size_type;
// complete decoder settings // complete decoder settings
const size_type width = array.shape(0); const size_type width = array.shape(0);
const size_type height = array.shape(1); const size_type height = array.shape(1);
skipping to change at line 479 skipping to change at line 580
typedef typename Accessor::value_type SrcValueType; typedef typename Accessor::value_type SrcValueType;
// complete decoder settings // complete decoder settings
const size_type width = lr.x - ul.x; const size_type width = lr.x - ul.x;
const size_type height = lr.y - ul.y; const size_type height = lr.y - ul.y;
enc->setWidth(width); enc->setWidth(width);
enc->setHeight(height); enc->setHeight(height);
enc->setNumBands(1); enc->setNumBands(1);
enc->finalizeSettings(); enc->finalizeSettings();
SrcRowIterator xs;
DstValueType * scanline; DstValueType * scanline;
// iterate // iterate
ImageIterator ys(ul); ImageIterator ys(ul);
// MIHAL no default constructor available for cachedfileimages.
SrcRowIterator xs = ys.rowIterator();
size_type y; size_type y;
for( y = 0; y < height; ++y, ++ys.y ) { for( y = 0; y < height; ++y, ++ys.y ) {
xs = ys.rowIterator(); xs = ys.rowIterator();
scanline = static_cast< DstValueType * >(enc->currentScanlineOf Band(0)); scanline = static_cast< DstValueType * >(enc->currentScanlineOf Band(0));
for( size_type x = 0; x < width; ++x, ++xs, ++scanline ) for( size_type x = 0; x < width; ++x, ++xs, ++scanline )
*scanline = detail::RequiresExplicitCast<DstValueType>::cas t(a(xs)); *scanline = detail::RequiresExplicitCast<DstValueType>::cas t(a(xs));
enc->nextScanline(); enc->nextScanline();
} }
} // write_band() } // write_band()
skipping to change at line 509 skipping to change at line 611
DestIterator dul, DestAccessor dge t ) DestIterator dul, DestAccessor dge t )
{ {
typedef typename SrcAccessor::value_type SrcValue; typedef typename SrcAccessor::value_type SrcValue;
typedef typename DestAccessor::value_type DestValue; typedef typename DestAccessor::value_type DestValue;
typedef typename NumericTraits<SrcValue>::RealPromote PromoteValue; typedef typename NumericTraits<SrcValue>::RealPromote PromoteValue;
FindMinMax<SrcValue> minmax; FindMinMax<SrcValue> minmax;
inspectImage( sul, slr, sget, minmax ); inspectImage( sul, slr, sget, minmax );
double scale = (double)NumericTraits<DestValue>::max() / (minmax.ma x - minmax.min) - double scale = (double)NumericTraits<DestValue>::max() / (minmax.ma x - minmax.min) -
(double)NumericTraits<DestValue>::min() / (minmax.ma x - minmax.min); (double)NumericTraits<DestValue>::min() / (minmax.ma x - minmax.min);
double offset = -minmax.min + NumericTraits<DestValue>::min() / sca le; double offset = (NumericTraits<DestValue>::min() / scale) - minmax. min ;
transformImage( sul, slr, sget, dul, dget, transformImage( sul, slr, sget, dul, dget,
linearIntensityTransform( scale, offset ) ); linearIntensityTransform( scale, offset ) );
} }
// export scalar images with conversion (if necessary) // export scalar images with conversion (if necessary)
template < class SrcIterator, class SrcAccessor, class T > template < class SrcIterator, class SrcAccessor, class T >
void exportScalarImage(SrcIterator sul, SrcIterator slr, SrcAccessor sg et, void exportScalarImage(SrcIterator sul, SrcIterator slr, SrcAccessor sg et,
Encoder * enc, bool downcast, T zero) Encoder * enc, bool downcast, T zero)
{ {
if (!downcast) { if (!downcast) {
skipping to change at line 542 skipping to change at line 644
void mapVectorImageToLowerPixelType( SrcIterator sul, SrcIterator slr, SrcAccessor sget, void mapVectorImageToLowerPixelType( SrcIterator sul, SrcIterator slr, SrcAccessor sget,
MArray & array ) MArray & array )
{ {
typedef typename SrcAccessor::value_type SrcValue; typedef typename SrcAccessor::value_type SrcValue;
typedef typename SrcValue::value_type SrcComponent; typedef typename SrcValue::value_type SrcComponent;
typedef typename MArray::value_type DestValue; typedef typename MArray::value_type DestValue;
FindMinMax<SrcComponent> minmax; FindMinMax<SrcComponent> minmax;
for(unsigned int i=0; i<sget.size(sul); ++i) for(unsigned int i=0; i<sget.size(sul); ++i)
{ {
VectorElementAccessor<SrcAccessor> band(i, sget); // FIXME dangelo - This will break with vector accessors that h
ave a "by value" interface.
// use VectorComponentValueAccessor instead, since it should wo
rk in both cases, even
// if it might be a bit slower..
//VectorElementAccessor<SrcAccessor> band(i, sget);
VectorComponentValueAccessor<typename SrcAccessor::value_type>
band(i);
inspectImage( sul, slr, band, minmax ); inspectImage( sul, slr, band, minmax );
} }
double scale = (double)NumericTraits<DestValue>::max() / (minmax.ma x - minmax.min) - double scale = (double)NumericTraits<DestValue>::max() / (minmax.ma x - minmax.min) -
(double)NumericTraits<DestValue>::min() / (minmax.ma x - minmax.min); (double)NumericTraits<DestValue>::min() / (minmax.ma x - minmax.min);
double offset = -minmax.min + NumericTraits<DestValue>::min() / sca // FIXME DGSW - Original was not correct. Is this what was intended?
le; // double offset = -minmax.min + NumericTraits<DestValue>::min() / s
cale;
double offset = (NumericTraits<DestValue>::min() / scale) - minmax.
min ;
for(unsigned int i=0; i<sget.size(sul); ++i) for(unsigned int i=0; i<sget.size(sul); ++i)
{ {
BasicImageView<DestValue> subImage = makeBasicImageView(array.b indOuter(i)); BasicImageView<DestValue> subImage = makeBasicImageView(array.b indOuter(i));
VectorElementAccessor<SrcAccessor> band(i, sget); // FIXME dangelo: use VectorComponentValueAccessor
//VectorElementAccessor<SrcAccessor> band(i, sget);
VectorComponentValueAccessor<typename SrcAccessor::value_type>
band(i);
transformImage( sul, slr, band, subImage.upperLeft(), subImage. accessor(), transformImage( sul, slr, band, subImage.upperLeft(), subImage. accessor(),
linearIntensityTransform( scale, offset ) ); linearIntensityTransform( scale, offset ) );
} }
} }
// export vector images with conversion (if necessary) // export vector images with conversion (if necessary)
template < class SrcIterator, class SrcAccessor, class T > template < class SrcIterator, class SrcAccessor, class T >
void exportVectorImage(SrcIterator sul, SrcIterator slr, SrcAccessor sg et, void exportVectorImage(SrcIterator sul, SrcIterator slr, SrcAccessor sg et,
Encoder * enc, bool downcast, T zero) Encoder * enc, bool downcast, T zero)
{ {
skipping to change at line 688 skipping to change at line 798
typedef typename AccessorValueType::value_type SrcValueType; typedef typename AccessorValueType::value_type SrcValueType;
std::string pixeltype = info.getPixelType(); std::string pixeltype = info.getPixelType();
std::auto_ptr<Encoder> enc = encoder(info); std::auto_ptr<Encoder> enc = encoder(info);
bool downcast = negotiatePixelType(enc->getFileType(), bool downcast = negotiatePixelType(enc->getFileType(),
TypeAsString<SrcValueType>::result(), pixeltype); TypeAsString<SrcValueType>::result(), pixeltype);
enc->setPixelType(pixeltype); enc->setPixelType(pixeltype);
if(pixeltype == "UINT8") if(pixeltype == "UINT8")
detail::exportVectorImage( sul, slr, sget, enc.get(), downcast, (UInt8)0); detail::exportVectorImage( sul, slr, sget, enc.get(), downcast, (UInt8)0);
else if(pixeltype == "INT16") else if(pixeltype == "INT16")
detail::exportVectorImage( sul, slr, sget, enc.get(), downcast, Int16()); detail::exportVectorImage( sul, slr, sget, enc.get(), downcast, Int16());
else if(pixeltype == "UINT16")
detail::exportVectorImage( sul, slr, sget, enc.get(), downcast,
(UInt16)0);
else if(pixeltype == "INT32") else if(pixeltype == "INT32")
detail::exportVectorImage( sul, slr, sget, enc.get(), downcast, Int32()); detail::exportVectorImage( sul, slr, sget, enc.get(), downcast, Int32());
else if(pixeltype == "UINT32")
detail::exportVectorImage( sul, slr, sget, enc.get(), downcast,
(UInt32)0);
else if(pixeltype == "FLOAT") else if(pixeltype == "FLOAT")
detail::exportVectorImage( sul, slr, sget, enc.get(), downcast, float()); detail::exportVectorImage( sul, slr, sget, enc.get(), downcast, float());
else if(pixeltype == "DOUBLE") else if(pixeltype == "DOUBLE")
detail::exportVectorImage( sul, slr, sget, enc.get(), downcast, double()); detail::exportVectorImage( sul, slr, sget, enc.get(), downcast, double());
enc->close(); enc->close();
} }
template < class SrcIterator, class SrcAccessor > template < class SrcIterator, class SrcAccessor >
void exportImage( SrcIterator sul, SrcIterator slr, SrcAccessor sget, void exportImage( SrcIterator sul, SrcIterator slr, SrcAccessor sget,
const ImageExportInfo & info, VigraTrueType /*scalar* / ) const ImageExportInfo & info, VigraTrueType /*scalar* / )
skipping to change at line 711 skipping to change at line 825
typedef typename SrcAccessor::value_type SrcValueType; typedef typename SrcAccessor::value_type SrcValueType;
std::string pixeltype = info.getPixelType(); std::string pixeltype = info.getPixelType();
std::auto_ptr<Encoder> enc = encoder(info); std::auto_ptr<Encoder> enc = encoder(info);
bool downcast = negotiatePixelType(enc->getFileType(), bool downcast = negotiatePixelType(enc->getFileType(),
TypeAsString<SrcValueType>::result(), pixeltype) ; TypeAsString<SrcValueType>::result(), pixeltype) ;
enc->setPixelType(pixeltype); enc->setPixelType(pixeltype);
if(pixeltype == "UINT8") if(pixeltype == "UINT8")
detail::exportScalarImage( sul, slr, sget, enc.get(), downcast, (UInt8)0); detail::exportScalarImage( sul, slr, sget, enc.get(), downcast, (UInt8)0);
else if(pixeltype == "INT16") else if(pixeltype == "INT16")
detail::exportScalarImage( sul, slr, sget, enc.get(), downcast, Int16()); detail::exportScalarImage( sul, slr, sget, enc.get(), downcast, Int16());
else if(pixeltype == "UINT16")
detail::exportScalarImage( sul, slr, sget, enc.get(), downcast,
(UInt16)0);
else if(pixeltype == "INT32") else if(pixeltype == "INT32")
detail::exportScalarImage( sul, slr, sget, enc.get(), downcast, Int32()); detail::exportScalarImage( sul, slr, sget, enc.get(), downcast, Int32());
else if(pixeltype == "UINT32")
detail::exportScalarImage( sul, slr, sget, enc.get(), downcast,
(UInt32)0);
else if(pixeltype == "FLOAT") else if(pixeltype == "FLOAT")
detail::exportScalarImage( sul, slr, sget, enc.get(), downcast, float()); detail::exportScalarImage( sul, slr, sget, enc.get(), downcast, float());
else if(pixeltype == "DOUBLE") else if(pixeltype == "DOUBLE")
detail::exportScalarImage( sul, slr, sget, enc.get(), downcast, double()); detail::exportScalarImage( sul, slr, sget, enc.get(), downcast, double());
enc->close(); enc->close();
} }
/********************************************************/ /********************************************************/
/* */ /* */
/* exportImage */ /* exportImage */
skipping to change at line 815 skipping to change at line 933
inline inline
void exportImage( SrcIterator sul, SrcIterator slr, SrcAccessor sget, void exportImage( SrcIterator sul, SrcIterator slr, SrcAccessor sget,
const ImageExportInfo & info ) const ImageExportInfo & info )
{ {
typedef typename NumericTraits<typename SrcAccessor::value_type>::i sScalar is_scalar; typedef typename NumericTraits<typename SrcAccessor::value_type>::i sScalar is_scalar;
try try
{ {
exportImage( sul, slr, sget, info, is_scalar() ); exportImage( sul, slr, sget, info, is_scalar() );
} }
catch(Encoder::TIFFNoLZWException &) catch(Encoder::TIFFCompressionException &)
{ {
const_cast<ImageExportInfo &>(info).setCompression(""); const_cast<ImageExportInfo &>(info).setCompression("");
exportImage( sul, slr, sget, info, is_scalar() ); exportImage( sul, slr, sget, info, is_scalar() );
} }
} }
template < class SrcIterator, class SrcAccessor > template < class SrcIterator, class SrcAccessor >
inline inline
void exportImage( triple<SrcIterator, SrcIterator, SrcAccessor> src, void exportImage( triple<SrcIterator, SrcIterator, SrcAccessor> src,
const ImageExportInfo & info ) const ImageExportInfo & info )
 End of changes. 25 change blocks. 
22 lines changed or deleted 162 lines changed or added


 initimage.hxx   initimage.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_INITIMAGE_HXX #ifndef VIGRA_INITIMAGE_HXX
#define VIGRA_INITIMAGE_HXX #define VIGRA_INITIMAGE_HXX
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/iteratortraits.hxx" #include "iteratortraits.hxx"
#include "vigra/functortraits.hxx" #include "functortraits.hxx"
namespace vigra { namespace vigra {
/** \addtogroup InitAlgo Algorithms to Initialize Images /** \addtogroup InitAlgo Algorithms to Initialize Images
Init images or image borders Init images or image borders
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 inspectimage.hxx   inspectimage.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_INSPECTIMAGE_HXX #ifndef VIGRA_INSPECTIMAGE_HXX
#define VIGRA_INSPECTIMAGE_HXX #define VIGRA_INSPECTIMAGE_HXX
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/iteratortraits.hxx" #include "iteratortraits.hxx"
#include "vigra/functortraits.hxx" #include "functortraits.hxx"
#include "vigra/rgbvalue.hxx" #include "rgbvalue.hxx"
namespace vigra { namespace vigra {
/** \addtogroup InspectAlgo Algorithms to Inspect Images /** \addtogroup InspectAlgo Algorithms to Inspect Images
Apply read-only functor to every pixel Apply read-only functor to every pixel
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
 End of changes. 2 change blocks. 
6 lines changed or deleted 6 lines changed or added


 interpolating_accessor.hxx   interpolating_accessor.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_INTERPOLATING_ACCESSOR_HXX #ifndef VIGRA_INTERPOLATING_ACCESSOR_HXX
#define VIGRA_INTERPOLATING_ACCESSOR_HXX #define VIGRA_INTERPOLATING_ACCESSOR_HXX
#include "vigra/accessor.hxx" #include "accessor.hxx"
#include "vigra/diff2d.hxx" #include "diff2d.hxx"
namespace vigra { namespace vigra {
/** \addtogroup DataAccessors /** \addtogroup DataAccessors
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
/* */ /* */
/* BilinearInterpolatingAccessor */ /* BilinearInterpolatingAccessor */
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added


 iteratoradapter.hxx   iteratoradapter.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 49 skipping to change at line 49
#define VIGRA_ITERATORADAPTER_HXX #define VIGRA_ITERATORADAPTER_HXX
namespace vigra { namespace vigra {
/********************************************************/ /********************************************************/
/* */ /* */
/* IteratorAdaptor */ /* IteratorAdaptor */
/* */ /* */
/********************************************************/ /********************************************************/
/*! \brief Quckly create 1-dimensional iterator adapters. /*! \brief Quickly create 1-dimensional iterator adapters.
This class supports the easy creation of 1D iterator adpaters out This class supports the easy creation of 1D iterator adpaters out
of existing iterators. To use it, you must first implement a policy cla ss of existing iterators. To use it, you must first implement a policy cla ss
that defines the iterator's behavior. The policy is used to that defines the iterator's behavior. The policy is used to
instantiate the IteratorAdapter template, which thus automatically instantiate the IteratorAdapter template, which thus automatically
obtains all required functions of an STL-compatible iterator. obtains all required functions of an STL-compatible iterator.
General information on how this works can be found on the General information on how this works can be found on the
<a href="http://www.boost.org/libs/utility/iterator_adaptors.htm">Boost Iterator Adaptor</a> <a href="http://www.boost.org/libs/utility/iterator_adaptors.htm">Boost Iterator Adaptor</a>
page, although there are some differences in the details of the page, although there are some differences in the details of the
boost and VIGRA implementations. boost and VIGRA implementations.
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 iteratortags.hxx   iteratortags.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2003 by Ullrich Koethe */ /* Copyright 1998-2003 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 iteratortraits.hxx   iteratortraits.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_ITERATORTRAITS_HXX #ifndef VIGRA_ITERATORTRAITS_HXX
#define VIGRA_ITERATORTRAITS_HXX #define VIGRA_ITERATORTRAITS_HXX
#include <vigra/accessor.hxx> #include "accessor.hxx"
#include <vigra/imageiteratoradapter.hxx> #include "imageiteratoradapter.hxx"
namespace vigra { namespace vigra {
/** \addtogroup ImageIterators /** \addtogroup ImageIterators
*/ */
//@{ //@{
/** \brief Export associated information for each image iterator. /** \brief Export associated information for each image iterator.
The IteratorTraits class contains the following fields: The IteratorTraits class contains the following fields:
skipping to change at line 263 skipping to change at line 263
These factory functions access <TT>img.upperLeft()</TT>, These factory functions access <TT>img.upperLeft()</TT>,
<TT>img.lowerRight()</TT>, and <TT>img.accessor()</TT> to obtain the it erators <TT>img.lowerRight()</TT>, and <TT>img.accessor()</TT> to obtain the it erators
and accessor for the given image (unless the accessor is and accessor for the given image (unless the accessor is
given explicitly). The following factory functions are provided: given explicitly). The following factory functions are provided:
<table> <table>
<tr><td> <tr><td>
\htmlonly \htmlonly
<th bgcolor="#f0e0c0" colspan=2 align=left> <th bgcolor="#f0e0c0" colspan=2 align=left>
\endhtmlonly \endhtmlonly
<TT>\ref vigra::BasicImage "vigra::BasicImage<SomeType>" img;</TT> <TT>\ref vigra::BasicImage "vigra::BasicImage<SomeType>" img;</TT>
\htmlonly or <br>
<TT>\ref vigra::BasicImageView "vigra::BasicImageView<SomeType>" i
mg;</TT>
\htmlonly
</th> </th>
\endhtmlonly \endhtmlonly
</td></tr> </td></tr>
<tr><td> <tr><td>
<TT>srcImageRange(img)</TT> <TT>srcImageRange(img)</TT>
</td><td> </td><td>
create argument object containing upper left, lower right, and create argument object containing upper left, lower right, and
default accessor of source image default accessor of source image
</td></tr> </td></tr>
<tr><td> <tr><td>
<TT>srcImageRange(img, Rect2D(...))</TT>
</td><td>
create argument object containing the ROI specified by <tt>\ref vig
ra::Rect2D</tt> and
default accessor of source image
</td></tr>
<tr><td>
<TT>srcImageRange(img, SomeAccessor())</TT> <TT>srcImageRange(img, SomeAccessor())</TT>
</td><td> </td><td>
create argument object containing upper left, lower right create argument object containing upper left, lower right
of source image, and given accessor of source image, and given accessor
</td></tr> </td></tr>
<tr><td> <tr><td>
<TT>srcImageRange(img, Rect2D(...), SomeAccessor())</TT>
</td><td>
create argument object containing the ROI specified by <tt>\ref vig
ra::Rect2D</tt> and
of source image, and given accessor
</td></tr>
<tr><td>
<TT>srcImage(img)</TT> <TT>srcImage(img)</TT>
</td><td> </td><td>
create argument object containing upper left, and create argument object containing upper left, and
default accessor of source image default accessor of source image
</td></tr> </td></tr>
<tr><td> <tr><td>
<TT>srcImage(img, Point2D(...))</TT>
</td><td>
create argument object with upper left at point given by <tt>\ref v
igra::Point2D</tt>, and
default accessor of source image
</td></tr>
<tr><td>
<TT>srcImage(img, SomeAccessor())</TT> <TT>srcImage(img, SomeAccessor())</TT>
</td><td> </td><td>
create argument object containing upper left create argument object containing upper left
of source image, and given accessor of source image, and given accessor
</td></tr> </td></tr>
<tr><td> <tr><td>
<TT>srcImage(img, Point2D(...), SomeAccessor())</TT>
</td><td>
create argument object with upper left at point given by <tt>\ref v
igra::Point2D</tt> of source image,
and given accessor
</td></tr>
<tr><td>
<TT>maskImage(img)</TT> <TT>maskImage(img)</TT>
</td><td> </td><td>
create argument object containing upper left, and create argument object containing upper left, and
default accessor of mask image default accessor of mask image
</td></tr> </td></tr>
<tr><td> <tr><td>
<TT>maskImage(img, Point2D(...))</TT>
</td><td>
create argument object with upper left at point given by <tt>\ref v
igra::Point2D</tt>, and
default accessor of mask image
</td></tr>
<tr><td>
<TT>maskImage(img, SomeAccessor())</TT> <TT>maskImage(img, SomeAccessor())</TT>
</td><td> </td><td>
create argument object containing upper left create argument object containing upper left
of mask image, and given accessor of mask image, and given accessor
</td></tr> </td></tr>
<tr><td> <tr><td>
<TT>maskImage(img, Point2D(...), SomeAccessor())</TT>
</td><td>
create argument object with upper left at point given by <tt>\ref v
igra::Point2D</tt> of mask image,
and given accessor
</td></tr>
<tr><td>
<TT>destImageRange(img)</TT> <TT>destImageRange(img)</TT>
</td><td> </td><td>
create argument object containing upper left, lower right, and create argument object containing upper left, lower right, and
default accessor of destination image default accessor of destination image
</td></tr> </td></tr>
<tr><td> <tr><td>
<TT>destImageRange(img, Rect2D(...))</TT>
</td><td>
create argument object containing the ROI specified by <tt>\ref vig
ra::Rect2D</tt> and
default accessor of destination image
</td></tr>
<tr><td>
<TT>destImageRange(img, SomeAccessor())</TT> <TT>destImageRange(img, SomeAccessor())</TT>
</td><td> </td><td>
create argument object containing upper left, lower right create argument object containing upper left, lower right
of destination image, and given accessor of destination image, and given accessor
</td></tr> </td></tr>
<tr><td> <tr><td>
<TT>destImageRange(img, Rect2D(...), SomeAccessor())</TT>
</td><td>
create argument object containing the ROI specified by <tt>\ref vig
ra::Rect2D</tt>
of destination image, and given accessor
</td></tr>
<tr><td>
<TT>destImage(img)</TT> <TT>destImage(img)</TT>
</td><td> </td><td>
create argument object containing upper left, and create argument object containing upper left, and
default accessor of destination image default accessor of destination image
</td></tr> </td></tr>
<tr><td>
<TT>destImage(img, Point2D(...))</TT>
</td><td>
create argument object with upper left at point given by <tt>\ref v
igra::Point2D</tt>, and
default accessor of destination image
</td></tr>
<tr><td> <tr><td>
<TT>destImage(img, SomeAccessor())</TT> <TT>destImage(img, SomeAccessor())</TT>
</td><td> </td><td>
create argument object containing upper left create argument object containing upper left
of destination image, and given accessor of destination image, and given accessor
</td></tr> </td></tr>
<tr><td>
<TT>destImage(img, Point2D(...), SomeAccessor())</TT>
</td><td>
create argument object with upper left at point given by <tt>\ref v
igra::Point2D</tt> of destination image,
and given accessor
</td></tr>
</table> </table>
\section MultiArrayBasedArgumentObjectFactories MultiArrayView Based Argu ment Object Factories \section MultiArrayBasedArgumentObjectFactories MultiArrayView Based Argu ment Object Factories
<b>Include:</b> automatically included with <b>Include:</b> automatically included with
"<a href="multi__array_8hxx-source.html">vigra/multi_array.hxx</a>"< br> "<a href="multi__array_8hxx-source.html">vigra/multi_array.hxx</a>"< br>
Namespace: vigra Namespace: vigra
These factories can be used to create argument objects when we These factories can be used to create argument objects when we
are given instances or subclasses of \ref vigra::MultiArrayView. are given instances or subclasses of \ref vigra::MultiArrayView.
 End of changes. 13 change blocks. 
6 lines changed or deleted 99 lines changed or added


 labelimage.hxx   labelimage.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_LABELIMAGE_HXX #ifndef VIGRA_LABELIMAGE_HXX
#define VIGRA_LABELIMAGE_HXX #define VIGRA_LABELIMAGE_HXX
#include <vector> #include <vector>
#include <functional> #include <functional>
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
namespace vigra { namespace vigra {
/** \addtogroup Labeling Connected Components Labeling /** \addtogroup Labeling Connected Components Labeling
The connected components algorithm may use either 4 or 8 connectivity. The connected components algorithm may use either 4 or 8 connectivity.
By means of a functor the merge criterium can be defined arbitrarily. By means of a functor the merge criterium can be defined arbitrarily.
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
skipping to change at line 639 skipping to change at line 639
} }
/********************************************************/ /********************************************************/
/* */ /* */
/* regionImageToCrackEdgeImage */ /* regionImageToCrackEdgeImage */
/* */ /* */
/********************************************************/ /********************************************************/
/** \brief Transform a labeled image into a crack edge image. /** \brief Transform a labeled image into a crack edge image.
This algorithm inserts border pixels (so called "crack edges" This algorithm inserts border pixels (so called "crack edges")
between regions in a labeled image like this (<TT>a</TT> and between regions in a labeled image like this (<TT>a</TT> and
<TT>c</TT> are the original labels, and <TT>0</TT> is the value of <TT>c</TT> are the original labels, and <TT>0</TT> is the value of
<TT>edge_marker</TT> and denotes the inserted edges): <TT>edge_marker</TT> and denotes the inserted edges):
\code \code
original image insert zero- and one-cells original image insert zero- and one-cells
a 0 c c c a 0 c c c
a c c a 0 0 0 c a c c a 0 0 0 c
a a c => a a a 0 c a a c => a a a 0 c
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added


 linear_algebra.hxx   linear_algebra.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2004 by Ullrich Koethe */ /* Copyright 2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_LINEAR_ALGREBRA_HXX #ifndef VIGRA_LINEAR_ALGREBRA_HXX
#define VIGRA_LINEAR_ALGREBRA_HXX #define VIGRA_LINEAR_ALGREBRA_HXX
#include "vigra/matrix.hxx" #include "matrix.hxx"
#include "vigra/linear_solve.hxx" #include "linear_solve.hxx"
#include "vigra/eigensystem.hxx" #include "eigensystem.hxx"
#endif // VIGRA_LINEAR_ALGREBRA_HXX #endif // VIGRA_LINEAR_ALGREBRA_HXX
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 linear_solve.hxx   linear_solve.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2004 by Gunnar Kedenburg and Ullrich Koethe */ /* Copyright 2004 by Gunnar Kedenburg and Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_LINEAR_SOLVE_HXX #ifndef VIGRA_LINEAR_SOLVE_HXX
#define VIGRA_LINEAR_SOLVE_HXX #define VIGRA_LINEAR_SOLVE_HXX
#include "vigra/matrix.hxx" #include "matrix.hxx"
namespace vigra namespace vigra
{ {
namespace linalg namespace linalg
{ {
/** \addtogroup LinearAlgebraFunctions Matrix functions /** \addtogroup LinearAlgebraFunctions Matrix functions
*/ */
//@{ //@{
/** invert square matrix \a v. /** invert square matrix \a v.
The result is written into \a r which must have the same shape. The result is written into \a r which must have the same shape.
The inverse is calculated by means of QR decomposition. If \a v The inverse is calculated by means of QR decomposition. If \a v
is not invertible, <tt>vigra::PreconditionViolation</tt> exception is thrown. is not invertible, <tt>vigra::PreconditionViolation</tt> exception is thrown.
<b>\#include</b> "<a href="linear__solve_8hxx-source.html">vigra/linear __solve.hxx</a>" or<br> <b>\#include</b> "<a href="linear__solve_8hxx-source.html">vigra/linear _solve.hxx</a>" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C1, class C2> template <class T, class C1, class C2>
void inverse(const MultiArrayView<2, T, C1> &v, MultiArrayView<2, T, C2> &r ) void inverse(const MultiArrayView<2, T, C1> &v, MultiArrayView<2, T, C2> &r )
{ {
const unsigned int n = rowCount(r); const unsigned int n = rowCount(r);
vigra_precondition(n == columnCount(v) && n == rowCount(v) && n == colu mnCount(r), vigra_precondition(n == columnCount(v) && n == rowCount(v) && n == colu mnCount(r),
"inverse(): matrices must be square."); "inverse(): matrices must be square.");
vigra_precondition(linearSolve(v, identityMatrix<T>(n), r), vigra_precondition(linearSolve(v, identityMatrix<T>(n), r),
skipping to change at line 84 skipping to change at line 84
is not invertible, <tt>vigra::PreconditionViolation</tt> exception is thrown. is not invertible, <tt>vigra::PreconditionViolation</tt> exception is thrown.
Usage: Usage:
\code \code
vigra::Matrix<double> v(n, n); vigra::Matrix<double> v(n, n);
v = ...; v = ...;
vigra::Matrix<double> m = inverse(v); vigra::Matrix<double> m = inverse(v);
\endcode \endcode
<b>\#include</b> "<a href="linear__solve_8hxx-source.html">vigra/linear __solve.hxx</a>" or<br> <b>\#include</b> "<a href="linear__solve_8hxx-source.html">vigra/linear _solve.hxx</a>" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C> template <class T, class C>
TemporaryMatrix<T> inverse(const MultiArrayView<2, T, C> &v) TemporaryMatrix<T> inverse(const MultiArrayView<2, T, C> &v)
{ {
const unsigned int n = rowCount(v); const unsigned int n = rowCount(v);
vigra_precondition(n == columnCount(v), vigra_precondition(n == columnCount(v),
"inverse(): matrix must be square."); "inverse(): matrix must be square.");
TemporaryMatrix<T> ret = identityMatrix<T>(n); TemporaryMatrix<T> ret = identityMatrix<T>(n);
skipping to change at line 114 skipping to change at line 114
vigra_precondition(n == v.columnCount(), vigra_precondition(n == v.columnCount(),
"inverse(): matrix must be square."); "inverse(): matrix must be square.");
vigra_precondition(linearSolve(v, identityMatrix<T>(n), v), vigra_precondition(linearSolve(v, identityMatrix<T>(n), v),
"inverse(): matrix is not invertible."); "inverse(): matrix is not invertible.");
return v; return v;
} }
/** QR decomposition. /** QR decomposition.
\a a contains the original matrix, results are returned in \a q and \a r, where \a a contains the original matrix, results are returned in \a q and \a r, where
\a q is a orthogonal matrix, and \a r is an uppr triangular matrix, and \a q is a orthogonal matrix, and \a r is an upper triangular matrix , and
the following relation holds: the following relation holds:
\code \code
assert(a == q * r); assert(a == q * r);
\endcode \endcode
This implementation uses householder transformations. It can be app lied in-place, This implementation uses householder transformations. It can be app lied in-place,
i.e. <tt>&a == &r</tt> is allowed. i.e. <tt>&a == &r</tt> is allowed.
<b>\#include</b> "<a href="linear__solve_8hxx-source.html">vigra/linear __solve.hxx</a>" or<br> <b>\#include</b> "<a href="linear__solve_8hxx-source.html">vigra/linear _solve.hxx</a>" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C1, class C2, class C3> template <class T, class C1, class C2, class C3>
void qrDecomposition(MultiArrayView<2, T, C1> const & a, void qrDecomposition(MultiArrayView<2, T, C1> const & a,
MultiArrayView<2, T, C2> &q, MultiArrayView<2, T, C3> &r) MultiArrayView<2, T, C2> &q, MultiArrayView<2, T, C3> &r)
{ {
typedef typename MultiArrayView<2, T, C2>::difference_type MatrixShape; typedef typename MultiArrayView<2, T, C2>::difference_type MatrixShape;
typedef typename MultiArray<1, T>::difference_type VectorShape; typedef typename MultiArray<1, T>::difference_type VectorShape;
skipping to change at line 208 skipping to change at line 208
The square matrix \a a must be a right-triangular coefficient matri x as can, The square matrix \a a must be a right-triangular coefficient matri x as can,
for example, be obtained by means of QR decomposition. The column v ectors for example, be obtained by means of QR decomposition. The column v ectors
in \a b are the right-hand sides of the equation (so, several equat ions in \a b are the right-hand sides of the equation (so, several equat ions
with the same coefficients can be solved in one go). The result is returned with the same coefficients can be solved in one go). The result is returned
int \a x, whose columns contain the solutions for the correspoindin g int \a x, whose columns contain the solutions for the correspoindin g
columns of \a b. The number of columns of \a a must equal the numbe r of rows of columns of \a b. The number of columns of \a a must equal the numbe r of rows of
both \a b and \a x, and the number of columns of \a b and \a x must be both \a b and \a x, and the number of columns of \a b and \a x must be
equal. This implementation can be applied in-place, i.e. <tt>&b == &x</tt> is allowed. equal. This implementation can be applied in-place, i.e. <tt>&b == &x</tt> is allowed.
<b>\#include</b> "<a href="linear__solve_8hxx-source.html">vigra/linear __solve.hxx</a>" or<br> <b>\#include</b> "<a href="linear__solve_8hxx-source.html">vigra/linear _solve.hxx</a>" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C1, class C2, class C3> template <class T, class C1, class C2, class C3>
void reverseElimination(const MultiArrayView<2, T, C1> &r, const MultiArray View<2, T, C2> &b, void reverseElimination(const MultiArrayView<2, T, C1> &r, const MultiArray View<2, T, C2> &b,
MultiArrayView<2, T, C3> & x) MultiArrayView<2, T, C3> & x)
{ {
unsigned int m = columnCount(r); unsigned int m = columnCount(r);
unsigned int n = columnCount(b); unsigned int n = columnCount(b);
vigra_precondition(m == rowCount(r), vigra_precondition(m == rowCount(r),
skipping to change at line 255 skipping to change at line 255
The square matrix \a a is the coefficient matrix, and the column ve ctors The square matrix \a a is the coefficient matrix, and the column ve ctors
in \a b are the right-hand sides of the equation (so, several equat ions in \a b are the right-hand sides of the equation (so, several equat ions
with the same coefficients can be solved in one go). The result is returned with the same coefficients can be solved in one go). The result is returned
int \a res, whose columns contain the solutions for the correspoind ing int \a res, whose columns contain the solutions for the correspoind ing
columns of \a b. The number of columns of \a a must equal the numbe r of rows of columns of \a b. The number of columns of \a a must equal the numbe r of rows of
both \a b and \a res, and the number of columns of \a b and \a res must be both \a b and \a res, and the number of columns of \a b and \a res must be
equal. The algorithm uses QR decomposition of \a a. The algorithm r eturns equal. The algorithm uses QR decomposition of \a a. The algorithm r eturns
<tt>false</tt> if \a a doesn't have full rank. This implementation can be <tt>false</tt> if \a a doesn't have full rank. This implementation can be
applied in-place, i.e. <tt>&b == &res</tt> or <tt>&a == &res</tt> a re allowed. applied in-place, i.e. <tt>&b == &res</tt> or <tt>&a == &res</tt> a re allowed.
<b>\#include</b> "<a href="linear__solve_8hxx-source.html">vigra/linear __solve.hxx</a>" or<br> <b>\#include</b> "<a href="linear__solve_8hxx-source.html">vigra/linear _solve.hxx</a>" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C1, class C2, class C3> template <class T, class C1, class C2, class C3>
bool linearSolve(const MultiArrayView<2, T, C1> &a, const MultiArrayView<2, T, C2> &b, bool linearSolve(const MultiArrayView<2, T, C1> &a, const MultiArrayView<2, T, C2> &b,
MultiArrayView<2, T, C3> & res) MultiArrayView<2, T, C3> & res)
{ {
unsigned int acols = columnCount(a); unsigned int acols = columnCount(a);
unsigned int bcols = columnCount(b); unsigned int bcols = columnCount(b);
vigra_precondition(acols == rowCount(a), vigra_precondition(acols == rowCount(a),
"linearSolve(): square coefficient matrix required."); "linearSolve(): square coefficient matrix required.");
vigra_precondition(acols == rowCount(b) && acols == rowCount(res) && bc ols == columnCount(res), vigra_precondition(acols == rowCount(b) && acols == rowCount(res) && bc ols == columnCount(res),
"linearSolve(): matrix shape mismatch."); "linearSolve(): matrix shape mismatch.");
Matrix<T> q(acols, acols), r(a); Matrix<T> q(acols, acols), r(a);
qrDecomposition(r, q, r); qrDecomposition(r, q, r);
if(r(acols-1, acols-1) == NumericTraits<T>::zero()) for(unsigned int k=0; k<acols; ++k)
return false; // a didn't have full rank. if(r(k,k) == NumericTraits<T>::zero())
return false; // a didn't have full rank.
q.transpose(); q.transpose();
reverseElimination(r, q * b, res); reverseElimination(r, q * b, res);
return true; return true;
} }
//@} //@}
} // namespace linalg } // namespace linalg
using linalg::inverse; using linalg::inverse;
 End of changes. 9 change blocks. 
10 lines changed or deleted 11 lines changed or added


 localminmax.hxx   localminmax.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_LOCALMINMAX_HXX #ifndef VIGRA_LOCALMINMAX_HXX
#define VIGRA_LOCALMINMAX_HXX #define VIGRA_LOCALMINMAX_HXX
#include <vector> #include <vector>
#include <functional> #include <functional>
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
#include "vigra/initimage.hxx" #include "initimage.hxx"
#include "vigra/labelimage.hxx" #include "labelimage.hxx"
#include "vigra/pixelneighborhood.hxx" #include "pixelneighborhood.hxx"
namespace vigra { namespace vigra {
/** \addtogroup LocalMinMax Local Minima and Maxima /** \addtogroup LocalMinMax Local Minima and Maxima
Detect local minima and maxima of the gray level, Detect local minima and maxima of the gray level,
including extremal plateaus larger than 1 pixel including extremal plateaus larger than 1 pixel
*/ */
//@{ //@{
skipping to change at line 407 skipping to change at line 407
} }
namespace detail { namespace detail {
template <class SrcIterator, class SrcAccessor, template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor, class DestValue, class DestIterator, class DestAccessor, class DestValue,
class Neighborhood, class Compare, class Equal> class Neighborhood, class Compare, class Equal>
void void
extendedLocalMinMax(SrcIterator sul, SrcIterator slr, SrcAccessor sa, extendedLocalMinMax(SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da, DestValue marker, DestIterator dul, DestAccessor da, DestValue marker,
Neighborhood neighborhood, Compare compare, Equal equal) Neighborhood /*neighborhood*/, Compare compare, Equal equal)
{ {
typedef typename SrcAccessor::value_type SrcType; typedef typename SrcAccessor::value_type SrcType;
int w = slr.x - sul.x; int w = slr.x - sul.x;
int h = slr.y - sul.y; int h = slr.y - sul.y;
int i,x,y; int i,x,y;
BasicImage<int> labels(w,h); BasicImage<int> labels(w,h);
int number_of_regions = int number_of_regions =
labelImage(sul, slr, sa, labels.upperLeft(), labels.accessor(), labelImage(sul, slr, sa, labels.upperLeft(), labels.accessor(),
(Neighborhood::DirectionCount == 8), equal); (Neighborhood::DirectionCount == 8), equal);
// assume that a region is a extremum until the opposite is proved // assume that a region is a extremum until the opposite is proved
std::vector<unsigned char> isExtremum(number_of_regions+1, 1); std::vector<unsigned char> isExtremum(number_of_regions+1, (unsigned ch ar)1);
BasicImage<int>::traverser ly = labels.upperLeft(); BasicImage<int>::traverser ly = labels.upperLeft();
for(y=0; y<h; ++y, ++sul.y, ++ly.y) for(y=0; y<h; ++y, ++sul.y, ++ly.y)
{ {
SrcIterator sx = sul; SrcIterator sx = sul;
BasicImage<int>::traverser lx(ly); BasicImage<int>::traverser lx(ly);
for(x=0; x<w; ++x, ++sx.x, ++lx.x) for(x=0; x<w; ++x, ++sx.x, ++lx.x)
{ {
 End of changes. 4 change blocks. 
8 lines changed or deleted 8 lines changed or added


 mathutil.hxx   mathutil.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2005 by Ullrich Koethe */ /* Copyright 1998-2005 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_MATHUTIL_HXX #ifndef VIGRA_MATHUTIL_HXX
#define VIGRA_MATHUTIL_HXX #define VIGRA_MATHUTIL_HXX
#include <cmath> #include <cmath>
#include <cstdlib> #include <cstdlib>
#include "vigra/config.hxx" #include "config.hxx"
#include "vigra/sized_int.hxx" #include "error.hxx"
#include "vigra/numerictraits.hxx" #include "tuple.hxx"
#include "sized_int.hxx"
#include "numerictraits.hxx"
/*! \page MathConstants Mathematical Constants /*! \page MathConstants Mathematical Constants
<TT>M_PI, M_SQRT2</TT> <TT>M_PI, M_SQRT2</TT>
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathutil.hx x</a>" <b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathutil.hx x</a>"
Since <TT>M_PI</TT> and <TT>M_SQRT2</TT> are not officially standardize d, Since <TT>M_PI</TT> and <TT>M_SQRT2</TT> are not officially standardize d,
we provide definitions here for those compilers that don't support them . we provide definitions here for those compilers that don't support them .
skipping to change at line 76 skipping to change at line 78
#ifndef M_PI #ifndef M_PI
# define M_PI 3.14159265358979323846 # define M_PI 3.14159265358979323846
#endif #endif
#ifndef M_SQRT2 #ifndef M_SQRT2
# define M_SQRT2 1.41421356237309504880 # define M_SQRT2 1.41421356237309504880
#endif #endif
namespace vigra { namespace vigra {
#ifndef __sun
/** \addtogroup MathFunctions Mathematical Functions /** \addtogroup MathFunctions Mathematical Functions
Useful mathematical functions and functors. Useful mathematical functions and functors.
*/ */
//@{ //@{
/*! The error function.
If <tt>erf()</tt> is not provided in the C standard math library (a
s it should according to the
new C99 standard ?), VIGRA implements <tt>erf()</tt> as an approxim
ation of the error
function
\f[
\mbox{erf}(x) = \int_0^x e^{-x^2} dx
\f]
according to the formula given in Press et al. "Numerical Recipes".
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti
l.hxx</a>"<br>
Namespace: vigra
*/
template <class T>
double erf(T x)
{
double t = 1.0/(1.0+0.5*VIGRA_CSTD::fabs(x));
double ans = t*VIGRA_CSTD::exp(-x*x-1.26551223+t*(1.00002368+t*(0.37409
196+
t*(0.09678418+t*(-0.18628806+t*(0.27886
807+
t*(-1.13520398+t*(1.48851587+t*(-0.8221
5223+
t*0.17087277)))))))));
if (x >= 0.0)
return 1.0 - ans;
else
return ans - 1.0;
}
#else
using VIGRA_CSTD::erf;
#endif
// import functions into namespace vigra which VIGRA is going to overload // import functions into namespace vigra which VIGRA is going to overload
using VIGRA_CSTD::pow; using VIGRA_CSTD::pow;
using VIGRA_CSTD::floor; using VIGRA_CSTD::floor;
using VIGRA_CSTD::ceil; using VIGRA_CSTD::ceil;
// import abs(float), abs(double), abs(long double) from <cmath>
// and abs(int), abs(long), abs(long long) from <cstdlib>
using std::abs; using std::abs;
// define the missing variants of abs() to avoid 'ambigous overload'
// errors in template functions
#define VIGRA_DEFINE_UNSIGNED_ABS(T) \ #define VIGRA_DEFINE_UNSIGNED_ABS(T) \
inline T abs(T t) { return t; } inline T abs(T t) { return t; }
VIGRA_DEFINE_UNSIGNED_ABS(bool) VIGRA_DEFINE_UNSIGNED_ABS(bool)
VIGRA_DEFINE_UNSIGNED_ABS(unsigned char) VIGRA_DEFINE_UNSIGNED_ABS(unsigned char)
VIGRA_DEFINE_UNSIGNED_ABS(unsigned short) VIGRA_DEFINE_UNSIGNED_ABS(unsigned short)
VIGRA_DEFINE_UNSIGNED_ABS(unsigned int) VIGRA_DEFINE_UNSIGNED_ABS(unsigned int)
VIGRA_DEFINE_UNSIGNED_ABS(unsigned long) VIGRA_DEFINE_UNSIGNED_ABS(unsigned long)
VIGRA_DEFINE_UNSIGNED_ABS(unsigned long long)
#undef VIGRA_DEFINE_UNSIGNED_ABS #undef VIGRA_DEFINE_UNSIGNED_ABS
#define VIGRA_DEFINE_MISSING_ABS(T) \
inline T abs(T t) { return t < 0 ? -t : t; }
VIGRA_DEFINE_MISSING_ABS(signed char)
VIGRA_DEFINE_MISSING_ABS(signed short)
#undef VIGRA_DEFINE_MISSING_ABS
/*! The rounding function. /*! The rounding function.
Defined for all floating point types. Rounds towards the nearest in Defined for all floating point types. Rounds towards the nearest in
teger for both teger
positive and negative inputs. such that <tt>abs(round(t)) == round(abs(t))</tt> for all <tt>t</tt
>.
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti l.hxx</a>"<br> <b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti l.hxx</a>"<br>
Namespace: vigra Namespace: vigra
*/ */
inline float round(float t) inline float round(float t)
{ {
return t >= 0.0 return t >= 0.0
? floor(t + 0.5) ? floor(t + 0.5)
: ceil(t - 0.5); : ceil(t - 0.5);
} }
inline double round(double t) inline double round(double t)
{ {
return t >= 0.0 return t >= 0.0
? floor(t + 0.5) ? floor(t + 0.5)
: ceil(t - 0.5); : ceil(t - 0.5);
} }
inline long double round(long double t) inline long double round(long double t)
{ {
return t >= 0.0 return t >= 0.0
? floor(t + 0.5) ? floor(t + 0.5)
: ceil(t - 0.5); : ceil(t - 0.5);
} }
/*! The square function. /*! The square function.
sq(x) is needed so often that it makes sense to define it as a func tion. sq(x) is needed so often that it makes sense to define it as a func tion.
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti l.hxx</a>"<br> <b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti l.hxx</a>"<br>
Namespace: vigra Namespace: vigra
*/ */
template <class T> template <class T>
skipping to change at line 215 skipping to change at line 194
224, 224, 225, 225, 226, 226, 227, 227, 228, 229, 229, 230, 230 , 231, 224, 224, 225, 225, 226, 226, 227, 227, 228, 229, 229, 230, 230 , 231,
231, 232, 232, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238 , 238, 231, 232, 232, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238 , 238,
239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245 , 246, 239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245 , 246,
246, 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252 , 253, 246, 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252 , 253,
253, 254, 254, 255 253, 254, 254, 255
}; };
template <class T> template <class T>
UInt32 IntSquareRoot<T>::exec(UInt32 x) UInt32 IntSquareRoot<T>::exec(UInt32 x)
{ {
unsigned long xn; UInt32 xn;
if (x >= 0x10000) if (x >= 0x10000)
if (x >= 0x1000000) if (x >= 0x1000000)
if (x >= 0x10000000) if (x >= 0x10000000)
if (x >= 0x40000000) { if (x >= 0x40000000) {
if (x >= (UInt32)65535*(UInt32)65535) if (x >= (UInt32)65535*(UInt32)65535)
return 65535; return 65535;
xn = sqq_table[x>>24] << 8; xn = sqq_table[x>>24] << 8;
} else } else
xn = sqq_table[x>>22] << 7; xn = sqq_table[x>>22] << 7;
else else
skipping to change at line 280 skipping to change at line 259
return xn; return xn;
} }
} // namespace detail } // namespace detail
using VIGRA_CSTD::sqrt; using VIGRA_CSTD::sqrt;
/*! Signed integer square root. /*! Signed integer square root.
Useful for fast fixed-point computations.
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti l.hxx</a>"<br> <b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti l.hxx</a>"<br>
Namespace: vigra Namespace: vigra
*/ */
inline Int32 sqrti(Int32 v) inline Int32 sqrti(Int32 v)
{ {
if(v < 0) if(v < 0)
throw std::domain_error("sqrti(Int32): negative argument."); throw std::domain_error("sqrti(Int32): negative argument.");
return (Int32)detail::IntSquareRoot<UInt32>::exec((UInt32)v); return (Int32)detail::IntSquareRoot<UInt32>::exec((UInt32)v);
} }
/*! Unsigned integer square root. /*! Unsigned integer square root.
Useful for fast fixed-point computations.
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti l.hxx</a>"<br> <b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti l.hxx</a>"<br>
Namespace: vigra Namespace: vigra
*/ */
inline UInt32 sqrti(UInt32 v) inline UInt32 sqrti(UInt32 v)
{ {
return detail::IntSquareRoot<UInt32>::exec(v); return detail::IntSquareRoot<UInt32>::exec(v);
} }
#ifdef VIGRA_NO_HYPOT #ifndef VIGRA_HAS_HYPOT
/*! Compute the Euclidean distance (length of the hypothenuse of a righ t-angled triangle). /*! Compute the Euclidean distance (length of the hypothenuse of a righ t-angled triangle).
The hypot() function returns the sqrt(a*a + b*b). The hypot() function returns the sqrt(a*a + b*b).
It is implemented in a way that minimizes round-off error. It is implemented in a way that minimizes round-off error.
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti l.hxx</a>"<br> <b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti l.hxx</a>"<br>
Namespace: vigra Namespace: vigra
*/ */
template <class T> inline double hypot(double a, double b)
T hypot(T a, T b)
{ {
T absa = abs(a), absb = abs(b); double absa = VIGRA_CSTD::fabs(a), absb = VIGRA_CSTD::fabs(b);
if (absa > absb) if (absa > absb)
return absa * VIGRA_CSTD::sqrt(1.0 + sq(absb/absa)); return absa * VIGRA_CSTD::sqrt(1.0 + sq(absb/absa));
else else
return absb == NumericTraits<T>::zero() return absb == 0.0
? NumericTraits<T>::zero() ? 0.0
: absb * VIGRA_CSTD::sqrt(1.0 + sq(absa/absb)); : absb * VIGRA_CSTD::sqrt(1.0 + sq(absa/absb));
} }
#else #else
using ::hypot; using ::hypot;
#endif #endif
/*! The sign function. /*! The sign function.
skipping to change at line 415 skipping to change at line 397
template <class T> template <class T>
inline typename NormTraits<T>::NormType inline typename NormTraits<T>::NormType
norm(T const & t) norm(T const & t)
{ {
typedef typename NormTraits<T>::SquaredNormType SNT; typedef typename NormTraits<T>::SquaredNormType SNT;
return sqrt(static_cast<typename SquareRootTraits<SNT>::SquareRootArgum ent>(squaredNorm(t))); return sqrt(static_cast<typename SquareRootTraits<SNT>::SquareRootArgum ent>(squaredNorm(t)));
} }
namespace detail { namespace detail {
template <class T>
T ellipticRD(T x, T y, T z)
{
double f = 1.0, s = 0.0, X, Y, Z, m;
while(true)
{
m = (x + y + 3.0*z) / 5.0;
X = 1.0 - x/m;
Y = 1.0 - y/m;
Z = 1.0 - z/m;
if(std::max(std::max(VIGRA_CSTD::fabs(X), VIGRA_CSTD::fabs(Y)), VIG
RA_CSTD::fabs(Z)) < 0.01)
break;
double l = VIGRA_CSTD::sqrt(x*y) + VIGRA_CSTD::sqrt(x*z) + VIGRA_CS
TD::sqrt(y*z);
s += f / (VIGRA_CSTD::sqrt(z)*(z + l));
f /= 4.0;
x = (x + l)/4.0;
y = (y + l)/4.0;
z = (z + l)/4.0;
}
double a = X*Y;
double b = sq(Z);
double c = a - b;
double d = a - 6.0*b;
double e = d + 2.0*c;
return 3.0*s + f*(1.0+d*(-3.0/14.0+d*9.0/88.0-Z*e*4.5/26.0)
+Z*(e/6.0+Z*(-c*9.0/22.0+a*Z*3.0/26.0))) / VIGRA_CSTD
::pow(m,1.5);
}
template <class T>
T ellipticRF(T x, T y, T z)
{
double X, Y, Z, m;
while(true)
{
m = (x + y + z) / 3.0;
X = 1.0 - x/m;
Y = 1.0 - y/m;
Z = 1.0 - z/m;
if(std::max(std::max(VIGRA_CSTD::fabs(X), VIGRA_CSTD::fabs(Y)), VIG
RA_CSTD::fabs(Z)) < 0.01)
break;
double l = VIGRA_CSTD::sqrt(x*y) + VIGRA_CSTD::sqrt(x*z) + VIGRA_CS
TD::sqrt(y*z);
x = (x + l)/4.0;
y = (y + l)/4.0;
z = (z + l)/4.0;
}
double d = X*Y - sq(Z);
double p = X*Y*Z;
return (1.0 - d/10.0 + p/14.0 + sq(d)/24.0 - d*p*3.0/44.0) / VIGRA_CSTD
::sqrt(m);
}
} // namespace detail
/*! The incomplete elliptic integral of the first kind.
Computes
\f[
\mbox{F}(x, k) = \int_0^x \frac{1}{\sqrt{1 - k^2 \sin(t)^2}} dt
\f]
according to the algorithm given in Press et al. "Numerical Recipes
".
Note: In some libraries (e.g. Mathematica), the second parameter of
the elliptic integral
functions must be k^2 rather than k. Check the documentation when r
esults disagree!
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti
l.hxx</a>"<br>
Namespace: vigra
*/
inline double ellipticIntegralF(double x, double k)
{
double c2 = sq(VIGRA_CSTD::cos(x));
double s = VIGRA_CSTD::sin(x);
return s*detail::ellipticRF(c2, 1.0 - sq(k*s), 1.0);
}
/*! The incomplete elliptic integral of the second kind.
Computes
\f[
\mbox{E}(x, k) = \int_0^x \sqrt{1 - k^2 \sin(t)^2} dt
\f]
according to the algorithm given in Press et al. "Numerical Recipes
". The
complete elliptic integral of the second kind is simply <tt>ellipti
cIntegralE(M_PI/2, k)</TT>.
Note: In some libraries (e.g. Mathematica), the second parameter of
the elliptic integral
functions must be k^2 rather than k. Check the documentation when r
esults disagree!
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti
l.hxx</a>"<br>
Namespace: vigra
*/
inline double ellipticIntegralE(double x, double k)
{
double c2 = sq(VIGRA_CSTD::cos(x));
double s = VIGRA_CSTD::sin(x);
k = sq(k*s);
return s*(detail::ellipticRF(c2, 1.0-k, 1.0) - k/3.0*detail::ellipticRD
(c2, 1.0-k, 1.0));
}
#ifndef VIGRA_HAS_ERF
namespace detail {
template <class T>
double erfImpl(T x)
{
double t = 1.0/(1.0+0.5*VIGRA_CSTD::fabs(x));
double ans = t*VIGRA_CSTD::exp(-x*x-1.26551223+t*(1.00002368+t*(0.37409
196+
t*(0.09678418+t*(-0.18628806+t*(0.27886
807+
t*(-1.13520398+t*(1.48851587+t*(-0.8221
5223+
t*0.17087277)))))))));
if (x >= 0.0)
return 1.0 - ans;
else
return ans - 1.0;
}
} // namespace detail
/*! The error function.
If <tt>erf()</tt> is not provided in the C standard math library (a
s it should according to the
new C99 standard ?), VIGRA implements <tt>erf()</tt> as an approxim
ation of the error
function
\f[
\mbox{erf}(x) = \int_0^x e^{-t^2} dt
\f]
according to the formula given in Press et al. "Numerical Recipes".
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti
l.hxx</a>"<br>
Namespace: vigra
*/
inline double erf(double x)
{
return detail::erfImpl(x);
}
#else
using VIGRA_CSTD::erf;
#endif
namespace detail {
template <class T>
double noncentralChi2CDFApprox(unsigned int degreesOfFreedom, T noncentrali
ty, T arg)
{
double a = degreesOfFreedom + noncentrality;
double b = (a + noncentrality) / sq(a);
double t = (VIGRA_CSTD::pow((double)arg / a, 1.0/3.0) - (1.0 - 2.0 / 9.
0 * b)) / VIGRA_CSTD::sqrt(2.0 / 9.0 * b);
return 0.5*(1.0 + erf(t/VIGRA_CSTD::sqrt(2.0)));
}
template <class T>
void noncentralChi2OneIteration(T arg, T & lans, T & dans, T & pans, unsign
ed int & j)
{
double tol = -50.0;
if(lans < tol)
{
lans = lans + VIGRA_CSTD::log(arg / j);
dans = VIGRA_CSTD::exp(lans);
}
else
{
dans = dans * arg / j;
}
pans = pans - dans;
j += 2;
}
template <class T>
std::pair<double, double> noncentralChi2CDF(unsigned int degreesOfFreedom,
T noncentrality, T arg, T eps)
{
vigra_precondition(noncentrality >= 0.0 && arg >= 0.0 && eps > 0.0,
"noncentralChi2P(): parameters must be positive.");
if (arg == 0.0 && degreesOfFreedom > 0)
return std::make_pair(0.0, 0.0);
// Determine initial values
double b1 = 0.5 * noncentrality,
ao = VIGRA_CSTD::exp(-b1),
eps2 = eps / ao,
lnrtpi2 = 0.22579135264473,
probability, density, lans, dans, pans, sum, am, hold;
unsigned int maxit = 500,
i, m;
if(degreesOfFreedom % 2)
{
i = 1;
lans = -0.5 * (arg + VIGRA_CSTD::log(arg)) - lnrtpi2;
dans = VIGRA_CSTD::exp(lans);
pans = erf(VIGRA_CSTD::sqrt(arg/2.0));
}
else
{
i = 2;
lans = -0.5 * arg;
dans = VIGRA_CSTD::exp(lans);
pans = 1.0 - dans;
}
// Evaluate first term
if(degreesOfFreedom == 0)
{
m = 1;
degreesOfFreedom = 2;
am = b1;
sum = 1.0 / ao - 1.0 - am;
density = am * dans;
probability = 1.0 + am * pans;
}
else
{
m = 0;
degreesOfFreedom = degreesOfFreedom - 1;
am = 1.0;
sum = 1.0 / ao - 1.0;
while(i < degreesOfFreedom)
detail::noncentralChi2OneIteration(arg, lans, dans, pans, i);
degreesOfFreedom = degreesOfFreedom + 1;
density = dans;
probability = pans;
}
// Evaluate successive terms of the expansion
for(++m; m<maxit; ++m)
{
am = b1 * am / m;
detail::noncentralChi2OneIteration(arg, lans, dans, pans, degreesOf
Freedom);
sum = sum - am;
density = density + am * dans;
hold = am * pans;
probability = probability + hold;
if((pans * sum < eps2) && (hold < eps2))
break; // converged
}
if(m == maxit)
vigra_fail("noncentralChi2P(): no convergence.");
return std::make_pair(0.5 * ao * density, std::min(1.0, std::max(0.0, a
o * probability)));
}
} // namespace detail
/*! Chi square distribution.
Computes the density of a chi square distribution with \a degreesOf
Freedom
and tolerance \a accuracy at the given argument \a arg
by calling <tt>noncentralChi2(degreesOfFreedom, 0.0, arg, accuracy)
</tt>.
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti
l.hxx</a>"<br>
Namespace: vigra
*/
inline double chi2(unsigned int degreesOfFreedom, double arg, double accura
cy = 1e-7)
{
return detail::noncentralChi2CDF(degreesOfFreedom, 0.0, arg, accuracy).
first;
}
/*! Cumulative chi square distribution.
Computes the cumulative density of a chi square distribution with \
a degreesOfFreedom
and tolerance \a accuracy at the given argument \a arg, i.e. the pr
obability that
a random number drawn from the distribution is below \a arg
by calling <tt>noncentralChi2CDF(degreesOfFreedom, 0.0, arg, accura
cy)</tt>.
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti
l.hxx</a>"<br>
Namespace: vigra
*/
inline double chi2CDF(unsigned int degreesOfFreedom, double arg, double acc
uracy = 1e-7)
{
return detail::noncentralChi2CDF(degreesOfFreedom, 0.0, arg, accuracy).
second;
}
/*! Non-central chi square distribution.
Computes the density of a non-central chi square distribution with
\a degreesOfFreedom,
noncentrality parameter \a noncentrality and tolerance \a accuracy
at the given argument
\a arg. It uses Algorithm AS 231 from Appl. Statist. (1987) Vol.36,
No.3 (code ported from
http://lib.stat.cmu.edu/apstat/231). The algorithm has linear compl
exity in the number of
degrees of freedom.
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti
l.hxx</a>"<br>
Namespace: vigra
*/
inline double noncentralChi2(unsigned int degreesOfFreedom,
double noncentrality, double arg, double accuracy = 1e-7)
{
return detail::noncentralChi2CDF(degreesOfFreedom, noncentrality, arg,
accuracy).first;
}
/*! Cumulative non-central chi square distribution.
Computes the cumulative density of a chi square distribution with \
a degreesOfFreedom,
noncentrality parameter \a noncentrality and tolerance \a accuracy
at the given argument
\a arg, i.e. the probability that a random number drawn from the di
stribution is below \a arg
It uses Algorithm AS 231 from Appl. Statist. (1987) Vol.36, No.3 (c
ode ported from
http://lib.stat.cmu.edu/apstat/231). The algorithm has linear compl
exity in the number of
degrees of freedom (see noncentralChi2CDFApprox() for a constant-ti
me algorithm).
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti
l.hxx</a>"<br>
Namespace: vigra
*/
inline double noncentralChi2CDF(unsigned int degreesOfFreedom,
double noncentrality, double arg, double accuracy = 1e-7)
{
return detail::noncentralChi2CDF(degreesOfFreedom, noncentrality, arg,
accuracy).second;
}
/*! Cumulative non-central chi square distribution (approximate).
Computes approximate values of the cumulative density of a chi squa
re distribution with \a degreesOfFreedom,
and noncentrality parameter \a noncentrality at the given argument
\a arg, i.e. the probability that a random number drawn from the di
stribution is below \a arg
It uses the approximate transform into a normal distribution due to
Wilson and Hilferty
(see Abramovitz, Stegun: "Handbook of Mathematical Functions", form
ula 26.3.32).
The algorithm's running time is independent of the inputs, i.e. is
should be used
when noncentralChi2CDF() is too slow, and approximate values are su
fficient. The accuracy is only
about 0.1 for few degrees of freedom, but reaches about 0.001 above
dof = 5.
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti
l.hxx</a>"<br>
Namespace: vigra
*/
inline double noncentralChi2CDFApprox(unsigned int degreesOfFreedom, double
noncentrality, double arg)
{
return detail::noncentralChi2CDFApprox(degreesOfFreedom, noncentrality,
arg);
}
namespace detail {
// both f1 and f2 are unsigned here // both f1 and f2 are unsigned here
template<class FPT> template<class FPT>
inline inline
FPT safeFloatDivision( FPT f1, FPT f2 ) FPT safeFloatDivision( FPT f1, FPT f2 )
{ {
return f2 < NumericTraits<FPT>::one() && f1 > f2 * NumericTraits<FPT>: :max() return f2 < NumericTraits<FPT>::one() && f1 > f2 * NumericTraits<FPT>: :max()
? NumericTraits<FPT>::max() ? NumericTraits<FPT>::max()
: (f2 > NumericTraits<FPT>::one() && f1 < f2 * NumericTrait s<FPT>::smallestPositive()) || : (f2 > NumericTraits<FPT>::one() && f1 < f2 * NumericTrait s<FPT>::smallestPositive()) ||
f1 == NumericTraits<FPT>::zero() f1 == NumericTraits<FPT>::zero()
? NumericTraits<FPT>::zero() ? NumericTraits<FPT>::zero()
skipping to change at line 444 skipping to change at line 757
rarely exactly equal in practice. If the tolerance \a epsilon is no t given, rarely exactly equal in practice. If the tolerance \a epsilon is no t given,
twice the machine epsilon is used. twice the machine epsilon is used.
<b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti l.hxx</a>"<br> <b>\#include</b> "<a href="mathutil_8hxx-source.html">vigra/mathuti l.hxx</a>"<br>
Namespace: vigra Namespace: vigra
*/ */
template <class T1, class T2> template <class T1, class T2>
bool closeAtTolerance(T1 l, T2 r, typename PromoteTraits<T1, T2>::Promote e psilon) bool closeAtTolerance(T1 l, T2 r, typename PromoteTraits<T1, T2>::Promote e psilon)
{ {
typedef typename PromoteTraits<T1, T2>::Promote T; typedef typename PromoteTraits<T1, T2>::Promote T;
if(l == 0.0 && r != 0.0) if(l == 0.0)
return VIGRA_CSTD::fabs(r) <= epsilon;
if(l != 0.0 && r == 0.0)
return VIGRA_CSTD::fabs(r) <= epsilon; return VIGRA_CSTD::fabs(r) <= epsilon;
if(r == 0.0)
return VIGRA_CSTD::fabs(l) <= epsilon;
T diff = VIGRA_CSTD::fabs( l - r ); T diff = VIGRA_CSTD::fabs( l - r );
T d1 = detail::safeFloatDivision<T>( diff, VIGRA_CSTD::fabs( r ) ); T d1 = detail::safeFloatDivision<T>( diff, VIGRA_CSTD::fabs( r ) );
T d2 = detail::safeFloatDivision<T>( diff, VIGRA_CSTD::fabs( l ) ); T d2 = detail::safeFloatDivision<T>( diff, VIGRA_CSTD::fabs( l ) );
return (d1 <= epsilon && d2 <= epsilon); return (d1 <= epsilon && d2 <= epsilon);
} }
template <class T1, class T2> template <class T1, class T2>
bool closeAtTolerance(T1 l, T2 r) bool closeAtTolerance(T1 l, T2 r)
{ {
 End of changes. 22 change blocks. 
69 lines changed or deleted 440 lines changed or added


 matrix.hxx   matrix.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2004 by Gunnar Kedenburg and Ullrich Koethe */ /* Copyright 2004 by Gunnar Kedenburg and Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 44 skipping to change at line 44
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_MATRIX_HXX #ifndef VIGRA_MATRIX_HXX
#define VIGRA_MATRIX_HXX #define VIGRA_MATRIX_HXX
#include <cmath> #include <cmath>
#include <iosfwd> #include <iosfwd>
#include <iomanip> #include <iomanip>
#include "vigra/multi_array.hxx" #include "multi_array.hxx"
#include "vigra/mathutil.hxx" #include "mathutil.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
namespace vigra namespace vigra
{ {
namespace linalg namespace linalg
{ {
template <class T, class C> template <class T, class C>
inline unsigned int rowCount(const MultiArrayView<2, T, C> &x); inline std::size_t rowCount(const MultiArrayView<2, T, C> &x);
template <class T, class C> template <class T, class C>
inline unsigned int columnCount(const MultiArrayView<2, T, C> &x); inline std::size_t columnCount(const MultiArrayView<2, T, C> &x);
template <class T, class C> template <class T, class C>
MultiArrayView <2, T, C> MultiArrayView <2, T, C>
rowVector(MultiArrayView <2, T, C> const & m, int d); rowVector(MultiArrayView <2, T, C> const & m, int d);
template <class T, class C> template <class T, class C>
MultiArrayView <2, T, C> MultiArrayView <2, T, C>
columnVector(MultiArrayView<2, T, C> const & m, int d); columnVector(MultiArrayView<2, T, C> const & m, int d);
template <class T, class ALLOC> template <class T, class ALLOC>
skipping to change at line 151 skipping to change at line 151
explicit Matrix(const difference_type &shape, explicit Matrix(const difference_type &shape,
ALLOC const & alloc = allocator_type()) ALLOC const & alloc = allocator_type())
: BaseType(shape, alloc) : BaseType(shape, alloc)
{} {}
/** construct with given shape and init all /** construct with given shape and init all
elements with zero. Note that the order of the axes is elements with zero. Note that the order of the axes is
<tt>(rows, columns)</tt> which <tt>(rows, columns)</tt> which
is the opposite of the usual VIGRA convention. is the opposite of the usual VIGRA convention.
*/ */
Matrix(unsigned int rows, unsigned int columns, Matrix(std::size_t rows, std::size_t columns,
ALLOC const & alloc = allocator_type()) ALLOC const & alloc = allocator_type())
: BaseType(difference_type(rows, columns), alloc) : BaseType(difference_type(rows, columns), alloc)
{} {}
/** construct with given shape and init all /** construct with given shape and init all
elements with the constant \a init. Note that the order of the axes is elements with the constant \a init. Note that the order of the axes is
<tt>difference_type(rows, columns)</tt> which <tt>difference_type(rows, columns)</tt> which
is the opposite of the usual VIGRA convention. is the opposite of the usual VIGRA convention.
*/ */
Matrix(const difference_type &shape, const_reference init, Matrix(const difference_type &shape, const_reference init,
allocator_type const & alloc = allocator_type()) allocator_type const & alloc = allocator_type())
: BaseType(shape, init, alloc) : BaseType(shape, init, alloc)
{} {}
/** construct with given shape and init all /** construct with given shape and init all
elements with the constant \a init. Note that the order of the axes is elements with the constant \a init. Note that the order of the axes is
<tt>(rows, columns)</tt> which <tt>(rows, columns)</tt> which
is the opposite of the usual VIGRA convention. is the opposite of the usual VIGRA convention.
*/ */
Matrix(unsigned int rows, unsigned int columns, const_reference init, Matrix(std::size_t rows, std::size_t columns, const_reference init,
allocator_type const & alloc = allocator_type()) allocator_type const & alloc = allocator_type())
: BaseType(difference_type(rows, columns), init, alloc) : BaseType(difference_type(rows, columns), init, alloc)
{} {}
/** construct with given shape and copy data from C-style array \a init. /** construct with given shape and copy data from C-style array \a init.
Unless \a layout is <tt>ColumnMajor</tt>, the elements in this array Unless \a layout is <tt>ColumnMajor</tt>, the elements in this array
are assumed to be given in row-major order (the C standard orde r) and are assumed to be given in row-major order (the C standard orde r) and
will automatically be converted to the required column-major fo rmat. will automatically be converted to the required column-major fo rmat.
Note that the order of the axes is <tt>difference_type(rows, co lumns)</tt> which Note that the order of the axes is <tt>difference_type(rows, co lumns)</tt> which
is the opposite of the usual VIGRA convention. is the opposite of the usual VIGRA convention.
skipping to change at line 205 skipping to change at line 205
} }
} }
/** construct with given shape and copy data from C-style array \a init. /** construct with given shape and copy data from C-style array \a init.
Unless \a layout is <tt>ColumnMajor</tt>, the elements in this array Unless \a layout is <tt>ColumnMajor</tt>, the elements in this array
are assumed to be given in row-major order (the C standard orde r) and are assumed to be given in row-major order (the C standard orde r) and
will automatically be converted to the required column-major fo rmat. will automatically be converted to the required column-major fo rmat.
Note that the order of the axes is <tt>(rows, columns)</tt> whi ch Note that the order of the axes is <tt>(rows, columns)</tt> whi ch
is the opposite of the usual VIGRA convention. is the opposite of the usual VIGRA convention.
*/ */
Matrix(unsigned int rows, unsigned int columns, const_pointer init, Raw ArrayMemoryLayout layout = RowMajor, Matrix(std::size_t rows, std::size_t columns, const_pointer init, RawAr rayMemoryLayout layout = RowMajor,
allocator_type const & alloc = allocator_type()) allocator_type const & alloc = allocator_type())
: BaseType(difference_type(rows, columns), alloc) // FIXME: this functi on initializes the memory twice : BaseType(difference_type(rows, columns), alloc) // FIXME: this functi on initializes the memory twice
{ {
if(layout == RowMajor) if(layout == RowMajor)
{ {
difference_type trans(columns, rows); difference_type trans(columns, rows);
linalg::transpose(MultiArrayView<2, T>(trans, const_cast<pointe r>(init)), *this); linalg::transpose(MultiArrayView<2, T>(trans, const_cast<pointe r>(init)), *this);
} }
else else
{ {
skipping to change at line 287 skipping to change at line 287
*/ */
template <class U, class C> template <class U, class C>
Matrix & operator=(const MultiArrayView<2, U, C> &rhs) Matrix & operator=(const MultiArrayView<2, U, C> &rhs)
{ {
BaseType::operator=(rhs); // has the correct semantics already BaseType::operator=(rhs); // has the correct semantics already
return *this; return *this;
} }
/** Create a matrix view that represents the row vector of row \a d . /** Create a matrix view that represents the row vector of row \a d .
*/ */
view_type rowVector(unsigned int d) const view_type rowVector(std::size_t d) const
{ {
return vigra::linalg::rowVector(*this, d); return vigra::linalg::rowVector(*this, d);
} }
/** Create a matrix view that represents the column vector of colum n \a d. /** Create a matrix view that represents the column vector of colum n \a d.
*/ */
view_type columnVector(unsigned int d) const view_type columnVector(std::size_t d) const
{ {
return vigra::linalg::columnVector(*this, d); return vigra::linalg::columnVector(*this, d);
} }
/** number of rows (height) of the matrix. /** number of rows (height) of the matrix.
*/ */
unsigned int rowCount() const std::size_t rowCount() const
{ {
return this->m_shape[0]; return this->m_shape[0];
} }
/** number of columns (width) of the matrix. /** number of columns (width) of the matrix.
*/ */
unsigned int columnCount() const std::size_t columnCount() const
{ {
return this->m_shape[1]; return this->m_shape[1];
} }
/** number of elements (width*height) of the matrix. /** number of elements (width*height) of the matrix.
*/ */
unsigned int elementCount() const std::size_t elementCount() const
{ {
return rowCount()*columnCount(); return rowCount()*columnCount();
} }
/** check whether the matrix is symmetric. /** check whether the matrix is symmetric.
*/ */
bool isSymmetric() const bool isSymmetric() const
{ {
return vigra::linalg::isSymmetric(*this); return vigra::linalg::isSymmetric(*this);
} }
#ifdef DOXYGEN #ifdef DOXYGEN
// repeat the index functions for documentation. In real code, they are inh erited. // repeat the index functions for documentation. In real code, they are inh erited.
/** read/write access to matrix element <tt>(row, column)</tt>. /** read/write access to matrix element <tt>(row, column)</tt>.
Note that the order of the argument is the opposite of the usua l Note that the order of the argument is the opposite of the usua l
VIGRA convention due to column-major matrix order. VIGRA convention due to column-major matrix order.
*/ */
value_type & operator()(unsigned int row, unsigned int column); value_type & operator()(std::size_t row, std::size_t column);
/** read access to matrix element <tt>(row, column)</tt>. /** read access to matrix element <tt>(row, column)</tt>.
Note that the order of the argument is the opposite of the usua l Note that the order of the argument is the opposite of the usua l
VIGRA convention due to column-major matrix order. VIGRA convention due to column-major matrix order.
*/ */
value_type operator()(unsigned int row, unsigned int column) const; value_type operator()(std::size_t row, std::size_t column) const;
#endif #endif
/** squared Frobenius norm. Sum of squares of the matrix elements. /** squared Frobenius norm. Sum of squares of the matrix elements.
*/ */
SquaredNormType squaredNorm() const SquaredNormType squaredNorm() const
{ {
return BaseType::squaredNorm(); return BaseType::squaredNorm();
} }
/** Frobenius norm. Root of sum of squares of the matrix elements. /** Frobenius norm. Root of sum of squares of the matrix elements.
skipping to change at line 383 skipping to change at line 383
Matrix & operator*=(T other); Matrix & operator*=(T other);
/** scalar devide this by \a other /** scalar devide this by \a other
*/ */
Matrix & operator/=(T other); Matrix & operator/=(T other);
}; };
template <class T, class ALLOC> template <class T, class ALLOC>
Matrix<T, ALLOC> & Matrix<T, ALLOC>::transpose() Matrix<T, ALLOC> & Matrix<T, ALLOC>::transpose()
{ {
const unsigned int cols = columnCount(); const std::size_t cols = columnCount();
vigra_precondition(cols == rowCount(), vigra_precondition(cols == rowCount(),
"Matrix::transpose(): in-place transposition requires square matrix ."); "Matrix::transpose(): in-place transposition requires square matrix .");
for(unsigned int i = 0; i < cols; ++i) for(std::size_t i = 0; i < cols; ++i)
for(unsigned int j = i+1; j < cols; ++j) for(std::size_t j = i+1; j < cols; ++j)
std::swap((*this)(j, i), (*this)(i, j)); std::swap((*this)(j, i), (*this)(i, j));
return *this; return *this;
} }
template <class T, class ALLOC> template <class T, class ALLOC>
template <class U, class C> template <class U, class C>
Matrix<T, ALLOC> & Matrix<T, ALLOC>::operator+=(MultiArrayView<2, U, C> con st & other) Matrix<T, ALLOC> & Matrix<T, ALLOC>::operator+=(MultiArrayView<2, U, C> con st & other)
{ {
const unsigned int rows = rowCount(); const std::size_t rows = rowCount();
const unsigned int cols = columnCount(); const std::size_t cols = columnCount();
vigra_precondition(rows == vigra::linalg::rowCount(other) && cols == vi gra::linalg::columnCount(other), vigra_precondition(rows == vigra::linalg::rowCount(other) && cols == vi gra::linalg::columnCount(other),
"Matrix::operator+=(): Shape mismatch."); "Matrix::operator+=(): Shape mismatch.");
for(unsigned int i = 0; i < cols; ++i) for(std::size_t i = 0; i < cols; ++i)
for(unsigned int j = 0; j < rows; ++j) for(std::size_t j = 0; j < rows; ++j)
(*this)(j, i) += other(j, i); (*this)(j, i) += other(j, i);
return *this; return *this;
} }
template <class T, class ALLOC> template <class T, class ALLOC>
template <class U, class C> template <class U, class C>
Matrix<T, ALLOC> & Matrix<T, ALLOC>::operator-=(MultiArrayView<2, U, C> con st & other) Matrix<T, ALLOC> & Matrix<T, ALLOC>::operator-=(MultiArrayView<2, U, C> con st & other)
{ {
const unsigned int rows = rowCount(); const std::size_t rows = rowCount();
const unsigned int cols = columnCount(); const std::size_t cols = columnCount();
vigra_precondition(rows == vigra::linalg::rowCount(other) && cols == vi gra::linalg::columnCount(other), vigra_precondition(rows == vigra::linalg::rowCount(other) && cols == vi gra::linalg::columnCount(other),
"Matrix::operator-=(): Shape mismatch."); "Matrix::operator-=(): Shape mismatch.");
for(unsigned int i = 0; i < cols; ++i) for(std::size_t i = 0; i < cols; ++i)
for(unsigned int j = 0; j < rows; ++j) for(std::size_t j = 0; j < rows; ++j)
(*this)(j, i) -= other(j, i); (*this)(j, i) -= other(j, i);
return *this; return *this;
} }
template <class T, class ALLOC> template <class T, class ALLOC>
Matrix<T, ALLOC> & Matrix<T, ALLOC>::operator*=(T other) Matrix<T, ALLOC> & Matrix<T, ALLOC>::operator*=(T other)
{ {
const unsigned int rows = rowCount(); const std::size_t rows = rowCount();
const unsigned int cols = columnCount(); const std::size_t cols = columnCount();
for(unsigned int i = 0; i < cols; ++i) for(std::size_t i = 0; i < cols; ++i)
for(unsigned int j = 0; j < rows; ++j) for(std::size_t j = 0; j < rows; ++j)
(*this)(j, i) *= other; (*this)(j, i) *= other;
return *this; return *this;
} }
template <class T, class ALLOC> template <class T, class ALLOC>
Matrix<T, ALLOC> & Matrix<T, ALLOC>::operator/=(T other) Matrix<T, ALLOC> & Matrix<T, ALLOC>::operator/=(T other)
{ {
const unsigned int rows = rowCount(); const std::size_t rows = rowCount();
const unsigned int cols = columnCount(); const std::size_t cols = columnCount();
for(unsigned int i = 0; i < cols; ++i) for(std::size_t i = 0; i < cols; ++i)
for(unsigned int j = 0; j < rows; ++j) for(std::size_t j = 0; j < rows; ++j)
(*this)(j, i) /= other; (*this)(j, i) /= other;
return *this; return *this;
} }
// TemporaryMatrix is provided as an optimization: Functions returning a ma trix can // TemporaryMatrix is provided as an optimization: Functions returning a ma trix can
// use TemporaryMatrix to make explicit that it was allocated as a temporar y data structure. // use TemporaryMatrix to make explicit that it was allocated as a temporar y data structure.
// Functions receiving a TemporaryMatrix can thus often avoid to allocate n ew temporary // Functions receiving a TemporaryMatrix can thus often avoid to allocate n ew temporary
// memory. // memory.
template <class T, class ALLOC = std::allocator<T> > template <class T, class ALLOC = std::allocator<T> >
class TemporaryMatrix class TemporaryMatrix
skipping to change at line 467 skipping to change at line 467
typedef TemporaryMatrix<T, ALLOC> temp_type; typedef TemporaryMatrix<T, ALLOC> temp_type;
typedef MultiArrayView<2, T, UnstridedArrayTag> view_type; typedef MultiArrayView<2, T, UnstridedArrayTag> view_type;
typedef typename BaseType::value_type value_type; typedef typename BaseType::value_type value_type;
typedef typename BaseType::pointer pointer; typedef typename BaseType::pointer pointer;
typedef typename BaseType::const_pointer const_pointer; typedef typename BaseType::const_pointer const_pointer;
typedef typename BaseType::reference reference; typedef typename BaseType::reference reference;
typedef typename BaseType::const_reference const_reference; typedef typename BaseType::const_reference const_reference;
typedef typename BaseType::difference_type difference_type; typedef typename BaseType::difference_type difference_type;
typedef ALLOC allocator_type; typedef ALLOC allocator_type;
TemporaryMatrix(unsigned int rows, unsigned int columns) TemporaryMatrix(std::size_t rows, std::size_t columns)
: BaseType(rows, columns, ALLOC()) : BaseType(rows, columns, ALLOC())
{} {}
TemporaryMatrix(unsigned int rows, unsigned int columns, const_referenc e init) TemporaryMatrix(std::size_t rows, std::size_t columns, const_reference init)
: BaseType(rows, columns, init, ALLOC()) : BaseType(rows, columns, init, ALLOC())
{} {}
template<class U, class C> template<class U, class C>
TemporaryMatrix(const MultiArrayView<2, U, C> &rhs) TemporaryMatrix(const MultiArrayView<2, U, C> &rhs)
: BaseType(rhs) : BaseType(rhs)
{} {}
TemporaryMatrix(const TemporaryMatrix &rhs) TemporaryMatrix(const TemporaryMatrix &rhs)
: BaseType() : BaseType()
skipping to change at line 533 skipping to change at line 533
*/ */
//@{ //@{
/** Number of rows of a matrix represented as a <tt>MultiArrayView&lt;2 ,...&gt;</tt> /** Number of rows of a matrix represented as a <tt>MultiArrayView&lt;2 ,...&gt;</tt>
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C> template <class T, class C>
inline unsigned int rowCount(const MultiArrayView<2, T, C> &x) inline std::size_t rowCount(const MultiArrayView<2, T, C> &x)
{ {
return x.shape(0); return x.shape(0);
} }
/** Number of columns of a matrix represented as a <tt>MultiArrayView&l t;2,...&gt;</tt> /** Number of columns of a matrix represented as a <tt>MultiArrayView&l t;2,...&gt;</tt>
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C> template <class T, class C>
inline unsigned int columnCount(const MultiArrayView<2, T, C> &x) inline std::size_t columnCount(const MultiArrayView<2, T, C> &x)
{ {
return x.shape(1); return x.shape(1);
} }
/** Create a row vector view for row \a d of the matrix \a m /** Create a row vector view for row \a d of the matrix \a m
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
skipping to change at line 588 skipping to change at line 588
/** Check whether matrix \a m is symmetric. /** Check whether matrix \a m is symmetric.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C> template <class T, class C>
bool bool
isSymmetric(MultiArrayView<2, T, C> const & m) isSymmetric(MultiArrayView<2, T, C> const & m)
{ {
const unsigned int size = rowCount(m); const std::size_t size = rowCount(m);
if(size != columnCount(m)) if(size != columnCount(m))
return false; return false;
for(unsigned int i = 0; i < size; ++i) for(std::size_t i = 0; i < size; ++i)
for(unsigned int j = i+1; j < size; ++j) for(std::size_t j = i+1; j < size; ++j)
if(m(j, i) != m(i, j)) if(m(j, i) != m(i, j))
return false; return false;
return true; return true;
} }
#ifdef DOXYGEN // documentation only -- function is already defined in vigr a/multi_array.hxx #ifdef DOXYGEN // documentation only -- function is already defined in vigr a/multi_array.hxx
/** calculate the squared Frobenius norm of a matrix. /** calculate the squared Frobenius norm of a matrix.
Equal to the sum of squares of the matrix elements. Equal to the sum of squares of the matrix elements.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >"
Namespace: vigra Namespace: vigra
*/ */
template <class T, class ALLOC> template <class T, class ALLOC>
typename Matrix<T, ALLLOC>::SquaredNormType typename Matrix<T, ALLLOC>::SquaredNormType
squaredNorm(const Matrix<T, ALLLOC> &a); squaredNorm(const Matrix<T, ALLLOC> &a);
/** calculate the squared Frobenius norm of a matrix. /** calculate the Frobenius norm of a matrix.
Equal to the sum of squares of the matrix elements. Equal to the root of the sum of squares of the matrix elements.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >"
Namespace: vigra Namespace: vigra
*/ */
template <class T, class ALLOC> template <class T, class ALLOC>
typename Matrix<T, ALLLOC>::NormType typename Matrix<T, ALLLOC>::NormType
norm(const Matrix<T, ALLLOC> &a); norm(const Matrix<T, ALLLOC> &a);
#endif // DOXYGEN #endif // DOXYGEN
/** initialize the given square matrix as an identity matrix. /** initialize the given square matrix as an identity matrix.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C> template <class T, class C>
void identityMatrix(MultiArrayView<2, T, C> &r) void identityMatrix(MultiArrayView<2, T, C> &r)
{ {
const unsigned int rows = rowCount(r); const std::size_t rows = rowCount(r);
vigra_precondition(rows == columnCount(r), vigra_precondition(rows == columnCount(r),
"identityMatrix(): Matrix must be square."); "identityMatrix(): Matrix must be square.");
for(unsigned int i = 0; i < rows; ++i) { for(std::size_t i = 0; i < rows; ++i) {
for(unsigned int j = 0; j < rows; ++j) for(std::size_t j = 0; j < rows; ++j)
r(j, i) = NumericTraits<T>::zero(); r(j, i) = NumericTraits<T>::zero();
r(i, i) = NumericTraits<T>::one(); r(i, i) = NumericTraits<T>::one();
} }
} }
/** create n identity matrix of the given size. /** create n identity matrix of the given size.
Usage: Usage:
\code \code
vigra::Matrix<double> m = vigra::identityMatrix<double>(size); vigra::Matrix<double> m = vigra::identityMatrix<double>(size);
\endcode \endcode
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T> template <class T>
TemporaryMatrix<T> identityMatrix(unsigned int size) TemporaryMatrix<T> identityMatrix(std::size_t size)
{ {
TemporaryMatrix<T> ret(size, size, NumericTraits<T>::zero()); TemporaryMatrix<T> ret(size, size, NumericTraits<T>::zero());
for(unsigned int i = 0; i < size; ++i) for(std::size_t i = 0; i < size; ++i)
ret(i, i) = NumericTraits<T>::one(); ret(i, i) = NumericTraits<T>::one();
return ret; return ret;
} }
template <class T, class C1, class C2> template <class T, class C1, class C2>
void diagonalMatrixImpl(MultiArrayView<1, T, C1> const & v, MultiArrayView< 2, T, C2> &r) void diagonalMatrixImpl(MultiArrayView<1, T, C1> const & v, MultiArrayView< 2, T, C2> &r)
{ {
const unsigned int size = v.elementCount(); const std::size_t size = v.elementCount();
vigra_precondition(rowCount(r) == size && columnCount(r) == size, vigra_precondition(rowCount(r) == size && columnCount(r) == size,
"diagonalMatrix(): result must be a square matrix."); "diagonalMatrix(): result must be a square matrix.");
for(unsigned int i = 0; i < size; ++i) for(std::size_t i = 0; i < size; ++i)
r(i, i) = v(i); r(i, i) = v(i);
} }
/** make a diagonal matrix from a vector. /** make a diagonal matrix from a vector.
The vector is given as matrix \a v, which must either have a single The vector is given as matrix \a v, which must either have a single
row or column. The result is witten into the square matrix \a r. row or column. The result is witten into the square matrix \a r.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
skipping to change at line 713 skipping to change at line 713
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C> template <class T, class C>
TemporaryMatrix<T> diagonalMatrix(MultiArrayView<2, T, C> const & v) TemporaryMatrix<T> diagonalMatrix(MultiArrayView<2, T, C> const & v)
{ {
vigra_precondition(rowCount(v) == 1 || columnCount(v) == 1, vigra_precondition(rowCount(v) == 1 || columnCount(v) == 1,
"diagonalMatrix(): input must be a vector."); "diagonalMatrix(): input must be a vector.");
unsigned int size = v.elementCount(); std::size_t size = v.elementCount();
TemporaryMatrix<T> ret(size, size, NumericTraits<T>::zero()); TemporaryMatrix<T> ret(size, size, NumericTraits<T>::zero());
if(rowCount(v) == 1) if(rowCount(v) == 1)
diagonalMatrixImpl(v.bindInner(0), ret); diagonalMatrixImpl(v.bindInner(0), ret);
else else
diagonalMatrixImpl(v.bindOuter(0), ret); diagonalMatrixImpl(v.bindOuter(0), ret);
return ret; return ret;
} }
/** transpose matrix \a v. /** transpose matrix \a v.
The result is written into \a r which must have the correct (i.e. The result is written into \a r which must have the correct (i.e.
transposed) shape. transposed) shape.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C1, class C2> template <class T, class C1, class C2>
void transpose(const MultiArrayView<2, T, C1> &v, MultiArrayView<2, T, C2> &r) void transpose(const MultiArrayView<2, T, C1> &v, MultiArrayView<2, T, C2> &r)
{ {
const unsigned int rows = rowCount(r); const std::size_t rows = rowCount(r);
const unsigned int cols = columnCount(r); const std::size_t cols = columnCount(r);
vigra_precondition(rows == columnCount(v) && cols == rowCount(v), vigra_precondition(rows == columnCount(v) && cols == rowCount(v),
"transpose(): arrays must have transposed shapes."); "transpose(): arrays must have transposed shapes.");
for(unsigned int i = 0; i < cols; ++i) for(std::size_t i = 0; i < cols; ++i)
for(unsigned int j = 0; j < rows; ++j) for(std::size_t j = 0; j < rows; ++j)
r(j, i) = v(i, j); r(j, i) = v(i, j);
} }
/** create the transpose of a matrix \a v. /** create the transpose of a matrix \a v.
The result is returned as a temporary matrix. The result is returned as a temporary matrix.
Usage: Usage:
\code \code
vigra::Matrix<double> v(rows, cols); vigra::Matrix<double> v(rows, cols);
v = ...; v = ...;
skipping to change at line 768 skipping to change at line 768
TemporaryMatrix<T> transpose(MultiArrayView<2, T, C> const & v) TemporaryMatrix<T> transpose(MultiArrayView<2, T, C> const & v)
{ {
TemporaryMatrix<T> ret(columnCount(v), rowCount(v)); TemporaryMatrix<T> ret(columnCount(v), rowCount(v));
transpose(v, ret); transpose(v, ret);
return ret; return ret;
} }
template <class T> template <class T>
TemporaryMatrix<T> transpose(TemporaryMatrix<T> const & v) TemporaryMatrix<T> transpose(TemporaryMatrix<T> const & v)
{ {
const unsigned int rows = v.rowCount(); const std::size_t rows = v.rowCount();
const unsigned int cols = v.columnCount(); const std::size_t cols = v.columnCount();
if(rows == cols) if(rows == cols)
{ {
return const_cast<TemporaryMatrix<T> &>(v).transpose(); return const_cast<TemporaryMatrix<T> &>(v).transpose();
} }
else else
{ {
TemporaryMatrix<T> ret(cols, rows); TemporaryMatrix<T> ret(cols, rows);
transpose(v, ret); transpose(v, ret);
return ret; return ret;
} }
skipping to change at line 793 skipping to change at line 793
The result is written into \a r. All three matrices must have the s ame shape. The result is written into \a r. All three matrices must have the s ame shape.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespace: vigra::linalg Namespace: vigra::linalg
*/ */
template <class T, class C1, class C2, class C3> template <class T, class C1, class C2, class C3>
void add(const MultiArrayView<2, T, C1> &a, const MultiArrayView<2, T, C2> &b, void add(const MultiArrayView<2, T, C1> &a, const MultiArrayView<2, T, C2> &b,
MultiArrayView<2, T, C3> &r) MultiArrayView<2, T, C3> &r)
{ {
const unsigned int rrows = rowCount(r); const std::size_t rrows = rowCount(r);
const unsigned int rcols = columnCount(r); const std::size_t rcols = columnCount(r);
vigra_precondition(rrows == rowCount(a) && rcols == columnCount(a) && vigra_precondition(rrows == rowCount(a) && rcols == columnCount(a) &&
rrows == rowCount(b) && rcols == columnCount(b), rrows == rowCount(b) && rcols == columnCount(b),
"add(): Matrix shapes must agree."); "add(): Matrix shapes must agree.");
for(unsigned int i = 0; i < rcols; ++i) { for(std::size_t i = 0; i < rcols; ++i) {
for(unsigned int j = 0; j < rrows; ++j) { for(std::size_t j = 0; j < rrows; ++j) {
r(j, i) = a(j, i) + b(j, i); r(j, i) = a(j, i) + b(j, i);
} }
} }
} }
/** add matrices \a a and \a b. /** add matrices \a a and \a b.
The two matrices must have the same shape. The two matrices must have the same shape.
The result is returned as a temporary matrix. The result is returned as a temporary matrix.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
skipping to change at line 853 skipping to change at line 853
The result is written into \a r. All three matrices must have the s ame shape. The result is written into \a r. All three matrices must have the s ame shape.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespace: vigra::linalg Namespace: vigra::linalg
*/ */
template <class T, class C1, class C2, class C3> template <class T, class C1, class C2, class C3>
void sub(const MultiArrayView<2, T, C1> &a, const MultiArrayView<2, T, C2> &b, void sub(const MultiArrayView<2, T, C1> &a, const MultiArrayView<2, T, C2> &b,
MultiArrayView<2, T, C3> &r) MultiArrayView<2, T, C3> &r)
{ {
const unsigned int rrows = rowCount(r); const std::size_t rrows = rowCount(r);
const unsigned int rcols = columnCount(r); const std::size_t rcols = columnCount(r);
vigra_precondition(rrows == rowCount(a) && rcols == columnCount(a) && vigra_precondition(rrows == rowCount(a) && rcols == columnCount(a) &&
rrows == rowCount(b) && rcols == columnCount(b), rrows == rowCount(b) && rcols == columnCount(b),
"subtract(): Matrix shapes must agree."); "subtract(): Matrix shapes must agree.");
for(unsigned int i = 0; i < rcols; ++i) { for(std::size_t i = 0; i < rcols; ++i) {
for(unsigned int j = 0; j < rrows; ++j) { for(std::size_t j = 0; j < rrows; ++j) {
r(j, i) = a(j, i) - b(j, i); r(j, i) = a(j, i) - b(j, i);
} }
} }
} }
/** subtract matrix \a b from \a a. /** subtract matrix \a b from \a a.
The two matrices must have the same shape. The two matrices must have the same shape.
The result is returned as a temporary matrix. The result is returned as a temporary matrix.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
skipping to change at line 892 skipping to change at line 892
inline TemporaryMatrix<T> inline TemporaryMatrix<T>
operator-(const TemporaryMatrix<T> &a, const MultiArrayView<2, T, C> &b) operator-(const TemporaryMatrix<T> &a, const MultiArrayView<2, T, C> &b)
{ {
return const_cast<TemporaryMatrix<T> &>(a) -= b; return const_cast<TemporaryMatrix<T> &>(a) -= b;
} }
template <class T, class C> template <class T, class C>
TemporaryMatrix<T> TemporaryMatrix<T>
operator-(const MultiArrayView<2, T, C> &a, const TemporaryMatrix<T> &b) operator-(const MultiArrayView<2, T, C> &a, const TemporaryMatrix<T> &b)
{ {
const unsigned int rows = rowCount(a); const std::size_t rows = rowCount(a);
const unsigned int cols = columnCount(a); const std::size_t cols = columnCount(a);
vigra_precondition(rows == b.rowCount() && cols == b.columnCount(), vigra_precondition(rows == b.rowCount() && cols == b.columnCount(),
"Matrix::operator-(): Shape mismatch."); "Matrix::operator-(): Shape mismatch.");
for(unsigned int i = 0; i < cols; ++i) for(std::size_t i = 0; i < cols; ++i)
for(unsigned int j = 0; j < rows; ++j) for(std::size_t j = 0; j < rows; ++j)
const_cast<TemporaryMatrix<T> &>(b)(j, i) = a(j, i) - b(j, i); const_cast<TemporaryMatrix<T> &>(b)(j, i) = a(j, i) - b(j, i);
return b; return b;
} }
template <class T> template <class T>
inline TemporaryMatrix<T> inline TemporaryMatrix<T>
operator-(const TemporaryMatrix<T> &a, const TemporaryMatrix<T> &b) operator-(const TemporaryMatrix<T> &a, const TemporaryMatrix<T> &b)
{ {
return const_cast<TemporaryMatrix<T> &>(a) -= b; return const_cast<TemporaryMatrix<T> &>(a) -= b;
} }
skipping to change at line 942 skipping to change at line 942
That is, matrix \a x must have a single row, and matrix \a y must That is, matrix \a x must have a single row, and matrix \a y must
have a single column, and the other dimensions must match. have a single column, and the other dimensions must match.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C1, class C2> template <class T, class C1, class C2>
T dot(const MultiArrayView<2, T, C1> &x, const MultiArrayView<2, T, C2> &y) T dot(const MultiArrayView<2, T, C1> &x, const MultiArrayView<2, T, C2> &y)
{ {
const unsigned int n = columnCount(x); const std::size_t n = columnCount(x);
vigra_precondition(n == rowCount(y) && 1 == rowCount(x) && 1 == columnC ount(y), vigra_precondition(n == rowCount(y) && 1 == rowCount(x) && 1 == columnC ount(y),
"dot(): shape mismatch."); "dot(): shape mismatch.");
T ret = NumericTraits<T>::zero(); T ret = NumericTraits<T>::zero();
for(unsigned int i = 0; i < n; ++i) for(std::size_t i = 0; i < n; ++i)
ret += x(0, i) * y(i, 0); ret += x(0, i) * y(i, 0);
return ret; return ret;
} }
/** calculate the inner product of two vectors. The vector /** calculate the inner product of two vectors. The vector
lenths must match. lengths must match.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C1, class C2> template <class T, class C1, class C2>
T dot(const MultiArrayView<1, T, C1> &x, const MultiArrayView<1, T, C2> &y) T dot(const MultiArrayView<1, T, C1> &x, const MultiArrayView<1, T, C2> &y)
{ {
const unsigned int n = x.elementCount(); const std::size_t n = x.elementCount();
vigra_precondition(n == y.elementCount(), vigra_precondition(n == y.elementCount(),
"dot(): shape mismatch."); "dot(): shape mismatch.");
T ret = NumericTraits<T>::zero(); T ret = NumericTraits<T>::zero();
for(unsigned int i = 0; i < n; ++i) for(std::size_t i = 0; i < n; ++i)
ret += x(i) * y(i); ret += x(i) * y(i);
return ret; return ret;
} }
/** calculate the cross product of two vectors of length 3. /** calculate the cross product of two vectors of length 3.
The result is written into \a r. The result is written into \a r.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
skipping to change at line 1036 skipping to change at line 1036
is written into \a r. is written into \a r.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C1, class C2, class C3> template <class T, class C1, class C2, class C3>
void outer(const MultiArrayView<2, T, C1> &x, const MultiArrayView<2, T, C2 > &y, void outer(const MultiArrayView<2, T, C1> &x, const MultiArrayView<2, T, C2 > &y,
MultiArrayView<2, T, C3> &r) MultiArrayView<2, T, C3> &r)
{ {
const unsigned int rows = rowCount(r); const std::size_t rows = rowCount(r);
const unsigned int cols = columnCount(r); const std::size_t cols = columnCount(r);
vigra_precondition(rows == rowCount(x) && cols == columnCount(y) && vigra_precondition(rows == rowCount(x) && cols == columnCount(y) &&
1 == columnCount(x) && 1 == rowCount(y), 1 == columnCount(x) && 1 == rowCount(y),
"outer(): shape mismatch."); "outer(): shape mismatch.");
for(unsigned int i = 0; i < cols; ++i) for(std::size_t i = 0; i < cols; ++i)
for(unsigned int j = 0; j < rows; ++j) for(std::size_t j = 0; j < rows; ++j)
r(j, i) = x(j, 0) * y(0, i); r(j, i) = x(j, 0) * y(0, i);
} }
/** calculate the outer product of two matrices representing vectors. /** calculate the outer product of two matrices representing vectors.
That is, matrix \a x must have a single column, and matrix \a y mus t That is, matrix \a x must have a single column, and matrix \a y mus t
have a single row, and the other dimensions must match. The result have a single row, and the other dimensions must match. The result
is returned as a temporary matrix. is returned as a temporary matrix.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg Namespaces: vigra and vigra::linalg
*/ */
template <class T, class C1, class C2> template <class T, class C1, class C2>
TemporaryMatrix<T> TemporaryMatrix<T>
outer(const MultiArrayView<2, T, C1> &x, const MultiArrayView<2, T, C2> &y) outer(const MultiArrayView<2, T, C1> &x, const MultiArrayView<2, T, C2> &y)
{ {
const unsigned int rows = rowCount(x); const std::size_t rows = rowCount(x);
const unsigned int cols = columnCount(y); const std::size_t cols = columnCount(y);
vigra_precondition(1 == columnCount(x) && 1 == rowCount(y), vigra_precondition(1 == columnCount(x) && 1 == rowCount(y),
"outer(): shape mismatch."); "outer(): shape mismatch.");
TemporaryMatrix<T> ret(rows, cols); TemporaryMatrix<T> ret(rows, cols);
outer(x, y, ret); outer(x, y, ret);
return ret; return ret;
} }
/** calculate the outer product of a matrix (representing a vector) wit
h itself.
The result is returned as a temporary matrix.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a
>" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line
ar_algebra.hxx</a>"<br>
Namespaces: vigra and vigra::linalg
*/
template <class T, class C1>
TemporaryMatrix<T>
outer(const MultiArrayView<2, T, C1> &x)
{
const std::size_t rows = rowCount(x);
const std::size_t cols = columnCount(x);
vigra_precondition(rows == 1 || cols == 1,
"outer(): matrix does not represent a vector.");
const std::size_t size = std::max(rows, cols);
TemporaryMatrix<T> ret(size, size);
if(rows == 1)
{
for(std::size_t i = 0; i < size; ++i)
for(std::size_t j = 0; j < size; ++j)
ret(j, i) = x(0, j) * x(0, i);
}
else
{
for(std::size_t i = 0; i < size; ++i)
for(std::size_t j = 0; j < size; ++j)
ret(j, i) = x(j, 0) * x(i, 0);
}
return ret;
}
/** multiply matrix \a a with scalar \a b. /** multiply matrix \a a with scalar \a b.
The result is written into \a r. \a a and \a r must have the same s hape. The result is written into \a r. \a a and \a r must have the same s hape.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespace: vigra::linalg Namespace: vigra::linalg
*/ */
template <class T, class C1, class C2> template <class T, class C1, class C2>
void smul(const MultiArrayView<2, T, C1> &a, T b, MultiArrayView<2, T, C2> &r) void smul(const MultiArrayView<2, T, C1> &a, T b, MultiArrayView<2, T, C2> &r)
{ {
const unsigned int rows = rowCount(a); const std::size_t rows = rowCount(a);
const unsigned int cols = columnCount(a); const std::size_t cols = columnCount(a);
vigra_precondition(rows == rowCount(r) && cols == columnCount(r), vigra_precondition(rows == rowCount(r) && cols == columnCount(r),
"smul(): Matrix sizes must agree."); "smul(): Matrix sizes must agree.");
for(unsigned int i = 0; i < cols; ++i) for(std::size_t i = 0; i < cols; ++i)
for(unsigned int j = 0; j < rows; ++j) for(std::size_t j = 0; j < rows; ++j)
r(j, i) = a(j, i) * b; r(j, i) = a(j, i) * b;
} }
/** multiply scalar \a a with matrix \a b. /** multiply scalar \a a with matrix \a b.
The result is written into \a r. \a b and \a r must have the same s hape. The result is written into \a r. \a b and \a r must have the same s hape.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespace: vigra::linalg Namespace: vigra::linalg
*/ */
skipping to change at line 1112 skipping to change at line 1145
The result is written into \a r. The three matrices must have match ing shapes. The result is written into \a r. The three matrices must have match ing shapes.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespace: vigra::linalg Namespace: vigra::linalg
*/ */
template <class T, class C1, class C2, class C3> template <class T, class C1, class C2, class C3>
void mmul(const MultiArrayView<2, T, C1> &a, const MultiArrayView<2, T, C2> &b, void mmul(const MultiArrayView<2, T, C1> &a, const MultiArrayView<2, T, C2> &b,
MultiArrayView<2, T, C3> &r) MultiArrayView<2, T, C3> &r)
{ {
const unsigned int rrows = rowCount(r); const std::size_t rrows = rowCount(r);
const unsigned int rcols = columnCount(r); const std::size_t rcols = columnCount(r);
const unsigned int acols = columnCount(a); const std::size_t acols = columnCount(a);
vigra_precondition(rrows == rowCount(a) && rcols == columnCount(b) && a cols == rowCount(b), vigra_precondition(rrows == rowCount(a) && rcols == columnCount(b) && a cols == rowCount(b),
"mmul(): Matrix shapes must agree."); "mmul(): Matrix shapes must agree.");
for(unsigned int i = 0; i < rcols; ++i) { for(std::size_t i = 0; i < rcols; ++i) {
for(unsigned int j = 0; j < rrows; ++j) { for(std::size_t j = 0; j < rrows; ++j) {
r(j, i) = 0.0; r(j, i) = 0.0;
for(unsigned int k = 0; k < acols; ++k) { for(std::size_t k = 0; k < acols; ++k) {
r(j, i) += a(j, k) * b(k, i); r(j, i) += a(j, k) * b(k, i);
} }
} }
} }
} }
/** perform matrix multiplication of matrices \a a and \a b. /** perform matrix multiplication of matrices \a a and \a b.
\a a and \a b must have matching shapes. \a a and \a b must have matching shapes.
The result is returned as a temporary matrix. The result is returned as a temporary matrix.
skipping to change at line 1156 skipping to change at line 1189
The result is written into \a r. All three matrices must have the s ame shape. The result is written into \a r. All three matrices must have the s ame shape.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespace: vigra::linalg Namespace: vigra::linalg
*/ */
template <class T, class C1, class C2, class C3> template <class T, class C1, class C2, class C3>
void pmul(const MultiArrayView<2, T, C1> &a, const MultiArrayView<2, T, C2> &b, void pmul(const MultiArrayView<2, T, C1> &a, const MultiArrayView<2, T, C2> &b,
MultiArrayView<2, T, C3> &r) MultiArrayView<2, T, C3> &r)
{ {
const unsigned int rrows = rowCount(r); const std::size_t rrows = rowCount(r);
const unsigned int rcols = columnCount(r); const std::size_t rcols = columnCount(r);
vigra_precondition(rrows == rowCount(a) && rcols == columnCount(a) && vigra_precondition(rrows == rowCount(a) && rcols == columnCount(a) &&
rrows == rowCount(b) && rcols == columnCount(b), rrows == rowCount(b) && rcols == columnCount(b),
"pmul(): Matrix shapes must agree."); "pmul(): Matrix shapes must agree.");
for(unsigned int i = 0; i < rcols; ++i) { for(std::size_t i = 0; i < rcols; ++i) {
for(unsigned int j = 0; j < rrows; ++j) { for(std::size_t j = 0; j < rrows; ++j) {
r(j, i) = a(j, i) * b(j, i); r(j, i) = a(j, i) * b(j, i);
} }
} }
} }
/** multiply matrices \a a and \a b pointwise. /** multiply matrices \a a and \a b pointwise.
\a a and \a b must have matching shapes. \a a and \a b must have matching shapes.
The result is returned as a temporary matrix. The result is returned as a temporary matrix.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
skipping to change at line 1244 skipping to change at line 1277
Namespace: vigra::linalg Namespace: vigra::linalg
*/ */
template <class T, class A, int N, class DATA, class DERIVED> template <class T, class A, int N, class DATA, class DERIVED>
TinyVector<T, N> TinyVector<T, N>
operator*(const Matrix<T, A> &a, const TinyVectorBase<T, N, DATA, DERIVED> &b) operator*(const Matrix<T, A> &a, const TinyVectorBase<T, N, DATA, DERIVED> &b)
{ {
vigra_precondition(N == rowCount(a) && N == columnCount(a), vigra_precondition(N == rowCount(a) && N == columnCount(a),
"operator*(Matrix, TinyVector): Shape mismatch."); "operator*(Matrix, TinyVector): Shape mismatch.");
TinyVector<T, N> res = TinyVectorView<T, N>(&a(0,0)) * b[0]; TinyVector<T, N> res = TinyVectorView<T, N>(&a(0,0)) * b[0];
for(unsigned int i = 1; i < N; ++i) for(std::size_t i = 1; i < N; ++i)
res += TinyVectorView<T, N>(&a(0,i)) * b[i]; res += TinyVectorView<T, N>(&a(0,i)) * b[i];
return res; return res;
} }
/** multiply TinyVector \a a with matrix \a b. /** multiply TinyVector \a a with matrix \a b.
\a b must be of size <tt>N x N</tt>. Vector \a a and the result \a b must be of size <tt>N x N</tt>. Vector \a a and the result
vector are interpreted as row vectors. vector are interpreted as row vectors.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespace: vigra::linalg Namespace: vigra::linalg
*/ */
template <class T, int N, class DATA, class DERIVED, class A> template <class T, int N, class DATA, class DERIVED, class A>
TinyVector<T, N> TinyVector<T, N>
operator*(const TinyVectorBase<T, N, DATA, DERIVED> &a, const Matrix<T, A> &b) operator*(const TinyVectorBase<T, N, DATA, DERIVED> &a, const Matrix<T, A> &b)
{ {
vigra_precondition(N == rowCount(b) && N == columnCount(b), vigra_precondition(N == rowCount(b) && N == columnCount(b),
"operator*(TinyVector, Matrix): Shape mismatch."); "operator*(TinyVector, Matrix): Shape mismatch.");
TinyVector<T, N> res; TinyVector<T, N> res;
for(unsigned int i = 0; i < N; ++i) for(std::size_t i = 0; i < N; ++i)
res[i] = dot(a, TinyVectorView<T, N>(&b(0,i))); res[i] = dot(a, TinyVectorView<T, N>(&b(0,i)));
return res; return res;
} }
/** perform matrix multiplication of matrices \a a and \a b. /** perform matrix multiplication of matrices \a a and \a b.
\a a and \a b must have matching shapes. \a a and \a b must have matching shapes.
The result is returned as a temporary matrix. The result is returned as a temporary matrix.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
skipping to change at line 1297 skipping to change at line 1330
/** divide matrix \a a by scalar \a b. /** divide matrix \a a by scalar \a b.
The result is written into \a r. \a a and \a r must have the same s hape. The result is written into \a r. \a a and \a r must have the same s hape.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespace: vigra::linalg Namespace: vigra::linalg
*/ */
template <class T, class C1, class C2> template <class T, class C1, class C2>
void sdiv(const MultiArrayView<2, T, C1> &a, T b, MultiArrayView<2, T, C2> &r) void sdiv(const MultiArrayView<2, T, C1> &a, T b, MultiArrayView<2, T, C2> &r)
{ {
const unsigned int rows = rowCount(a); const std::size_t rows = rowCount(a);
const unsigned int cols = columnCount(a); const std::size_t cols = columnCount(a);
vigra_precondition(rows == rowCount(r) && cols == columnCount(r), vigra_precondition(rows == rowCount(r) && cols == columnCount(r),
"sdiv(): Matrix sizes must agree."); "sdiv(): Matrix sizes must agree.");
for(unsigned int i = 0; i < cols; ++i) for(std::size_t i = 0; i < cols; ++i)
for(unsigned int j = 0; j < rows; ++j) for(std::size_t j = 0; j < rows; ++j)
r(j, i) = a(j, i) / b; r(j, i) = a(j, i) / b;
} }
/** divide two matrices \a a and \a b pointwise. /** divide two matrices \a a and \a b pointwise.
The result is written into \a r. All three matrices must have the s ame shape. The result is written into \a r. All three matrices must have the s ame shape.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespace: vigra::linalg Namespace: vigra::linalg
*/ */
template <class T, class C1, class C2, class C3> template <class T, class C1, class C2, class C3>
void pdiv(const MultiArrayView<2, T, C1> &a, const MultiArrayView<2, T, C2> &b, void pdiv(const MultiArrayView<2, T, C1> &a, const MultiArrayView<2, T, C2> &b,
MultiArrayView<2, T, C3> &r) MultiArrayView<2, T, C3> &r)
{ {
const unsigned int rrows = rowCount(r); const std::size_t rrows = rowCount(r);
const unsigned int rcols = columnCount(r); const std::size_t rcols = columnCount(r);
vigra_precondition(rrows == rowCount(a) && rcols == columnCount(a) && vigra_precondition(rrows == rowCount(a) && rcols == columnCount(a) &&
rrows == rowCount(b) && rcols == columnCount(b), rrows == rowCount(b) && rcols == columnCount(b),
"pdiv(): Matrix shapes must agree."); "pdiv(): Matrix shapes must agree.");
for(unsigned int i = 0; i < rcols; ++i) { for(std::size_t i = 0; i < rcols; ++i) {
for(unsigned int j = 0; j < rrows; ++j) { for(std::size_t j = 0; j < rrows; ++j) {
r(j, i) = a(j, i) * b(j, i); r(j, i) = a(j, i) * b(j, i);
} }
} }
} }
/** divide matrices \a a and \a b pointwise. /** divide matrices \a a and \a b pointwise.
\a a and \a b must have matching shapes. \a a and \a b must have matching shapes.
The result is returned as a temporary matrix. The result is returned as a temporary matrix.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
skipping to change at line 1424 skipping to change at line 1457
/** print a matrix \a m to the stream \a s. /** print a matrix \a m to the stream \a s.
<b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br> <b>\#include</b> "<a href="matrix_8hxx-source.html">vigra/matrix.hxx</a >" or<br>
<b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br> <b>\#include</b> "<a href="linear__algebra_8hxx-source.html">vigra/line ar_algebra.hxx</a>"<br>
Namespace: std Namespace: std
*/ */
template <class T, class C> template <class T, class C>
std::ostream & std::ostream &
operator<<(std::ostream & s, const vigra::MultiArrayView<2, T, C> &m) operator<<(std::ostream & s, const vigra::MultiArrayView<2, T, C> &m)
{ {
const unsigned int rows = vigra::linalg::rowCount(m); const std::size_t rows = vigra::linalg::rowCount(m);
const unsigned int cols = vigra::linalg::columnCount(m); const std::size_t cols = vigra::linalg::columnCount(m);
std::ios::fmtflags flags = std::ios::fmtflags flags =
s.setf(std::ios::right | std::ios::fixed, std::ios::adjustfield | s td::ios::floatfield); s.setf(std::ios::right | std::ios::fixed, std::ios::adjustfield | s td::ios::floatfield);
for(unsigned int j = 0; j < rows; ++j) for(std::size_t j = 0; j < rows; ++j)
{ {
for(unsigned int i = 0; i < cols; ++i) for(std::size_t i = 0; i < cols; ++i)
{ {
s << std::setw(7) << std::setprecision(4) << m(j, i) << " "; s << std::setw(7) << std::setprecision(4) << m(j, i) << " ";
} }
s << std::endl; s << std::endl;
} }
s.setf(flags); s.setf(flags);
return s; return s;
} }
//@} //@}
 End of changes. 72 change blocks. 
109 lines changed or deleted 145 lines changed or added


 memory.hxx   memory.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2002-2003 by Ullrich Koethe, Hans Meine */ /* Copyright 2002-2003 by Ullrich Koethe, Hans Meine */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_MEMORY_HXX #ifndef VIGRA_MEMORY_HXX
#define VIGRA_MEMORY_HXX #define VIGRA_MEMORY_HXX
#include <vigra/metaprogramming.hxx> #include "metaprogramming.hxx"
namespace vigra { namespace detail { namespace vigra { namespace detail {
template <class T> template <class T>
void destroy_n(T * /* p */, int /* n */, VigraTrueType /* isPOD */) void destroy_n(T * /* p */, int /* n */, VigraTrueType /* isPOD */)
{ {
} }
template <class T> template <class T>
void destroy_n(T * p, int n, VigraFalseType /* isPOD */) void destroy_n(T * p, int n, VigraFalseType /* isPOD */)
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 metaprogramming.hxx   metaprogramming.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 multi_array.hxx   multi_array.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2003 by Gunnar Kedenburg */ /* Copyright 2003 by Gunnar Kedenburg */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* ( Version 1.3.0, Sep 10 2004 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 44 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_MULTI_ARRAY_HXX #ifndef VIGRA_MULTI_ARRAY_HXX
#define VIGRA_MULTI_ARRAY_HXX #define VIGRA_MULTI_ARRAY_HXX
#include <memory> #include <memory>
#include <algorithm> #include <algorithm>
#include "vigra/accessor.hxx" #include "accessor.hxx"
#include "vigra/tinyvector.hxx" #include "tinyvector.hxx"
#include "vigra/rgbvalue.hxx" #include "rgbvalue.hxx"
#include "vigra/basicimageview.hxx" #include "basicimageview.hxx"
#include "vigra/imageiterator.hxx" #include "imageiterator.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/multi_iterator.hxx" #include "multi_iterator.hxx"
#include "vigra/metaprogramming.hxx" #include "metaprogramming.hxx"
#include "vigra/mathutil.hxx" #include "mathutil.hxx"
namespace vigra namespace vigra
{ {
namespace detail namespace detail
{ {
/********************************************************/ /********************************************************/
/* */ /* */
/* defaultStride */ /* defaultStride */
/* */ /* */
skipping to change at line 184 skipping to change at line 183
typedef MultiIterator <N, T, REFERENCE, POINTER> type; typedef MultiIterator <N, T, REFERENCE, POINTER> type;
}; };
}; };
/********************************************************/ /********************************************************/
/* */ /* */
/* helper functions */ /* helper functions */
/* */ /* */
/********************************************************/ /********************************************************/
template <class DestIterator, class Shape, class T, int N>
void
initMultiArrayData(DestIterator d, Shape const & shape, T const & init, Met
aInt<N>)
{
DestIterator dend = d + shape[N];
for(; d != dend; ++d)
{
initMultiArrayData(d.begin(), shape, init, MetaInt<N-1>());
}
}
template <class DestIterator, class Shape, class T> template <class DestIterator, class Shape, class T>
void void
initMultiArrayData(DestIterator d, Shape const & shape, T const & init, Met aInt<0>) initMultiArrayData(DestIterator d, Shape const & shape, T const & init, Met aInt<0>)
{ {
DestIterator dend = d + shape[0]; DestIterator dend = d + shape[0];
for(; d != dend; ++d) for(; d != dend; ++d)
{ {
*d = init; *d = init;
} }
} }
template <class SrcIterator, class Shape, class DestIterator, int N> template <class DestIterator, class Shape, class T, int N>
void void
copyMultiArrayData(SrcIterator s, Shape const & shape, DestIterator d, Meta Int<N>) initMultiArrayData(DestIterator d, Shape const & shape, T const & init, Met aInt<N>)
{ {
SrcIterator send = s + shape[N]; DestIterator dend = d + shape[N];
for(; s != send; ++s, ++d) for(; d != dend; ++d)
{ {
copyMultiArrayData(s.begin(), shape, d.begin(), MetaInt<N-1>()); initMultiArrayData(d.begin(), shape, init, MetaInt<N-1>());
} }
} }
template <class SrcIterator, class Shape, class DestIterator> template <class SrcIterator, class Shape, class DestIterator>
void void
copyMultiArrayData(SrcIterator s, Shape const & shape, DestIterator d, Meta Int<0>) copyMultiArrayData(SrcIterator s, Shape const & shape, DestIterator d, Meta Int<0>)
{ {
SrcIterator send = s + shape[0]; SrcIterator send = s + shape[0];
for(; s != send; ++s, ++d) for(; s != send; ++s, ++d)
{ {
*d = *s; *d = *s;
} }
} }
template <class SrcIterator, class Shape, class T, class ALLOC, int N> template <class SrcIterator, class Shape, class DestIterator, int N>
void void
uninitializedCopyMultiArrayData(SrcIterator s, Shape const & shape, T * & d , ALLOC & a, MetaInt<N>) copyMultiArrayData(SrcIterator s, Shape const & shape, DestIterator d, Meta Int<N>)
{ {
SrcIterator send = s + shape[N]; SrcIterator send = s + shape[N];
for(; s != send; ++s) for(; s != send; ++s, ++d)
{ {
uninitializedCopyMultiArrayData(s.begin(), shape, d, a, MetaInt<N-1 >()); copyMultiArrayData(s.begin(), shape, d.begin(), MetaInt<N-1>());
} }
} }
template <class SrcIterator, class Shape, class T, class ALLOC> template <class SrcIterator, class Shape, class T, class ALLOC>
void void
uninitializedCopyMultiArrayData(SrcIterator s, Shape const & shape, T * & d , ALLOC & a, MetaInt<0>) uninitializedCopyMultiArrayData(SrcIterator s, Shape const & shape, T * & d , ALLOC & a, MetaInt<0>)
{ {
SrcIterator send = s + shape[0]; SrcIterator send = s + shape[0];
for(; s != send; ++s, ++d) for(; s != send; ++s, ++d)
{ {
a.construct(d, *s); a.construct(d, *s);
} }
} }
template <class SrcIterator, class Shape, class T, int N> template <class SrcIterator, class Shape, class T, class ALLOC, int N>
void void
squaredNormOfMultiArray(SrcIterator s, Shape const & shape, T & result, Met aInt<N>) uninitializedCopyMultiArrayData(SrcIterator s, Shape const & shape, T * & d , ALLOC & a, MetaInt<N>)
{ {
SrcIterator send = s + shape[N]; SrcIterator send = s + shape[N];
for(; s != send; ++s) for(; s != send; ++s)
{ {
squaredNormOfMultiArray(s.begin(), shape, result, MetaInt<N-1>()); uninitializedCopyMultiArrayData(s.begin(), shape, d, a, MetaInt<N-1 >());
} }
} }
template <class SrcIterator, class Shape, class T> template <class SrcIterator, class Shape, class T>
void void
squaredNormOfMultiArray(SrcIterator s, Shape const & shape, T & result, Met aInt<0>) squaredNormOfMultiArray(SrcIterator s, Shape const & shape, T & result, Met aInt<0>)
{ {
SrcIterator send = s + shape[0]; SrcIterator send = s + shape[0];
for(; s != send; ++s) for(; s != send; ++s)
{ {
result += *s * *s; result += *s * *s;
} }
} }
template <class SrcIterator, class Shape, class T, int N>
void
squaredNormOfMultiArray(SrcIterator s, Shape const & shape, T & result, Met
aInt<N>)
{
SrcIterator send = s + shape[N];
for(; s != send; ++s)
{
squaredNormOfMultiArray(s.begin(), shape, result, MetaInt<N-1>());
}
}
} // namespace detail } // namespace detail
/********************************************************/ /********************************************************/
/* */ /* */
/* MultiArrayView */ /* MultiArrayView */
/* */ /* */
/********************************************************/ /********************************************************/
// forward declaration // forward declaration
template <unsigned int N, class T, class C = UnstridedArrayTag> template <unsigned int N, class T, class C = UnstridedArrayTag>
skipping to change at line 387 skipping to change at line 386
/** the squared norm type (return type of array.squaredNorm()). /** the squared norm type (return type of array.squaredNorm()).
*/ */
typedef typename NormTraits<T>::SquaredNormType SquaredNormType; typedef typename NormTraits<T>::SquaredNormType SquaredNormType;
/** the norm type (return type of array.norm()). /** the norm type (return type of array.norm()).
*/ */
typedef typename SquareRootTraits<SquaredNormType>::SquareRootResult No rmType; typedef typename SquareRootTraits<SquaredNormType>::SquareRootResult No rmType;
protected: protected:
static const typename difference_type::value_type diff_zero = 0; typedef typename difference_type::value_type diff_zero_t;
/** the shape of the image pointed to is stored here. /** the shape of the image pointed to is stored here.
*/ */
difference_type m_shape; difference_type m_shape;
/** the strides (offset of a sample to the next) for every dimensio n /** the strides (offset of a sample to the next) for every dimensio n
are stored here. are stored here.
*/ */
difference_type m_stride; difference_type m_stride;
/** pointer to the image. /** pointer to the image.
*/ */
pointer m_ptr; pointer m_ptr;
public: public:
/** default constructor: create an empty image of size 0. /** default constructor: create an empty image of size 0.
*/ */
MultiArrayView () MultiArrayView ()
: m_shape (diff_zero), m_stride (diff_zero), m_ptr (0) : m_shape (diff_zero_t(0)), m_stride (diff_zero_t(0)), m_ptr (0)
{} {}
/** construct from shape and pointer /** construct from shape and pointer
*/ */
MultiArrayView (const difference_type &shape, pointer ptr); MultiArrayView (const difference_type &shape, pointer ptr);
/** construct from shape, strides (offset of a sample to the next) /** construct from shape, strides (offset of a sample to the next)
for every dimension) and pointer for every dimension) and pointer
*/ */
MultiArrayView (const difference_type &shape, MultiArrayView (const difference_type &shape,
skipping to change at line 1021 skipping to change at line 1020
/** the squared norm type (return type of squaredNorm(array)). /** the squared norm type (return type of squaredNorm(array)).
*/ */
typedef typename view_type::SquaredNormType SquaredNormType; typedef typename view_type::SquaredNormType SquaredNormType;
/** the norm type (return type of norm(array)). /** the norm type (return type of norm(array)).
*/ */
typedef typename view_type::NormType NormType; typedef typename view_type::NormType NormType;
protected: protected:
static const typename difference_type::value_type diff_zero = 0; typedef typename difference_type::value_type diff_zero_t;
/** the allocator used to allocate the memory /** the allocator used to allocate the memory
*/ */
allocator_type m_alloc; allocator_type m_alloc;
/** allocate memory for s pixels, write its address into the given /** allocate memory for s pixels, write its address into the given
pointer and initialize the pixels with init. pointer and initialize the pixels with init.
*/ */
void allocate (pointer &ptr, std::size_t s, const_reference init); void allocate (pointer &ptr, std::size_t s, const_reference init);
skipping to change at line 1166 skipping to change at line 1165
/** get the allocator. /** get the allocator.
*/ */
allocator_type const & allocator () const allocator_type const & allocator () const
{ {
return m_alloc; return m_alloc;
} }
}; };
template <unsigned int N, class T, class A> template <unsigned int N, class T, class A>
MultiArray <N, T, A>::MultiArray () MultiArray <N, T, A>::MultiArray ()
: MultiArrayView <N, T> (difference_type (diff_zero), : MultiArrayView <N, T> (difference_type (diff_zero_t(0)),
difference_type (diff_zero), 0) difference_type (diff_zero_t(0)), 0)
{} {}
template <unsigned int N, class T, class A> template <unsigned int N, class T, class A>
MultiArray <N, T, A>::MultiArray (allocator_type const & alloc) MultiArray <N, T, A>::MultiArray (allocator_type const & alloc)
: MultiArrayView <N, T> (difference_type (diff_zero), : MultiArrayView <N, T> (difference_type (diff_zero_t(0)),
difference_type (diff_zero), 0), difference_type (diff_zero_t(0)), 0),
m_alloc(alloc) m_alloc(alloc)
{} {}
template <unsigned int N, class T, class A> template <unsigned int N, class T, class A>
MultiArray <N, T, A>::MultiArray (const difference_type &shape, MultiArray <N, T, A>::MultiArray (const difference_type &shape,
allocator_type const & alloc) allocator_type const & alloc)
: MultiArrayView <N, T> (shape, detail::defaultStride <MultiArrayView<N ,T>::actual_dimension> (shape), 0), : MultiArrayView <N, T> (shape, detail::defaultStride <MultiArrayView<N ,T>::actual_dimension> (shape), 0),
m_alloc(alloc) m_alloc(alloc)
{ {
if (N == 0) if (N == 0)
 End of changes. 20 change blocks. 
42 lines changed or deleted 41 lines changed or added


 multi_convolution.hxx   multi_convolution.hxx 
//-- -*- c++ -*- //-- -*- c++ -*-
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2003 by Christian-Dennis Rahn */ /* Copyright 2003 by Christian-Dennis Rahn */
/* and Ullrich Koethe */ /* and Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_MULTI_CONVOLUTION_H #ifndef VIGRA_MULTI_CONVOLUTION_H
#define VIGRA_MULTI_CONVOLUTION_H #define VIGRA_MULTI_CONVOLUTION_H
#include <vigra/separableconvolution.hxx> #include "separableconvolution.hxx"
#include <vigra/array_vector.hxx> #include "array_vector.hxx"
#include <vigra/multi_array.hxx> #include "multi_array.hxx"
#include <vigra/accessor.hxx> #include "accessor.hxx"
#include <vigra/numerictraits.hxx> #include "numerictraits.hxx"
#include <vigra/navigator.hxx> #include "navigator.hxx"
#include <vigra/metaprogramming.hxx> #include "metaprogramming.hxx"
#include <vigra/multi_pointoperators.hxx> #include "multi_pointoperators.hxx"
namespace vigra namespace vigra
{ {
namespace detail namespace detail
{ {
/********************************************************/ /********************************************************/
/* */ /* */
/* internalSeparableConvolveMultiArray */ /* internalSeparableConvolveMultiArray */
skipping to change at line 213 skipping to change at line 213
<b>\#include</b> "<a href="multi__convolution_8hxx-source.html">vigra/m ulti_convolution.hxx</a>" <b>\#include</b> "<a href="multi__convolution_8hxx-source.html">vigra/m ulti_convolution.hxx</a>"
\code \code
MultiArray<3, unsigned char>::size_type shape(width, height, depth); MultiArray<3, unsigned char>::size_type shape(width, height, depth);
MultiArray<3, unsigned char> source(shape); MultiArray<3, unsigned char> source(shape);
MultiArray<3, float> dest(shape); MultiArray<3, float> dest(shape);
... ...
Kernel1D<float> gauss; Kernel1D<float> gauss;
gauss.initGaussian(sigma); gauss.initGaussian(sigma);
// create 3 Gauss kernels, one for each dimension
ArrayVector<Kernel1D<float> > kernels(3, gauss);
// perform Gaussian smoothing on all dimensions // perform Gaussian smoothing on all dimensions
separableConvolveMultiArray(srcMultiArrayRange(source), destMultiArray( separableConvolveMultiArray(srcMultiArrayRange(source), destMultiArray(
dest), gauss); dest),
kernels.begin());
\endcode \endcode
\see vigra::Kernel1D, convolveLine() \see vigra::Kernel1D, convolveLine()
*/ */
template <class SrcIterator, class SrcShape, class SrcAccessor, template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor, class KernelIterator> class DestIterator, class DestAccessor, class KernelIterator>
void void
separableConvolveMultiArray( SrcIterator s, SrcShape const & shape, SrcAcce ssor src, separableConvolveMultiArray( SrcIterator s, SrcShape const & shape, SrcAcce ssor src,
DestIterator d, DestAccessor dest, KernelItera tor kernels ) DestIterator d, DestAccessor dest, KernelItera tor kernels )
{ {
 End of changes. 4 change blocks. 
11 lines changed or deleted 14 lines changed or added


 multi_impex.hxx   multi_impex.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2003 by Gunnar Kedenburg */ /* Copyright 2003 by Gunnar Kedenburg */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 46 skipping to change at line 46
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_MULTI_IMPEX_HXX #ifndef VIGRA_MULTI_IMPEX_HXX
#define VIGRA_MULTI_IMPEX_HXX #define VIGRA_MULTI_IMPEX_HXX
#include <memory> #include <memory>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "vigra/basicimageview.hxx" #include "config.hxx"
#include "vigra/impex.hxx" #include "basicimageview.hxx"
#include "vigra/multi_array.hxx" #include "impex.hxx"
#include "multi_array.hxx"
namespace vigra { namespace vigra {
void findImageSequence(const std::string &name_base, VIGRA_EXPORT void findImageSequence(const std::string &name_base,
const std::string &name_ext, const std::string &name_ext,
std::vector<std::string> & numbers); std::vector<std::string> & numbers);
/** \addtogroup VolumeImpex Import/export of volume data. /** \addtogroup VolumeImpex Import/export of volume data.
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
/* */ /* */
skipping to change at line 160 skipping to change at line 161
std::stringstream stream; std::stringstream stream;
stream << std::setfill ('0') << std::setw (numlen) << i; stream << std::setfill ('0') << std::setw (numlen) << i;
std::string name_num; std::string name_num;
stream >> name_num; stream >> name_num;
std::string name = name_base + name_num + name_ext; std::string name = name_base + name_num + name_ext;
// generate a basic image view to the current layer // generate a basic image view to the current layer
MultiArrayView <2, T, Tag> array_view (volume.bindOuter (i)); MultiArrayView <2, T, Tag> array_view (volume.bindOuter (i));
BasicImageView <T> view = makeBasicImageView (array_view); BasicImageView <T> view = makeBasicImageView (array_view);
// import the image // export the image
ImageExportInfo info (name.c_str ()); ImageExportInfo info(name.c_str ());
exportImage (srcImageRange(view), info); exportImage(srcImageRange(view), info);
} }
} }
//@} //@}
} // namespace vigra } // namespace vigra
#endif // VIGRA_MULTI_IMPEX_HXX #endif // VIGRA_MULTI_IMPEX_HXX
 End of changes. 4 change blocks. 
8 lines changed or deleted 9 lines changed or added


 multi_iterator.hxx   multi_iterator.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2003 by Gunnar Kedenburg */ /* Copyright 2003 by Gunnar Kedenburg */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* ( Version 1.3.0, Sep 10 2004 ) */ /* ( Version 1.3.0, Sep 10 2004 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
skipping to change at line 43 skipping to change at line 43
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_MULTI_ITERATOR_HXX #ifndef VIGRA_MULTI_ITERATOR_HXX
#define VIGRA_MULTI_ITERATOR_HXX #define VIGRA_MULTI_ITERATOR_HXX
#include <sys/types.h> #include <sys/types.h>
#include "vigra/tinyvector.hxx" #include "tinyvector.hxx"
#include "vigra/iteratortags.hxx" #include "iteratortags.hxx"
namespace vigra { namespace vigra {
template <unsigned int N, class T, template <unsigned int N, class T,
class REFERENCE = T &, class POINTER = T *> class MultiIterator; class REFERENCE = T &, class POINTER = T *> class MultiIterator;
template <unsigned int N, class T, template <unsigned int N, class T,
class REFERENCE = T &, class POINTER = T *> class StridedMultiIte rator; class REFERENCE = T &, class POINTER = T *> class StridedMultiIte rator;
/** \page MultiIteratorPage Multi-dimensional Array Iterators /** \page MultiIteratorPage Multi-dimensional Array Iterators
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added


 multi_pointoperators.hxx   multi_pointoperators.hxx 
//-- -*- c++ -*- //-- -*- c++ -*-
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2003 by Ullrich Koethe */ /* Copyright 2003 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_MULTI_POINTOPERATORS_H #ifndef VIGRA_MULTI_POINTOPERATORS_H
#define VIGRA_MULTI_POINTOPERATORS_H #define VIGRA_MULTI_POINTOPERATORS_H
#include <vigra/initimage.hxx> #include "initimage.hxx"
#include <vigra/copyimage.hxx> #include "copyimage.hxx"
#include <vigra/transformimage.hxx> #include "transformimage.hxx"
#include <vigra/combineimages.hxx> #include "combineimages.hxx"
#include <vigra/inspectimage.hxx> #include "inspectimage.hxx"
#include <vigra/multi_array.hxx> #include "multi_array.hxx"
#include <vigra/metaprogramming.hxx> #include "metaprogramming.hxx"
namespace vigra namespace vigra
{ {
/** \addtogroup MultiPointoperators Point operators for multi-dimensional a rrays. /** \addtogroup MultiPointoperators Point operators for multi-dimensional a rrays.
Copy, transform, and inspect arbitrary dimensional arrays which are rep resented Copy, transform, and inspect arbitrary dimensional arrays which are rep resented
by iterators compatible to \ref MultiIteratorPage. Note that are range is here by iterators compatible to \ref MultiIteratorPage. Note that are range is here
specified by a pair: an iterator referring to the first point of the ar ray specified by a pair: an iterator referring to the first point of the ar ray
and a shape object specifying the size of the (rectangular) ROI. and a shape object specifying the size of the (rectangular) ROI.
skipping to change at line 1568 skipping to change at line 1568
void void
inspectTwoMultiArrays(triple<Iterator1, Shape, Accessor1> const & s1, inspectTwoMultiArrays(triple<Iterator1, Shape, Accessor1> const & s1,
pair<Iterator2, Accessor2> const & s2, Functor & f) pair<Iterator2, Accessor2> const & s2, Functor & f)
{ {
inspectTwoMultiArrays(s1.first, s1.second, s1.third, inspectTwoMultiArrays(s1.first, s1.second, s1.third,
s2.first, s2.second, f); s2.first, s2.second, f);
} }
//@} //@}
}; //-- namespace vigra } //-- namespace vigra
#endif //-- VIGRA_MULTI_POINTOPERATORS_H #endif //-- VIGRA_MULTI_POINTOPERATORS_H
 End of changes. 3 change blocks. 
9 lines changed or deleted 9 lines changed or added


 navigator.hxx   navigator.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2004 by Ullrich Koethe */ /* Copyright 2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 nonlineardiffusion.hxx   nonlineardiffusion.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_NONLINEARDIFFUSION_HXX #ifndef VIGRA_NONLINEARDIFFUSION_HXX
#define VIGRA_NONLINEARDIFFUSION_HXX #define VIGRA_NONLINEARDIFFUSION_HXX
#include <vector> #include <vector>
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
#include "vigra/stdimagefunctions.hxx" #include "stdimagefunctions.hxx"
#include "vigra/imageiteratoradapter.hxx" #include "imageiteratoradapter.hxx"
#include "vigra/functortraits.hxx" #include "functortraits.hxx"
namespace vigra { namespace vigra {
template <class SrcIterator, class SrcAccessor, template <class SrcIterator, class SrcAccessor,
class CoeffIterator, class DestIterator> class CoeffIterator, class DestIterator>
void internalNonlinearDiffusionDiagonalSolver( void internalNonlinearDiffusionDiagonalSolver(
SrcIterator sbegin, SrcIterator send, SrcAccessor sa, SrcIterator sbegin, SrcIterator send, SrcAccessor sa,
CoeffIterator diag, CoeffIterator upper, CoeffIterator lower, CoeffIterator diag, CoeffIterator upper, CoeffIterator lower,
DestIterator dbegin) DestIterator dbegin)
{ {
skipping to change at line 677 skipping to change at line 677
one_(NumericTraits<result_type>::one()), one_(NumericTraits<result_type>::one()),
zero_(NumericTraits<result_type>::zero()) zero_(NumericTraits<result_type>::zero())
{} {}
/** calculate diffusivity from scalar arguments /** calculate diffusivity from scalar arguments
*/ */
result_type operator()(first_argument_type const & gx, second_argument_ type const & gy) const result_type operator()(first_argument_type const & gx, second_argument_ type const & gy) const
{ {
Value mag = (gx*gx + gy*gy) / weight_; Value mag = (gx*gx + gy*gy) / weight_;
return (mag == zero_) ? one_ : one_ - exp(-3.315 / mag / mag); return (mag == zero_) ? one_ : one_ - VIGRA_CSTD::exp(-3.315 / mag / mag);
} }
/** calculate diffusivity from RGB arguments /** calculate diffusivity from RGB arguments
*/ */
result_type operator()(RGBValue<Value> const & gx, RGBValue<Value> cons t & gy) const result_type operator()(RGBValue<Value> const & gx, RGBValue<Value> cons t & gy) const
{ {
result_type mag = (gx.red()*gx.red() + result_type mag = (gx.red()*gx.red() +
gx.green()*gx.green() + gx.green()*gx.green() +
gx.blue()*gx.blue() + gx.blue()*gx.blue() +
gy.red()*gy.red() + gy.red()*gy.red() +
gy.green()*gy.green() + gy.green()*gy.green() +
gy.blue()*gy.blue()) / weight_; gy.blue()*gy.blue()) / weight_;
return (mag == zero_) ? one_ : one_ - exp(-3.315 / mag / mag); return (mag == zero_) ? one_ : one_ - VIGRA_CSTD::exp(-3.315 / mag / mag);
} }
result_type weight_; result_type weight_;
result_type one_; result_type one_;
result_type zero_; result_type zero_;
}; };
template <class ValueType> template <class ValueType>
class FunctorTraits<DiffusivityFunctor<ValueType> > class FunctorTraits<DiffusivityFunctor<ValueType> >
: public FunctorTraitsBase<DiffusivityFunctor<ValueType> > : public FunctorTraitsBase<DiffusivityFunctor<ValueType> >
 End of changes. 4 change blocks. 
7 lines changed or deleted 7 lines changed or added


 numerictraits.hxx   numerictraits.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 44 skipping to change at line 44
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_NUMERICTRAITS_HXX #ifndef VIGRA_NUMERICTRAITS_HXX
#define VIGRA_NUMERICTRAITS_HXX #define VIGRA_NUMERICTRAITS_HXX
#include <limits.h> #include <limits.h>
#include <cfloat> #include <cfloat>
#include <complex> #include <complex>
#include "vigra/metaprogramming.hxx" #include "metaprogramming.hxx"
#include "vigra/sized_int.hxx" #include "sized_int.hxx"
/********************************************************/ /********************************************************/
/* */ /* */
/* NumericTraits */ /* NumericTraits */
/* */ /* */
/********************************************************/ /********************************************************/
/** \page NumericPromotionTraits Numeric and Promotion Traits /** \page NumericPromotionTraits Numeric and Promotion Traits
Meta-information about arithmetic types. Meta-information about arithmetic types.
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added


 orientedtensorfilters.hxx   orientedtensorfilters.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2002-2004 by Ullrich Koethe */ /* Copyright 2002-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_ORIENTEDTENSORFILTERS_HXX #ifndef VIGRA_ORIENTEDTENSORFILTERS_HXX
#define VIGRA_ORIENTEDTENSORFILTERS_HXX #define VIGRA_ORIENTEDTENSORFILTERS_HXX
#include <cmath> #include <cmath>
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/initimage.hxx" #include "initimage.hxx"
#include "vigra/stdconvolution.hxx" #include "stdconvolution.hxx"
namespace vigra { namespace vigra {
/** \addtogroup TensorImaging Tensor Image Processing /** \addtogroup TensorImaging Tensor Image Processing
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
/* */ /* */
/* hourGlassFilter */ /* hourGlassFilter */
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 pixelneighborhood.hxx   pixelneighborhood.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2005 by Hans Meine, Ullrich Koethe */ /* Copyright 1998-2005 by Hans Meine, Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_PIXELNEIGHBORHOOD_HXX #ifndef VIGRA_PIXELNEIGHBORHOOD_HXX
#define VIGRA_PIXELNEIGHBORHOOD_HXX #define VIGRA_PIXELNEIGHBORHOOD_HXX
#include <vigra/utilities.hxx> #include "utilities.hxx"
namespace vigra { namespace vigra {
/** \addtogroup PixelNeighborhood Utilities to manage pixel neighborhoods /** \addtogroup PixelNeighborhood Utilities to manage pixel neighborhoods
4- and 8-neighborhood definitions and circulators. 4- and 8-neighborhood definitions and circulators.
<b>\#include</b> "<a href="pixelneighborhood_8hxx-source.html">vigra/pi xelneighborhood.hxx</a>"<br> <b>\#include</b> "<a href="pixelneighborhood_8hxx-source.html">vigra/pi xelneighborhood.hxx</a>"<br>
<b>See also:</b> \ref vigra::NeighborhoodCirculator <b>See also:</b> \ref vigra::NeighborhoodCirculator
skipping to change at line 938 skipping to change at line 938
<b>\#include</b> "<a href="pixelneighborhood_8hxx-source.html">vigra/pi xelneighborhood.hxx</a>"<br> <b>\#include</b> "<a href="pixelneighborhood_8hxx-source.html">vigra/pi xelneighborhood.hxx</a>"<br>
Namespace: vigra Namespace: vigra
\code \code
BImage::traverser upperleft(...), lowerright(...); BImage::traverser upperleft(...), lowerright(...);
int width = lowerright.x - upperleft.x; int width = lowerright.x - upperleft.x;
int height = lowerright.y - upperleft.y; int height = lowerright.y - upperleft.y;
++upperleft.y; // avoide image border ++upperleft.y; // avoid image border
for(int y=1; y<height-1; ++y, ++upperleft.y) for(int y=1; y<height-1; ++y, ++upperleft.y)
{ {
BImage::traverser ix = upperleft + Diff2D(1,0); BImage::traverser ix = upperleft + Diff2D(1,0);
for(int x=1; x<width-1; ++x, ++ix.x) for(int x=1; x<width-1; ++x, ++ix.x)
{ {
// analyse all neighbors of a pixel (use FourNeighborCode // analyse all neighbors of a pixel (use FourNeighborCode
// instead of EightNeighborCode for 4-neighborhood): // instead of EightNeighborCode for 4-neighborhood):
NeighborhoodCirculator<BImage::traverser, EightNeighborCode> NeighborhoodCirculator<BImage::traverser, EightNeighborCode>
circulator(ix), circulator(ix),
end(circulator); end(circulator);
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added


 polynomial.hxx   polynomial.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2004 by Ullrich Koethe */ /* Copyright 1998-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 44 skipping to change at line 44
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_POLYNOMIAL_HXX #ifndef VIGRA_POLYNOMIAL_HXX
#define VIGRA_POLYNOMIAL_HXX #define VIGRA_POLYNOMIAL_HXX
#include <cmath> #include <cmath>
#include <complex> #include <complex>
#include <algorithm> #include <algorithm>
#include "vigra/error.hxx" #include <iosfwd>
#include "vigra/mathutil.hxx" #include "error.hxx"
#include "vigra/numerictraits.hxx" #include "mathutil.hxx"
#include "vigra/array_vector.hxx" #include "numerictraits.hxx"
#include "array_vector.hxx"
namespace vigra { namespace vigra {
template <class T> class Polynomial; template <class T> class Polynomial;
template <unsigned int MAXORDER, class T> class StaticPolynomial; template <unsigned int MAXORDER, class T> class StaticPolynomial;
/*****************************************************************/ /*****************************************************************/
/* */ /* */
/* PolynomialView */ /* PolynomialView */
/* */ /* */
skipping to change at line 466 skipping to change at line 467
/** Construct polynomial with given <tt>order</tt> and all coeffici ents /** Construct polynomial with given <tt>order</tt> and all coeffici ents
set to zero (they can be set later using <tt>operator[]</tt> set to zero (they can be set later using <tt>operator[]</tt>
or the iterators). <tt>epsilon</tt> (default: 1.0e-14) determin es or the iterators). <tt>epsilon</tt> (default: 1.0e-14) determin es
the precision of subsequent algorithms (especially root finding ) the precision of subsequent algorithms (especially root finding )
performed on the polynomial. performed on the polynomial.
*/ */
Polynomial(unsigned int order = 0, double epsilon = 1.0e-14) Polynomial(unsigned int order = 0, double epsilon = 1.0e-14)
: BaseType(epsilon), : BaseType(epsilon),
polynomial_(order + 1, T()) polynomial_(order + 1, T())
{ {
setCoeffs(&polynomial_[0], order); this->setCoeffs(&polynomial_[0], order);
} }
/** Copy constructor /** Copy constructor
*/ */
Polynomial(Polynomial const & p) Polynomial(Polynomial const & p)
: BaseType(p.epsilon()), : BaseType(p.epsilon()),
polynomial_(p.begin(), p.end()) polynomial_(p.begin(), p.end())
{ {
setCoeffs(&polynomial_[0], p.order()); this->setCoeffs(&polynomial_[0], p.order());
} }
/** Construct polynomial by copying the given coefficient sequence. /** Construct polynomial by copying the given coefficient sequence.
*/ */
template <class ITER> template <class ITER>
Polynomial(ITER i, unsigned int order) Polynomial(ITER i, unsigned int order)
: BaseType(), : BaseType(),
polynomial_(i, i + order + 1) polynomial_(i, i + order + 1)
{ {
setCoeffs(&polynomial_[0], order); this->setCoeffs(&polynomial_[0], order);
} }
/** Construct polynomial by copying the given coefficient sequence. /** Construct polynomial by copying the given coefficient sequence.
Set <tt>epsilon</tt> (default: 1.0e-14) as Set <tt>epsilon</tt> (default: 1.0e-14) as
the precision of subsequent algorithms (especially root finding ) the precision of subsequent algorithms (especially root finding )
performed on the polynomial. performed on the polynomial.
*/ */
template <class ITER> template <class ITER>
Polynomial(ITER i, unsigned int order, double epsilon) Polynomial(ITER i, unsigned int order, double epsilon)
: BaseType(epsilon), : BaseType(epsilon),
polynomial_(i, i + order + 1) polynomial_(i, i + order + 1)
{ {
setCoeffs(&polynomial_[0], order); this->setCoeffs(&polynomial_[0], order);
} }
/** Assigment /** Assigment
*/ */
Polynomial & operator=(Polynomial const & p) Polynomial & operator=(Polynomial const & p)
{ {
if(this == &p) if(this == &p)
return *this; return *this;
ArrayVector<T> tmp(p.begin(), p.end()); ArrayVector<T> tmp(p.begin(), p.end());
polynomial_.swap(tmp); polynomial_.swap(tmp);
setCoeffs(&polynomial_[0], p.order()); this->setCoeffs(&polynomial_[0], p.order());
this->epsilon_ = p.epsilon_; this->epsilon_ = p.epsilon_;
return *this; return *this;
} }
/** Construct new polynomial representing the derivative of this /** Construct new polynomial representing the derivative of this
polynomial. polynomial.
*/ */
Polynomial<T> getDerivative(unsigned int n = 1) const Polynomial<T> getDerivative(unsigned int n = 1) const
{ {
Polynomial<T> res(*this); Polynomial<T> res(*this);
skipping to change at line 600 skipping to change at line 601
or the iterators). <tt>epsilon</tt> (default: 1.0e-14) determin es or the iterators). <tt>epsilon</tt> (default: 1.0e-14) determin es
the precision of subsequent algorithms (especially root finding ) the precision of subsequent algorithms (especially root finding )
performed on the polynomial. performed on the polynomial.
*/ */
StaticPolynomial(unsigned int order = 0, double epsilon = 1.0e-14) StaticPolynomial(unsigned int order = 0, double epsilon = 1.0e-14)
: BaseType(epsilon) : BaseType(epsilon)
{ {
vigra_precondition(order <= MAXORDER, vigra_precondition(order <= MAXORDER,
"StaticPolynomial(): order exceeds MAXORDER."); "StaticPolynomial(): order exceeds MAXORDER.");
std::fill_n(polynomial_, order+1, T()); std::fill_n(polynomial_, order+1, T());
setCoeffs(polynomial_, order); this->setCoeffs(polynomial_, order);
} }
/** Copy constructor /** Copy constructor
*/ */
StaticPolynomial(StaticPolynomial const & p) StaticPolynomial(StaticPolynomial const & p)
: BaseType(p.epsilon()) : BaseType(p.epsilon())
{ {
std::copy(p.begin(), p.end(), polynomial_); std::copy(p.begin(), p.end(), polynomial_);
setCoeffs(polynomial_, p.order()); this->setCoeffs(polynomial_, p.order());
} }
/** Construct polynomial by copying the given coefficient sequence. /** Construct polynomial by copying the given coefficient sequence.
<tt>order <= MAXORDER</tt> is required. <tt>order <= MAXORDER</tt> is required.
*/ */
template <class ITER> template <class ITER>
StaticPolynomial(ITER i, unsigned int order) StaticPolynomial(ITER i, unsigned int order)
: BaseType() : BaseType()
{ {
vigra_precondition(order <= MAXORDER, vigra_precondition(order <= MAXORDER,
"StaticPolynomial(): order exceeds MAXORDER."); "StaticPolynomial(): order exceeds MAXORDER.");
std::copy(i, i + order + 1, polynomial_); std::copy(i, i + order + 1, polynomial_);
setCoeffs(polynomial_, order); this->setCoeffs(polynomial_, order);
} }
/** Construct polynomial by copying the given coefficient sequence. /** Construct polynomial by copying the given coefficient sequence.
<tt>order <= MAXORDER</tt> is required. Set <tt>epsilon</tt> (d efault: 1.0e-14) as <tt>order <= MAXORDER</tt> is required. Set <tt>epsilon</tt> (d efault: 1.0e-14) as
the precision of subsequent algorithms (especially root finding ) the precision of subsequent algorithms (especially root finding )
performed on the polynomial. performed on the polynomial.
*/ */
template <class ITER> template <class ITER>
StaticPolynomial(ITER i, unsigned int order, double epsilon) StaticPolynomial(ITER i, unsigned int order, double epsilon)
: BaseType(epsilon) : BaseType(epsilon)
{ {
vigra_precondition(order <= MAXORDER, vigra_precondition(order <= MAXORDER,
"StaticPolynomial(): order exceeds MAXORDER."); "StaticPolynomial(): order exceeds MAXORDER.");
std::copy(i, i + order + 1, polynomial_); std::copy(i, i + order + 1, polynomial_);
setCoeffs(polynomial_, order); this->setCoeffs(polynomial_, order);
} }
/** Assigment. /** Assigment.
*/ */
StaticPolynomial & operator=(StaticPolynomial const & p) StaticPolynomial & operator=(StaticPolynomial const & p)
{ {
if(this == &p) if(this == &p)
return *this; return *this;
std::copy(p.begin(), p.end(), polynomial_); std::copy(p.begin(), p.end(), polynomial_);
setCoeffs(polynomial_, p.order()); this->setCoeffs(polynomial_, p.order());
this->epsilon_ = p.epsilon_; this->epsilon_ = p.epsilon_;
return *this; return *this;
} }
/** Construct new polynomial representing the derivative of this /** Construct new polynomial representing the derivative of this
polynomial. polynomial.
*/ */
StaticPolynomial getDerivative(unsigned int n = 1) const StaticPolynomial getDerivative(unsigned int n = 1) const
{ {
StaticPolynomial res(*this); StaticPolynomial res(*this);
skipping to change at line 1096 skipping to change at line 1097
inline bool inline bool
polynomialRealRoots(POLYNOMIAL const & poriginal, VECTOR & roots) polynomialRealRoots(POLYNOMIAL const & poriginal, VECTOR & roots)
{ {
return polynomialRealRoots(poriginal, roots, true); return polynomialRealRoots(poriginal, roots, true);
} }
//@} //@}
} // namespace vigra } // namespace vigra
namespace std {
template <class T>
ostream & operator<<(ostream & o, vigra::PolynomialView<T> const & p)
{
for(unsigned int k=0; k < p.order(); ++k)
o << p[k] << " ";
o << p[p.order()];
return o;
}
} // namespace std
#endif // VIGRA_POLYNOMIAL_HXX #endif // VIGRA_POLYNOMIAL_HXX
 End of changes. 13 change blocks. 
15 lines changed or deleted 29 lines changed or added


 rational.hxx   rational.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2004 by Ullrich Koethe */ /* Copyright 1998-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* It was adapted from the file boost/rational.hpp of the */ /* It was adapted from the file boost/rational.hpp of the */
/* boost library. */ /* boost library. */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
skipping to change at line 55 skipping to change at line 55
// implied warranty, and with no claim as to its suitability for any purpo se. // implied warranty, and with no claim as to its suitability for any purpo se.
// //
// See http://www.boost.org/libs/rational for documentation. // See http://www.boost.org/libs/rational for documentation.
#ifndef VIGRA_RATIONAL_HPP #ifndef VIGRA_RATIONAL_HPP
#define VIGRA_RATIONAL_HPP #define VIGRA_RATIONAL_HPP
#include <cmath> #include <cmath>
#include <stdexcept> #include <stdexcept>
#include <iosfwd> #include <iosfwd>
#include "vigra/config.hxx" #include "config.hxx"
#include "vigra/mathutil.hxx" #include "mathutil.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/metaprogramming.hxx" #include "metaprogramming.hxx"
namespace vigra { namespace vigra {
/** \addtogroup MathFunctions Mathematical Functions /** \addtogroup MathFunctions Mathematical Functions
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
/* */ /* */
/* gcd */ /* gcd */
 End of changes. 2 change blocks. 
5 lines changed or deleted 5 lines changed or added


 recursiveconvolution.hxx   recursiveconvolution.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_RECURSIVECONVOLUTION_HXX #ifndef VIGRA_RECURSIVECONVOLUTION_HXX
#define VIGRA_RECURSIVECONVOLUTION_HXX #define VIGRA_RECURSIVECONVOLUTION_HXX
#include <cmath> #include <cmath>
#include <vector> #include <vector>
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/imageiteratoradapter.hxx" #include "imageiteratoradapter.hxx"
#include "vigra/bordertreatment.hxx" #include "bordertreatment.hxx"
namespace vigra { namespace vigra {
/********************************************************/ /********************************************************/
/* */ /* */
/* Recursive convolution functions */ /* Recursive convolution functions */
/* */ /* */
/********************************************************/ /********************************************************/
/** \addtogroup RecursiveConvolution Recursive convolution functions /** \addtogroup RecursiveConvolution Recursive convolution functions
 End of changes. 2 change blocks. 
5 lines changed or deleted 5 lines changed or added


 resampling_convolution.hxx   resampling_convolution.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2004 by Ullrich Koethe */ /* Copyright 1998-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_RESAMPLING_CONVOLUTION_HXX #ifndef VIGRA_RESAMPLING_CONVOLUTION_HXX
#define VIGRA_RESAMPLING_CONVOLUTION_HXX #define VIGRA_RESAMPLING_CONVOLUTION_HXX
#include <cmath> #include <cmath>
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
#include "vigra/array_vector.hxx" #include "array_vector.hxx"
#include "vigra/rational.hxx" #include "rational.hxx"
#include "vigra/functortraits.hxx" #include "functortraits.hxx"
namespace vigra { namespace vigra {
namespace resampling_detail namespace resampling_detail
{ {
struct MapTargetToSourceCoordinate struct MapTargetToSourceCoordinate
{ {
MapTargetToSourceCoordinate(Rational<int> const & samplingRatio, MapTargetToSourceCoordinate(Rational<int> const & samplingRatio,
Rational<int> const & offset) Rational<int> const & offset)
skipping to change at line 253 skipping to change at line 253
void void
resamplingConvolveX(triple<SrcIter, SrcIter, SrcAcc> src, resamplingConvolveX(triple<SrcIter, SrcIter, SrcAcc> src,
triple<DestIter, DestIter, DestAcc> dest, triple<DestIter, DestIter, DestAcc> dest,
Kernel const & kernel, Kernel const & kernel,
Rational<int> const & samplingRatio, Rational<i nt> const & offset); Rational<int> const & samplingRatio, Rational<i nt> const & offset);
} }
\endcode \endcode
<b> Usage:</b> <b> Usage:</b>
<b>\#include</b> "<a href="resampling_convolution_8hxx-source.html">vig ra/resampling_convolution.hxx</a>" <b>\#include</b> "<a href="resampling__convolution_8hxx-source.html">vi gra/resampling_convolution.hxx</a>"
\code \code
Rational<int> ratio(2), offset(0); Rational<int> ratio(2), offset(0);
FImage src(w,h), FImage src(w,h),
dest(rational_cast<int>(ratio*w), h); dest(rational_cast<int>(ratio*w), h);
float sigma = 2.0; float sigma = 2.0;
Gaussian<float> smooth(sigma); Gaussian<float> smooth(sigma);
... ...
skipping to change at line 388 skipping to change at line 388
void void
resamplingConvolveY(triple<SrcIter, SrcIter, SrcAcc> src, resamplingConvolveY(triple<SrcIter, SrcIter, SrcAcc> src,
triple<DestIter, DestIter, DestAcc> dest, triple<DestIter, DestIter, DestAcc> dest,
Kernel const & kernel, Kernel const & kernel,
Rational<int> const & samplingRatio, Rational<i nt> const & offset); Rational<int> const & samplingRatio, Rational<i nt> const & offset);
} }
\endcode \endcode
<b> Usage:</b> <b> Usage:</b>
<b>\#include</b> "<a href="resampling_convolution_8hxx-source.html">vig ra/resampling_convolution.hxx</a>" <b>\#include</b> "<a href="resampling__convolution_8hxx-source.html">vi gra/resampling_convolution.hxx</a>"
\code \code
Rational<int> ratio(2), offset(0); Rational<int> ratio(2), offset(0);
FImage src(w,h), FImage src(w,h),
dest(w, rational_cast<int>(ratio*h)); dest(w, rational_cast<int>(ratio*h));
float sigma = 2.0; float sigma = 2.0;
Gaussian<float> smooth(sigma); Gaussian<float> smooth(sigma);
... ...
skipping to change at line 511 skipping to change at line 511
triple<DestIterator, DestIterator, DestAccessor> dest, triple<DestIterator, DestIterator, DestAccessor> dest,
KernelX const & kx, KernelX const & kx,
Rational<int> const & samplingRatioX, Rational<i nt> const & offsetX, Rational<int> const & samplingRatioX, Rational<i nt> const & offsetX,
KernelY const & ky, KernelY const & ky,
Rational<int> const & samplingRatioY, Rational<i nt> const & offsetY); Rational<int> const & samplingRatioY, Rational<i nt> const & offsetY);
} }
\endcode \endcode
<b> Usage:</b> <b> Usage:</b>
<b>\#include</b> "<a href="resampling_convolution_8hxx-source.html">vig ra/resampling_convolution.hxx</a>" <b>\#include</b> "<a href="resampling__convolution_8hxx-source.html">vi gra/resampling_convolution.hxx</a>"
\code \code
Rational<int> xratio(2), yratio(3), offset(0); Rational<int> xratio(2), yratio(3), offset(0);
FImage src(w,h), FImage src(w,h),
dest(rational_cast<int>(xratio*w), rational_cast<int>(yratio*h)) ; dest(rational_cast<int>(xratio*w), rational_cast<int>(yratio*h)) ;
float sigma = 2.0; float sigma = 2.0;
Gaussian<float> smooth(sigma); Gaussian<float> smooth(sigma);
... ...
 End of changes. 5 change blocks. 
8 lines changed or deleted 8 lines changed or added


 resizeimage.hxx   resizeimage.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2004 by Ullrich Koethe */ /* Copyright 1998-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_RESIZEIMAGE_HXX #ifndef VIGRA_RESIZEIMAGE_HXX
#define VIGRA_RESIZEIMAGE_HXX #define VIGRA_RESIZEIMAGE_HXX
#include <vector> #include <vector>
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
#include "vigra/recursiveconvolution.hxx" #include "recursiveconvolution.hxx"
#include "vigra/separableconvolution.hxx" #include "separableconvolution.hxx"
#include "vigra/resampling_convolution.hxx" #include "resampling_convolution.hxx"
#include "vigra/splines.hxx" #include "splines.hxx"
namespace vigra { namespace vigra {
/*****************************************************************/ /*****************************************************************/
/* */ /* */
/* CoscotFunction */ /* CoscotFunction */
/* */ /* */
/*****************************************************************/ /*****************************************************************/
/*! The Coscot interpolation function. /*! The Coscot interpolation function.
 End of changes. 2 change blocks. 
8 lines changed or deleted 8 lines changed or added


 rfftw.hxx   rfftw.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_RFFTW_HXX #ifndef VIGRA_RFFTW_HXX
#define VIGRA_RFFTW_HXX #define VIGRA_RFFTW_HXX
#include "vigra/array_vector.hxx" #include "array_vector.hxx"
#include "vigra/fftw.hxx" #include "fftw.hxx"
#include <rfftw.h> #include <rfftw.h>
namespace vigra { namespace vigra {
namespace detail { namespace detail {
struct FFTWSinCosConfig struct FFTWSinCosConfig
{ {
ArrayVector<fftw_real> twiddles; ArrayVector<fftw_real> twiddles;
ArrayVector<fftw_real> fftwInput; ArrayVector<fftw_real> fftwInput;
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added


 rgbvalue.hxx   rgbvalue.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 43 skipping to change at line 43
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_RGBVALUE_HXX #ifndef VIGRA_RGBVALUE_HXX
#define VIGRA_RGBVALUE_HXX #define VIGRA_RGBVALUE_HXX
#include <cmath> // abs(double) #include <cmath> // abs(double)
#include <cstdlib> // abs(int) #include <cstdlib> // abs(int)
#include "vigra/config.hxx" #include "config.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/accessor.hxx" #include "accessor.hxx"
#include "vigra/tinyvector.hxx" #include "tinyvector.hxx"
#include "vigra/static_assert.hxx" #include "static_assert.hxx"
namespace vigra { namespace vigra {
namespace detail { namespace detail {
template <unsigned int I, unsigned int R, unsigned int G, unsigned int B> template <unsigned int I, unsigned int R, unsigned int G, unsigned int B>
struct SelectColorIndexRHS; struct SelectColorIndexRHS;
template <unsigned int R, unsigned int G, unsigned int B> template <unsigned int R, unsigned int G, unsigned int B>
struct SelectColorIndexRHS<0, R, G, B> struct SelectColorIndexRHS<0, R, G, B>
 End of changes. 2 change blocks. 
6 lines changed or deleted 6 lines changed or added


 seededregiongrowing.hxx   seededregiongrowing.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2003 by Ullrich Koethe, Hans Meine */ /* Copyright 1998-2003 by Ullrich Koethe, Hans Meine */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 44 skipping to change at line 44
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_SEEDEDREGIONGROWING_HXX #ifndef VIGRA_SEEDEDREGIONGROWING_HXX
#define VIGRA_SEEDEDREGIONGROWING_HXX #define VIGRA_SEEDEDREGIONGROWING_HXX
#include <vector> #include <vector>
#include <stack> #include <stack>
#include <queue> #include <queue>
#include <vigra/utilities.hxx> #include "utilities.hxx"
#include <vigra/stdimage.hxx> #include "stdimage.hxx"
#include <vigra/stdimagefunctions.hxx> #include "stdimagefunctions.hxx"
namespace vigra { namespace vigra {
namespace detail { namespace detail {
template <class COST> template <class COST>
class SeedRgPixel class SeedRgPixel
{ {
public: public:
Point2D location_, nearest_; Point2D location_, nearest_;
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 separableconvolution.hxx   separableconvolution.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_SEPARABLECONVOLUTION_HXX #ifndef VIGRA_SEPARABLECONVOLUTION_HXX
#define VIGRA_SEPARABLECONVOLUTION_HXX #define VIGRA_SEPARABLECONVOLUTION_HXX
#include <cmath> #include <cmath>
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/imageiteratoradapter.hxx" #include "imageiteratoradapter.hxx"
#include "vigra/bordertreatment.hxx" #include "bordertreatment.hxx"
#include "vigra/gaussians.hxx" #include "gaussians.hxx"
#include "vigra/array_vector.hxx" #include "array_vector.hxx"
namespace vigra { namespace vigra {
/********************************************************/ /********************************************************/
/* */ /* */
/* internalConvolveLineWrap */ /* internalConvolveLineWrap */
/* */ /* */
/********************************************************/ /********************************************************/
template <class SrcIterator, class SrcAccessor, template <class SrcIterator, class SrcAccessor,
 End of changes. 2 change blocks. 
7 lines changed or deleted 7 lines changed or added


 sized_int.hxx   sized_int.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 99 skipping to change at line 99
struct SelectBiggestIntegerType<Int_type_not_supported_on_this_platform> struct SelectBiggestIntegerType<Int_type_not_supported_on_this_platform>
{ {
enum { size = 0 }; enum { size = 0 };
typedef Int_type_not_supported_on_this_platform type; typedef Int_type_not_supported_on_this_platform type;
}; };
typedef IntTypeList<signed char, typedef IntTypeList<signed char,
IntTypeList<signed short, IntTypeList<signed short,
IntTypeList<signed int, IntTypeList<signed int,
IntTypeList<signed long, IntTypeList<signed long,
Int_type_not_supported_on_this_platform > > > > SignedIntTypes; IntTypeList<signed long long,
Int_type_not_supported_on_this_platform > > > > > SignedIntTypes;
typedef IntTypeList<unsigned char, typedef IntTypeList<unsigned char,
IntTypeList<unsigned short, IntTypeList<unsigned short,
IntTypeList<unsigned int, IntTypeList<unsigned int,
IntTypeList<unsigned long, IntTypeList<unsigned long,
Int_type_not_supported_on_this_platform > > > > UnsignedIntTypes; IntTypeList<unsigned long long,
Int_type_not_supported_on_this_platform > > > > > UnsignedIntTypes;
} // namespace detail } // namespace detail
/** \addtogroup FixedSizeInt Fixed Size Integer Types /** \addtogroup FixedSizeInt Fixed Size Integer Types
Since the C++ standard does only specifiy minimal sizes for the built-i Since the C++ standard does only specify minimal sizes for the built-in
n integer types, one cannot rely on them to have a specific size. But
integer types, one cannot rely on them have a specific size. But
pixel types with a specific size are often required in image processing , pixel types with a specific size are often required in image processing ,
especially when reading or writing binary files. The VIGRA typedefs especially when reading or writing binary files. The VIGRA typedefs
are guaranteed to have exactly the correct size. If the system are guaranteed to have exactly the correct size. If the system
does not provide a suitable type, the typedef will evaluate to does not provide a suitable type, the typedef will evaluate to
<tt>Int_type_not_supported_on_this_platform</tt>. <tt>Int_type_not_supported_on_this_platform</tt>.
*/ */
//@{ //@{
/// 8-bit signed int /// 8-bit signed int
typedef detail::SelectIntegerType<8, detail::SignedIntTypes>::type Int8; typedef detail::SelectIntegerType<8, detail::SignedIntTypes>::type Int8;
 End of changes. 4 change blocks. 
6 lines changed or deleted 7 lines changed or added


 splineimageview.hxx   splineimageview.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2004 by Ullrich Koethe */ /* Copyright 1998-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_SPLINEIMAGEVIEW_HXX #ifndef VIGRA_SPLINEIMAGEVIEW_HXX
#define VIGRA_SPLINEIMAGEVIEW_HXX #define VIGRA_SPLINEIMAGEVIEW_HXX
#include "vigra/mathutil.hxx" #include "mathutil.hxx"
#include "vigra/recursiveconvolution.hxx" #include "recursiveconvolution.hxx"
#include "vigra/splines.hxx" #include "splines.hxx"
#include "vigra/array_vector.hxx" #include "array_vector.hxx"
#include "vigra/basicimage.hxx" #include "basicimage.hxx"
#include "vigra/copyimage.hxx" #include "copyimage.hxx"
#include "vigra/tinyvector.hxx" #include "tinyvector.hxx"
#include "vigra/fixedpoint.hxx" #include "fixedpoint.hxx"
#include "vigra/multi_array.hxx" #include "multi_array.hxx"
namespace vigra { namespace vigra {
/********************************************************/ /********************************************************/
/* */ /* */
/* SplineImageView */ /* SplineImageView */
/* */ /* */
/********************************************************/ /********************************************************/
/** \brief Create a continuous view onto a discrete image using splines. /** \brief Create a continuous view onto a discrete image using splines.
This class is very useful if image values or derivatives at arbitrary This class is very useful if image values or derivatives at arbitrary
real-valued coordinates are needed. Access at such coordinates is imple mented by real-valued coordinates are needed. Access at such coordinates is imple mented by
interpolating the given discrete image values with a spline of the interpolating the given discrete image values with a spline of the
specified <tt>ORDER</TT>. Continuous derivatives are available up to specified <tt>ORDER</TT>. Continuous derivatives are available up to
degree <tt>ORDER-1</TT>. If the requested coordinates are near the imag e border, degree <tt>ORDER-1</TT>. If the requested coordinates are near the imag e border,
reflective boundary conditions are applied. In principle, this class ca n also be used reflective boundary conditions are applied. In principle, this class ca n also be used
for image resizing, but here the functions from the <tt>resize...</tt> family are for image resizing, but here the functions from the <tt>resize...</tt> family are
more efficient. more efficient, since they exploit the regularity of the sampling grid.
The <tt>SplineImageView</tt> template is explicitly specialized to make it as efficient as possible. The <tt>SplineImageView</tt> template is explicitly specialized to make it as efficient as possible.
In particular, unnecessary copying of the image is avoided when the ite rators passed In particular, unnecessary copying of the image is avoided when the ite rators passed
in the constructor originate from a \ref vigra::BasicImage. In addition , these specializations in the constructor originate from a \ref vigra::BasicImage. In addition , these specializations
provide function <tt>unchecked(...)</tt> that do not perform bounds che cking. If the original image provide function <tt>unchecked(...)</tt> that do not perform bounds che cking. If the original image
is not a variant of \ref vigra::BasicImage, one can customize the inter nal representation by is not a variant of \ref vigra::BasicImage, one can customize the inter nal representation by
using \ref vigra::SplineImageview0 or \ref vigra::SplineImageview1. using \ref vigra::SplineImageView0 or \ref vigra::SplineImageView1.
<b>Usage:</b> <b>Usage:</b>
<b>\#include</b> "<a href="splineimageview_8hxx-source.html">vigra/spli neimageview.hxx</a>"<br> <b>\#include</b> "<a href="splineimageview_8hxx-source.html">vigra/spli neimageview.hxx</a>"<br>
Namespace: vigra Namespace: vigra
\code \code
BImage img(w,h); BImage img(w,h);
... // fill img ... // fill img
skipping to change at line 1222 skipping to change at line 1222
{} {}
template <unsigned IntBits1, unsigned FractionalBits1, template <unsigned IntBits1, unsigned FractionalBits1,
unsigned IntBits2, unsigned FractionalBits2> unsigned IntBits2, unsigned FractionalBits2>
value_type unchecked(FixedPoint<IntBits1, FractionalBits1> x, value_type unchecked(FixedPoint<IntBits1, FractionalBits1> x,
FixedPoint<IntBits2, FractionalBits2> y) const FixedPoint<IntBits2, FractionalBits2> y) const
{ {
int ix = floor(x); int ix = floor(x);
FixedPoint<0, FractionalBits1> tx = frac(x - FixedPoint<IntBits1, F ractionalBits1>(ix)); FixedPoint<0, FractionalBits1> tx = frac(x - FixedPoint<IntBits1, F ractionalBits1>(ix));
FixedPoint<0, FractionalBits1> dtx = dual_frac(tx); FixedPoint<0, FractionalBits1> dtx = dual_frac(tx);
if(ix == w_ - 1) if(ix == (int)w_ - 1)
{ {
--ix; --ix;
tx.value = FixedPoint<0, FractionalBits1>::ONE; tx.value = FixedPoint<0, FractionalBits1>::ONE;
dtx.value = 0; dtx.value = 0;
} }
int iy = floor(y); int iy = floor(y);
FixedPoint<0, FractionalBits2> ty = frac(y - FixedPoint<IntBits2, F ractionalBits2>(iy)); FixedPoint<0, FractionalBits2> ty = frac(y - FixedPoint<IntBits2, F ractionalBits2>(iy));
FixedPoint<0, FractionalBits2> dty = dual_frac(ty); FixedPoint<0, FractionalBits2> dty = dual_frac(ty);
if(iy == h_ - 1) if(iy == (int)h_ - 1)
{ {
--iy; --iy;
ty.value = FixedPoint<0, FractionalBits2>::ONE; ty.value = FixedPoint<0, FractionalBits2>::ONE;
dty.value = 0; dty.value = 0;
} }
return fixed_point_cast<value_type>( return fixed_point_cast<value_type>(
dty*(dtx*fixedPoint(internalIndexer_(ix,iy)) + dty*(dtx*fixedPoint(internalIndexer_(ix,iy)) +
tx*fixedPoint(internalIndexer_(ix+1,iy)) ) + tx*fixedPoint(internalIndexer_(ix+1,iy)) ) +
ty *(dtx*fixedPoint(internalIndexer_(ix,iy+1)) + ty *(dtx*fixedPoint(internalIndexer_(ix,iy+1)) +
tx*fixedPoint(internalIndexer_(ix+1,iy+1 )))); tx*fixedPoint(internalIndexer_(ix+1,iy+1 ))));
skipping to change at line 1253 skipping to change at line 1253
template <unsigned IntBits1, unsigned FractionalBits1, template <unsigned IntBits1, unsigned FractionalBits1,
unsigned IntBits2, unsigned FractionalBits2> unsigned IntBits2, unsigned FractionalBits2>
value_type unchecked(FixedPoint<IntBits1, FractionalBits1> x, value_type unchecked(FixedPoint<IntBits1, FractionalBits1> x,
FixedPoint<IntBits2, FractionalBits2> y, FixedPoint<IntBits2, FractionalBits2> y,
unsigned int dx, unsigned int dy) const unsigned int dx, unsigned int dy) const
{ {
int ix = floor(x); int ix = floor(x);
FixedPoint<0, FractionalBits1> tx = frac(x - FixedPoint<IntBits1, F ractionalBits1>(ix)); FixedPoint<0, FractionalBits1> tx = frac(x - FixedPoint<IntBits1, F ractionalBits1>(ix));
FixedPoint<0, FractionalBits1> dtx = dual_frac(tx); FixedPoint<0, FractionalBits1> dtx = dual_frac(tx);
if(ix == w_ - 1) if(ix == (int)w_ - 1)
{ {
--ix; --ix;
tx.value = FixedPoint<0, FractionalBits1>::ONE; tx.value = FixedPoint<0, FractionalBits1>::ONE;
dtx.value = 0; dtx.value = 0;
} }
int iy = floor(y); int iy = floor(y);
FixedPoint<0, FractionalBits2> ty = frac(y - FixedPoint<IntBits2, F ractionalBits2>(iy)); FixedPoint<0, FractionalBits2> ty = frac(y - FixedPoint<IntBits2, F ractionalBits2>(iy));
FixedPoint<0, FractionalBits2> dty = dual_frac(ty); FixedPoint<0, FractionalBits2> dty = dual_frac(ty);
if(iy == h_ - 1) if(iy == (int)h_ - 1)
{ {
--iy; --iy;
ty.value = FixedPoint<0, FractionalBits2>::ONE; ty.value = FixedPoint<0, FractionalBits2>::ONE;
dty.value = 0; dty.value = 0;
} }
switch(dx) switch(dx)
{ {
case 0: case 0:
switch(dy) switch(dy)
{ {
skipping to change at line 1308 skipping to change at line 1308
return NumericTraits<VALUETYPE>::zero(); return NumericTraits<VALUETYPE>::zero();
} }
default: default:
return NumericTraits<VALUETYPE>::zero(); return NumericTraits<VALUETYPE>::zero();
} }
} }
value_type unchecked(double x, double y) const value_type unchecked(double x, double y) const
{ {
int ix = (int)std::floor(x); int ix = (int)std::floor(x);
if(ix == w_ - 1) if(ix == (int)w_ - 1)
--ix; --ix;
double tx = x - ix; double tx = x - ix;
int iy = (int)std::floor(y); int iy = (int)std::floor(y);
if(iy == h_ - 1) if(iy == (int)h_ - 1)
--iy; --iy;
double ty = y - iy; double ty = y - iy;
return NumericTraits<value_type>::fromRealPromote( return NumericTraits<value_type>::fromRealPromote(
(1.0-ty)*((1.0-tx)*internalIndexer_(ix,iy) + tx*internal Indexer_(ix+1,iy)) + (1.0-ty)*((1.0-tx)*internalIndexer_(ix,iy) + tx*internal Indexer_(ix+1,iy)) +
ty *((1.0-tx)*internalIndexer_(ix,iy+1) + tx*internalIn dexer_(ix+1,iy+1))); ty *((1.0-tx)*internalIndexer_(ix,iy+1) + tx*internalIn dexer_(ix+1,iy+1)));
} }
value_type unchecked(double x, double y, unsigned int dx, unsigned int dy) const value_type unchecked(double x, double y, unsigned int dx, unsigned int dy) const
{ {
int ix = (int)std::floor(x); int ix = (int)std::floor(x);
if(ix == w_ - 1) if(ix == (int)w_ - 1)
--ix; --ix;
double tx = x - ix; double tx = x - ix;
int iy = (int)std::floor(y); int iy = (int)std::floor(y);
if(iy == h_ - 1) if(iy == (int)h_ - 1)
--iy; --iy;
double ty = y - iy; double ty = y - iy;
switch(dx) switch(dx)
{ {
case 0: case 0:
switch(dy) switch(dy)
{ {
case 0: case 0:
return NumericTraits<value_type>::fromRealPromote( return NumericTraits<value_type>::fromRealPromote(
(1.0-ty)*((1.0-tx)*internalIndexer_(ix,iy) + tx*internalIndexer_(ix+1,iy)) + (1.0-ty)*((1.0-tx)*internalIndexer_(ix,iy) + tx*internalIndexer_(ix+1,iy)) +
skipping to change at line 1535 skipping to change at line 1535
return y >= 0.0 && y <= height() - 1.0; return y >= 0.0 && y <= height() - 1.0;
} }
bool isInside(double x, double y) const bool isInside(double x, double y) const
{ {
return isInsideX(x) && isInsideY(y); return isInsideX(x) && isInsideY(y);
} }
bool isValid(double x, double y) const bool isValid(double x, double y) const
{ {
return x < 2.0*w_-2.0 && x > -w_+1.0 && y < 2.0*h_-2.0 && y > -h_+1 .0; return x < 2.0*w_-2.0 && x > 1.0-w_ && y < 2.0*h_-2.0 && y > 1.0-h_ ;
} }
bool sameFacet(double x0, double y0, double x1, double y1) const bool sameFacet(double x0, double y0, double x1, double y1) const
{ {
x0 = VIGRA_CSTD::floor(x0); x0 = VIGRA_CSTD::floor(x0);
y0 = VIGRA_CSTD::floor(y0); y0 = VIGRA_CSTD::floor(y0);
x1 = VIGRA_CSTD::floor(x1); x1 = VIGRA_CSTD::floor(x1);
y1 = VIGRA_CSTD::floor(y1); y1 = VIGRA_CSTD::floor(y1);
return x0 == x1 && y0 == y1; return x0 == x1 && y0 == y1;
} }
 End of changes. 13 change blocks. 
21 lines changed or deleted 21 lines changed or added


 splines.hxx   splines.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2004 by Ullrich Koethe */ /* Copyright 1998-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_SPLINES_HXX #ifndef VIGRA_SPLINES_HXX
#define VIGRA_SPLINES_HXX #define VIGRA_SPLINES_HXX
#include <cmath> #include <cmath>
#include "vigra/config.hxx" #include "config.hxx"
#include "vigra/mathutil.hxx" #include "mathutil.hxx"
#include "vigra/polynomial.hxx" #include "polynomial.hxx"
#include "vigra/array_vector.hxx" #include "array_vector.hxx"
#include "vigra/fixedpoint.hxx" #include "fixedpoint.hxx"
namespace vigra { namespace vigra {
/** \addtogroup MathFunctions Mathematical Functions /** \addtogroup MathFunctions Mathematical Functions
*/ */
//@{ //@{
/* B-Splines of arbitrary order and interpolating Catmull/Rom splines. /* B-Splines of arbitrary order and interpolating Catmull/Rom splines.
<b>\#include</b> "<a href="splines_8hxx-source.html">vigra/splines.hxx< /a>"<br> <b>\#include</b> "<a href="splines_8hxx-source.html">vigra/splines.hxx< /a>"<br>
Namespace: vigra Namespace: vigra
 End of changes. 2 change blocks. 
6 lines changed or deleted 6 lines changed or added


 static_assert.hxx   static_assert.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2004-2005 by Ullrich Koethe */ /* Copyright 2004-2005 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 stdconvolution.hxx   stdconvolution.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_STDCONVOLUTION_HXX #ifndef VIGRA_STDCONVOLUTION_HXX
#define VIGRA_STDCONVOLUTION_HXX #define VIGRA_STDCONVOLUTION_HXX
#include <cmath> #include <cmath>
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
#include "vigra/bordertreatment.hxx" #include "bordertreatment.hxx"
#include "vigra/separableconvolution.hxx" #include "separableconvolution.hxx"
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/sized_int.hxx" #include "sized_int.hxx"
namespace vigra { namespace vigra {
template <class SrcIterator, class SrcAccessor, template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor, class DestIterator, class DestAccessor,
class KernelIterator, class KernelAccessor, class KernelIterator, class KernelAccessor,
class KSumType> class KSumType>
void internalPixelEvaluationByClip(int x, int y, int w, int h, SrcIterator xs, void internalPixelEvaluationByClip(int x, int y, int w, int h, SrcIterator xs,
SrcAccessor src_acc, DestIterator xd, De stAccessor dest_acc, SrcAccessor src_acc, DestIterator xd, De stAccessor dest_acc,
KernelIterator ki, Diff2D kul, Diff2D kl r, KernelAccessor ak, KernelIterator ki, Diff2D kul, Diff2D kl r, KernelAccessor ak,
skipping to change at line 489 skipping to change at line 489
typedef typename typedef typename
NumericTraits<typename KernelAccessor::value_type>::RealPromote Ker nelSumType; NumericTraits<typename KernelAccessor::value_type>::RealPromote Ker nelSumType;
typedef typedef
NumericTraits<typename DestAccessor::value_type> DestTraits; NumericTraits<typename DestAccessor::value_type> DestTraits;
// calculate width and height of the image // calculate width and height of the image
int w = src_lr.x - src_ul.x; int w = src_lr.x - src_ul.x;
int h = src_lr.y - src_ul.y; int h = src_lr.y - src_ul.y;
// calculate width and height of the kernel // calculate width and height of the kernel
int kernel_width = klr.x - kul.x + 1; int kernel_width = klr.x - kul.x + 1;
int kernel_height = klr.y - kul.y + 1; int kernel_height = klr.y - kul.y + 1;
vigra_precondition(w >= kernel_width && h >= kernel_height, vigra_precondition(w >= kernel_width && h >= kernel_height,
"convolveImage(): kernel larger than image."); "convolveImage(): kernel larger than image.");
int x,y;
KernelSumType norm = NumericTraits<KernelSumType>::zero(); KernelSumType norm = NumericTraits<KernelSumType>::zero();
if(border == BORDER_TREATMENT_CLIP) if(border == BORDER_TREATMENT_CLIP)
{ {
// caluclate the sum of the kernel elements for renormalization // calculate the sum of the kernel elements for renormalization
KernelIterator yk = ki + klr; KernelIterator yk = ki + klr;
//Die Summe der Punkte im Kernel wird ermittelt (= norm) // determine sum within kernel (= norm)
for(y=0; y<kernel_height; ++y, --yk.y) for(int y = 0; y < kernel_height; ++y, --yk.y)
{ {
KernelIterator xk = yk; KernelIterator xk = yk;
for(x=0; x<kernel_width; ++x, --xk.x) for(int x = 0; x < kernel_width; ++x, --xk.x)
{ {
norm += ak(xk); norm += ak(xk);
} }
} }
vigra_precondition(norm != NumericTraits<KernelSumType>::zero(), vigra_precondition(norm != NumericTraits<KernelSumType>::zero(),
"convolveImage(): Cannot use BORDER_TREATMENT_CLIP with a DC-fr ee kernel"); "convolveImage(): Cannot use BORDER_TREATMENT_CLIP with a DC-fr ee kernel");
} }
// create iterators for the interior part of the image (where the kerne l always fits into the image) // create iterators for the interior part of the image (where the kerne l always fits into the image)
DestIterator yd = dest_ul + Diff2D(klr.x, klr.y); DestIterator yd = dest_ul + Diff2D(klr.x, klr.y);
SrcIterator ys = src_ul + Diff2D(klr.x, klr.y); SrcIterator ys = src_ul + Diff2D(klr.x, klr.y);
SrcIterator send = src_lr + Diff2D(kul.x, kul.y); SrcIterator send = src_lr + Diff2D(kul.x, kul.y);
// iterate over the interior part // iterate over the interior part
for(; ys.y < send.y; ++ys.y, ++yd.y) for(; ys.y < send.y; ++ys.y, ++yd.y)
{ {
// create x iterators // create x iterators
DestIterator xd(yd); DestIterator xd(yd);
SrcIterator xs(ys); SrcIterator xs(ys);
for(; xs.x < send.x; ++x, ++xs.x, ++xd.x) for(; xs.x < send.x; ++xs.x, ++xd.x)
{ {
// init the sum // init the sum
SumType sum = NumericTraits<SumType>::zero(); SumType sum = NumericTraits<SumType>::zero();
SrcIterator yys = xs - klr; SrcIterator yys = xs - klr;
SrcIterator yyend = xs - kul; SrcIterator yyend = xs - kul;
KernelIterator yk = ki + klr; KernelIterator yk = ki + klr;
for(; yys.y <= yyend.y; ++yys.y, --yk.y) for(; yys.y <= yyend.y; ++yys.y, --yk.y)
{ {
skipping to change at line 584 skipping to change at line 582
{ {
borderskipx = -w+1; borderskipx = -w+1;
borderskipy = -h+1; borderskipy = -h+1;
borderinc = 1; borderinc = 1;
} }
// create iterators for the entire image // create iterators for the entire image
yd = dest_ul; yd = dest_ul;
ys = src_ul; ys = src_ul;
// go over the entire image (but skip the already computed points in th // work on entire image (but skip the already computed points in the lo
e loop) op)
for(y=0; y < h; ++y, ++ys.y, ++yd.y) for(int y = 0; y < h; ++y, ++ys.y, ++yd.y)
{ {
int top = std::max(static_cast<IntBiggest>(-klr.y), int top = std::max(static_cast<IntBiggest>(-klr.y),
static_cast<IntBiggest>(src_ul.y - ys.y)); static_cast<IntBiggest>(src_ul.y - ys.y));
int bottom = std::min(static_cast<IntBiggest>(-kul.y), int bottom = std::min(static_cast<IntBiggest>(-kul.y),
static_cast<IntBiggest>(src_lr.y - ys.y - 1)) ; static_cast<IntBiggest>(src_lr.y - ys.y - 1)) ;
// create x iterators // create x iterators
DestIterator xd(yd); DestIterator xd(yd);
SrcIterator xs(ys); SrcIterator xs(ys);
for(x=0; x < w; ++x, ++xs.x, ++xd.x) for(int x = 0; x < w; ++x, ++xs.x, ++xd.x)
{ {
// check if we are away from the border // check if we are away from the border
if(y >= klr.y && y < h+kul.y && x == klr.x) if(y >= klr.y && y < h+kul.y && x == klr.x)
{ {
// yes => skip the already computed points // yes => skip the already computed points
x += interiorskip; x += interiorskip;
xs.x += interiorskip; xs.x += interiorskip;
xd.x += interiorskip; xd.x += interiorskip;
continue; continue;
} }
if (border == BORDER_TREATMENT_CLIP) if (border == BORDER_TREATMENT_CLIP)
{ {
internalPixelEvaluationByClip(x, y, w, h, xs, src_acc, xd, dest_acc, ki, kul, klr, ak, norm); internalPixelEvaluationByClip(x, y, w, h, xs, src_acc, xd, dest_acc, ki, kul, klr, ak, norm);
} }
else else
{ {
int left = std::max(-klr.x, src_ul.x - xs.x); int left = std::max(-klr.x, src_ul.x - xs.x);
int right = std::min(-kul.x, src_lr.x - xs.x - 1); int right = std::min(-kul.x, src_lr.x - xs.x - 1);
// init the sum // init the sum
SumType sum = NumericTraits<SumType>::zero(); SumType sum = NumericTraits<SumType>::zero();
// create iterators for the part of the kernel that fits in to the image // create iterators for the part of the kernel that fits in to the image
SrcIterator yys = xs + Size2D(0, top); SrcIterator yys = xs + Size2D(0, top);
KernelIterator yk = ki - Size2D(0, top); KernelIterator yk = ki - Size2D(0, top);
int yy; int yy;
for(yy = top; yy <= bottom; ++yy, ++yys.y, --yk.y) for(yy = top; yy <= bottom; ++yy, ++yys.y, --yk.y)
 End of changes. 11 change blocks. 
20 lines changed or deleted 18 lines changed or added


 stdimage.hxx   stdimage.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_STDIMAGE_HXX #ifndef VIGRA_STDIMAGE_HXX
#define VIGRA_STDIMAGE_HXX #define VIGRA_STDIMAGE_HXX
#include "vigra/sized_int.hxx" #include "sized_int.hxx"
#include "vigra/tuple.hxx" #include "tuple.hxx"
#include "vigra/basicimage.hxx" #include "basicimage.hxx"
#include "vigra/iteratortraits.hxx" #include "iteratortraits.hxx"
#include "vigra/accessor.hxx" #include "accessor.hxx"
#include "vigra/rgbvalue.hxx" #include "rgbvalue.hxx"
namespace vigra { namespace vigra {
/** \addtogroup StandardImageTypes Standard Image Types /** \addtogroup StandardImageTypes Standard Image Types
\brief The most common instantiations of the \ref vigra::BasicImage tem plate \brief The most common instantiations of the \ref vigra::BasicImage tem plate
*/ */
//@{ //@{
/** Byte (8-bit unsigned) image. /** Byte (8-bit unsigned) image.
 End of changes. 2 change blocks. 
7 lines changed or deleted 7 lines changed or added


 stdimagefunctions.hxx   stdimagefunctions.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 88 skipping to change at line 88
\ref MultiPointoperators \ref MultiPointoperators
<DD> <em>Point operators on multi-dimensional arrays</em> <DD> <em>Point operators on multi-dimensional arrays</em>
</DL> </DL>
<b>\#include</b> "<a href="stdimagefunctions_8hxx-source.html">vigra/st dimagefunctions.hxx</a>"<br> <b>\#include</b> "<a href="stdimagefunctions_8hxx-source.html">vigra/st dimagefunctions.hxx</a>"<br>
Namespace: vigra Namespace: vigra
see also: \ref FunctorExpressions "Automatic Functor Creation" see also: \ref FunctorExpressions "Automatic Functor Creation"
*/ */
#include "vigra/initimage.hxx" #include "initimage.hxx"
#include "vigra/inspectimage.hxx" #include "inspectimage.hxx"
#include "vigra/copyimage.hxx" #include "copyimage.hxx"
#include "vigra/transformimage.hxx" #include "transformimage.hxx"
#include "vigra/combineimages.hxx" #include "combineimages.hxx"
#include "vigra/resizeimage.hxx" #include "resizeimage.hxx"
#endif // VIGRA_STDIMAGEFUNCTIONS_HXX #endif // VIGRA_STDIMAGEFUNCTIONS_HXX
 End of changes. 2 change blocks. 
7 lines changed or deleted 7 lines changed or added


 symmetry.hxx   symmetry.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_SYMMETRY_HXX #ifndef VIGRA_SYMMETRY_HXX
#define VIGRA_SYMMETRY_HXX #define VIGRA_SYMMETRY_HXX
#include <vigra/utilities.hxx> #include "utilities.hxx"
#include <vigra/numerictraits.hxx> #include "numerictraits.hxx"
#include <vigra/stdimage.hxx> #include "stdimage.hxx"
#include <vigra/convolution.hxx> #include "convolution.hxx"
namespace vigra { namespace vigra {
/** \addtogroup SymmetryDetection Symmetry Detection /** \addtogroup SymmetryDetection Symmetry Detection
Measure the local symmetry at each pixel. Measure the local symmetry at each pixel.
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
/* */ /* */
 End of changes. 2 change blocks. 
5 lines changed or deleted 5 lines changed or added


 tensorutilities.hxx   tensorutilities.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 2002-2004 by Ullrich Koethe */ /* Copyright 2002-2004 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_TENSORUTILITIES_HXX #ifndef VIGRA_TENSORUTILITIES_HXX
#define VIGRA_TENSORUTILITIES_HXX #define VIGRA_TENSORUTILITIES_HXX
#include <cmath> #include <cmath>
#include "vigra/utilities.hxx" #include "utilities.hxx"
namespace vigra { namespace vigra {
/** \addtogroup TensorImaging Tensor Image Processing /** \addtogroup TensorImaging Tensor Image Processing
*/ */
//@{ //@{
/********************************************************/ /********************************************************/
/* */ /* */
/* vectorToTensor */ /* vectorToTensor */
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 tiff.hxx   tiff.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_TIFF_HXX #ifndef VIGRA_TIFF_HXX
#define VIGRA_TIFF_HXX #define VIGRA_TIFF_HXX
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/rgbvalue.hxx" #include "rgbvalue.hxx"
extern "C" extern "C"
{ {
#include <tiff.h> #include <tiff.h>
#include <tiffio.h> #include <tiffio.h>
} }
namespace vigra { namespace vigra {
typedef TIFF TiffImage; typedef TIFF TiffImage;
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 tinyvector.hxx   tinyvector.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 44 skipping to change at line 44
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_TINYVECTOR_HXX #ifndef VIGRA_TINYVECTOR_HXX
#define VIGRA_TINYVECTOR_HXX #define VIGRA_TINYVECTOR_HXX
#include <cmath> // abs(double) #include <cmath> // abs(double)
#include <cstdlib> // abs(int) #include <cstdlib> // abs(int)
#include <iosfwd> // ostream #include <iosfwd> // ostream
#include "vigra/config.hxx" #include "config.hxx"
#include "vigra/error.hxx" #include "error.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/mathutil.hxx" #include "mathutil.hxx"
namespace vigra { namespace vigra {
using VIGRA_CSTD::abs; using VIGRA_CSTD::abs;
using VIGRA_CSTD::ceil; using VIGRA_CSTD::ceil;
using VIGRA_CSTD::floor; using VIGRA_CSTD::floor;
template <class V1, int SIZE, class D1, class D2> template <class V1, int SIZE, class D1, class D2>
class TinyVectorBase; class TinyVectorBase;
skipping to change at line 1311 skipping to change at line 1311
} }
/// squared norm /// squared norm
template <class V1, int SIZE, class D1, class D2> template <class V1, int SIZE, class D1, class D2>
inline inline
typename TinyVectorBase<V1, SIZE, D1, D2>::SquaredNormType typename TinyVectorBase<V1, SIZE, D1, D2>::SquaredNormType
squaredNorm(TinyVectorBase<V1, SIZE, D1, D2> const & t) squaredNorm(TinyVectorBase<V1, SIZE, D1, D2> const & t)
{ {
return t.squaredMagnitude(); return t.squaredMagnitude();
} }
/// squared norm
template <class V, int SIZE>
inline
typename TinyVector<V, SIZE>::SquaredNormType
squaredNorm(TinyVector<V, SIZE> const & t)
{
return t.squaredMagnitude();
}
//@} //@}
} // namespace vigra } // namespace vigra
#endif // VIGRA_TINYVECTOR_HXX #endif // VIGRA_TINYVECTOR_HXX
 End of changes. 3 change blocks. 
5 lines changed or deleted 14 lines changed or added


 transformimage.hxx   transformimage.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_TRANSFORMIMAGE_HXX #ifndef VIGRA_TRANSFORMIMAGE_HXX
#define VIGRA_TRANSFORMIMAGE_HXX #define VIGRA_TRANSFORMIMAGE_HXX
#include "vigra/utilities.hxx" #include "utilities.hxx"
#include "vigra/numerictraits.hxx" #include "numerictraits.hxx"
#include "vigra/iteratortraits.hxx" #include "iteratortraits.hxx"
#include "vigra/rgbvalue.hxx" #include "rgbvalue.hxx"
#include "vigra/functortraits.hxx" #include "functortraits.hxx"
namespace vigra { namespace vigra {
/** \addtogroup TransformAlgo Algorithms to Transform Images /** \addtogroup TransformAlgo Algorithms to Transform Images
Apply functor to calculate a pixelwise transformation of one image Apply functor to calculate a pixelwise transformation of one image
@{ @{
*/ */
/********************************************************/ /********************************************************/
skipping to change at line 251 skipping to change at line 251
Functor const & f) Functor const & f)
} }
\endcode \endcode
<b> Usage:</b> <b> Usage:</b>
<b>\#include</b> "<a href="transformimage_8hxx-source.html">vigra/t ransformimage.hxx</a>"<br> <b>\#include</b> "<a href="transformimage_8hxx-source.html">vigra/t ransformimage.hxx</a>"<br>
Namespace: vigra Namespace: vigra
\code \code
#include <math.h> // for sqrt() #include <cmath> // for sqrt()
vigra::transformImageIf(srcImageRange(src), vigra::transformImageIf(srcImageRange(src),
maskImage(mask), maskImage(mask),
destImage(dest), destImage(dest),
&::sqrt ); (double(*)(double))&std::sqrt );
\endcode \endcode
<b> Required Interface:</b> <b> Required Interface:</b>
\code \code
SrcImageIterator src_upperleft, src_lowerright; SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft; DestImageIterator dest_upperleft;
MaskImageIterator mask_upperleft; MaskImageIterator mask_upperleft;
SrcImageIterator::row_iterator sx = src_upperleft.rowIterator(); SrcImageIterator::row_iterator sx = src_upperleft.rowIterator();
skipping to change at line 981 skipping to change at line 981
diff_(max - min), diff_(max - min),
zero_(NumericTraits<promote_type>::zero()), zero_(NumericTraits<promote_type>::zero()),
one_(NumericTraits<promote_type>::one()) one_(NumericTraits<promote_type>::one())
{} {}
/** Calculate modified gray or color value /** Calculate modified gray or color value
*/ */
result_type operator()(argument_type const & v) const result_type operator()(argument_type const & v) const
{ {
promote_type v1 = (v - min_) / diff_; promote_type v1 = (v - min_) / diff_;
promote_type brighter = pow(v1, b_); promote_type brighter = VIGRA_CSTD::pow(v1, b_);
promote_type v2 = 2.0 * brighter - one_; promote_type v2 = 2.0 * brighter - one_;
promote_type contrasted = (v2 < zero_) ? promote_type contrasted = (v2 < zero_) ?
-pow(-v2, c_) : -VIGRA_CSTD::pow(-v2, c_) :
pow(v2, c_); VIGRA_CSTD::pow(v2, c_);
return result_type(0.5 * diff_ * (contrasted + one_) + min_); return result_type(0.5 * diff_ * (contrasted + one_) + min_);
} }
private: private:
promote_type b_, c_; promote_type b_, c_;
argument_type min_; argument_type min_;
promote_type diff_, zero_, one_; promote_type diff_, zero_, one_;
}; };
template <> template <>
 End of changes. 6 change blocks. 
11 lines changed or deleted 11 lines changed or added


 tuple.hxx   tuple.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 utilities.hxx   utilities.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2002 by Ullrich Koethe */ /* Copyright 1998-2002 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 41 skipping to change at line 41
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_BASICS_HXX #ifndef VIGRA_BASICS_HXX
#define VIGRA_BASICS_HXX #define VIGRA_BASICS_HXX
#include "vigra/config.hxx" #include "config.hxx"
#include "vigra/error.hxx" #include "error.hxx"
#include "vigra/metaprogramming.hxx" #include "metaprogramming.hxx"
#include "vigra/tuple.hxx" #include "tuple.hxx"
#include "vigra/diff2d.hxx" #include "diff2d.hxx"
#include "vigra/mathutil.hxx" #include "mathutil.hxx"
/*! \page Utilities Utilities /*! \page Utilities Utilities
Basic helper functionality needed throughout. Basic helper functionality needed throughout.
<DL> <DL>
<DT> <DT>
<IMG BORDER=0 ALT="-" SRC="documents/bullet.gif"> <IMG BORDER=0 ALT="-" SRC="documents/bullet.gif">
\ref vigra::ArrayVector \ref vigra::ArrayVector
<DD><em>replacement for std::vector</em> <DD><em>replacement for std::vector</em>
<DT> <DT>
<IMG BORDER=0 ALT="-" SRC="documents/bullet.gif"> <IMG BORDER=0 ALT="-" SRC="documents/bullet.gif">
\ref RangesAndPoints \ref RangesAndPoints
<DD><em>2-dimensioanl positions, extents, amd rectangles</em> <DD><em>2-dimensional positions, extents, and rectangles</em>
<DT> <DT>
<IMG BORDER=0 ALT="-" SRC="documents/bullet.gif"> <IMG BORDER=0 ALT="-" SRC="documents/bullet.gif">
\ref PixelNeighborhood \ref PixelNeighborhood
<DD><em>4- and 8-neighborhood definitions and circulators</em> <DD><em>4- and 8-neighborhood definitions and circulators</em>
<DT> <DT>
<IMG BORDER=0 ALT="-" SRC="documents/bullet.gif"> <IMG BORDER=0 ALT="-" SRC="documents/bullet.gif">
\ref vigra::IteratorAdaptor \ref vigra::IteratorAdaptor
<DD><em>Quickly create STL-compatible 1D iterator adaptors</em> <DD><em>Quickly create STL-compatible 1D iterator adaptors</em>
<DT> <DT>
<IMG BORDER=0 ALT="-" SRC="documents/bullet.gif"> <IMG BORDER=0 ALT="-" SRC="documents/bullet.gif">
 End of changes. 3 change blocks. 
8 lines changed or deleted 8 lines changed or added


 watersheds.hxx   watersheds.hxx 
/************************************************************************/ /************************************************************************/
/* */ /* */
/* Copyright 1998-2005 by Ullrich Koethe */ /* Copyright 1998-2005 by Ullrich Koethe */
/* Cognitive Systems Group, University of Hamburg, Germany */ /* Cognitive Systems Group, University of Hamburg, Germany */
/* */ /* */
/* This file is part of the VIGRA computer vision library. */ /* This file is part of the VIGRA computer vision library. */
/* ( Version 1.4.0, Dec 21 2005 ) */ /* ( Version 1.5.0, Dec 07 2006 ) */
/* The VIGRA Website is */ /* The VIGRA Website is */
/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */
/* Please direct questions, bug reports, and contributions to */ /* Please direct questions, bug reports, and contributions to */
/* koethe@informatik.uni-hamburg.de or */ /* koethe@informatik.uni-hamburg.de or */
/* vigra@kogs1.informatik.uni-hamburg.de */ /* vigra@kogs1.informatik.uni-hamburg.de */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person */ /* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */ /* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */ /* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */ /* restriction, including without limitation the rights to use, */
skipping to change at line 42 skipping to change at line 42
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */ /* OTHER DEALINGS IN THE SOFTWARE. */
/* */ /* */
/************************************************************************/ /************************************************************************/
#ifndef VIGRA_WATERSHEDS_HXX #ifndef VIGRA_WATERSHEDS_HXX
#define VIGRA_WATERSHEDS_HXX #define VIGRA_WATERSHEDS_HXX
#include <functional> #include <functional>
#include "vigra/mathutil.hxx" #include "mathutil.hxx"
#include "vigra/stdimage.hxx" #include "stdimage.hxx"
#include "vigra/pixelneighborhood.hxx" #include "pixelneighborhood.hxx"
namespace vigra { namespace vigra {
template <class SrcIterator, class SrcAccessor, template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor, class DestIterator, class DestAccessor,
class Neighborhood> class Neighborhood>
unsigned int watershedLabeling(SrcIterator upperlefts, unsigned int watershedLabeling(SrcIterator upperlefts,
SrcIterator lowerrights, SrcAccessor sa, SrcIterator lowerrights, SrcAccessor sa,
DestIterator upperleftd, DestAccessor da, DestIterator upperleftd, DestAccessor da,
Neighborhood neighborhood) Neighborhood neighborhood)
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/