Jump to content
OMRON Forums

Code example - C# - how to read images from Microhawk MV via Cloudlink API

Recommended Posts

Below are step by step instructions on what should be done on the client side:

1. Open a new project in VisualStudio and verify that the following references are added to the project:

    using System.Net;

    using System.Web.Script.Serialization;

2. The next step is to build the url for the web request, using image service from the Cloudlink API and the IP address of the camera.
    string imageUrl = "";

3. Now we will create the web request object using the url we defined above. The request will be sent to the server.
        var request = WebRequest.Create(imageUrl);

4. In the following step we use WebResponse object for receiving the reply from the server and feed it to a stream object to hold the data:
    var response = request.GetResponse();
5. Then get the image data into a stream:
    var stream = response.GetResponseStream();
6. The final stage is to show the image data in a PictureBox control on our WinForm. Add a PictureBox control to your Form, then do the following in order to display the image in the PictureBox control:
        pictureBox1.Image = Bitmap.FromStream(stream, true, true);

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...