How to use Mat Objects

66 views
Skip to first unread message

dschaudel

unread,
Apr 14, 2012, 5:40:59 PM4/14/12
to cvb...@googlegroups.com

Hi,

I have to do something like that:

Mat ipl = Mat(720,480,CV_8U);
Mat label = Mat(740,480, CV_32FC1);

IplImage ipl_mat = ipl;   
IplImage label_mat = label;
CvBlobs blobs;
unsigned int result = cvLabel(&ipl_mat, &label_mat, blobs);


This code causes a segmentation fault. 
Is there any possibility to use cvLabel like this -> cvLabel(&ipl_mat, &label_mat, blobs) resp. I want to use a Mat Object as the output image.
I dont want to do this like this:

...

IplImage ipl_mat = ipl;
IplImage* label_mat = cvCreateImage(cvSize(RESOLUTION_W, RESOLUTION_H), IPL_DEPTH_LABEL, 1);

unsigned int result = cvLabel(&ipl_mat, &label_mat, blobs);

dschaudel

unread,
Apr 14, 2012, 5:43:39 PM4/14/12
to cvb...@googlegroups.com
last line of code

unsigned int result = cvLabel(&ipl_mat, &label_mat, blobs);


last line of code

unsigned int result = cvLabel(&ipl_mat, label_mat, blobs);

Farzad Husain

unread,
Aug 17, 2012, 10:13:29 PM8/17/12
to cvb...@googlegroups.com
Hi

I am also doing exactly the same thing. I tried both ways
IplImage* ipl_labelImg = cvCreateImage(cvSize(480, 640), IPL_DEPTH_LABEL, 1);
and
IplImage ipl_labelImg = cv::Mat(480,640,CV_32FC1);

but I am getting a segmentation fault at:
unsigned int result = cvLabel(&ipl_segment_dil, ipl_labelImg, blobs);

Please let me know if you have found a solution
Reply all
Reply to author
Forward
0 new messages