Picture discrimination

Unfortunately, the wiring lacks of extra wires, so I’d like to find a solution by pictures of my gate.
Later on I will try to set up a WiFi or LIN communication with the gate control.

I’m looking to determine the state of my gate, according to a taken picture.
I assume that a picture in gray-scale may indicate whether the gate is fully close and when is fully open. It’s necessary in a gray color because of night vision.

What are the possibilities ?