00001 ///////////////////////////////////////////////////////////////////////////////// 00002 // 00003 // This file is part of the TLIB computer vision library. 00004 // Copyright (C) 2003-2008 Sebastien Grange 00005 // Copyright (C) 2003-2007 VRAI Group, EPFL 00006 // All rights reserved. 00007 // 00008 // This library is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License("GPL") version 2 00010 // as published by the Free Software Foundation. 00011 // 00012 // <http://www.tuyphon.com/tlib> 00013 // 00014 ///////////////////////////////////////////////////////////////////////////////// 00015 00016 00017 00018 #ifndef __TLCOLORMODEL_H__ 00019 #define __TLCOLORMODEL_H__ 00020 00021 00022 #include "tlVision.h" 00023 #include "tlColor.h" 00024 00025 00026 #define TL_COLOR_MODEL_DETECTION_THRESHOLD 25 00027 00028 00029 00030 class tlColorModel 00031 { 00032 private: 00033 tlHist2D *NRGHist; 00034 tlHist2D *HSHist; 00035 tl_format format; 00036 00037 public: 00038 tlColorModel (); 00039 tlColorModel (char *filebase); 00040 virtual ~tlColorModel (); 00041 00042 tlHist2D *getNRGHist () { return NRGHist; }; 00043 tlHist2D *getHSHist () { return HSHist; }; 00044 00045 int reset (); 00046 int finalize (); 00047 00048 int save (char *filebase); 00049 int load (char *filebase); 00050 00051 int train (tlImage *image); 00052 int train (tlImage *image, tlPoint *point); 00053 int train (tlImage *image, tlChain *chain); 00054 00055 int filter (tlImage *image, int threshold = TL_COLOR_MODEL_DETECTION_THRESHOLD); 00056 int filter (tlImage *image, tlRect *rect, int threshold = TL_COLOR_MODEL_DETECTION_THRESHOLD); 00057 00058 int test (tlColor *color, int threshold = TL_COLOR_MODEL_DETECTION_THRESHOLD); 00059 }; 00060 00061 00062 #endif 00063