Basic openCV contour questions

asked 2019-12-04 01:39:03 -0500

MingCheng gravatar image

updated 2019-12-04 03:30:26 -0500

berak gravatar image

Hi, May I ask that what is the meaning of this line of code: "key=cv2.contourArea" Thank you for reading this post.

edit retag flag offensive close merge delete

Comments

1

please don't post large blocks of code in a comment.

instead EDIT your question, and put the relevant portion of your code there, thank you.

berak gravatar imageberak ( 2019-12-04 03:31:39 -0500 )edit
1

My apologies, here is the relevant portion.

bluecnts = cv2.findContours(mask.copy(),cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)[-2]
if len(bluecnts)>0:
        blue_area = max(bluecnts, key=cv2.contourArea)
        (xg,yg,wg,hg) = cv2.boundingRect(blue_area)
MingCheng gravatar imageMingCheng ( 2019-12-04 03:54:59 -0500 )edit
1

You have copied the code from https://answers.opencv.org/question/2...

You should ask the person who wrote it

mvuori gravatar imagemvuori ( 2019-12-04 06:17:57 -0500 )edit
supra56 gravatar imagesupra56 ( 2019-12-04 09:59:34 -0500 )edit