I would like to apply a thresholding operation to several grayscale images with different threshold values so that the output, which is displayed as a matplotlib plot, will be 15 or so different images with levels of threshold applied to each. The problem I am facing is that it only displays one image after it runs but if I say print(dst.shape)
in the loop it will print 15 image shapes.
I have tried putting the output dst
in a list so that I could access them by index dst[2]
but this returned an error.
maxValue = 255
dst = []
for thresh in range(0, 255, 51):
for img in imageB, imageG, imageR:
th, dst = cv2.threshold(img, thresh, maxValue, cv2.THRESH_BINARY)
#print(dst.shape)
#print(len(dst))
plt.imshow(dst)
What I am trying to achieve is 15 different images from the loop. Is this a matplotlib issue? Am I required to create a figure of a specific size then access each variable in the dst
list? If so, why when I print(len(dst))
does it only return the length of the rows in the image?