Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

ofxCv chessboard error

$
0
0

Hey Of Community!

I am working on a project where I want to un-distort some video coming from a 180 degree fisheye camera. I was hoping to test out one method presented here: http://www.aishack.in/tutorials/calibrating-undistorting-with-opencv-in-c-oh-yeah/
It basically uses a chess-board to work out the parameters necessary for calibrating the camera.

It's a fairly straightforward guide which I modified a bit to fit in to openFrameworks but I'm having some trouble when I call findChessboardCorners(). It works fine if there is no chessboard in the scene but as soon as it detects a chessboard, (ie when I put one into the frame) I get a sigabrt error with some weird text about theo's OpenCV library... here is the error:

OpenCV Error: Assertion failed (func != 0) in convertTo, file /Users/theo/Downloads/OpenCV-2.3.1/modules/core/src/convert.cpp, line 937
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Users/theo/Downloads/OpenCV-2.3.1/modules/core/src/convert.cpp:937: error: (-215) func != 0 in function convertTo

I'm not sure why this is happening, here are the relevant bits of code that cause the error:

setup() {
ofVideoGrabber grabber;
grabber.initGrabber(400, 400);
int numCornersVer = 3;
int numCornersHor = 4;
vector< ofVec2f > corners;

Mat input_mat;
cv::Size = board_sz = cv::Size(numCornersHor, numCornersVer);
}

update() {
grabber.update();
input_mat = toCv(grabber.getPixelsRef());
findChessboardCorners(input_mat, board_sz, corners, CV_CALIB_CB_ADAPTIVE_THRESH | CV_CALIB_CB_FILTER_QUADS)
}

P.S. All the variables I'm using are declared in ofApp.h just adding types for clarity.

Thanks in advance!


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>