Segmentation error with std::vector<cv::Mat>

218 views
Skip to first unread message

Caffe User

unread,
Dec 28, 2014, 7:40:19 AM12/28/14
to caffe...@googlegroups.com
Hello. I am using this reference (https://github.com/BVLC/caffe/issues/1443) to do C++ image prediction. 

My code is as followed: 
  cv::Mat image = cv::imread("/to/caffe-dev/examples/images/fish-bike.jpg");

  std::vector<cv::Mat> dv;
  dv = image;

However, I am getting Segmentation fault (core dumped) at 
dv = image;

Could anyone help me why I am getting Segmentation fault?
Thank you and happy new year! 

Ido Freeman

unread,
Dec 29, 2014, 5:44:59 AM12/29/14
to caffe...@googlegroups.com
You're trying to assign a Mat to a vector object.
Try

dv.push_back(image);

Stefano Fabri

unread,
Dec 29, 2014, 5:58:34 AM12/29/14
to caffe...@googlegroups.com
You can also try to use this:

https://github.com/BVLC/caffe/pull/1416

Caffe User

unread,
Dec 29, 2014, 8:03:03 AM12/29/14
to caffe...@googlegroups.com
I appreciate the replies!
I solved the error by
dv.push_back(image);
Reply all
Reply to author
Forward
0 new messages