title: cv2.moments for two contours
body: <p>The code recognizes the two contours of the specified color, however I don't know how to save the coordinates (X, Y) of each contour individually.</p>
  <p>Although the coordinates appear in the frame, when printing the position variables it only saves one of the two coordinates.</p>
  <p>Does anyone know how I can use cv.moments to find the moment of each contour individually or have another idea to achieve the expected goal?</p>
  <pre><code>    for c_2 in contour_2:
          area = cv2.contourArea(c_2)
          # Noise reduction using area as parameter
          if area &gt; 2000:
              M_1 = cv2.moments(c_2)
              # Centroid
              if M_1[&quot;m00&quot;] == 0: M_1[&quot;m00&quot;, &quot;m01&quot;] = 1
              x_2 = int(M_1[&quot;m10&quot;] / M_1[&quot;m00&quot;])
              y_2 = int(M_1[&quot;m01&quot;] / M_1[&quot;m00&quot;])
  
              cv2.circle(frame, (x_2, y_2), 7, (0, 255, 0), -1)
  
              font = cv2.FONT_HERSHEY_SIMPLEX
              cv2.putText(frame, '{},{}'.format(x_2, y_2), (x_2 + 10, y_2), font, 0.75, (0, 255, 0), 1, cv2.LINE_AA)
  
              # Contour smoothing
              newContour = cv2.convexHull(c)
              cv2.drawContours(frame, [newContour], 0, (255, 0, 0), 3)´´´
  </code></pre>
  <p><a href="https://i.stack.imgur.com/mrNEQ.png" rel="nofollow noreferrer">enter image description here</a></p>