cjm2671
cjm2671

Reputation: 19486

Data types in OpenCV

I'm working with OpenCV for the first time and I'm a little bit confused with data types. I am working with Python.

I see that I can store an image as:

The problem I'm having is that different parts of OpenCV seem to require different types and I keep having to try and convert back and forth- it's very confusing, and I'm certain it can't have been designed this way on purpose. I'm also a bit confused about when something should be in the cv module vs cv2.cv:

import cv
import cv2.cv

Can someone explain the logic? It would really help.

Thanks!

Upvotes: 3

Views: 2544

Answers (1)

berak
berak

Reputation: 39806

  • cv (or, cv2.cv)

    is the old opencv python api, using IplImage and CvMat.

    you should not use that anymore. it's being phased out, and won't be available in the next version.

  • cv2 is the new python api, using numpy arrays for almost anything instead,

    so easy to combine with scipy, matplotlib and what not. (and , btw, much closer the the current c++ api)

Upvotes: 3

Related Questions