0

I have two programs, one which accepts an Image as a matrix and does the processing like tracking objects using contour detection.The second program takes image as an array(IplImage) and counting no. of objects.But I want to merge these programs to count as well as track these objects.How can I merge them ?

  • 1
    [duplicate](http://stackoverflow.com/questions/2468307/how-to-convert-a-mat-variable-type-in-an-iplimage-variable-type-in-opencv-2-0?rq=1)? Does that answer your question? – KobeJohn Jun 21 '12 at 11:51
  • 2
    possible duplicate of [converting cvmat to iplimage](http://stackoverflow.com/questions/11065249/converting-cvmat-to-iplimage) – karlphillip Jun 21 '12 at 12:36

1 Answers1

0

In the following code left is CvMat, left1 is IplImage. In this way you can manually convert cvmat to IplImage.

for (int y=0;y<height1;y++)
          {
                   uchar* leftdata=(uchar*)(left->data.ptr+y*left->step);
                   uchar* left1data=(uchar* )(left->imageData+y*left1step);
               for (int x=0;x<width1;x++)
                   left1data[x]=leftdata[x];
          }

or here is another link How to convert a Mat variable type in an IplImage variable type in OpenCV 2.0?

Community
  • 1
  • 1
nbsrujan
  • 1,179
  • 1
  • 12
  • 26