Detect corner points of rectangle

As far as I can understand, he already did it. The scanner seems to be alineear one with have 24 sensors in line, and the program takes 50 readings (20ms per reading, for 1 m of the underlying belt movement), with a "1" when a change has been detected, creating in fact a kinda "edge detection".
But unless the OP will show us how he's actually getting the data together with a practical result and its current storage method, I think we can make a lot of congectures and hypothesys and suggest a different hardware, but without solving his problem...