Matrox GatorEye Series Installation And Technical Reference page 34

Table of Contents

Advertisement

34 Chapter 3: Matrox GatorEye User Guide
Laser range control example (Continued)
// Inquire frame size of the camera.
MIL_INT SizeX, SizeY = 0;
SizeX = MdigInquire(MilDigitizer, M_SIZE_X+M_MAX, M_NULL);
SizeY = MdigInquire(MilDigitizer, M_SIZE_Y+M_MAX, M_NULL);
// Allocate all image buffers to perform multiple buffering using MdigProcess().
// Restriction: These image buffers must have the same Y-size as the CCD image,
// although # rows containing data is established by # laser line images.
for(MIL_INT ii = 0; ii < BUFFERING_SIZE_MAX; ii++)
{
MbufAlloc2d(MilSystem, SizeX, SizeY, 8+M_UNSIGNED,M_IMAGE+M_GRAB, &MilGrabBufList[ii]);
MbufClear(MilGrabBufList[ii], M_NULL);
}
// Allocate a display image buffer and select it to display.
HookData.Disp_MilImageBuf = MbufAlloc2d(MilSystem, SizeX, SizeY, 8+M_UNSIGNED,
M_IMAGE+M_PROC+M_DISP+M_GRAB, M_NULL);
MbufClear(HookData.Disp_MilImageBuf, 0.0);
MdispSelect(MilDisplay, HookData.Disp_MilImageBuf);
#ifndef USE_INTENSITY
// Create an image that contains the 16-bit position values. Use MbufCreate2d()
// to create a region over the "grabbed" image, so that another copy is not required.
MIL_UINT8* RawDataMemory;
HookData.PosAndI_MILImageBuf = MbufAlloc2d(MilSystem, SizeX, 2*NbLaserLines,
8+M_UNSIGNED, M_IMAGE+M_GRAB, M_NULL);
MbufInquire(HookData.PosAndI_MILImageBuf, M_HOST_ADDRESS, &RawDataMemory);
HookData.Pos_MilImageBuf = MbufCreate2d(MilSystem, SizeX, NbLaserLines, 16+M_UNSIGNED,
M_IMAGE+M_PROC, M_HOST_ADDRESS+M_PITCH_BYTE, 2*SizeX, RawDataMemory, M_NULL);
HookData.I_MilImageBuf = M_NULL;
#else
// Create two images: one that contains the 16-bit position values, and
// another that contains the 8-bit intensity values. Use MbufCreate2d() to
// create two regions over the "grabbed" image, so that two copies are not required.
MIL_UINT8* RawDataMemory;
HookData.PosAndI_MILImageBuf = MbufAlloc2d(MilSystem, SizeX, 3*NbLaserLines,
8+M_UNSIGNED, M_IMAGE+M_GRAB, M_NULL);
MbufInquire(HookData.PosAndI_MILImageBuf, M_HOST_ADDRESS, &RawDataMemory);
HookData.Pos_MilImageBuf = MbufCreate2d(MilSystem, SizeX, NbLaserLines, 16+M_UNSIGNED,
M_IMAGE+M_PROC, M_HOST_ADDRESS+M_PITCH_BYTE, 3*SizeX, RawDataMemory, M_NULL);
HookData.I_MilImageBuf = MbufCreate2d(MilSystem, SizeX, NbLaserLines, 8+M_UNSIGNED,
M_IMAGE+M_PROC, M_HOST_ADDRESS+M_PITCH_BYTE, 3*SizeX, RawDataMemory+2*SizeX, M_NULL);
#endif
// Set up options. (Extraction fixed point format must match between camera
// and image processing draw operation.)
MdigControlFeature(MilDigitizer, M_DEFAULT, MIL_TEXT("LocatePeakMethod"),
MdigControlFeature(MilDigitizer, M_DEFAULT, MIL_TEXT("LocatePeakFixedPointPosition"),
M_TYPE_STRING_ENUMERATION , MIL_TEXT("CenterOfGravity"));
M_TYPE_MIL_INT32 , &ExtractionFixedPoint);

Advertisement

Table of Contents
loading

Table of Contents