Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How do i electronically zoom using the PCI-1422 framegrabber IMAQ and the libraries?

I am using a couple of KAC1310 kodak imaging sensors. I wish to scale the displayed image up and down. This can be done using the measurement software provided with the framegrabbers, but i wish to do this in a visual studio app. I can zoom in and out without the I2C begining connected to the camera.

Crispen
Message 1 of 15
(4,757 Views)
Hi Crispen,

Thanks for using our Discussion Forums. If you are using the Vision Development Module for image processing, we offer a function you may find useful. I am pasting the usage and description from the help file (for C programming). This might be along the lines of what you are looking for. You may also try manipulating an algorithm of sorts where you alter the region of interest of your image and appropriately scale the size of your display window correspondingly.

Regards

Dan
National Instruments



*************************************
imaqZoomWindow
Usage
int = imaqZoomWindow(int windowNumber, int xZoom, int yZoom, Point center)

Purpose
Sets the current zoom factors for a given image window. The zoom factor indicates an increase or decrease in the magnification of an image. A positive number indicates a magnification by the amount specified. For example, a zoom factor of 3 indicates that the image is displayed at three times its actual size (3:1). A negative number indicates that the image is decreased in magnification by the specified amount. For example, a zoom factor of -5 indicates that the image is displayed at one-fifth its actual size (1:5).

Parameters
Name Type Description
windowNumber int The window number of the image window.
xZoom int The zoom factor for the x direction. Set xZoom to zero to maintain the current zoom factor for the x direction.
yZoom int The zoom factor for the y direction. Set yZoom to zero to maintain the current zoom factor for the y direction.
center Point The center point around which to zoom. Set this parameter to IMAQ_NO_POINT to maintain the current center point.

Return Value
int—On success, this function returns a non-zero value. On failure, this function returns 0. To get extended error information, call imaqGetLastError().
****************************************
0 Kudos
Message 2 of 15
(4,743 Views)
I am not using the vision development module, sorry, the driver i have for the frame grabber is NI-IMAQ 2.5.1, this did not come with labview, just a set of C++ libraries and i cannot find the function you are suggesting in the NI-IMAQ function Reference Manual Nov 2000 Ed, Part Number 370161A-01, what should i do?

Crispen
0 Kudos
Message 3 of 15
(4,731 Views)
Crispen,

You should be able to use the imgSessionConfigureROI function to set a region of interest on which you want to zoom in. YOu can then appropriately resize your display to fit the zooming.

Regards

Dan
National Instruments
0 Kudos
Message 4 of 15
(4,723 Views)
Hey guys i really appreciate all the help but i do not have access to the function imgSessionConfigureROI it just does not appear in the reference manual and the compilier does not even recoginise it. But does
"imgSetAttribute(Sid,IMG_SCALE_DIV2,6)" or some variant thereof, because the one i have does not work either.

Thanks for all your help

Crispen
0 Kudos
Message 5 of 15
(4,711 Views)
Crispen,

Sorry to hear you keep having trouble with this. What version of NI-IMAQ do you have installed? I just checked the function reference help again and imgSessionConfigureROI is certainly an option in there that you should have available as well. Here are the details on the function- I have also attached the Function Reference Help file

************************************
rval = imgSessionConfigureROI(SESSION_ID sid, uInt32 top, uInt32 left, uInt32 height, uInt32 width);

Purpose
Sets the acquisition region of interest (ROI). This function modifies the following attributes:

IMG_ATTR_ROI_TOP
IMG_ATTR_ROI_LEFT
IMG_ATTR_ROI_HEIGHT
IMG_ATTR_ROI_WIDTH

To use imgSessionConfigureROI, the ROI you set must be properly aligned. Use imgSessionFitROI function to ensure that the ROI is properly aligned.

Parameters
Name Type Direction
sid SESSION_ID input
top uInt32 input
left uInt32 input
height uInt32 input
width uInt32 input
rval Int32 output

Parameter Discussion
sid: valid SESSION_ID.

top: top offset of the first pixel to acquire.

left: left offset of the first pixel to acquire.

height: height of the area to acquire.

width: width of the area to acquire.

Return Value
This function returns 0 on success. On failure, this function returns an error code. For information about the error code, call imgShowError.
**************************
0 Kudos
Message 6 of 15
(4,691 Views)
Thank for begin so patient, but i do not have that function. I have the "imgSessionSetROI", but that just grabs a specified region of the overall image, and does not zoom it up or down. I know the camera is capable of it since i can perform this function in the Measurement and automation program version 2.0.3.6. The NI-IMAQ software is version 2.5.1 that runs the framegrabbers, and i will include a pdf of the reference manual i use with the framegrabber so you can see what i have to work with.

You chaps are doing well

Crispen
0 Kudos
Message 7 of 15
(4,684 Views)
Crispen,

Once you have now selected just that region of interest, all you should need to do is resize the display on your front panel and be essentially "zoomed in".

Dan
National Instruments
0 Kudos
Message 8 of 15
(4,673 Views)
Thank you for your reply, but i think we are talking of about two different things, i mean zoom in/out and have the image scale itself to suit. Because i have a 1024x1230 camera i cannot see it all at once. Hence i wish to zoom out and see all of the view in a smaller window.

Sorry about confusion

Crispen
0 Kudos
Message 9 of 15
(4,670 Views)
Crispen,

Thank you for clarifying what it was that you're trying to accomplish. Unfortunately, this isn't a feature that is native to IMAQ for the C++ environment. I actually played with this in C++ this afternoon and these would be our options:

1. You could simply view parts of the image at a given time by manipulating the parameters in the imgPlot function
2. You could develop in LabVIEW instead, where we offer a native zoom tool to the image display allowing you to zoom in and out with the click of a mouse
3. You could use the Vision Development Module which includes Zooming Functions.

The IMAQ driver is really geared toward simply acquiring the images, whereas the Vision Development module is for processing.

Hopefully one of these options will work for you!

Dan
National Instruments
0 Kudos
Message 10 of 15
(4,661 Views)