2

I am working on a project that uses the OpenCV library, it uses Emgu.CV.Image as the image captured from the camera.

I am trying to move the code into a Microsoft Azure Worker Role to handle the image processing in the cloud.

I have a line of code in my current solution

//Get the current frame from capture device
   _currentFrame = _grabber.QueryFrame().Resize(320, 240, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);

This line of code grabs the current frame from the camera and returns an Image of the type > Emgu.CV.Image

As I am moving this code to the cloud, I won't be able to access a camera device to grab a frame.

So I want to pass to the cloud a .Net Image or Byte Array converted from a base64 image string at the point my code expects an Emgu.CV.Image image from the current frame.

The challenge I have is my code wants to work with Emgu.CV.Image but I only have now .Net Image, Byte Array or base64 image string. I need to convert that to Emgu.CV.Image and I am not quite sure how to go about it.

Can anyone nudge me in the right direction please.

Lismore
  • 259
  • 2
  • 11
  • 1
    Have you checked http://stackoverflow.com/questions/16633134/how-to-convert-emgu-cv-imagegray-byte-to-system-image and http://stackoverflow.com/questions/16241004/how-to-convert-bitmap-to-imagebgr-byte? – Eugene Podskal Oct 26 '14 at 15:47
  • Thank you , much appreciated - I have not checked those. Looks exactly what I need. – Lismore Oct 26 '14 at 16:09
  • In such a case there is a good advice in [How-To-Ask](http://stackoverflow.com/help/how-to-ask) - "[Search](http://stackoverflow.com/search), and research ...". Because otherwise, if the question can be answered with first hit in google by keywords, a post can get a lot of downvotes and face [closure as duplicate](http://stackoverflow.com/help/duplicates). – Eugene Podskal Oct 26 '14 at 16:16
  • thanks for the advice & heads up in future – Lismore Oct 26 '14 at 17:24

1 Answers1

3

This was the solution I ended up going with

public Emgu.CV.Image<Bgr, Byte> imageToEmguImage(System.Drawing.Image imageIn)
{
    Bitmap bmpImage = new Bitmap(imageIn);
    Emgu.CV.Image<Bgr, Byte> imageOut = new Emgu.CV.Image<Bgr, Byte>(bmpImage);

    return imageOut;
}
Lismore
  • 259
  • 2
  • 11