Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Bus error (core dumped) while declaring cv::Mat

Hi, I have been dealing with very simple matrices. The code snippet is below

cv::Size sz, sz1, sz2;
sz2 = cv::Size(4,1);
cv::Mat M(sz2, CV_8U);
int color_array_size = (1/3) * (point_cloud->width * point_cloud->height);
uint32_t arr [point_cloud->width * point_cloud->height] = {0};
uint8_t red_array[color_array_size] ={}, blue_array[color_array_size] ={} , green_array[color_array_size] ={};

sz= cv::Size(point_cloud->width, point_cloud->height);
sz1= cv::Size( point_cloud->width, point_cloud->height);
cv::Mat_ <cv::Vec3f> image(sz, CV_32FC3);
cv::Mat image_color(sz, CV_32F, arr);

The trouble is caused due to cv::Mat M(sz2, CV_8U); Some other type of matrices are also causing this annoying trouble. Anyone could suggest something to get rid of this?

Bus error (core dumped) while declaring cv::Mat

Hi, I have been dealing with very simple matrices. The code snippet is below

cv::Size sz, sz1, sz2;
sz2 = cv::Size(4,1);
cv::Mat M(sz2, CV_8U);
int color_array_size = (1/3) * (point_cloud->width * point_cloud->height);
uint32_t arr [point_cloud->width * point_cloud->height] = {0};
uint8_t red_array[color_array_size] ={}, blue_array[color_array_size] ={} , green_array[color_array_size] ={};

sz= cv::Size(point_cloud->width, point_cloud->height);
sz1= cv::Size( point_cloud->width, point_cloud->height);
cv::Mat_ <cv::Vec3f> image(sz, CV_32FC3);
cv::Mat image_color(sz, CV_32F, arr);

The trouble is caused due to cv::Mat M(sz2, CV_8U); building the code is fine. While running the executable Bus error (core dumped) occurs. Some other type of matrices are also causing this annoying trouble. Anyone could suggest something to get rid of this?