anyKode Marilou
ContentsIndexHome
PreviousUpNext
Image

Image management.

C++
class Image;

Image.h

The Image class contains the information and pixels of an image (for exemple, from a camera device). 

 

Using with openCV

Image pixels can be converted to an external libraries format easily. For OpenCV the code looks like: 

 

ModaCPP::Image image;
ModaCPP:DeviceCamera* pCamera;

(...)

//capture the image and store it in opencv image
if(pCamera->GetNextImage(&image))
  {
  int nChannels = image.GetBitsPerPixel() == 1 ? 1 : image.GetBitsPerPixel()/8 ;
  int depth = image.GetBitsPerPixel() == 1 ? IPL_DEPTH_1U : IPL_DEPTH_8U;
  img = cvCreateImage(cvSize(image.GetWidth(),image.GetHeight()), depth,nChannels);
  memcpy(img->imageData, (char*)image.GetImageBits(), image.GetImageBytesCount());
  }

(...)

//release the opencv image
cvReleaseImage(&img);
Documentation v4.7 (18/01/2015), Copyright (c) 2015 anyKode. All rights reserved.
What do you think about this topic? Send feedback!