Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

The image is not large enough for the operation.

hi all,
im currently developing a simple application that captures image, and perform some color matching on it..
i grouped all my grab codes into a function called grab(),coz i need to call it a few times throughout the program.
after calling the grab() function, i attempt to use the image(myImage) and perform color matching from another function.however,im getting this error:
 
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information:
The image is not large enough for the operation.
 
at:
CWIMAQVision1.LearnColor(myImage, ColInfo, ViewRect)
 
wer myImage is the image from grab(), ColInfo is the color info, and ViewRect is the region.when i debug,i can see that there is no image height and width.so i suspect that the image is not passed to the LearnColor correctly.but myImage is a global variable,so i dont understand y the function cant access it..i've even tried pasting all the grab codesin the same function as LearnColor,but i am still getting the same error..Smiley Sad
if possible,i want the grab function to be called from any function in the program,and subsequently use the image in it.this is because i would like my program to start from one function call,and all subsequent process will be called from there.
 
i have also posted this question in Measurement Studio for VB...so for those who are reading this for the second time,im sorry..Smiley Wink
 
thank you..
0 Kudos
Message 1 of 4
(5,034 Views)
hi,
i have pin pointed where the problem lies.
 
there seems to be a delay in storing the image in the myImage variable..i found this by inserting some textboxes that display the image height in certain locations.
i noticed that before and after the grab() function,the height is still 0,which means the image is not in the variable yet.
but just before i use it in the learn function(which is right after the grab),it gives me 600.so my guess is the image is taking a few seconds to be stored after the grab..Smiley Surprised
 
and another thing,the program worked perfectly with all those text boxes popping out..but when i remove them,i get the same error again..i guess thats because by waiting for me to click on the OK,there is some delay,so it evens out..without that,the program reaches the learn color too fast,without giving time for the image to be stored properly..Smiley Sad
 
if i put the grab codes in the load event of the form,evrything works fine..so i guess thats one way to solve it..but if someone can help me to do it without it,that would be great..
this is because i want the grab to be initiated by the user,instead of automatically doing it when the form loads..
 
thanks..
0 Kudos
Message 2 of 4
(5,019 Views)
Hi rebecs,

It appears that this is being discussed in another thread.  For future reference, we would like to limit each issue to one post.  

Regards,

Vu
0 Kudos
Message 3 of 4
(5,011 Views)
hi vu,
 
oopps...sorry for the multiple posts..i will stick to one thread from now on..
thanks..
 
rebecca
0 Kudos
Message 4 of 4
(5,004 Views)