I'm trying to find the intersection between color green and blue of a set of images that are similar to this one:
So what I need is something is something like this:
And because I need to use the contours for some calculus after that I would like to know if it's possible to have the points of the curve in an array or something... but I have no idea if this is possible. I tried to do the mask but I don't think it's going to work... here's the code:
lower_val = np.array([0, 0, 0])
upper_val = np.array([150, 255, 150])
mask = cv2.inRange(image, lower_val, upper_val)
only_lumen = cv2.bitwise_and(image, image, mask=mask)
gray = cv2.cvtColor(only_lumen, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(gray, (3, 3), 0)
thresh = cv2.threshold(blur, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
thresh = 255 - thresh
This is how I'm trying to display the points:
x, y = [i[0] for i in pts_list], [i[1] for i in pts_list]
max_x, max_y = max(x), max(y)
image = np.zeros((max_y + 1, max_x + 1))
for i in range(len(pts_list)):
image[max_y - y[i], x[i]] = 1
And this is the image I obtain:

I don't understand why the dots meet in a corner and why the background is violet... The lines where supposed to be in the middel





