Coming with our comments, what you can do is create a list of numpyarrays, where each element is an intensity that describe the inside of the contour of each object. In particular, for each path, create a binary mask that fills the inside of the path, find the coordinates of the (x,y)filled object, then index your image and capture the intensities.
I don’t know exactly how you configured your code, but let's assume that you have a grayscale image with a name img. You may need to convert the image to grayscale, as it cv2.findContoursworks with grayscale images. In this case, usually call cv2.findContours:
import cv2
import numpy as np
contours,_ = cv2.findContours(img, cv2.RETR_LIST, cv2.cv.CV_CHAIN_APPROX_NONE)
contours 3D numpy , N x 1 x 2, N .
, :
lst_intensities = []
for i in range(len(contours)):
cimg = np.zeros_like(img)
cv2.drawContours(cimg, contours, i, color=255, thickness=-1)
pts = np.where(cimg == 255)
lst_intensities.append(img[pts[0], pts[1]])
, . , , thickness -1. 255. numpy.where , . , 255. , , .
lst_intensities 1D numpy , , . , lst_intensities[i] i - , .