hello,
i am facing a problem. I am using a ofxKinect to grab a depth image and ofxOpenCV to detect blobs.
Here is a part of the code :
void kinectTracker::update() {
kinect.update();
if(kinect.isFrameNew())
{
//////////////////////////////////////////
// TODO : threshNear, threshFar, mirror //
//////////////////////////////////////////
// load grayscale depth image from the kinect source
depthImage.setFromPixels(kinect.getDepthPixels(), kinect.width, kinect.height);
// ---------- ROI -----------
CvRect cvROI = cvRect(roi.x,roi.y,roi.width,roi.height);
cvSetImageROI(depthImage.getCvImage(),cvROI);
//thresholdImage = depthImage;
depthImage.threshold(threshold);
// update the cv images
depthImage.flagImageChanged();
//find blob in ROI
contourFinder.findContours(depthImage, minBlobSize, roi.width*roi.height, 1, false);
}
if (contourFinder.nBlobs > 0 && contourFinder.blobs[0].area > minBlobSize)
{
// Optimize blob options
if (bDilate){
for(int i = 0; i < 10; i++){
depthImage.dilate(); // APP CRASH HERE !!!
}
}
if (bErode) {
for(int i = 0; i < 10; i++){
depthImage.erode(); // APP CRASH HERE !!!
}
}
pos = contourFinder.blobs.at(0).centroid;
pos.z = kinect.getDistanceAt(pos.x, pos.y);
}
}
i was trying to optimize blob detection by using dilate() and erode() methods but the app crashes when i activate one of those.
I get a signal SIGABRT error :
OpenCV Error: Assertion failed (src.size() == dst.size() && src.type() == dst.type()) in cvDilate, file /Users/theo/Downloads/OpenCV-2.3.1/modules/imgproc/src/morph.cpp, line 1232
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Users/theo/Downloads/OpenCV-2.3.1/modules/imgproc/src/morph.cpp:1232: error: (-215) src.size() == dst.size() && src.type() == dst.type() in function cvDilate
it seems like there is a problem with image size or image type but i can’t figure out why !
If you need more code, please see the github page :
thanks a lot for any help you may give