【发布时间】:2020-05-11 05:44:18
【问题描述】:
这是我的代码:
printf("preallocations\n");
char * addr = (char *) bo_gc320->m_fb_id[gc320_buf_idx];
cv::Mat src(cvSize(bo_gc320->m_width, bo_gc320->m_height), CV_8UC4, addr);
cv::Mat alpha(cvSize(bo_gc320->m_width, bo_gc320->m_height), CV_8UC1);
cv::Mat rgb(cvSize(bo_gc320->m_width, bo_gc320->m_height), CV_8UC3);
cv::Mat dst(cvSize(bo_gc320->m_width, bo_gc320->m_height), CV_8UC3);
printf("postallocations\n");
cv::Mat * out = new cv::Mat[4];// malloc(4*sizeof(cv::Mat *));
for (int k=0;k<4;k++) {
out[k] = cv::Mat(cvSize(bo_gc320->m_width, bo_gc320->m_height), CV_8UC1);
printInfo(out[k]);
}
printf("presplit\n");
printInfo(src);
cv::split(src, out);
printf("postsplit\n");
输出是:
preallocations
postallocations
dim(332, 768)unsigned char(1)
dim(332, 768)unsigned char(1)
dim(332, 768)unsigned char(1)
dim(332, 768)unsigned char(1)
presplit
dim(332, 768)unsigned char(4)
Segmentation fault (core dumped)
我正在帮助函数中打印有关数组的信息。 addr 中的数据来自 gc320 GPU 的输出缓冲区。这可能是由于地址不包含有效数据造成的吗?
【问题讨论】:
-
请阅读minimal reproducible example,然后阅读edit您的问题。
标签: c++ opencv image-processing gpu