Thread Subject: read image from c# object, not from file

Subject: read image from c# object, not from file

From: Chang shen

Date: 7 Jan, 2009 17:18:02

Message: 1 of 1

If I have an object of bitmap image in C#. How can I read it into Matlab?

The purpose: I want to build a C# Dll to include many Matlab functions so C# program can use it. Then I need to pass the image data to this Dll. One of the data is image, say in Bitmap format. I want this Dll to be able to directly read Bitmap object.

Usually in DLL, I can have a Matlab m file to read in an image from a file
filename = 'c:\1.bmp';
img = imread( filename);
...
Then, in C#, I need first save the bitmap into a file, and let the Dll to read it. Then save it as another file and let C# code to read in. That is not efficient.

What I want to do is like this: (Suppose I have a Matlab Dll called MatlabDll and a method "ProcessIt" in it.) And I referenced it in the C# project.


....
string filename = @"c:\1.bmp";
Bitmap img = new Bitmap(filename);

//First, do a lot of data processing in C#
//.....
//Then pass the Bitmap image object to MatlabDll for Matlab processing and return a //Bitmap object back to C#

Bitmap newimg = MatlabDll.ProcessIt(img);

How can I do this?

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
read bitmap obj... C Shen 7 Jan, 2009 12:20:05
rssFeed for this Thread

Contact us at files@mathworks.com