eLynx SDK
v3.3.0 C++ image processing API reference |
00001 //============================================================================ 00002 // ImageHistogram.h Image.Component package 00003 //============================================================================ 00004 // Usage : tool class for image histogram 00005 //---------------------------------------------------------------------------- 00006 // Inheritance : 00007 // ImageHistogram 00008 //---------------------------------------------------------------------------- 00009 // Copyright (C) 2006 by eLynx project 00010 // 00011 // This library is free software; you can redistribute it and/or 00012 // modify it under the terms of the GNU Library General Public 00013 // License as published by the Free Software Foundation; either 00014 // version 2 of the License, or (at your option) any later version. 00015 // 00016 // This library is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00019 // See the GNU Library General Public License for more details. 00020 //---------------------------------------------------------------------------- 00021 #ifndef __ImageHistogram_h__ 00022 #define __ImageHistogram_h__ 00023 00024 #include <elx/core/CoreTypes.h> 00025 #include "ImageLib.h" 00026 00027 namespace eLynx { 00028 namespace Image { 00029 00030 class AbstractImage; 00031 00032 enum { HistogramSamples = 512 }; 00033 00036 class ExportedByImage ChannelHistogram 00037 { 00038 public: 00039 ChannelHistogram(); 00040 ChannelHistogram(const ChannelHistogram& iHistogram); 00041 const ChannelHistogram& operator= (const ChannelHistogram& iHistogram); 00042 00043 uint32 * GetMap(); 00044 const uint32 * GetMap() const; 00045 uint32 GetMin() const; 00046 uint32 GetMax() const; 00047 void SetMin(uint32 iMin); 00048 void SetMax(uint32 iMax); 00049 00050 void Reset(); 00051 void UpdateMinMax(); 00052 float ComputeDominance() const; 00053 00054 private: 00055 uint32 _map[HistogramSamples]; 00056 uint32 _min; 00057 uint32 _max; 00058 }; 00059 00062 class ExportedByImage ImageHistogram 00063 { 00064 public: 00065 ImageHistogram(uint32 iChannelCount=4); 00066 ImageHistogram(const ImageHistogram& iHistogram); 00067 00068 uint32 GetChannelCount() const; 00069 uint32 GetMin() const; 00070 uint32 GetMax() const; 00071 00072 ChannelHistogram& GetChannel(uint32 iChannel); 00073 const ChannelHistogram& GetChannel(uint32 iChannel) const; 00074 00075 void Reset(uint32 iChannelCount=5); 00076 void UpdateMinMax(); 00077 float ComputeDominance() const; 00078 00079 private: 00080 ChannelHistogram _channel[4+1]; // 4 planes + Luminosity for RGB or RGBA 00081 uint32 _nChannel; 00082 uint32 _min; 00083 uint32 _max; 00084 }; 00085 00086 } // namespace Image 00087 } // namespace eLynx 00088 00089 #endif // __ImageHistogram_h__ 00090