Moment and Archlength return values - confused
Hello, I had used the moment coding together with the arch length code 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.
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 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
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
Here is the image with two white area
Could you create an image in which you show the detected contours (e.g. different colors)
If I look in detail, I can see a small point somewhere above the white rectangle... What are the sizes of the contours (aka how many points do each have)?
You have posted another question earlier. I have already mentioned that your image contains a white small area in the same place as the other image, please review your fake-image generator
@FooBar, @thdrksdfthmn, answer as below in the answer section because I need yo upload images... if u hv any comment let me know. I'll also then move to the new thread as per said by @thdrksdfthmn.