10-27-2008 01:39 AM
Hi,
I'm using LabwindowsCVI8.5 & NI Vision. Recently, I met a problem that when I tried to apply a toolwindow on the image diaplayed by picture box or canvas, the toolwindow successfully showed but couldn't work. I knew that I can use imaqCreateImage & imaqDisplayImage functions to create the image on a new separated window, and then, both the toolwindow & imaqBCGTransform work well, but I just wanna know is there any way to use the Image processing functions with the image displaying as a part of the UIR or as a sub-panel? Coz I think it will be much conventional to see the image being processed that way.
Thanks a lot!
Kitty, eng.
URT
Solved! Go to Solution.
10-27-2008 07:56 AM
i always wondered why there is no control to put into an UIR for displaying an image from NI Vision...
anyway, there is a clever hack to embed an image display window of NI Vision into a panel. it has already been discussed on this forum but i can't find the link anymore.
it goes something like this:
HWND window_handle, parent_handle;
int image_window;
int left, top, width, height;
// initialize CVIRTE, etc.
// create the parent panel
panel = LoadPanel( ... );
// get a new display window handle (optional, see the documentation for imaqGetWindowHandle)
imaqGetWindowHandle( &image_window );
// integrate into a parent panel
window_handle = (HWND)imaqGetSystemWindowHandle( image_window );
GetPanelAttribute( panel, ATTR_SYSTEM_WINDOW_HANDLE, (int *)&parent_handle );
SetWindowLong( window_handle, GWL_STYLE, WS_CHILDWINDOW );
SetParent( window_handle, parent_handle);
SetWindowLong( window_handle, GWL_STYLE, WS_CLIPSIBLINGS );
// position the display where it should be displayed and resize it
imaqSetWindowSize( image_window, width, height );
imaqMoveWindow( image_window, MakePoint( left, top) );
i hope this helps...
10-28-2008 04:13 AM
Thanks a lot~!!!!!!!!
That's really a good way to solve the problem~!!!
10-29-2008 05:15 AM
no it is not a good way. it is still a hack and will definitely be a hack until NI comes with a better solution.
this problems appears regularly into the "Machine vision" forum as well as this forum and has never found a solution better than this hack. it has a lot of drawbacks, the most important one being the inability to embed an image into a child panel...
it may be the time for NI to think about implementing a better solution for CVI users...
03-08-2009 11:10 AM
03-09-2009 09:25 AM
10-22-2009 09:32 PM
Hi, dummy_decoy~Are you still working in this field? Could you please tell me that did NI have any development in their new edition on this question after almost one year? Thanks a lot & best wishes~!
10-23-2009 01:58 AM
i did not see many changes in CVI 9.0: there is still no image control to put on an UIR.
however, there has been a big step forward in NI Vision 8.6.4: now, when you apply a transform on an image (scale, rotate, etc...) you can apply the transform on the overlay too. so now, there is nothing preventing us from coding our own image control, although this might be quite a lot of work.