have a problem with my job production.
sometime my system missing an object:

in left side of posted image, you can see that miss something....
Now i'm earching a solution, to detect when my system fail, and allert user.
I think to 'measure' distance from upper border and first point not 'blank' [white] :

if this value is higher than given value, error occours.
Any help, or idea to solve this ?
thank you for any help,
m.