I guess it could work by comparing the matrices, respectively by comparing the value of the single pixel.
The images are 512x640 logical. So the value of the pixels is 0 for black or 1 for white.
So the idea is now:
1) to create a matrix of every image
2) check every pixel in every matrix
if the pixel value in all all images is 1, then keep this pixel
if the pixel value is not 1 in all images, then set zero
3) Create a new matrix with the new values
Could this solution work for my problem?