Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Moment and Archlength return values - confused

$
0
0
Hello, I had used the moment coding together with the arch length [code](http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/moments/moments.html) and found out the number do not match what I had expected. I had an image 500X500 pixel as in this [C:\fakepath\ImageTest.png](/upfiles/14389334882708997.png). Info: Area and Contour Length - Contour[0] - Area (M_00) = 0.00 - Area OpenCV: 0.00 - Length: 994.83 - Hu:0.00 - Contour[1] - Area (M_00) = 0.00 - Area OpenCV: 0.00 - Length: 994.00 - Hu:0.00 For the M00 it state = 0? why 0?? There should be maybe 500 pixel? and the contour found are 2, I may agree due to the two lines in the result window. The biggest confusion is the arch length value. Why 994? if it is a straight line, it should be the size of the image which is 500 pixels. Can someone show me where should I look on? **FROM DOUBLE POST** Hello, after testing and debugging the code for ImageTest.png using this [code](http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/moments/moments.html) I realized that the countours detected are two on the same white area image. This cause the calculation of moments are also 2 for the same white area. My question, why it detect two contours? [C:\fakepath\ImageTest.png](/upfiles/14389242754189891.png) Second question, I tried also another type of image which the white area are continuous until at the end of the image as in test.png. running moment code does not reflect the white area as the contour is not detected at the end of the image. Is there any method that I can use for the program to know that the white area is the area that I want to calculate even it had touched the boundary of the image? [C:\fakepath\test.png](/upfiles/1438924632571687.png) Here is the image with two white area ![image description](/upfiles/14393664045577622.png)

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>