store multiple images efficiently in Python data structure
<p>I have several images (their number might increase over time) and their corresponding annotated images - let's call them image masks.</p>

<p>I want to convert the original images to Grayscale and the annotated masks to Binary images (B&amp;W) and then save the gray scale values in a Pandas DataFrame/CSV file based on the B&amp;W pixel coordinates. </p>

<p>So that means a lot of switching back and forth the original image and the binary images.</p>

<p>I don't want to read every time the images from file because it might be very time consuming.</p>

<p>Any suggestion which data structure should be used for storing several types of images in Python?</p>

<p>I used several lists and list.append() for storing the image.</p>

<p>For finding the white regions in the black &amp; white images I used <strong>cv2.findNonZero()</strong>.</p>

python image algorithm opencv image-processing