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
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