Click or drag to resize

IMcRegionAccessGetArea Method

Read a block of pixel values from the image.

Namespace:  MediaCy.IQL.Engine
Assembly:  MediaCy.IQL.Engine (in MediaCy.IQL.Engine.dll) Version: 10.0.6912.0
Syntax
VB
Function GetArea ( 
	<OutAttribute> ByRef pvArea As Object,
	Optional lLeft As Integer = -1,
	Optional lTop As Integer = -1,
	Optional lRight As Integer = -1,
	Optional lBottom As Integer = -1
) As Integer

Parameters

pvArea
Type: SystemObject
VARIANT* : A pointer to a VARIANT receiving the pixel values. If the VARIANT is empty, the function will return one containing a two-dimensional SAFEARRAY (for one channel per pixel) or a three-dimensional SAFEARRAY (for multiple channels per pixel). If a 2-D array is created, it will be shaped as vLine(0 to lWidth-1, 0 to lHeight-1) for VB arrays and as vLine[lHeight][lWidth] for C/C++/Java arrays. If a 2-D array is created, it will be shaped as vLine(0 to nChannels-1, 0 to lWidth-1, 0 to lHeight-1) for VB arrays and as vLine[lHeight][lWidth][nChannels] for C/C++/Java arrays. The number of values contained in the SAFEARRAY is equal to the area of the McRegionAccess times the number of channels in the McRegionAccess. For color McRegionAccess red, green, and blue values are interlaced. The type of values in the SAFEARRAY and the number of channels returned is determined by the type and channel arguments of the call to IMcImage.CreateRegionAccess.
lLeft (Optional)
Type: SystemInt32
long : Optional. Left side of the block. Must be between 0 and Right. The default value of -1 is the same as 0.
lTop (Optional)
Type: SystemInt32
long : Optional. Top side of the area. Must be between 0 and Bottom. The default value of -1 is the same as 0.
lRight (Optional)
Type: SystemInt32
long : Optional. Right side of the area. Must be between 0 and Right. The default value of -1 is the same as Right.
lBottom (Optional)
Type: SystemInt32
long : Optional. Bottom side of the area. Must be between 0 and Bottom. The default value of -1 is the same as Bottom.

Return Value

Type: Int32
Remarks
The coordinates are relative to the McRegionAccess ROI, not the image. The pixel values returned are in the requested color model, which may differ from the image's native color model. When the routine itself creates the array it is typed after the image type, which guarantees that the pixel values will fit into the array. If pvArea already contains an array it must be of the right data type and size. For languages that do not support the unsigned integer type (like Visual Basic or VBA), 16 bits values bigger than 32767 will be reported as negative because their sign bit is set. The best way to work around this limitation is to use a "long" McRegionAccess, which will then return long positive values (4 bytes) instead of unsigned integers (2 bytes). If this McRegionAccess instance is created with the McImage.CreateRegionAccessEx with the mcRegionAccessMode.mcramUnsignedGetFlag set in the AccessMode parameter, then the default return type for 12, 16 and 32 bit integral pixel types will be an unsigned integral type; if this flag is not set, then these types are signed for back-compatibility with VB6 as discussed above.
Note Note
Avoid using GetArea followed by PutArea to copy large image frames. This causes the entire image frame being copied to need to reside in memory. Instead use the CopyInEntireArea method. Or set up your own per line loop and use GetLine followed by PutLine (you will need to call BeginEndUpdateBlock(TRUE/FALSE) around such a loop to avoid excessive image updating).
See Also