Check specific area of an image

Hello, I have a challenge. We are going to put a camera on top of a tube, and every time a ship arrives, I have to measure the size of the frame (hole). In the attached photo, I only have part of the hole, but in the real world, I will get the entire square. It could be a square or a rectangle. I need to make this measurement.
Does anyone have any idea how I can do this?

Thanks

I recognize this situation. top-down view onto a bulk carrier ship that carries bulk goods (grain, powders, …). the big fat straw is part of the harbor infrastructure. it sucks the bulk up and sends it onwards on land.

monocular vision can do nothing in this situation.

you appear to be new to computer vision/machine vision. you’d have to learn an entire lecture’s worth of material and then spend months working on a prototype.

just engage some engineering company to do this for you.

Thanks for the feedback! We’ll think about it then!