RealOrangeOne / zoloto

A fiducial marker system powered by OpenCV - Supports ArUco and April
https://zoloto.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
13 stars 7 forks source link

Remove internal uses of `ndarray` #283

Closed RealOrangeOne closed 3 years ago

RealOrangeOne commented 3 years ago

ndarray is annoying, and not very type safe, especially in its uses in OpenCV.

I think the best option here is to just remove as much ndarray as possible.

This has the benefit of reducing this issue as much as possible, but also enables deeper typing.

I'm expecting to have to create a Frame and Pixel type, and reuse some of the existing ones in coords.py.

Also, array is a method, not a type.

See also https://github.com/RealOrangeOne/zoloto/pull/282

RealOrangeOne commented 3 years ago

Having tried this, it's not that simple. The CV APIs require ndarray

The bigger drawback is that casting appears to be very expensive. It's critical zoloto is as fast as possible, and leaving the data in ndarray trades off speed for API flexibility, and I think that's a trade off worth making.

Happy to review in future if it becomes too annoying, but for now...