Image Component Library (ICL)
|
00001 /******************************************************************** 00002 ** Image Component Library (ICL) ** 00003 ** ** 00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld ** 00005 ** Neuroinformatics Group ** 00006 ** Website: www.iclcv.org and ** 00007 ** http://opensource.cit-ec.de/projects/icl ** 00008 ** ** 00009 ** File : ICLFilter/src/ICLFilter/ChamferOp.h ** 00010 ** Module : ICLFilter ** 00011 ** Authors: Christof Elbrechter ** 00012 ** ** 00013 ** ** 00014 ** GNU LESSER GENERAL PUBLIC LICENSE ** 00015 ** This file may be used under the terms of the GNU Lesser General ** 00016 ** Public License version 3.0 as published by the ** 00017 ** ** 00018 ** Free Software Foundation and appearing in the file LICENSE.LGPL ** 00019 ** included in the packaging of this file. Please review the ** 00020 ** following information to ensure the license requirements will ** 00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt ** 00022 ** ** 00023 ** The development of this software was supported by the ** 00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** 00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** 00026 ** Forschungsgemeinschaft (DFG) in the context of the German ** 00027 ** Excellence Initiative. ** 00028 ** ** 00029 ********************************************************************/ 00030 00031 #pragma once 00032 00033 #include <ICLUtils/CompatMacros.h> 00034 #include <ICLUtils/Point.h> 00035 #include <ICLCore/Img.h> 00036 #include <ICLFilter/UnaryOp.h> 00037 #include <vector> 00038 00039 namespace icl{ 00040 namespace filter{ 00042 00189 class ICLFilter_API ChamferOp : public UnaryOp{ 00190 public: 00192 enum hausdorffMetric{ 00193 hausdorff_max, 00194 hausdorff_mean 00195 }; 00197 enum outerROIPenaltyMode{ 00198 noPenalty, 00199 constPenalty, 00200 distancePenalty 00201 }; 00202 00204 00218 ChamferOp( icl32s horizontalAndVerticalNeighbourDistance=3, icl32s diagonalNeighborDistance=4, int scaleFactor=1, bool scaleUpResult=true); 00219 00221 virtual ~ChamferOp(){} 00222 00224 00234 virtual void apply(const core::ImgBase *poSrc, core::ImgBase **ppoDst); 00235 00237 using UnaryOp::apply; 00238 00240 00248 static void renderModel(const std::vector<utils::Point> &model, core::ImgBase **image, const utils::Size &size, icl32s bg=0, icl32s fg=255, utils::Rect roi=utils::Rect::null); 00249 00250 00252 00260 static double computeDirectedHausdorffDistance(const core::Img32s *chamferImage, 00261 const std::vector<utils::Point> &model, 00262 hausdorffMetric m=hausdorff_mean, 00263 outerROIPenaltyMode pm=noPenalty, 00264 icl32s penaltyValue=0); 00266 00275 static double computeDirectedHausdorffDistance(const core::Img32s *chamferImage, 00276 const core::Img32s *modelChamferImage, 00277 ChamferOp::hausdorffMetric m, 00278 ChamferOp::outerROIPenaltyMode pm=noPenalty, 00279 icl32s penaltyValue=0); 00280 00281 00283 00295 static double computeSymmetricHausdorffDistance(const core::Img32s *chamferImageA, 00296 const core::Img32s *chamferImageB, 00297 hausdorffMetric m=hausdorff_mean, 00298 ChamferOp::outerROIPenaltyMode pm=noPenalty, 00299 icl32s penaltyValue=0); 00301 00323 static double computeSymmetricHausdorffDistance(const std::vector<utils::Point> setA, const utils::Size &sizeA, const utils::Rect &roiA, core::ImgBase **bufferA, 00324 const std::vector<utils::Point> setB, const utils::Size &sizeB, const utils::Rect &roiB, core::ImgBase **bufferB, 00325 hausdorffMetric m=hausdorff_mean, 00326 ChamferOp::outerROIPenaltyMode pm=noPenalty, 00327 icl32s penaltyValue=0, 00328 ChamferOp coA=ChamferOp(), 00329 ChamferOp coB=ChamferOp() ); 00330 00332 00345 static double computeSymmeticHausdorffDistance(const core::Img32s *chamferImage, 00346 const std::vector<utils::Point> &model, 00347 const utils::Size &modelImageSize, 00348 const utils::Rect &modelImageROI, 00349 core::ImgBase **bufferImageA, 00350 core::ImgBase **bufferImageB, 00351 hausdorffMetric m=hausdorff_mean, 00352 ChamferOp::outerROIPenaltyMode pm=noPenalty, 00353 icl32s penaltyValue=0, 00354 ChamferOp co=ChamferOp()); 00355 00356 00357 private: 00359 icl32s m_iHorizontalAndVerticalNeighbourDistance; 00360 00362 icl32s m_iDiagonalNeighborDistance; 00363 00365 int m_iScaleFactor; 00366 00368 bool m_bScaleUpResult; 00369 00371 core::Img32s m_oBufferImage; 00372 }; 00373 } // namespace filter 00374 }