Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace khipu{
- //filterbank.h
- template < typename T >
- class Filterbank;
- template < typename T >
- void swap( Filterbank<T> &, Filterbank<T> & );
- template < typename T >
- class Filterbank{
- public:
- typedef std::unique_ptr<Kernel2D<T> > KernelPtr;
- Filterbank();
- Filterbank( Filterbank<T> && );
- ~Filterbank();
- friend void swap <>( Filterbank<T> &, Filterbank<T> & );
- Filterbank<T> & operator =( Filterbank<T> && );
- const std::unique_ptr<Kernel2D<T> > & at ( int ) const;
- int size() const;
- private:
- std::vector< KernelPtr > m_Bank; // error here
- // error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_Ty>'
- //
- };
- }
- namespace khipu{
- // filterbankdescriptor.h
- template < typename T >
- class FilterbankDescriptor : public Descriptor<T>{
- public:
- FilterbankDescriptor();
- FilterbankDescriptor( const Filterbank<T> & );
- FilterbankDescriptor( const FilterbankDescriptor<T> & );
- FilterbankDescriptor( FilterbankDescriptor<T> && );
- ~FilterbankDescriptor();
- virtual std::unique_ptr<Descriptor<T> > clone() const;
- virtual std::unique_ptr<Descriptor<T> > create() const;
- virtual FeatureImage<T> describe(const Matrix<T> &, const std::string & ) const;
- virtual FeatureImage<T> describe(const FeatureImage<T> &, const std::string & ) const;
- private:
- Filterbank<T> m_Bank; // error here
- };
- }
- namespace khipu{
- //filterbank.cpp
- template < typename T >
- Filterbank<T>::Filterbank()
- {
- }
- template < typename T >
- Filterbank<T>::Filterbank( Filterbank<T> && other)
- :m_Bank(std::move(other.m_Bank))
- {
- }
- template < typename T >
- Filterbank<T>::~Filterbank()
- {
- }
- template < typename T >
- void swap( Filterbank<T> & bank_a, Filterbank<T> & bank_b ){
- bank_a.m_Bank.swap(bank_b.m_Bank);
- }
- template < typename T >
- Filterbank<T> & Filterbank<T>::operator =( Filterbank<T> && bank ){
- //bank.swap(*this);
- m_Bank = std::move(bank.m_Bank);
- return (*this);
- }
- template < typename T >
- const std::unique_ptr<Kernel2D<T> > & Filterbank<T>::at( int index ) const{
- return m_Bank[index];
- }
- template < typename T >
- int Filterbank<T>::size() const{
- return static_cast<int>(m_Bank.size());
- }
- // explicit instantiations
- template class Filterbank<float>;
- template class Filterbank<double>;
- template void swap ( Filterbank<float> &, Filterbank<float> & );
- template void swap ( Filterbank<double> &, Filterbank<double> & );
- }
- namespace khipu{
- //filterbankdescriptor.cpp
- template < typename T >
- FilterbankDescriptor<T>::FilterbankDescriptor(){
- }
- template < typename T >
- FilterbankDescriptor<T>::FilterbankDescriptor( const Filterbank<T> & bank )
- :m_Bank(bank)
- {
- }
- template < typename T >
- FilterbankDescriptor<T>::FilterbankDescriptor( const FilterbankDescriptor<T> & filterbankDesc )
- :m_Bank(filterbankDesc.m_Bank)
- {
- }
- template < typename T >
- FilterbankDescriptor<T>::FilterbankDescriptor( FilterbankDescriptor<T> && other )
- :m_Bank(std::move(other.m_Bank))
- {
- }
- template < typename T >
- FilterbankDescriptor<T>::~FilterbankDescriptor(){
- }
- template < typename T >
- std::unique_ptr<Descriptor<T> > FilterbankDescriptor<T>::clone() const{
- return std::unique_ptr<Descriptor<T> >( new FilterbankDescriptor<T>(*this) );
- }
- template < typename T >
- std::unique_ptr<Descriptor<T> > FilterbankDescriptor<T>::create() const{
- return std::unique_ptr<Descriptor<T> >( new FilterbankDescriptor<T>( ) );
- }
- template < typename T >
- FeatureImage<T> FilterbankDescriptor<T>::describe(const Matrix<T> & refMatrix, const std::string & strOutput ) const{
- int nRows = refMatrix.getRows();
- int nCols = refMatrix.getCols();
- int nChannels = refMatrix.getChannels();
- int nBankSize = m_Bank.size();
- int nDepth = nChannels * nBankSize;
- int nFeatIndex = 0;
- int nIdx = 0;
- FeatureImage<T> featImage(nRows, nCols, nDepth);
- return (featImage);
- }
- template < typename T >
- FeatureImage<T> FilterbankDescriptor<T>::describe(const FeatureImage<T> & refFeatImage, const std::string & strOutput ) const{
- int nRows = refFeatImage.getHeight();
- int nCols = refFeatImage.getWidth();
- int nChannels = refFeatImage.getDepth();
- int nBankSize = m_Bank.size();
- int nDepth = nChannels * nBankSize;
- int nFeatIndex = 0;
- int nIdx = 0;
- FeatureImage<T> featImage(nRows, nCols, nDepth);
- return (featImage);
- }
- template class FilterbankDescriptor<float>;
- template class FilterbankDescriptor<double>;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement