Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ChamferOp.h
Go to the documentation of this file.
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.GPL  **
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 <ICLFilter/UnaryOp.h>
00034 #include <ICLCore/Img.h>
00035 #include <vector>
00036 #include <ICLUtils/Point.h>
00037 
00038 namespace icl{
00039   namespace filter{
00041 
00188     class ChamferOp : public UnaryOp{
00189       public:
00191       enum hausdorffMetric{
00192         hausdorff_max, 
00193         hausdorff_mean 
00194       };
00196       enum outerROIPenaltyMode{
00197         noPenalty,      
00198         constPenalty,   
00199         distancePenalty 
00200       };
00201       
00203 
00217       ChamferOp( icl32s horizontalAndVerticalNeighbourDistance=3, icl32s diagonalNeighborDistance=4, int scaleFactor=1, bool scaleUpResult=true);
00218       
00220       virtual ~ChamferOp(){}
00221       
00223 
00233       virtual void apply(const core::ImgBase *poSrc, core::ImgBase **ppoDst);
00234   
00236       using UnaryOp::apply;
00237       
00239 
00247       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);
00248       
00249       
00251 
00259       static double computeDirectedHausdorffDistance(const core::Img32s *chamferImage, 
00260                                                      const std::vector<utils::Point> &model,
00261                                                      hausdorffMetric m=hausdorff_mean, 
00262                                                      outerROIPenaltyMode pm=noPenalty,
00263                                                      icl32s penaltyValue=0);
00265 
00274       static double computeDirectedHausdorffDistance(const core::Img32s *chamferImage, 
00275                                                      const core::Img32s *modelChamferImage, 
00276                                                      ChamferOp::hausdorffMetric m, 
00277                                                      ChamferOp::outerROIPenaltyMode pm=noPenalty,
00278                                                      icl32s penaltyValue=0);
00279   
00280   
00282 
00294       static double computeSymmetricHausdorffDistance(const core::Img32s *chamferImageA, 
00295                                                       const core::Img32s *chamferImageB,
00296                                                       hausdorffMetric m=hausdorff_mean,
00297                                                       ChamferOp::outerROIPenaltyMode pm=noPenalty,
00298                                                       icl32s penaltyValue=0);
00300 
00322       static double computeSymmetricHausdorffDistance(const std::vector<utils::Point> setA, const utils::Size &sizeA, const utils::Rect &roiA, core::ImgBase **bufferA, 
00323                                                       const std::vector<utils::Point> setB, const utils::Size &sizeB, const utils::Rect &roiB, core::ImgBase **bufferB, 
00324                                                       hausdorffMetric m=hausdorff_mean,
00325                                                       ChamferOp::outerROIPenaltyMode pm=noPenalty,
00326                                                       icl32s penaltyValue=0,
00327                                                       ChamferOp coA=ChamferOp(),
00328                                                       ChamferOp coB=ChamferOp() );
00329       
00331 
00344       static double computeSymmeticHausdorffDistance(const core::Img32s *chamferImage, 
00345                                                      const std::vector<utils::Point> &model, 
00346                                                      const utils::Size &modelImageSize,
00347                                                      const utils::Rect &modelImageROI,
00348                                                      core::ImgBase **bufferImageA, 
00349                                                      core::ImgBase **bufferImageB, 
00350                                                      hausdorffMetric m=hausdorff_mean,
00351                                                      ChamferOp::outerROIPenaltyMode pm=noPenalty,
00352                                                      icl32s penaltyValue=0,
00353                                                      ChamferOp co=ChamferOp());
00354       
00355       
00356       private:
00358       icl32s m_iHorizontalAndVerticalNeighbourDistance;
00359       
00361       icl32s m_iDiagonalNeighborDistance;
00362   
00364       int m_iScaleFactor;
00365       
00367       bool m_bScaleUpResult;
00368       
00370       core::Img32s m_oBufferImage;
00371     };
00372   } // namespace filter
00373 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines