An Example Of Laser Range Control - Matrox GatorEye Series Installation And Technical Reference

Table of Contents

Advertisement

Laser range control example
// This example shows how to use the laser ranging module of your Matrox GatorEye
// industrial camera.
#include <windows.h>
#include <mil.h>
//#define USE_INTENSITY
#define BUFFERING_SIZE_MAX 4
const MIL_INT NbLaserLines = 10;
const MIL_INT ExtractionFixedPoint = 5;
const MIL_INT LocatePeakMinIntensity = 100;
const MIL_INT LocatePeakWidth = 10;
const MIL_INT LocatePeakMissingDataValue = 0xFFFF;
// MdigProcess() callback function used to process each frame of data sent by the camera.
MIL_INT MFTYPE GrabCallbackFn(MIL_INT HookType, MIL_ID HookId, void MPTYPE *UHookDataPtr);
// MdigProcess() callback function data structure.
typedef struct
{
MIL_ID Disp_MilImageBuf;
MIL_ID PosAndI_MILImageBuf; // Image buffer for copy of raw data from the camera.
MIL_ID Pos_MilImageBuf;
MIL_ID I_MilImageBuf;
} HookDataStruct;
int MosMain(void)
{
MIL_ID MilGrabBufList[BUFFERING_SIZE_MAX] = { 0 }; // Array of image buffers used
HookDataStruct HookData = { 0 };
// Allocate MIL objects: application, system, display and digitizer.
MIL_ID MilApplication = MappAlloc(M_DEFAULT, M_NULL);
MIL_ID MilSystem
MIL_ID MilDisplay
MIL_ID MilDigitizer
// Ensure that image buffers are allocated with a pitch equal to the specified X-size
MsysControl(MilSystem, M_ALLOCATION_OVERSCAN, M_DISABLE);

An example of laser range control

The following example shows how to use the LocatePeak... features of your Matrox
GatorEye using MIL.
// Uncomment if you want intensity values too.
// # of buffers used to perform multiple buffering so
// frames of data sent by the camera are not lost.
// Image buffer to display found the laser line.
// Buffer containing position values (16-bit) of raw data.
// Buffer containing intensity values of raw data.
= MsysAlloc(M_SYSTEM_DEFAULT, M_DEFAULT, M_DEFAULT, M_NULL);
= MdispAlloc(MilSystem, M_DEFAULT, MIL_TEXT("M_DEFAULT"),
M_WINDOWED, M_NULL);
= MdigAlloc(MilSystem, M_DEFAULT, MIL_TEXT("M_DEFAULT"),
M_DEFAULT, M_NULL);
Configuring your laser range control
// to receive data from camera
33

Advertisement

Table of Contents
loading

Table of Contents