Correction de bug sur Weigth
This commit is contained in:
parent
12b520707f
commit
366f71dfc6
@ -11,7 +11,7 @@ find_package(Boost REQUIRED system chrono thread program_options date_time seria
|
||||
find_package(GDAL REQUIRED)
|
||||
find_package(TBB REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(TinyXML QUIET)
|
||||
find_package(TinyXML)
|
||||
|
||||
##############################################
|
||||
# Create triskele and set properties
|
||||
@ -40,7 +40,8 @@ target_include_directories(triskele
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
${GDAL_INCLUDE_DIR})
|
||||
|
||||
target_link_libraries(triskele ${BOOST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${GDAL_LIBRARY} ${TBB_LIBRARIES} ${TinyXML_LIBRARY})
|
||||
target_link_libraries(triskele ${BOOST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${GDAL_LIBRARY} ${TBB_LIBRARIES})
|
||||
# ${TinyXML_LIBRARY})
|
||||
|
||||
target_compile_definitions(triskele PUBLIC -DNDEBUG -DNO_OTB -DINTEL_TBB_THREAD) # -DBOOST_DISABLE_ASSERTS)
|
||||
|
||||
|
@ -21,7 +21,8 @@ PRF_SRC = $(patsubst %, $(CPP_DIR)/%.cpp, $(PRF_PRG))
|
||||
PRF_OUT = $(patsubst %, $(OUT_DIR)/%, $(PRF_PRG))
|
||||
|
||||
## FLAGS ###############################
|
||||
DFLAGS = -O2 -DNDEBUG -DNO_OTB -DINTEL_TBB_THREAD # -DBOOST_DISABLE_ASSERTS
|
||||
DFLAGS = -O2 -DNDEBUG -DNO_OTB -DINTEL_TBB_THREAD -DBOOST_DISABLE_ASSERTS
|
||||
#DFLAGS = -O2 -DNDEBUG -DNO_OTB -DINTEL_TBB_THREAD
|
||||
#DFLAGS = -g -DENABLE_LOG -DNO_OTB # -DTHREAD_DISABLE -DENABLE_SMART_LOG
|
||||
IFLAGS = $(DFLAGS) -MMD -I$(HPP_DIR) -I/usr/include/gdal
|
||||
LFLAGS = -L$(LIB_DIR) -ltriskele -lstdc++ -lpthread -lboost_system -lboost_chrono -lboost_thread -lboost_program_options -lboost_date_time -lboost_serialization -lboost_filesystem -lboost_unit_test_framework -lgdal -ltbb
|
||||
@ -57,8 +58,9 @@ clean:
|
||||
|
||||
wipe: clean
|
||||
rm -rf $(OBJ_DIR)
|
||||
rm -f $(APG_OUT) $(TST_OUT) $(LIB_DIR)/libtriskele.a
|
||||
rm -f $(APG_OUT) $(TST_OUT) $(PRF_OUT) $(LIB_DIR)/libtriskele.a
|
||||
rm -f $(OUT_DIR)/*.d
|
||||
-rmdir $(OUT_DIR) $(OBJ_DIR) $(LIB_DIR) $(BLD_DIR)
|
||||
|
||||
libtriskele: $(LIB_DIR)/libtriskele.a
|
||||
|
||||
|
@ -1,4 +1,13 @@
|
||||
* Git de Triskele
|
||||
Note aux développeurs
|
||||
|
||||
** La TODO list
|
||||
- vérifier min et max
|
||||
- vérifier coupure
|
||||
- vérifier alpha-tree
|
||||
- faire un omega-tree
|
||||
- vérifier production windows
|
||||
|
||||
|
||||
** Infos concernant le pattern de git de Triskele
|
||||
|
||||
@ -31,3 +40,14 @@ Triskele suit partiellement le [[https://nvie.com/posts/a-successful-git-branchi
|
||||
# Pour une branche distante
|
||||
$ git push origin --delete nomDeBranch
|
||||
|
||||
- Fusionner les modifications
|
||||
# Il faut synchroniser la branche développement
|
||||
$ git pull
|
||||
$ git commit -a
|
||||
$ git push
|
||||
# Il faut sélectionner la branche master
|
||||
$ git checkout master
|
||||
# Il faut fusionner
|
||||
$ git merge develop
|
||||
# Il est possible d'annuler le traitement en cas de conflit
|
||||
$ git merge --abort
|
||||
|
@ -44,17 +44,19 @@ namespace otb {
|
||||
const DimImg &minVal, const DimImg &maxVal) const;
|
||||
};
|
||||
|
||||
// ========================================
|
||||
/*! Structure intégrant la façon dont est géré un poids pour un MinTree */
|
||||
template <typename PixelT, typename WeightT> struct MaxWeight : public WeightBase<PixelT, WeightT> {
|
||||
template <typename PixelT, typename WeightT> struct MinWeight : public WeightBase<PixelT, WeightT> {
|
||||
typedef WeightBase<PixelT, WeightT> WB;
|
||||
|
||||
static inline bool isWeightInf (const WeightT &a, const WeightT &b);
|
||||
|
||||
inline bool getDecr () const;
|
||||
static inline bool isWeightInf (const WeightT &a, const WeightT &b);
|
||||
static inline bool isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b);
|
||||
static inline void sort (Edge<WeightT> *edges, DimEdge count);
|
||||
|
||||
inline MaxWeight();
|
||||
inline MaxWeight (const PixelT *pixels, const Size &size);
|
||||
inline MaxWeight (const MaxWeight &model, const PixelT *pixels, const Size &size);
|
||||
inline MinWeight ();
|
||||
inline MinWeight (const PixelT *pixels, const Size &size);
|
||||
inline MinWeight (const MinWeight &model, const PixelT *pixels, const Size &size);
|
||||
|
||||
inline WeightT getWeight (const DimImg &idx) const;
|
||||
inline WeightT getWeight (const Point &a, const Point &b) const;
|
||||
@ -62,14 +64,12 @@ namespace otb {
|
||||
|
||||
// ========================================
|
||||
/*! Structure intégrant la façon dont est géré un poids pour un MaxTree */
|
||||
template <typename PixelT, typename WeightT> struct MinWeight : public WeightBase<PixelT, WeightT> {
|
||||
template <typename PixelT, typename WeightT> struct MaxWeight : public WeightBase<PixelT, WeightT> {
|
||||
typedef WeightBase<PixelT, WeightT> WB;
|
||||
|
||||
inline bool getDecr () const;
|
||||
|
||||
inline MinWeight ();
|
||||
inline MinWeight (const PixelT *pixels, const Size &size);
|
||||
inline MinWeight (const MinWeight &model, const PixelT *pixels, const Size &size);
|
||||
inline MaxWeight();
|
||||
inline MaxWeight (const PixelT *pixels, const Size &size);
|
||||
inline MaxWeight (const MaxWeight &model, const PixelT *pixels, const Size &size);
|
||||
|
||||
inline WeightT getWeight (const DimImg &idx) const;
|
||||
inline WeightT getWeight (const Point &a, const Point &b) const;
|
||||
|
@ -101,60 +101,28 @@ WeightBase<PixelT, WeightT>::weight2valueBound (PixelT *compAPTree, const Weight
|
||||
// ========================================
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline bool
|
||||
MaxWeight<PixelT, WeightT>::isWeightInf (const WeightT &a, const WeightT &b) {
|
||||
MinWeight<PixelT, WeightT>::getDecr () const {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline bool
|
||||
MinWeight<PixelT, WeightT>::isWeightInf (const WeightT &a, const WeightT &b) {
|
||||
return a > b;
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline bool
|
||||
MaxWeight<PixelT, WeightT>::isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b) {
|
||||
MinWeight<PixelT, WeightT>::isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b) {
|
||||
return isWeightInf (a.weight, b.weight);
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline void
|
||||
MaxWeight<PixelT, WeightT>::sort (Edge<WeightT> *edges, DimEdge count) {
|
||||
MinWeight<PixelT, WeightT>::sort (Edge<WeightT> *edges, DimEdge count) {
|
||||
std::sort (edges, edges+count, isEdgeInf);
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MaxWeight<PixelT, WeightT>::MaxWeight ()
|
||||
: WB (nullptr, NullSize) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MaxWeight<PixelT, WeightT>::MaxWeight (const PixelT *pixels, const Size &size)
|
||||
: WB (pixels, size) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MaxWeight<PixelT, WeightT>::MaxWeight (const MaxWeight &model, const PixelT *pixels, const Size &size)
|
||||
: WB (pixels, size) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline WeightT
|
||||
MaxWeight<PixelT, WeightT>::getWeight (const DimImg &idx) const {
|
||||
return WB::getValue (idx);
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline WeightT
|
||||
MaxWeight<PixelT, WeightT>::getWeight (const Point &a, const Point &b) const {
|
||||
return std::max (getWeight (WB::pointIdx (a)),
|
||||
getWeight (WB::pointIdx (b)));
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline bool
|
||||
MinWeight<PixelT, WeightT>::getDecr () const {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MinWeight<PixelT, WeightT>::MinWeight ()
|
||||
@ -186,6 +154,38 @@ MinWeight<PixelT, WeightT>::getWeight (const Point &a, const Point &b) const {
|
||||
getWeight (WB::pointIdx (b)));
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MaxWeight<PixelT, WeightT>::MaxWeight ()
|
||||
: WB (nullptr, NullSize) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MaxWeight<PixelT, WeightT>::MaxWeight (const PixelT *pixels, const Size &size)
|
||||
: WB (pixels, size) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
MaxWeight<PixelT, WeightT>::MaxWeight (const MaxWeight &model, const PixelT *pixels, const Size &size)
|
||||
: WB (pixels, size) {
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline WeightT
|
||||
MaxWeight<PixelT, WeightT>::getWeight (const DimImg &idx) const {
|
||||
return WB::getValue (idx);
|
||||
}
|
||||
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline WeightT
|
||||
MaxWeight<PixelT, WeightT>::getWeight (const Point &a, const Point &b) const {
|
||||
return std::max (getWeight (WB::pointIdx (a)),
|
||||
getWeight (WB::pointIdx (b)));
|
||||
}
|
||||
|
||||
// ========================================
|
||||
template <typename PixelT, typename WeightT>
|
||||
inline
|
||||
|
@ -40,7 +40,7 @@ perf (const Raster<PixelT> &raster, const GraphWalker &graphWalker, const TreeTy
|
||||
int
|
||||
main (int argc, char **argv, char **envp) {
|
||||
if (argc != 5) {
|
||||
cerr << "Usage: " << argv[0] << ": treeType coreCount nbTest imageSize" << endl;
|
||||
cerr << "Usage: " << argv[0] << ": {MIN|MAX|TOS|ALPHA} coreCount nbTest imageSize" << endl;
|
||||
exit (1);
|
||||
}
|
||||
string argType (argv[1]);
|
||||
|
@ -203,7 +203,7 @@ Tree::checkSpare () const {
|
||||
BOOST_ASSERT (compParents[compId] != compId);
|
||||
BOOST_ASSERT (compParents[compId] < maxParent);
|
||||
if (compParents[compId] < compId)
|
||||
BOOST_ASSERT (*(childrenStart + 2 + compParents[compId]) > *(childrenStart + 2 + compId));
|
||||
BOOST_ASSERT (childrenStart[2 + compParents[compId]] > childrenStart[2 + compId]);
|
||||
//BOOST_ASSERT (childCount[compParents[compId]] > childCount[compId]); // Edited line to prevent the "Unused variable" warning
|
||||
}
|
||||
BOOST_ASSERT (compParents[maxParent] == DimImg_MAX);
|
||||
|
Loading…
Reference in New Issue
Block a user