I am a beginner in opencv-python. I want to get all the X and Y coordinates of for the region of the interest mentioned in the code and store it in an array. Can anyone give me an idea on how to proceed? I was able to run the code, but is not showing any results.
Image for detecting all the X and Y coordinates

The sample code i wrote is written below,
import cv2 import numpy as np import matplotlib.pyplot as plt import imutils img = cv2.imread("/home/harikrishnan/Desktop/image.jpg",0) img1 = imutils.resize(img) img2 = img1[197:373,181:300] #roi of the image ans = [] for y in range(0, img2.shape[0]): #looping through each rows for x in range(0, img2.shape[1]): #looping through each column if img2[y, x] != 0: ans = ans + [[x, y]] ans = np.array(ans) print ans