<< Click to Display Table of Contents >> Navigation: Image Manager > CVB Technology > Acquisition device drivers and CVB Programming Interfaces > IImageRect Interface |
IImageRect Interface description : image resolution changes
Some cameras or other devices allow the user to read out a reduced size image or parts of an image, so this interface can be used to change the resolution of the image or to inform the driver for resolution changes made previously in the hardware.
For cameras allowing to read out a reduced size or parts of the image this can be used with the IImageRect Interface.
The settings can be adjusted with the
•ImageOffset and the ImageSize method of the CV Grabber Control or the
•corresponding functions of the IImageRect Interface of the CVB Driver Library.
With GenICam compliant cameras settings as resolution, pixel format and - if supported - binning or partial scan, can be changed in the camera directly.
This can be done either with a control tool or the node map interface.
If one of these settings is changed, the image object has to be updated.
You can restart the application or inform the driver about the changed resolution or pixel size.
This is necessary as the underlying image object holds preinitialised buffers where the image stream from the camera is written to.
When the size of the image changes the underlying image object need to be informed and the buffers need to be reinitialized.
To do that you need to:
•Change the setting in the camera (PixelType, image size, binning etc.) as described in the Camera Manual.
•Call the IRImageSize function of the IImageRect with the IMAGERECT_CMD_RESET parameter.
•This function will return a new image handle.
•Pass this new handle to all components which reference the original image handle.
•The original image handle does not hold a reference to the driver object anymore.
Normally this image is not needed anymore and should be released with the ReleaseObject function.
C# Example Code:
SharedImg imgNew; int width = 0; int height = 0; int bResult = Cvb.Driver.IImageRect.IRImageSize (m_cvImage.Image, Cvb.Driver.IImageRect.TImageRectCMD.IMAGERECT_CMD_RESET, ref width, ref height, out imgNew);
if (bResult >= 0 && imgNew != 0) { // Put new Image into Image and Display Control m_cvImage.Image = imgNew; m_cvDisplay.Image = m_cvImage.Image; m_cvDisplay.Refresh();
// imgNew Object is not needed anymore as it is available in the Image OCX // dispose it here. imgNew.Dispose();
// Update NodeMap and GenApiGrid this.ReadGenICamInfos(); // Register all Callbacks this.RegisterCallbacks(); } |
For testing, please use the Common Vision Blox Viewer or CVB Image Manager Tutorials VCPureDLL/VCDriverMDI example or VB Grabber OCX.