LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use ImaqScale() function after grabing image

Actually, I am building the imaging system with Labwindow/CVI. 
 
The Hamamatsu camera and Imaq frame grabber is used.  I grabed image using a image grab exmpale in IMAQ sample.
However, the image size is too large to fit canvas.
 
Because of that, I want to zoom out the image.
 
So, I found the function, ImagScale() to scale the image.  I don't know how to use the function.
 
After grabing ,  the data type of the image is array.
But, in the function, Image data type is required. Therefore, I think that I need to manipulate the image array before using the ImaqScale() function.
 
I don't know that. Do you have any idea about that. 
 
Please, give a tip or example..
 
Thanks
 
0 Kudos
Message 1 of 5
(4,374 Views)
Good morning Jay,
 
The ImaqScale() function operates on the image datatype.  Therefore, you will have to use the imaqArrayToImage function to convert your array of pixels into an image.  Then, this function either enlarges the image by duplicating pixel values or shrinks it by subsampling the pixels.  The enlarging or shrinking is based on the input parameters xscale and yscale.  It then puts the new image into the variable input called dest.  For a more sophisticated type of scaling, you will need to use the ImaqResample(). 
 
I hope that this information is helpful.  If you need more detailed information, please post back and I will do my best to answer!
 
Respectfully,
Message 2 of 5
(4,362 Views)

Thanks your reply.

I already tried to that before I posted my question.

First of all, I declare variable like below,  and then, I used the function imaqArrayToImage(). But, there is error message at the red sentence, not an image.

How to correct that.

static Image *tempimage;
static Image *tempimage2;

  

   imgGrab (Sid, (void **)&ImaqBuffer2, TRUE);
   imaqArrayToImage (tempimage, ImaqBuffer2,AcqWinWidth ,  AcqWinHeight);

   imaqScale (tempimage2, tempimage, 2, 2, IMAQ_SCALE_SMALLER,
   IMAQ_NO_RECT);

    imaqImageToArray (tempimage2, IMAQ_NO_RECT, NULL, NULL);
    imgPlot (CVIWndHndl, tempimage2, 0, 0, AcqWinWidth, AcqWinHeight,
          CanvasLeft, CanvasTop, plotFlag);
   

0 Kudos
Message 3 of 5
(4,351 Views)
Jay,
 
Creating images in CVI is a little different than creating other datatypes.  You can't "declare" an image like a typical variable.  There are specific function calls to create images in CVI.  Here is a link to an example:
 
 
This example goes the opposite way of your direction.  That is, it takes an image and converts it to an array.  However, it will be a great starting point for the structure of image programming in CVI.  Please take a look at this code and then post back if you are having further issues.
 
Respectfully,
0 Kudos
Message 4 of 5
(4,322 Views)

Hi!

I wanted to get more details about how to use imaqResample() with regards to the problem below:

I have a camera that streams images of resolution 640x480. I wanted to know if there is a way of scaling down the image to 320x240. How do I use this function or another to do this.

Thank you so much.

0 Kudos
Message 5 of 5
(3,889 Views)