0

I have to rewrite the source code to new version of OpenCV and I have problem with functions and class cvLoad, cvarrToMat and IplImage which doesn't exist in new version of OpenCV.

My old code is:

cv::Mat load(string path) {
   IplImage * imgT = (IplImage*) cvLoad(path.c_str());
   return cvarrToMat(imgT);
}

I get this error output while compiling:

error: 'IplImage' was not declared in this scope

The data which are loaded are depth maps from UTKinect 3D dataset. Here is example of xml file:

<?xml version="1.0"?>
<opencv_storage>
<depthImg190 type_id="opencv-image">
  <width>320</width>
  <height>240</height>
  <origin>top-left</origin>
  <layout>interleaved</layout>
  <dt>w</dt>
  <data>
    0 0 0 0 27120 27384 27120 27120 27384 27120 27120 27120 27120 27384
    27384 27664 27664 27944 27944 27664 27664 27944 27944 27944 28224
    27944 27944 28224 28224 28224 28224 28520 28816 29120 29120 29120
    29120 29120 29120 29120 29432 29744 30072 30072 29744 29744 30072
    30072 30072 30400 30400 30736 30736 31080 31080 31080 31440 31440
    31440 31440 31800 31800 31800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
...
gulliver
  • 86
  • 2
  • 9
  • I suppose, you (just) want to load (or read) an image from a file!? For example, have a look at [`imread`](https://docs.opencv.org/4.1.0/d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56). – HansHirse Jun 28 '19 at 12:54
  • I use it for loading depth binary image of UTKinect Action 3D dataset. – gulliver Jun 28 '19 at 12:56
  • Hm, ok. You should add all information you have, e.g. regarding the header, to your question. If possible, you may also add some sample data. From the quite simple code, I assumed some simple image loading operation. Does `cvLoad` do something automagically to these Kinect data, which wouldn't be also covered by `cv::imread`? – HansHirse Jun 28 '19 at 14:57
  • Yeah, good idea, I updated the article. Sorry for mystification, the data are stored in xml file. – gulliver Jun 28 '19 at 20:24
  • and for information, I tried the imread, no works. – gulliver Jun 28 '19 at 20:26
  • Have a look at [this answer](https://stackoverflow.com/a/44056881/11089932) and the link inside. Hopefully, that'll help you! – HansHirse Jun 29 '19 at 20:12

0 Answers0