转换float数组图像可用于OpenCV的格式 [英] Convert float array image to a format usable for opencv
问题描述
我不知道是否有转换我的float数组图像的IplImage一个简单的方法,
这可以通过opencv的处理。当然,我可以创建具有相同大小的空IplImage结构,只是从我的float数组图像的emplty的IplImage复制以往的像素,但有更好的解决了这一点。也许更快的内存更少消耗的方法,因为源图像是pretty大,在复制过程将需要一段时间。
i wonder if there is a easy way to convert my float array image to iplimage, which can be handled by opencv. Of course i could create an empty iplimage with the same size and just copy ever pixel from my float array image to the emplty iplimage, but is there more elegant solution to this. Maybe a faster less memory consuming method, since the source images are pretty large and the copy process would take a while.
最好的问候,
Zhengtonic
Zhengtonic
推荐答案
您可以做这样的事情(假设32位浮点数):
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;
这篇关于转换float数组图像可用于OpenCV的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!