diff --git a/example/main.cpp b/example/main.cpp index 03062f8..ab462e3 100644 --- a/example/main.cpp +++ b/example/main.cpp @@ -3,6 +3,7 @@ #include #include "blob.h" #include "BlobResult.h" +#include "highgui.h" //include it to use GUI functions. const int NUMCORES = 2; using namespace std; diff --git a/library/BlobResult.cpp b/library/BlobResult.cpp index 56165c6..3ef8dd1 100644 --- a/library/BlobResult.cpp +++ b/library/BlobResult.cpp @@ -85,12 +85,13 @@ CBlobResult::CBlobResult(IplImage *source, IplImage *mask,int numThreads) { if(mask!=NULL){ Mat temp = Mat::zeros(Size(source->width,source->height),CV_8UC1); - Mat(source).copyTo(temp,Mat(mask)); + cvarrToMat(source).copyTo(temp,cvarrToMat(mask)); compLabeler.set(numThreads,temp); compLabeler.doLabeling(m_blobs); } else{ - compLabeler.set(numThreads,source); + Mat temp = Mat::zeros(Size(source->width,source->height),CV_8UC1); + compLabeler.set(numThreads,temp); compLabeler.doLabeling(m_blobs); } } diff --git a/library/blob.cpp b/library/blob.cpp index ec660bd..fd762ec 100644 --- a/library/blob.cpp +++ b/library/blob.cpp @@ -477,7 +477,7 @@ double CBlob::Mean( IplImage *image ) offset.x = -m_boundingBox.x; offset.y = -m_boundingBox.y; - Mat mask_mat(mask); + Mat mask_mat = cvarrToMat(mask); //If joined if(isJoined){ @@ -787,9 +787,9 @@ CvBox2D CBlob::GetEllipse() void CBlob::FillBlob( IplImage *image, CvScalar color, int offsetX , int offsetY, bool intContours, const IplImage *srcImage) { if(srcImage==NULL) - FillBlob(Mat(image),color,offsetX,offsetY,intContours,Mat()); + FillBlob(cvarrToMat(image),color,offsetX,offsetY,intContours,Mat()); else - FillBlob(Mat(image),color,offsetX,offsetY,intContours,Mat(srcImage)); + FillBlob(cvarrToMat(image),color,offsetX,offsetY,intContours,cvarrToMat(srcImage)); } void CBlob::FillBlob( Mat image, CvScalar color, int offsetX, int offsetY, bool intContours, const Mat srcImage){ CV_FUNCNAME("CBlob::FillBlob");