opnecv axis and numpy dimension mismatch

asked 2018-07-17 14:42:06 -0600

On reading a jpg image through imread, the shape of numpy ndarray comes out to be ( h,w, c), where h , w and c are respectively height, width, and channel.

However, any drawing function in opnecv uses the convention ( w, h) ( e.g. line, rectangle , etc.).

Wondering why this discrepancy exists.

edit retag flag offensive close merge delete

Comments

can it be you're missing, that opencv is a c++ library (that also has python bindings) ?

berak gravatar imageberak ( 2018-07-17 20:06:29 -0600 )edit

That should not matter, as both interfaces are in Python.

whatdhack gravatar imagewhatdhack ( 2018-07-17 20:25:32 -0600 )edit

you don't get it. numpy conventions might be irrelevant for ppl who do not use python at all.

(but yea, admittedly confusing)

berak gravatar imageberak ( 2018-07-17 22:45:30 -0600 )edit

I see, you are entirely missing the point of my question. My question entirely was on the OpenCV Python APIs ( if it is not already clear ). Hence the underlying C++ implementation should not matter .

whatdhack gravatar imagewhatdhack ( 2018-07-18 01:32:30 -0600 )edit

ok, the language is irrelevant.

berak gravatar imageberak ( 2018-07-18 10:42:54 -0600 )edit