I am using Open CV in python and I extracted some points from contour and pointpolygon test operation. (I basically used pointpolygon test to check if some pixels are inside a contour or not). Now I got the points but I want to visually confirm if the points I have are actually inside the contour or not. How to go about it? Ideally, I want to draw the contour first and then plot the extracted pixels. I can draw the contour using drawcontours functions but for plotting these points, only way I know is plt.scatter which is more using matplotlib instead of opencv.
There could be something fundamentally wrong in how I am approaching this because it feels like there should be an easier way to do this which I am missing. Here is a code snipper of what I have so far for reference.
Edit: Based on Mark Setchell's suggestion, added a code snippet where I am using image[x,y] to set color to a particular pixel. However, (x,y) is cartesian coordinate in my case and it does not work if I give it as pixel coordinate to the image.
import numpy as np
import cv2
import matplotlib.pyplot as plt
img = cv2.imread('ti.png',1)
plt.imshow(img)
ret, thresh = cv2.threshold(img, 250, 300, cv2.THRESH_BINARY_INV)
greySrc = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
laplacianSrc= cv2.Laplacian(greySrc, cv2.CV_8U, greySrc, ksize = 5)
contours, hierarchy=cv2.findContours(laplacianSrc, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
indices = np.where(img!= [0])
coordinates = zip(indices[0], indices[1])
pts=list(coordinates)
in_or_out=[cv2.pointPolygonTest(contours[0],point,measureDist=False) for point in pts]
pts_ins_ctr=[x for x, y in zip(pts, in_or_out) if y == 1]
xi=[pts_ins_ctr[i][0] for i in range(len(pts_ins_ctr))]
yi=[pts_ins_ctr[i][1] for i in range(len(pts_ins_ctr))]
img[np.array(pts_ins_ctr)]=np.array([255,0,0],dtype=np.uint8)
plt.imshow(img)