Convert float array image to a format usable for opencv

前端 未结 2 1930
一向
一向 2021-02-09 18:19

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 ju

相关标签:
2条回答
  • 2021-02-09 19:12

    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.

    0 讨论(0)
  • 2021-02-09 19:18

    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;
    
    0 讨论(0)
提交回复
热议问题