1Image Moments {#tutorial_moments} 2============= 3 4@tableofcontents 5 6@prev_tutorial{tutorial_bounding_rotated_ellipses} 7@next_tutorial{tutorial_point_polygon_test} 8 9| | | 10| -: | :- | 11| Original author | Ana Huamán | 12| Compatibility | OpenCV >= 3.0 | 13 14Goal 15---- 16 17In this tutorial you will learn how to: 18 19- Use the OpenCV function @ref cv::moments 20- Use the OpenCV function @ref cv::contourArea 21- Use the OpenCV function @ref cv::arcLength 22 23Theory 24------ 25 26Code 27---- 28 29@add_toggle_cpp 30This tutorial code's is shown lines below. You can also download it from 31[here](https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/ShapeDescriptors/moments_demo.cpp) 32@include samples/cpp/tutorial_code/ShapeDescriptors/moments_demo.cpp 33@end_toggle 34 35@add_toggle_java 36This tutorial code's is shown lines below. You can also download it from 37[here](https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/ShapeDescriptors/moments/MomentsDemo.java) 38@include samples/java/tutorial_code/ShapeDescriptors/moments/MomentsDemo.java 39@end_toggle 40 41@add_toggle_python 42This tutorial code's is shown lines below. You can also download it from 43[here](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/ShapeDescriptors/moments/moments_demo.py) 44@include samples/python/tutorial_code/ShapeDescriptors/moments/moments_demo.py 45@end_toggle 46 47Explanation 48----------- 49 50Result 51------ 52 53Here it is: 54![](images/Moments_Source_Image.jpg) 55![](images/Moments_Result1.jpg) 56![](images/Moments_Result2.jpg) 57