OpenCV notes
Jump to navigation
Jump to search
✎ This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.
While unrelated, You may also be looking for
Python
Interfaces
tl;dr: you probably want to use cv2
- cv
- official
- thin wrapper, with cvMat types as in C++, and cvSeq for things like contours
- generally somewhat cumbersome, and sometimes less efficient
- cv2
- official, replaced cv (you can still get this interface via cv2.cv)
- uses numpy and native python types only
- pyopencv
- seems abandoned
- SimpleCV
- a wrapper (around cv2?(verify) that makes it easier to set up quick and dirty experiments
- maybe nice for an intro but you may end up using cv2
- Also not exposing as much, so sometimes slower depending on the task (verify)
- uses PyGame as an interface to the Simple Directmedia Layer (SDL).
SimpleCV example:
# use first camera, detect face, draw rectangle
import SimpleCV
cam = SimpleCV.Camera()
while True:
img = cam.getImage()
faces = img.findHaarFeatures('haarcascade_frontalface_alt.xml')
if faces:
for face in faces:
face.draw()
img.show()
See also:
Basic tests
Errors
nvcc fatal : Unsupported gpu architecture 'compute_11'
When compiling OpenCV with CUDA support, you probably want to specify CUDA_GENERATION, e.g. to Kepler (3)
Cannot move to target thread
Something like:
QObject::moveToThread: Current thread (0x1ac0000) is not the object's thread (0x1b35290). Cannot move to target thread (0x1ac0000)
This is typically a mix of versions of opencv finding each other.
Isolate them properly, or uninstall older versions.