-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage_moments.cpp
executable file
·83 lines (62 loc) · 2.87 KB
/
image_moments.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//https://aishack.in/tutorials/image-moments/
//https://en.wikipedia.org/wiki/Image_moment
//void Moments( CvMoments &moments,IplImage * img)
//{
///* class Moments
// {
// public:
// Moments();
// Moments(double m00, double m10, double m01, double m20, double m11,
// double m02, double m30, double m21, double m12, double m03 );
// Moments( const CvMoments& moments );
// operator CvMoments() const;
// // spatial moments
// double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
// // central moments
// double mu20, mu11, mu02, mu30, mu21, mu12, mu03;
// // central normalized moments
// double nu20, nu11, nu02, nu30, nu21, nu12, nu03;
// because:
// m00=m00
// mu01=0
// mu10=0
// }
// Parameters:
// array – Raster image (single-channel, 8-bit or floating-point 2D array) or an array ( or ) of 2D points (Point or Point2f ).
// binaryImage – If it is true, all non-zero image pixels are treated as 1’s. The parameter is used for images only.
// moments – Output moments.
// */
///*
// All of the moments—including spatial and central moments up to the 3rd order calculated and fills moment state structure.
// void cvMoments(const CvArr* image,CvMoments* moments, int isBinary = 0 );
// double cvGetSpatialMoment( CvMoments* moments, int x_order, int y_order );//m00, m10, m01, m20, m11, m02, m30, m21, m12, m03
// double cvGetCentralMoment( CvMoments* moments, int x_order,int y_order );//mu20, mu11, mu02, mu30, mu21, mu12, mu03;
// double cvGetNormalizedCentralMoment(CvMoments* moments, int x_order,int y_order );//u20, nu11, nu02, nu30, nu21, nu12, nu03;
// void cvGetHuMoments(CvMoments* moments, CvHuMoments* HuMoments);// h1, h2, h3,...
//*/
//}
//void Moments_Test(char ** argv)
//{
//// example of run: images/gedeck1.jpg
// IplImage* img= cvLoadImage(argv[1],CV_LOAD_IMAGE_GRAYSCALE);
// CvMoments moments;
// cvMoments( img,&moments,1);
///*
// All of the moments—including spatial and central moments up to the 3rd order calculated and fills moment state structure.
// void cvMoments(const CvArr* image,CvMoments* moments, int isBinary = 0 );
// double cvGetSpatialMoment( CvMoments* moments, int x_order, int y_order );//m00, m10, m01, m20, m11, m02, m30, m21, m12, m03
// double cvGetCentralMoment( CvMoments* moments, int x_order,int y_order );//mu20, mu11, mu02, mu30, mu21, mu12, mu03;
// double cvGetNormalizedCentralMoment(CvMoments* moments, int x_order,int y_order );//u20, nu11, nu02, nu30, nu21, nu12, nu03;
// void cvGetHuMoments(CvMoments* moments, CvHuMoments* HuMoments);// h1, h2, h3,...
//*/
// double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
// m00 = cvGetSpatialMoment(&moments,0,0);
// m10 = cvGetSpatialMoment(&moments,1,0);
// m01 = cvGetSpatialMoment(&moments,0,1);
//// http://opencv.willowgarage.com/wiki/cvBlobsLib#Download
//// cv::findContours()
//}
int main()
{
return 0;
}