user arrays and VARIANT *

G

gilnux

Hi all

I've got nearly 2 years experience programming in C and image
processing. Now I have to migrate one of my applications to a MFC
interface. I am having problems with the VARIANT variable. Let's see.

I have been using Matrox Imaging Lybrary (MIL). With this library, I
can load an image and pass this image into a C array using the function
MbufGet() and perform all my calculations using C.

If my image is 256 pixels wide and 192 pixels high, I need to create a
two dimensions array. If my image is 8 bits depth, I have to use an 8
bits variable, that is, I use unsigned char.

So I declare my array:

unsigned char myArray[192][256]

and I have my image loaded: myImageBuffer

So I use the function

MbufGet(myImageBuffer, myArray)

and just it, the value of each pixel is transferred to each element of
myArray.

Now I have to do exactly the same in my MFC interface. I have to use
now ActiveMIL instead of MIL. Now my imageBuffer is an object of the
class CImage1 with a method Get().

So I load my image from a file:

imageBuffer.Load("myfile.tif");

and when I use the Get() method, like:

imageBuffer.Get(myArray, ...)

I get errors like:

CImage1::Get : cannot convert parameter 1 from 'unsigned char
[192][256]' to 'VARIANT *'

I check the declaration of the Get() method and it looks like:

void Get(VARIANT * UserArray, ...

I have spent several days trying to get information about VARIANT but I
haven't got any clue, I still don't know how to transfer my image
from a buffer to an array.

Any hint? Any help of suggestion is welcomed.

Many thanks
 
M

mlimber

gilnux said:
I've got nearly 2 years experience programming in C and image
processing. Now I have to migrate one of my applications to a MFC
interface. I am having problems with the VARIANT variable. Let's see. [snip]
Now I have to do exactly the same in my MFC interface. I have to use
now ActiveMIL instead of MIL. Now my imageBuffer is an object of the
class CImage1 with a method Get().

So I load my image from a file:

imageBuffer.Load("myfile.tif");

and when I use the Get() method, like:

imageBuffer.Get(myArray, ...)

I get errors like:

CImage1::Get : cannot convert parameter 1 from 'unsigned char
[192][256]' to 'VARIANT *'

I check the declaration of the Get() method and it looks like:

void Get(VARIANT * UserArray, ...

I have spent several days trying to get information about VARIANT but I
haven't got any clue, I still don't know how to transfer my image
from a buffer to an array.

Any hint? Any help of suggestion is welcomed.

Variants are a common need (Boost has one, too, for instance), but
specific third-party implementations like this are off-topic here. Try
in a Microsoft-specific group. A description of what is on-topic here
and a list of some other groups you might consider can be found here:

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9

Cheers! --M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top