Back to Imagemagick

Magick++: Statistic.h Source File

www/api/Magick++/Statistic_8h_source.html

7.1.2-2112.2 KB
Original Source

| Magick++ 7.1.0 |

Statistic.h

Go to the documentation of this file.

1 // This may look like C code, but it is really -*- C++ -*-

2 //

3 // Copyright @ 2014 ImageMagick Studio LLC, a non-profit organization

4 // dedicated to making software imaging solutions freely available.

5 //

6 // Definition of channel moments.

7 //

8

9 #if !defined (Magick_ChannelMoments_header)

10 #define Magick_ChannelMoments_header

11

12 #include "Magick++/Include.h"

13 #include <vector>

14

15 namespace Magick

16 {

17class Image;

18

19class MagickPPExport ChannelMoments

20 {

21public:

22

23// Default constructor

24ChannelMoments(void);

25

26// Copy constructor

27ChannelMoments(const ChannelMoments &channelMoments_);

28

29// Destroy channel moments

30 ~ChannelMoments(void);

31

32// X position of centroid

33double centroidX(void) const;

34

35// Y position of centroid

36double centroidY(void) const;

37

38// The channel

39 PixelChannel channel(void) const;

40

41// X position of ellipse axis

42double ellipseAxisX(void) const;

43

44// Y position of ellipse axis

45double ellipseAxisY(void) const;

46

47// Ellipse angle

48double ellipseAngle(void) const;

49

50// Ellipse eccentricity

51double ellipseEccentricity(void) const;

52

53// Ellipse intensity

54double ellipseIntensity(void) const;

55

56// Hu invariants (valid range for index is 0-7)

57double huInvariants(const size_t index_) const;

58

59// Does object contain valid channel moments?

60bool isValid() const;

61

62//

63// Implemementation methods

64//

65

66ChannelMoments(const PixelChannel channel_,

67const MagickCore::ChannelMoments *channelMoments_);

68

69private:

70 PixelChannel _channel;

71 std::vector<double> _huInvariants;

72double _centroidX;

73double _centroidY;

74double _ellipseAxisX;

75double _ellipseAxisY;

76double _ellipseAngle;

77double _ellipseEccentricity;

78double _ellipseIntensity;

79 };

80

81class MagickPPExport ChannelPerceptualHash

82 {

83public:

84

85// Default constructor

86ChannelPerceptualHash(void);

87

88// Copy constructor

89ChannelPerceptualHash(const ChannelPerceptualHash &channelPerceptualHash_);

90

91// Constructor using the specified hash string

92ChannelPerceptualHash(const PixelChannel channel_,

93const std::string &hash_);

94

95// Destroy channel perceptual hash

96 ~ChannelPerceptualHash(void);

97

98// Return hash string

99operator std::string() const;

100

101// The channel

102 PixelChannel channel(void) const;

103

104// Does object contain valid channel perceptual hash?

105bool isValid() const;

106

107// Returns the sum squared difference between this hash and the other hash

108double sumSquaredDifferences(

109const ChannelPerceptualHash &channelPerceptualHash_);

110

111// SRGB hu preceptual hash (valid range for index is 0-6)

112double srgbHuPhash(const size_t index_) const;

113

114// HCLp hu preceptual hash (valid range for index is 0-6)

115double hclpHuPhash(const size_t index_) const;

116

117//

118// Implemementation methods

119//

120

121ChannelPerceptualHash(const PixelChannel channel_,

122const MagickCore::ChannelPerceptualHash *channelPerceptualHash_);

123

124private:

125 PixelChannel _channel;

126 std::vector<double> _srgbHuPhash;

127 std::vector<double> _hclpHuPhash;

128 };

129

130// Obtain image statistics. Statistics are normalized to the range

131// of 0.0 to 1.0 and are output to the specified ImageStatistics

132// structure.

133class MagickPPExport ChannelStatistics

134 {

135public:

136

137// Default constructor

138ChannelStatistics(void);

139

140// Copy constructor

141ChannelStatistics(const ChannelStatistics &channelStatistics_);

142

143// Destroy channel statistics

144 ~ChannelStatistics(void);

145

146// Area

147double area() const;

148

149// The channel

150 PixelChannel channel(void) const;

151

152// Depth

153size_t depth() const;

154

155// Entropy

156double entropy() const;

157

158// Does object contain valid channel statistics?

159bool isValid() const;

160

161// Kurtosis

162double kurtosis() const;

163

164// Minimum value observed

165double maxima() const;

166

167// Average (mean) value observed

168double mean() const;

169

170// Maximum value observed

171double minima() const;

172

173// Skewness

174double skewness() const;

175

176// Standard deviation, sqrt(variance)

177double standardDeviation() const;

178

179// Sum

180double sum() const;

181

182// Sum cubed

183double sumCubed() const;

184

185// Sum fourth power

186double sumFourthPower() const;

187

188// Sum squared

189double sumSquared() const;

190

191// Variance

192double variance() const;

193

194//

195// Implemementation methods

196//

197

198ChannelStatistics(const PixelChannel channel_,

199const MagickCore::ChannelStatistics *channelStatistics_);

200

201private:

202 PixelChannel _channel;

203double _area;

204size_t _depth;

205double _entropy;

206double _kurtosis;

207double _maxima;

208double _mean;

209double _minima;

210double _skewness;

211double _standardDeviation;

212double _sum;

213double _sumCubed;

214double _sumFourthPower;

215double _sumSquared;

216double _variance;

217 };

218

219class MagickPPExport ImageMoments

220 {

221public:

222

223// Default constructor

224ImageMoments(void);

225

226// Copy constructor

227ImageMoments(const ImageMoments &imageMoments_);

228

229// Destroy image moments

230 ~ImageMoments(void);

231

232// Returns the moments for the specified channel

233ChannelMoments channel(const PixelChannel channel_) const;

234

235//

236// Implemementation methods

237//

238ImageMoments(const Image &image_);

239

240private:

241 std::vector<ChannelMoments> _channels;

242 };

243

244class MagickPPExport ImagePerceptualHash

245 {

246public:

247

248// Default constructor

249ImagePerceptualHash(void);

250

251// Copy constructor

252ImagePerceptualHash(const ImagePerceptualHash &imagePerceptualHash_);

253

254// Constructor using the specified hash string

255ImagePerceptualHash(const std::string &hash_);

256

257// Destroy image perceptual hash

258 ~ImagePerceptualHash(void);

259

260// Return hash string

261operator std::string() const;

262

263// Returns the perceptual hash for the specified channel

264ChannelPerceptualHash channel(const PixelChannel channel_) const;

265

266// Does object contain valid perceptual hash?

267bool isValid() const;

268

269// Returns the sum squared difference between this hash and the other hash

270double sumSquaredDifferences(

271const ImagePerceptualHash &channelPerceptualHash_);

272

273//

274// Implemementation methods

275//

276ImagePerceptualHash(const Image &image_);

277

278private:

279 std::vector<ChannelPerceptualHash> _channels;

280 };

281

282class MagickPPExport ImageStatistics

283 {

284public:

285

286// Default constructor

287ImageStatistics(void);

288

289// Copy constructor

290ImageStatistics(const ImageStatistics &imageStatistics_);

291

292// Destroy image statistics

293 ~ImageStatistics(void);

294

295// Returns the statistics for the specified channel

296ChannelStatistics channel(const PixelChannel channel_) const;

297

298//

299// Implemementation methods

300//

301ImageStatistics(const Image &image_);

302

303private:

304 std::vector<ChannelStatistics> _channels;

305 };

306 }

307

308 #endif // Magick_ChannelMoments_header

Magick::ChannelMoments

Definition: Statistic.h:19

Magick::ImagePerceptualHash

Definition: Statistic.h:244

Magick::ImageMoments

Definition: Statistic.h:219

Magick::ChannelPerceptualHash

Definition: Statistic.h:81

MagickPPExport

#define MagickPPExport

Definition: Include.h:297

Magick::ChannelStatistics

Definition: Statistic.h:133

Include.h

Magick::ImageStatistics

Definition: Statistic.h:282

Magick::Image

class MagickPPExport Image

Definition: Drawable.h:722

Magick

Definition: Blob.h:17

Magick::Image

Definition: Image.h:55