0

I converted IplImage to SDL_Surface
With the reference of this link

SDL_Surface *single_channel_ipl_to_surface (IplImage *opencvimg)
{
    SDL_Surface *surface = SDL_CreateRGBSurfaceFrom((void*)opencvimg->imageData,
                           opencvimg->width,
                           opencvimg->height,
                           opencvimg->depth*opencvimg->nChannels,
                           opencvimg->widthStep,
                           1, 1, 1 ,0);
    return surface;
}

How can I convert SDL_Surface to IplImage

Wazy
  • 8,822
  • 10
  • 53
  • 98

1 Answers1

0

There are 4 pieces of information you'll have to retrieve from SDL_Surface, so investigate the API to know how you can retrieve:

  • The size of the image (width/height);
  • The bit depth of the image;
  • The number of channels;
  • And the data (pixels) of the image;

After that you can create an IplImage from scratch with cvCreateImageHeader() followed by cvSetData().

Community
  • 1
  • 1
karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • Let me try (its gonna take me time) and then revert back...Thanks for the answer by the way... – Wazy Jul 10 '12 at 13:22