Loiter mode in the absence of GPS

Already in the link. Have you use GitHub before, check out the readme?

By the way, if you intend to use openCV and with ArduPilot, then you should use Mavros 2 (mavlink + ROS). Then VIO tracking camera for non-GPS navigation may be of your interest.