6

我想知道是否有一种简单的方法可以将我的浮点数组图像转换为 iplimage,可以由 opencv 处理。当然,我可以创建一个相同大小的空iplimage,然后将浮点数组图像中的任何像素复制到空iplimage,但是有没有更优雅的解决方案。也许是一种更快、更少内存消耗的方法,因为源图像非常大并且复制过程需要一段时间。

此致,

正补品

4

2 回答 2

3

You can do something like this (assuming 32 bit floats):

float* my_float_image_data;

CvSize size;
size.height = height ;
size.width = width;
IplImage* ipl_image_p = cvCreateImageHeader(size, IPL_DEPTH_32F, 1);
ipl_image_p->imageData = my_float_image_data;
ipl_image_p->imageDataOrigin = ipl_image_p->imageData;
于 2009-10-20T14:21:56.053 回答
1

You can fill an iplimage structure 'by hand' to describe your array following the comments here.

The field imageData will point to your original array.

But then don't use deallocation functions on it. Just delete the structure in the end.

于 2009-10-20T14:18:23.907 回答