MATLAB: Image comparison with respect to edges

compareedge detectionimageimage processingMATLAB

I want to compare two pictures with respect to edges.
I have a slit that moves over lens and camera takes pictures for each step on lens.
To detection of starting point of lens, i want to take pictures continuously and use edge detection to compare with old picture until having a picture with edges.
For example the first picture is completely dark (completely zero on binary) and the next picture has some 1s on binary. How can i compare and tell to program if an edge occurs?

Best Answer

Unless I am missing something (and I probably am),
any(Image(:))
will be true if and only if there are some non-zero elements in Image.