title: How to apply contour on its corresponding original image in a loop?
body: <p>with this code, All contour draw on a single image only and I want to draw each contour to its corresponding original image.</p>
  
  <pre><code>
      import cv2
      import numpy as np
      import matplotlib.pyplot as plt
      import matplotlib.image as mpimg
      import glob
      import os
  
      path = 'C:\pfm\segmented\original_cropped/*.jpg'
  
      for file in glob.glob(path):
          img = cv2.imread(file)
  
      path2 = 'C:\pfm\segmented/*.jpg'
      folderlen2 = len(path2)
      for file in glob.glob(path2):
  
          img2 = cv2.imread(file)
          image2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
  
          from scipy import ndimage as nd
          gaussian_img = nd.gaussian_filter(image2, sigma=3)
  
          ret, thresh = cv2.threshold(gaussian_img, 127,255, cv2.THRESH_BINARY+cv2.THRESH_OTSU)
  
          contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) 
  
          for cnt in contours:
  
              cv2.drawContours(img, contours, -1, (0,255,0),2)
              plt.imshow(img)
  </code></pre>