Magick++  7.0.10
ChannelMoments.h
Go to the documentation of this file.
1 // This may look like C code, but it is really -*- C++ -*-
2 //
3 // Copyright Dirk Lemstra 2014-2015
4 //
5 // Definition of channel moments.
6 //
7 
8 #if !defined (Magick_ChannelMoments_header)
9 #define Magick_ChannelMoments_header
10 
11 #include "Magick++/Include.h"
12 #include <vector>
13 
14 namespace Magick
15 {
16  class Image;
17 
19  {
20  public:
21 
22  // Default constructor
23  ChannelMoments(void);
24 
25  // Copy constructor
26  ChannelMoments(const ChannelMoments &channelMoments_);
27 
28  // Destroy channel moments
29  ~ChannelMoments(void);
30 
31  //
32  // Implemementation methods
33  //
34 
35  ChannelMoments(const ChannelType channel_,
36  const MagickCore::ChannelMoments *channelMoments_);
37 
38  // X position of centroid
39  double centroidX(void) const;
40 
41  // Y position of centroid
42  double centroidY(void) const;
43 
44  // The channel
45  ChannelType channel(void) const;
46 
47  // X position of ellipse axis
48  double ellipseAxisX(void) const;
49 
50  // Y position of ellipse axis
51  double ellipseAxisY(void) const;
52 
53  // Ellipse angle
54  double ellipseAngle(void) const;
55 
56  // Ellipse eccentricity
57  double ellipseEccentricity(void) const;
58 
59  // Ellipse intensity
60  double ellipseIntensity(void) const;
61 
62  // Hu invariants (valid range for index is 0-7)
63  double huInvariants(const size_t index_) const;
64 
65  private:
66  std::vector<double> _huInvariants;
67  ChannelType _channel;
68  double _centroidX;
69  double _centroidY;
70  double _ellipseAxisX;
71  double _ellipseAxisY;
72  double _ellipseAngle;
73  double _ellipseEccentricity;
74  double _ellipseIntensity;
75  };
76 
78  {
79  public:
80 
81  // Default constructor
82  ImageMoments(void);
83 
84  // Copy constructor
85  ImageMoments(const ImageMoments &imageMoments_);
86 
87  // Destroy image moments
88  ~ImageMoments(void);
89 
90  // Returns the moments for the specified channel
91  ChannelMoments channel(const ChannelType channel_=CompositeChannels) const;
92 
93  //
94  // Implemementation methods
95  //
96  ImageMoments(const Image &image_);
97 
98  private:
99  std::vector<ChannelMoments> _channels;
100  };
101 }
102 
103 #endif // Magick_ChannelMoments_header
#define MagickPPExport
Definition: Include.h:264
class MagickPPExport Image
Definition: Drawable.h:642