Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

converting canvas to an IMAQ Image in CVI

Hi,
I am generating a Canvas image and I would like to use Imaq Vision functions on the image. How can I pass the image from the canvas to an object of type Image?
I need to use the canvas images as color planes to generate an RGB color image.
Thanks,
JHH
0 Kudos
Message 1 of 2
(2,830 Views)
JHH-

There are two steps:

1) Convert the canvas to an array using CanvasGetPixels, and
2) Convert the array to an image using imaqArrayToImage

Here is some example code for a canvas that is 320x425:

TestImage = imaqCreateImage (IMAQ_IMAGE_RGB, 3);
CanvasGetPixels (panel, PANEL_CANVAS, MakeRect (0, 0, 320, 425), Data);
imaqArrayToImage (TestImage, Data, 425, 320);
imaqDisplayImage (TestImage, 0, TRUE);

Hope this helps-

Dustin W.
Message 2 of 2
(2,830 Views)