Portál AbcLinuxu, 18. prosince 2025 12:51
namespace deghosting {
class Deghosting
{
public:
Deghosting() { ; }
virtual vector<FImagePtr> createWeightMasks() = 0;
virtual void loadImages(vector<string>& newInputFiles) = 0;
virtual void setFlags(const uint16_t newFlags) = 0;
virtual void setIterationNum(const int newIterations) = 0;
virtual ~Deghosting() { ; }
};
}
khan.h
namespace deghosting {
/** Mexican hat function, eq. 5 from Khan paper */
// AS FUNCTOR
template <typename InputType, typename ResultType>
class weightMexicanHatFunctor
{
public:
weightMexicanHatFunctor() { ; }
inline ResultType operator()(const InputType& a) const {
return mexicanHat(a);
}
protected:
template <class T>
inline ResultType mexicanHat(const T& a) const {
typedef typename NumericTraits<T>::RealPromote RealType;
const RealType x = NumericTraits<T>::toRealPromote(a);
RealType t = (x/127.5 -1);
t *= t; // ^2
t *= t; // ^4
t *= t; // ^8
t *= t; // ^16
return NumericTraits<ResultType>::fromRealPromote(1.0 - t);
}
};
struct khanAdvModes {
// nějaké ty enumy
};
template <class T>
class khan : public Deghosting
{
public:
khan(vector<string>& setInputFiles, int setIter, uint16_t setFlags, uint8_t setSave, uint8_t setUI);
void loadImages(vector<string>& newInputFiles) { inputFiles = newInputFiles; }
void setFlags(const uint16_t newFlags) { flags = newFlags; }
void setSaveMode(const uint8_t newSave) { save = newSave; }
void setIterationNum(const int newIterations) { iterations = newIterations; }
int getWidth() { return width; }
int getHeight() { return height; }
vector<FImagePtr> createWeightMasks();
~khan();
private:
// implementační krávovinky
};
}
Otázka je, proč mi to sakra po slinkování do .so knihovny nefunguje. Ostatní funkce, které jsou samostatně definováni v namespace deghosting ale podle nm exportovány jsou.
Kompletní zdrojáky jsou ke stažení ze svn:
https://hugin.svn.sourceforge.net/svnroot/hugin/hugin/branches/gsoc2009_deghosting/
add_executable(hugin_hdrmerge hugin_hdrmerge.cpp jbu.cpp khan.cpp support.cpp)
target_link_libraries(hugin_hdrmerge ${common_libs} ${image_libs})
Tady by snad neměly být žádné problémy, ale opět skončím s chybou:
/home/lukas/development/gsoc2009_deghosting/src/deghosting/hugin_hdrmerge.cpp:396: undefined reference to `deghosting::khan<deghosting::weightMexicanHatFunctor<int, float> >::khan(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, int, unsigned short, unsigned char, unsigned char)'
khan<weightMexicanHatFunctor<int,float> > deghoster(inputFiles, num_iters, adv, save, ui); tak by snad mělo ke konkretizaci té šablony dojít, ne? Problém je, že nejsem moc zběhlý v používání šablon tříd.
Pokud ji mas v .cpp, tak ji prendej to souboru s priponou .tcc a ten includuj na konci headeru. Vzhledem k tomu, ze ta metoda je inline, tak by ani nemela byt v knihovne.
Ivan
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.