Efficient way to pass a .jpg in c# program to compiled function

  • Follow


Hi I am hoping that someone would have some ideas for a 
more efficient way of solving the problem I currently have.

I am running a C# program that calls a Matlab compiled 
function, this function needs an image as input and 
currently I am taking the input .jpg within the C#, 
converting into a bitmap, saving off the r,g,b components 
as separate double arrays, then converting these into 
mxDoubleMatrix, passing all three into the function and 
then constructing back into an image within the Matlab 
function. 

This is obviously a very time consuming process and I would 
be very grateful to anyone who could think of a better way 
of just passing the .jpg directly or pointing me in better 
direction.

Many thanks in advance for your help,

J Hill

0
Reply jameshill1000 (3) 7/1/2008 10:47:03 AM

In article <g4d1v7$97s$1@fred.mathworks.com>,
James Hill <jameshill1000@hotmail.co.uk> wrote:
>Hi I am hoping that someone would have some ideas for a 
>more efficient way of solving the problem I currently have.

>I am running a C# program that calls a Matlab compiled 
>function, this function needs an image as input and 
>currently I am taking the input .jpg within the C#, 
>converting into a bitmap, saving off the r,g,b components 
>as separate double arrays, then converting these into 
>mxDoubleMatrix, passing all three into the function and 
>then constructing back into an image within the Matlab 
>function. 

>This is obviously a very time consuming process and I would 
>be very grateful to anyone who could think of a better way 
>of just passing the .jpg directly or pointing me in better 
>direction.

You could potentially reprogram the matlab function so that
if it detected a character string in that location, it did
an imread() on the string as a file name to load the image itself.

Otherwise, instead of saving the r, g, b components into
separate double arrays, put them all together into a single array,
red plane then green plane then blue plane. That's all that
a truecolor "image" is to Matlab, an N x M x 3 array of double,
so there would be no need of "constructing back into an image"
within the Matlab function.
-- 
  "The Romans believed that every man had his Genius, and every
   woman her Juno."                              -- Thomas Bulfinch
0
Reply roberson2 (8067) 7/1/2008 10:54:58 AM


1 Replies
97 Views

(page loaded in 0.058 seconds)

Similiar Articles:













7/18/2012 5:25:52 PM


Reply: