Skip to content

Comment on OpenCV Python (NumPy) to C++ CV:Mat Conversion Guide for NDArrays

Comments

When working with OpenCV in Python and C++ there are some key differences. For starters OpenCV Python is seemlessly integrated with NumPy. This makes working with images much easier if you are familliar with common NumPy operations. However when using the C++ API things can get more complicated. However for common 2D operations, the C++ class CV::Mat seems to have lots of common operations to manipulate 2D color images. In that case CV::Mat represents can represent a 2D, 3D, or 4D array which can represent Gray, RGB (BGR in OpenCV), or BGR + Alpha. However many people are not aware that CV::Mat can act as an ND Array where dimensions > 4.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.