| |
 |
|
|
Science Forum Index » Image Processing Forum » user arrays and VARIANT *
Page 1 of 1
|
| Author |
Message |
| gilnux |
Posted: Thu Nov 30, 2006 12:27 pm |
|
|
|
Guest
|
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 |
|
|
| Back to top |
|
| aruzinsky |
Posted: Thu Nov 30, 2006 1:21 pm |
|
|
|
Guest
|
|
| Back to top |
|
| Matrox Imaging |
Posted: Fri Dec 01, 2006 3:32 pm |
|
|
|
Guest
|
Hello gilnux,
The problem is probably because wrapper classes (for ActiveMIL
controls) are not supported as of ActiveMIL 7.5. In this case you will
want to use NativeCOM to develop with ActiveMIL. The ActiveMIL
documentation offers an entire chapter "Using ActiveMIL with Microsoft
Visual C++ (Native COM)", which explains how to use ActiveMIL with
NativeCOM and also explains how to use data types such as VARIANTs,
BSTRs and SAFEARRAYS with ActiveMIL. Furthermore, using ActiveMIL with
NativeCOM also has the benefit of taking advantage of ActiveMIL's dual
interfaces, which will lead to an improved program performance over
wrapper classes.
Please note that you can also post any questions or comments about
Matrox Imaging products on the Matrox Imaging Developers' Forum.
Technical Marketing,
Matrox Imaging
gilnux wrote:
Quote: 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 |
|
|
| Back to top |
|
| |
|
Page 1 of 1
All times are GMT - 5 Hours
The time now is Mon Oct 06, 2008 5:15 pm
|
|