Skip to content

Commit a5eb474

Browse files
committed
Merge pull request #18 from KhArtNJava/master
Fixes for new version of the OpenCV
2 parents 28f77ac + a596bef commit a5eb474

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

example/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <fstream>
44
#include "blob.h"
55
#include "BlobResult.h"
6+
#include "highgui.h" //include it to use GUI functions.
67

78
const int NUMCORES = 2;
89
using namespace std;

library/BlobResult.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,13 @@ CBlobResult::CBlobResult(IplImage *source, IplImage *mask,int numThreads)
8585
{
8686
if(mask!=NULL){
8787
Mat temp = Mat::zeros(Size(source->width,source->height),CV_8UC1);
88-
Mat(source).copyTo(temp,Mat(mask));
88+
cvarrToMat(source).copyTo(temp,cvarrToMat(mask));
8989
compLabeler.set(numThreads,temp);
9090
compLabeler.doLabeling(m_blobs);
9191
}
9292
else{
93-
compLabeler.set(numThreads,source);
93+
Mat temp = Mat::zeros(Size(source->width,source->height),CV_8UC1);
94+
compLabeler.set(numThreads,temp);
9495
compLabeler.doLabeling(m_blobs);
9596
}
9697
}

library/blob.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ double CBlob::Mean( IplImage *image )
477477
offset.x = -m_boundingBox.x;
478478
offset.y = -m_boundingBox.y;
479479

480-
Mat mask_mat(mask);
480+
Mat mask_mat = cvarrToMat(mask);
481481

482482
//If joined
483483
if(isJoined){
@@ -787,9 +787,9 @@ CvBox2D CBlob::GetEllipse()
787787
void CBlob::FillBlob( IplImage *image, CvScalar color, int offsetX , int offsetY, bool intContours, const IplImage *srcImage)
788788
{
789789
if(srcImage==NULL)
790-
FillBlob(Mat(image),color,offsetX,offsetY,intContours,Mat());
790+
FillBlob(cvarrToMat(image),color,offsetX,offsetY,intContours,Mat());
791791
else
792-
FillBlob(Mat(image),color,offsetX,offsetY,intContours,Mat(srcImage));
792+
FillBlob(cvarrToMat(image),color,offsetX,offsetY,intContours,cvarrToMat(srcImage));
793793
}
794794
void CBlob::FillBlob( Mat image, CvScalar color, int offsetX, int offsetY, bool intContours, const Mat srcImage){
795795
CV_FUNCNAME("CBlob::FillBlob");

0 commit comments

Comments
 (0)