Ask Your Question
0

cv::seamlessClone is getting error (matrix.cpp:2236: error: (-215) CV_MAT_TYPE(mtype) == m.type() in function create) in ios

asked 2015-07-15 08:27:59 -0500

Tamajit gravatar image
 UIImageToMat([UIImage imageNamed:@"lisa_opencv_poisson.png"], src);
 UIImageToMat([UIImage imageNamed:@"mona_opencv_poisson.png"], tar);
 UIImageToMat([UIImage imageNamed:@"vinci_mask.png"], msk);

cv::Mat out1;
cv::seamlessClone(src, tar, msk, cv::Point(tar.cols/2,tar.rows/2), out1, cv::NORMAL_CLONE); // crash in this line
UIImageWriteToSavedPhotosAlbum(MatToUIImage(out1), nil, nil, nil);

NB: src and msk have same size

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-07-15 08:47:42 -0500

LBerger gravatar image

updated 2015-07-15 09:21:32 -0500

you should check channels of msk. Png is offen 4 channels so it's not possible to use as parameters

edit flag offensive delete link more

Comments

@LBerger i have implemented

if(msk.type() == CV_8UC3){
    NSLog(@"3 chnl");
}
else if(msk.type() == CV_8UC4){
    NSLog(@"4 chnl");
}
else if(msk.type() == CV_8UC2){
    NSLog(@"2 chnl");
}
else if(msk.type() == CV_8UC1){
    NSLog(@"1 chnl");
}

this code below

UIImageToMat([UIImage imageNamed:@"vinci_mask.png"], msk);

and it showing "1 chnl"

Tamajit gravatar imageTamajit ( 2015-07-16 00:12:06 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-07-15 08:27:59 -0500

Seen: 549 times

Last updated: Jul 15 '15