← all repositories
kylemcdonald/ofxCv

OpenCV for openFrameworks without the baggage

A wrapper that wants you to graduate to raw OpenCV, not stay dependent on its abstractions.

665 stars C++ Computer Vision
ofxCv
Velocity · 7d
+0.1
★ / day
Trend
steady
star history

What it does

ofxCv is an openFrameworks addon that makes OpenCV 2 available without inventing a parallel type system. It provides toCv() and toOf() conversion functions, helper wrappers for common operations, and classes like Calibration—but the core idea is letting you use native OF types (ofImage, ofPixels) alongside native OpenCV Mat objects.

The interesting bit

Most wrappers trap you; this one tries to make itself obsolete. The README explicitly encourages direct OpenCV usage, provides clean internal implementations as “stepping stones,” and uses overloaded names (ofxCv::Canny() vs cv::Canny()) so you can write Canny() and let argument types pick the right path. The imitate() function is a small gem: it lazily allocates buffers matching a prototype’s dimensions, working across Mat, ofImage, ofVideoGrabber, or anything extending ofBaseHasPixels.

Key highlights

  • Zero-copy conversion for images via toCv(); deep copies via clone() or copy()
  • drawMat() for quick-and-dirty previewing, with clear guidance on the efficient texture path
  • Overloaded function names let you migrate from wrappers to native OpenCV gradually
  • Explicit namespace usage (cv::, ofxCv::) documented, including the Rect/Point collision with MacTypes.h on macOS
  • Branch-matching required: stable for OF 0.9.8, master for 0.10.0

Caveats

  • toCv() can’t always be used inline; non-const reference parameters will fail to compile
  • drawMat() creates a texture every frame—documented as convenient, not optimal
  • README warns it may “fall out of date”; examples are the ground truth

Verdict

Worth a look if you’re doing computer vision in openFrameworks and want a smoother on-ramp to OpenCV without committing to ofxCvImage-style abstractions. Skip if you’re already comfortable with cv::Mat and don’t need conversion helpers or the Calibration wrapper.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.