Simple shape recognition - coordinate feedback

I’m hoping for some advice on where to start with this. I’m looing for a way to recognise the position of a shape within an image, and feed back the coordinate of a point on that shape.

I’ve done a bit of reading but most papers quickly get into object tracking, facial recognition or 3d, but I think I need something much simpler - monochrome 2d would be fine.

The project is to build and control a robot arm to plug in a charge cable to an Electric Vehicle. The port on the car has a distinct shape, and so I just want to move the arm (with camera attached) until that shape lines up exactly in the correct place in the camera.

Any tips on how to proceed would be appreciated!

an example image would be helpful :wink:

The arm will start close to the vehicle and see something like this.
It needs to identify this approx shape (cover highlighted), and then move in x and y axes so that it is in a known location relative to the cover.
ChargePortShape

that tank flap won’t be bright yellow. it have the same silvery reflective appearance as everything around it. it’ll at most be distinguishable from the visible edges of the part.

anyway, you can do shape matching. simple shape matching uses moments. more advanced shape matching uses a fourier transform.

Yes I just added the yellow for emphasis. In reality that shape is still pretty distinctive with the black rubber seal outlining the flap.

So where do I start with a shape match?

start with finding a proper contour (since all matching is about analyzing those)

If the target would not change continually in the inspection image, you can try NCC-based template matching.

I just implemented a rotation invariant one.
Here is the effect:


Whole project