Mission Planner and OpenCV

I want to use OpenCV with Mission Planner, where I have the drone visit waypoints and when it reaches the last waypoint it uses OpenCV to detect and track an object and follow it.

Do I have to create a new mode and add it as an event and use this as the last waypoint? Is there a way to trigger running the OpenCV program via mavlink?

Thanks

Well it depends on your purposes.
I was implementing bit more complex scenarios, so at the end of investigation I decided to go with vanilla AP.
All business logic I moved to the external software and the communication between business logic and AP was based on Mavlink over Serial.
The business logic app was changing existing flight mods and by setting up next waypoint and updating it constantly…

Thanks for your response!

I’m looking to modify the way the plane flies as well, instead of just adding waypoints. I think I would need to modify AP to make my own control surface deflections (w/ functions in ArduPlane/servos.cpp) ?
I’m using a Navio2 flight controller btw.