Home > Software engineering >  OPENCV contourArea computing area
OPENCV contourArea computing area

Time:09-28


Using OPENCV how to calculate the image, with a black line drawn area;
I made a left click, point, record the points to calculated using contourArea, but always abnormal;
Problem a, to calculate the area, whether to need to do other operations?
Question 2, I again drew a region in the area of the black line, how to compute can one-time large area is not part of the small circle area in?

CodePudding user response:

Collapsed in the pop-up dialog box, press the corresponding button to enter debugging press Alt + 7 key to view the Call Stack, namely "the Call Stack" from the inside to the following out of from the inner to outer function Call history, double-click a row to the cursor to the Call of the source code or assembly instruction, don't understand when double click on the next line, until we can read ,

CodePudding user response:

Don't know what did you do, but contourArea is calculating the area of the contour, you may need to look for the outline (outline is closed), the simple point set may calculate don't come out

CodePudding user response:

reference 1st floor zhao4zhong1 response:
collapsed in the pop-up dialog box, press the corresponding button to enter debugging press Alt + 7 view the Call Stack that is "the Call Stack" from the inside to the following out of from the inner to outer function Call history, double-click a row to the cursor to the Call of the source code or assembly instruction, don't understand, until can read ,
find the reason, there is no problem, the first problem to solve, the second problem remains unsolved.

CodePudding user response:

refer to the second floor m0_37901643 response:
don't know what did you do, but contourArea is calculating the area of the contour, you may need to look for the outline (outline is closed), the simple point set may not be able to calculate out
three points above is a closed interval, specific algorithm, when the overlapping area, do computing still have a little problem,

CodePudding user response:

Outer contour and constitute a hole in the middle of the difference between a contour of node order is clockwise/counterclockwise,
Or, in turn,

CodePudding user response:

reference 5 floor zhao4zhong1 reply:
outer contour and constitute a profile hole in the middle of the difference between a sequence of nodes is clockwise/counterclockwise,
Or, in turn,

Well, I just want to come to remove the internal hole, to get the problem areas

CodePudding user response:

refer to 6th floor dd985081749 response:
Quote: refer to the fifth floor zhao4zhong1 reply:

Outer contour and constitute a hole in the middle of the difference between a contour of node order is clockwise/counterclockwise,
Or, in turn,

Well, I just want to come to remove the internal hole, get outside problem areas

Reference OpenCV's own example:
Opencv \ sources \ samples \ CPP \ contours2 CPP
  • Related