Ardusub and OpenCV for Vision-based autonomous navigation


I am completing a challenge in which it is necessary to navigate towards a red spray painted section of PVC pipe autonomously. My ROV is equipped with the Pixhawk 1, Raspberry Pi 3B, and a Raspberry PiCam. I assume this would be done with OpenCV, but have no experience with this library and see that most of their courses are expensive. If it is valuable, I am 100% willing to take those courses, but if anyone else has experience with this sort of challenge, it would be great if you could share the resources you used to learn about it.

Thank you,
Makenna Reilly

1 Like

Hi @Makenna,

There are many free online resources for using OpenCV, as well as online forums where you can ask for help - the official courses are no doubt helpful for getting a decent starting point from a single site, but I don’t expect they’ll be necessary for your task.

The complexity of a computer vision pipeline is largely dependent on the variability of what you need to detect. For example,

  1. if the water colour and lighting are expected to be reasonably consistent, and if there aren’t other red objects in the scene, then searching the internet for something like “OpenCV find object by colour” should yield several relevant tutorials.
  2. if there’s strong variability in the lighting then a broad colour mask may still work, but it might also be relevant to incorporate the geometry of the target into your object search (potentially by doing some edge detection and looking for lines)

Your problem has some additional complexity because it requires interfacing with the vehicle autopilot to actually move around, but that’s not something OpenCV’s courses are likely to have content on anyway.

I’m unsure of the nature of your challenge, but if you’re able to share the code you’re using (or at least minimal working examples of parts you’re struggling with) as you progress then we (as a community) may be able to provide some relevant advice and guidance.

Thank you for the guidance! It is in a pool with relatively consistent lighting, so that should not be a huge problem. I will make sure to share issues and my code as I learn more.

1 Like

No problem :slight_smile:

As a couple of extra notes:

  1. Given a Raspberry Pi 3 doesn’t have a lot of processing power or memory I’d recommend downsampling your camera frames before doing any processing/analysis. You likely don’t need much pixel resolution for your task, especially if you’re able to stick with some form of colour masking for your detection.
  2. This comment is relevant for using a picamera specifically - it covers how to get the full field of view while using the Raspberry Pi’s GPU to handle downsampling/resizing for you, which then places minimal load on the CPU (which frees up processing power for your vision/control program, and the other programs running on the Raspberry Pi).

Good luck, and have fun.
I look forward to seeing how things progress :slight_smile:

time ago I made an autonomous rover drived by opencv.
I started from here:

It’s not so hard as I expected… but good luck!