application note...an028 3d system setup, 08/2008 v1.0 3.2.2 hardware diagnosis after you have...

37
Photonfocus AG APPLICATION NOTE AN028 Topic: 3D system configuration using the MV-D1024E-3D01 camera and a Silicon Software – microEnable IV frame grabber Summary: This application note explains how to install the required hard- and software in order to obtain your first 3D range map from your MV-D1024E-3D01 camera.

Upload: others

Post on 28-Sep-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

Photonfocus AG

APPLICATION NOTE

AN028 Topic:

3D system configuration using the MV-D1024E-3D01 camera and a Silicon Software – microEnable IV frame grabber

Summary:

This application note explains how to install the required hard- and

software in order to obtain your first 3D range map from your

MV-D1024E-3D01 camera.

Page 2: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

CONTENT

1 INTRODUCTION............................................................................. 3

2 REQUIREMENTS ............................................................................ 3

2.1 System Requirements .........................................................................3 2.2 Software .............................................................................................3 2.3 Hardware............................................................................................3

3 INSTALLATION.............................................................................. 4

3.1 Frame Grabber Installation.................................................................4 3.2 Silicon Software microDisplay IV Installation.....................................4 3.2.1 Setup microDisplay IV ........................................................................ 4 3.2.2 Hardware Diagnosis............................................................................ 6 3.3 PFRemote Installation ........................................................................7 3.3.1 PFRemote Overview............................................................................ 7 3.3.2 PFRemote Port Browser...................................................................... 7 3.3.3 PFRemote Configuration Dialog .......................................................... 8 3.4 PF 3D Suite Installation ......................................................................9 3.4.1 PF 3D Suite Overview ......................................................................... 9 3.4.2 Structure of the Installation Directory................................................ 9 3.4.3 PF 3D Suite User Interface................................................................ 11 3.5 Additional Tools ................................................................................12 3.5.1 Range Map Viewer ............................................................................ 12

4 SYSTEM CONFIGURATION ........................................................... 13

4.1 3D Laser Triangulation......................................................................13 4.2 Frame Grabber Configuration............................................................14 4.2.1 The Windows in microDisplayMe4..................................................... 15 4.2.2 Parameter Table ............................................................................... 16 4.2.3 Save Frame Grabber Configuration ................................................... 17 4.3 Camera Configuration .......................................................................17 4.3.1 Camera Check ................................................................................... 17 4.3.2 Start PFRemote................................................................................. 17 4.3.3 Setup - 3D01..................................................................................... 18 4.3.4 Setup - Trigger.................................................................................. 19 4.3.5 Setup - Window ................................................................................ 19 4.3.6 Setup - Exposure .............................................................................. 20

5 SYSTEM CHECK............................................................................ 21

5.1 How to get started with PF 3D Suite .................................................21 5.2 Setup Grab Parameters.....................................................................21

Photonfocus AG I

Page 3: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

5.2.1 Grabber Device settings.................................................................... 22 5.2.2 Frame Settings.................................................................................. 22 5.2.3 Range Map settings........................................................................... 22 5.3 Camera Configuration .......................................................................23 5.4 Setup Mode.......................................................................................23 5.5 Acquisition Mode...............................................................................24 5.6 Visualization .....................................................................................26

6 3D SDK LIBRARY ......................................................................... 27

6.1 SDK Description ................................................................................27 6.2 Frame Grabber Library......................................................................27 6.3 PFLib.................................................................................................28 6.4 PF3DLib ............................................................................................28

7 EXAMPLE ..................................................................................... 29

7.1 3D-Quickstart ...................................................................................29

8 CONTACT..................................................................................... 36

9 REVISION HISTORY .................................................................... 36

Photonfocus AG II

Page 4: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

1 Introduction

Before installing any software or hardware it is strongly recommended to read this application

note carefully. This guide will help you to install all the required components in the right order

and make sure you set up your system to get started with your first 3D application in just a

few steps. While executing the following tasks you will see how easy it is and you will

recognize that the 3D laser triangulation in the MV-D1024E-3D01 camera opens a new

dimension in machine vision.

2 Requirements

2.1

2.2

2.3

System Requirements

Before you start with the installation of the hard- and software ensure that all the system

requirements are fulfilled.

Operating system:

• Windows XP with Service Pack 2 or higher

• Windows 2000 with Service Pack 4 or higher

PCIe1 slot:

• PCIe (PCI Express) x1 or

• PCIe x4 or

• PCIe x8 or

• PCIe x16

Software

This package should include the following software components.

• PF Remote installer

• PF 3D Suite installer

• Silicon Software microEnable IV installer

Hardware

This package should include the following hardware components.

• Silicon Software microEnable IV Base x1 frame grabber

1 Peripheral Component Interconnect Express

Photonfocus AG 3

Page 5: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

3 Installation

3.1 Frame Grabber Installation

Before starting with the software installation shut down your computer and insert the

microEnable IV frame grabber board into a free PCIExpress (PCIe) slot of your computer.

Figure 1: Frame grabber microEnable IV

3.2 Silicon Software microDisplay IV Installation

After having successfully inserted the frame grabber into a free PCIe slot and after restart of

your computer insert the installation CD into your CD-ROM drive and locate the folder with the

name “SiSo_mE4_Ver3.5.0_Installation”. Within the folder “windows” start the application

“setupMe4_v3.5.0.exe” and follow the installation dialogs.

3.2.1 Setup microDisplay IV

Select the setup language in the dialog as shown in Figure 2. After selection of the setup

language start the installation via the setup dialog as shown in Figure 3.

Figure 2: Select setup language during installation

Photonfocus AG 4

Page 6: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

Figure 3: Setup microEnable IV frame grabber installation

After the installation has finished you will be prompted to reboot the computer. Choose the

option “Yes, restart the computer now” and press the button Finish as shown in Figure 4.

Figure 4: Setup microEnable IV frame grabber installation completing

Photonfocus AG 5

Page 7: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

3.2.2 Hardware Diagnosis

After you have completed the microEnable IV frame grabber installation setup wizard and after

your computer has rebooted, start the frame grabber hardware diagnosis from the “Start –

Programs – Silicon Software – mE4Runtime – microDiagnosisMe4”.

Figure 5: Start Hardware Diagnosis

The diagnosis tool will execute a hardware test, a software test and a flashing functionality. If

during the installation process any problems have occurred then the hardware diagnosis tool

will not show any frame grabber board.

For more information about the Silicon Software microDiagnosisMe4 refer to the Silicon

Software documentation (see folder “SiliconSoftware/mE4Runtime3.3/doc”).

Ensure that your frame grabber was properly installed by using the microDiagnosis tool

before you proceed with the 3D system setup.

Photonfocus AG 6

Page 8: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

3.3 PFRemote Installation

After the frame grabber and all related software have been installed successfully you are ready

to start the PFRemote installer. Locate the installer file in the folder “PFRemote” and start the

setup wizard as shown in Figure 6. It is recommended to use the default settings during

installation.

Figure 6: Setup – PFRemote and SDK

3.3.1 PFRemote Overview

PFRemote is a graphical configuration tool for Photonfocus cameras. The latest release can be

downloaded from the support area of http://www.photonfocus.com. All Photonfocus cameras

can be either configured by PFRemote, or they can be programmed with custom software using

the PFLib SDK ([PFLIB]).

3.3.2 PFRemote Port Browser

On start, PFRemote displays a list of available communication ports in the main window as

shown in Figure 7.

Photonfocus AG 7

Page 9: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

Figure 7: Available communication ports displayed in the port browser and log messages of the

PFRemote main window

After connecting the camera, the device can be opened with a double click on the port name or

by right-clicking on the port name and choosing Open & Configure. If the initialization of the

camera was successful, the configuration dialog will open. The device is closed when PFRemote

is closed. Alternatively, e.g. when connecting another camera, the device can also be closed

explicitly by right clicking on the port name and choosing Close. Make sure that the

configuration dialog is closed prior to closing the port.

3.3.3 PFRemote Configuration Dialog

The configuration dialog appears as a sub window as soon as a camera port was opened

successfully. Through these dialogs the user can configure the camera properties.

For more information about the PFRemote graphical configuration tool refer to the Photonfocus

Software documentation (see folder “/Photonfocus/PFRemote/doc”).

PFRemote is not needed during the installation of the PF 3D Suite and can be closed now.

Photonfocus AG 8

Page 10: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

3.4 PF 3D Suite Installation

In the final step the PF 3D suite will be installed. Locate the PF 3D Suite installer file in the

folder “PF 3D Suite” and start the setup wizard as shown in Figure 8.

3.4.1 PF 3D Suite Overview

The PF 3D Suite is a graphical application intended to correctly configure and ease the

evaluation of the Photonfocus product range of 3D digital cameras. PF 3D Suite does not only

allow to see the effects of the camera configuration parameters with live image, but it is also

able to show the 3D information acquired in real time.

Figure 8: Setup – PF 3D Suite

The PF 3D Suite package installs several files into the Microsoft Windows system. Although the

user may change the installation directory when running the MSI installer, by default it

proposes the recommended path C:\Program Files\Photonfocus\PF3DSuite\. It is also

recommended to use the default settings during installation.

3.4.2 Structure of the Installation Directory

The SDK included with the PF 3D Suite is a C++ software library entitled “PF3DLib”.

• bin - The main PF 3D Suite binary, DLLs from the PF3DLib, and precompiled

executables of the examples distributed with the PF3DLib SDK.

• drivers - Frame Grabber Driver binary files (*.fgd). You need these files to use the PF

3D Suite, in order to grab frame objects easily. Each FGD file supports one frame

grabber device.

Photonfocus AG 9

Page 11: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

• SDK\doc\pf3dlib - The PF3DLib SDK documentation in html. Open the index.html to

start.

• SDK\doc\pflib[.chm] - The Photonfocus camera configuration library documentation.

• SDK\examples\wxWidgets - Visual C++ 2005 example projects using PF3DLib (see

distributed examples for more information).

• SDK\examples\pflib - Visual C++ 6 example projects using the Photonfocus camera

configuration library.

• SDK\include - Path to be added to the INCLUDE_PATH parameter of your compiler.

This directory contains the C++ declarations in PF3DLib, the internal declarations for

the C functions and structures used in the DLLs, and the Photonfocus camera

configuration API declarations (pflib).

• SDK\lib - Path to be added to the LIBRARY_PATH parameter of your linker. These files

will allow the user to link his program to the PF3DLib and Photonfocus DLLs.

Figure 9: Setup – Completed the PF 3D Suite Setup Wizard

Photonfocus AG 10

Page 12: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

3.4.3 PF 3D Suite User Interface

The PF 3D Suite consists of a main window, several secondary windows, and some

configuration dialogs. The main window displays the frame acquired by the camera. Additional

windows display further information (a histogram of the frame, the range map, the 3D

representation, and a zoom window of the live image). A toolbar contains buttons for the most

common actions regarding visualization and acquisition.

Figure 10: PF 3D Suite – Main Window

For more information about the PF 3D Suite, refer to the Photonfocus software documentation

(see folder “/Photonfocus/PF3DSuite/bin/pf3dsuite.chm”).

Photonfocus AG 11

Page 13: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

3.5 Additional Tools

3.5.1 Range Map Viewer

The installer of the PF 3D Suite also installs some sample tools. These applications are also

located in the bin folder “Photonfocus/PF3DSuite/bin” of the PF 3D Suite installation

directory. Currently there are four additional tools available. The “RangeMapViewer” allows the

range map files (.arm) to be displayed in 2D or 3D representation. Figure 11 shows the GUI of

the Range Map Viewer.

Figure 11: Range Map Viewer

Further tools are a the “Histogram Viewer”, a “Normalize Viewer”, and a “Peak Finder”. All the

sample tools are also available in C++ source code and are located in the SDK installation

folder under the Program Files “/Photonfocus/PF3DSuite/SDK/examples”.

Photonfocus AG 12

Page 14: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

4 System Configuration

All the hardware and software have now been installed and you are ready to setup your

system. Figure 12 shows the triangulation principle with the projection of a laser line over an

object. The setup shall include the proper configuration of the camera, the frame grabber and

of course the 3D laser triangulation environment including a laser and a conveyor belt or a

similar actuator device. After completing the system configuration you are ready to start

measuring with the 3D laser triangulation.

Figure 12: Triangulation principle: Projection of a laser line over an object

4.1 3D Laser Triangulation

In a laser triangulation setup, the 3D information of an object is extracted by measuring the

deviation in x-direction (ΔX) of the laser line profile. The deviation is proportional to the height

of the object and an increase of ΔX corresponds to an increase of the objects height above the

ground level (see Figure 13).

Figure 13: Principle of a 3D laser triangulation. The arrow indicates the direction of the object

displacement on a conveyor belt or a similar device.

Photonfocus AG 13

Page 15: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

The laser line needs to be aligned in vertical orientation towards the camera.

Only one vertical laser line can be processed at a time by the 3D Peak Detector.

4.2 Frame Grabber Configuration

Start the microDisplay application. In the first popup dialog (see Figure 14) you can choose

among the three options “Restore Previous State”, “Load Applet” or “Load Configuration File”.

Figure 14: Select hardware applet

Choose the function “Load Applet”; this will open the “Load Hardware Applet” window (see

Figure 15). In the left panel of this dialog any frame grabber, which has been detected by the

software, will be listed. In the middle panel of the “Load Hardware Applet” window the

available DLLs are named and on the right hand side an applet filter allows to customize the

applet selection procedure. For activating a chosen applet, click on the middle button at the

bottom of the window. Afterwards, while the dialog is still open, it allows you to choose

another applet for a second frame grabber board or to unload a design, for instance.

For the MV-D1024E-3D01 it is recommended to select the “DualAreaGray16” applet, even

though you may intend to work with one camera only.

Photonfocus AG 14

Page 16: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

Figure 15: Load Hardware Applet

To finish with entering parameters for the chosen applet(s) in the main window click Close.

4.2.1 The Windows in microDisplayMe4

In microDisplayMe4, fast access to all settings functions is given by the side panel next to the

main window. In the following the most important panels will be described.

Figure 16: Main window of microDisplayMe4

Photonfocus AG 15

Page 17: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

4.2.2 Parameter Table

To enter the necessary parameters, enter your required values to the parameters in the

parameters table in the middle of the right hand side. Subentries become visible if you click on

the “+” symbol at the left of each entry.

Figure 17: Parameter table in microDisplayMe4

Adapt the display size to the desired dimension (e.g. Width = 1024; Height = 1024) and set

the CameraLink input format to the appropriate size of 8 bit dual tap. All other parameters can

be left in the default settings.

The size of the ROI will be dynamically adapted using the PF 3D Suite.

Photonfocus AG 16

Page 18: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

4.2.3 Save Frame Grabber Configuration

After the necessary parameters have been set in the parameter table, the current

configuration must be saved in a frame grabber configuration file. The user has to generate

this frame grabber configuration file (*.mcf), as it will be required for the follow up steps of the

setup process.

Figure 18: Save frame grabber configuration in a mcf file

4.3 Camera Configuration

In the very last configuration step the overall system configuration will be completed by the

setup of the camera.

4.3.1 Camera Check

Ensure that the camera is connected to the frame grabber and that the power supply is

correctly plugged in. If the camera is working properly the green status LED at the rear of the

camera housing lights up. Next start the PFRemote configuration tool.

4.3.2 Start PFRemote

Go to the Windows “Start” Menu and execute the PFRemote application. Select (Double click)

the corresponding port that is connected to the camera.

The PFRemote configuration dialog appears. In the following section only the 3D related

parameters will be explained. For further information on how to configure the camera refer to

the detailed PFRemote documentation or to the online help included within the PFRemote

software.

Photonfocus AG 17

Page 19: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

4.3.3 Setup - 3D01

The dialog tab 3D01 includes the parameters for the 3D peak detector. Figure 19 shows the

3D01 settings for the MV-D1024E-3D01 camera.

Figure 19: PFRemote 3D01 configuration dialog

4.3.3.1 Mode Settings

The Peak Detector functionality in the MV-D1024E-3D01-160 camera can be configured in

different modes, depending on what image information shall be transferred from the camera to

the frame grabber.

The following settings can be selected:

• 2D Mode: In the 2D mode the camera is sending raw image data to the frame grabber, which can then be further processed on the frame grabber or by an image processing software tool. No additional 3D information is transferred with the raw image data when using the 2D mode.

• 2D and 3D Mode: In the 2D and 3D mode the camera sends the raw image data

including the necessary 3D information to the frame grabber. The raw image containing the laser line is analyzed by the Peak Detector in the camera’s FPGA. This 3D information is then attached to the 2D raw image.

• 3D Mode: In the 3D mode the camera only sends the 3D data calculated by the Peak

Detector algorithm in the camera FPGA to the frame grabber.

4.3.3.2 Threshold Settings

The raw image data is first processed by the threshold pre-filter before being analyzed by the

Peak Detector algorithm. All grey level values in the raw image data will be set to 0, if the grey

value undergoes a given threshold value.

Photonfocus AG 18

Page 20: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

The raw image data and the threshold values are 12 bit values (maximum 4095).

4.3.3.3 Trigger Resolution Settings

For a successful 3D image acquisition it is important to use the encoder pulses from the

conveyer belt or from a similar device for triggering the image acquisition of the camera.

However, it may occur that the delivered encoder pulse frequency exceeds the requirements of

the 3D application. To allow for exact configuration of the image acquisition system the Trigger

Resolution feature allows to skip a predefined number of trigger pulses delivered from the

incremental encoder between each frame acquisition.

4.3.4 Setup - Trigger

If a trigger signal (e.g. from a shaft / position encoder) is used to control the camera, this

must be configured via the Trigger dialog tab (see Figure 20). Otherwise the trigger settings

can be left in the default settings Free running (Not recommended).

Figure 20: PFRemote – Trigger dialog Tab

4.3.5 Setup - Window

Use the Window dialog tab (see Figure 21) to adjust the window size of your region of interest

(ROI). The width and the height can be setup through the parameters “W” and “H”. The

parameters “X” and “Y” can be used to shift the ROI position horizontally to the right and to

shift the ROI vertically downwards.

Photonfocus AG 19

Page 21: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

After changing any settings in the Window setup, always press Enter in order to make the

changes active.

Figure 21: PFRemote – Window dialog tab

4.3.6 Setup - Exposure

Finally you can adjust the exposure time to a suitable value. Exposure time, frame time and

frame rate have to be adapted to the system requirements. The appropriate window is

displayed in Figure 22.

Figure 22: PFRemote – Exposure dialog Tab

Photonfocus AG 20

Page 22: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

5 System Check

At this point it is time to verify the overall configuration of the system. For this task start the

PF 3D Suite application previously installed.

5.1

5.2

How to get started with PF 3D Suite

The PF 3D Suite GUI allows the user to work in two different modes. The first mode is called

“setup mode” and the second mode is the “acquisition mode”. The setup mode lets the user

configure the camera parameters before starting the acquisition.

PFRemote is not needed during the installation of the PF 3D Suite and can be closed

during the system check.

Before working in the setup mode, the frame grabber must be configured (see chapter

5.2).

Setup Grab Parameters

Once you have started the PF 3D Suite application press the Toolbar button “Config and

Grab” or choose the corresponding command from the menu Grabber. The execution of this

command opens the Grab Parameters dialog as shown in Figure 23.

Figure 23: PF 3D Suite – Grab Parameters dialog

Photonfocus AG 21

Page 23: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

5.2.1 Grabber Device settings

Driver File: In order to support an increasing number of frame grabbers, PF 3D Suite has the

specific driver code for each frame grabber stored in external files. These drivers provided in

the PF 3D Suite require additional installation of the frame grabber vendor software (Windows

drivers and libraries). The default installation path for the drivers needed in the dialog is

C:\Program Files\Photonfocus\PF3DSuite\drivers.

Config File: You must also enter the path for a frame grabber configuration file. This file is

specific for each frame grabber, and the user should create it using the proper software

delivered by the frame grabber vendor. This file provides the information for the acquisition

system of the user, namely the port, the size of the grabbed frames, the pixel data format,

and other configuration parameters (see also chapter 4.2.3).

Timeout (ms): You can configure the maximum time allowed between two consecutive

frames (see also chapter 5.2.3).

5.2.2 Frame Settings

When using a real frame grabber, the application can talk to the camera delivering the frames,

and get or set any camera parameter needed for a proper acquisition. For this, you need to

select the serial port where the camera is connected in the list of serial ports, next to the

checkbox "Use Camera".

5.2.3 Range Map settings

The range map settings influence how range maps are displayed by the PF 3D Suite. The size

of the displayed range maps can be defined in two ways:

1. Time out and

2. Number of profiles.

The Time out (configured in the Grabber Device Section) defines the maximum time allowed

between two consecutive frames. If a new frame is delivered by the camera for a time

exceeding the defined time out, the current range map is ended. Subsequent frames will be

displayed in a new range map. The time out condition may help in acquisition systems where

the camera is working in trigger mode. The camera captures a frame for each pulse of the

trigger signal. When no pulses are received, the camera does not send any frame, so the

range map grabbing stops properly due to the time out condition.

The maximum number of profiles (Max. profiles) defines the maximum size of any captured

range map. Once the range map is composed of the pre-selected amount of profiles, the

Photonfocus AG 22

Page 24: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

application ends the range map grabbing. Since both conditions are always used, each range

map acquired ends if at least one of both conditions is fulfilled.

For more information about the PF 3D Suite refer to the Photonfocus Software documentation

(see folder “/Photonfocus/PF3DSuite/bin/pf3dsuite.chm”).

5.3

5.4

Camera Configuration

In order to change the configuration parameters of your camera, select Camera - Configure

menu option. PF 3D Suite will present a list of serial ports for choosing the camera, much like

in the Grab Parameters dialog. Please refer to the camera manual for more information about

the configuration parameters that can be selected in this dialog.

Setup Mode

In order to graphically select the region of interest (ROI) use the mouse, and activate the

setup mode in the Camera - Region of interest menu option (or by clicking the corresponding

toolbar button). While the camera is operating in the setup mode (see Figure 24), the

region of interest (ROI) of the camera is set to full resolution, the trigger is set to Free

Running, and the 3D Mode is set to 2D and 3D, in order to make the ROI setup operation

comfortable. Exiting the setup mode the camera is programmed according to the previously

used dialog settings.

The user can select the ROI by drawing a rectangle over the frame. To draw the rectangle, the

user must drag the mouse diagonally and release the mouse button to set the rectangle. After

the ROI selection, the user should deactivate the setup mode in order to get the selected ROI

settings applied.

Photonfocus AG 23

Page 25: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

Figure 24: PF 3D Suite – Setup mode

5.5 Acquisition Mode

To acquire a range map, the user should ensure that the camera is either set to the 2D/3D

mode or set to the 3D mode. Please refer to chapter 5.3 to configure the camera parameters.

Once all the setup has been done as described above, the 3D system is ready for the first 3D

measurement task. To start the 3D measurement press the Toolbar button Grab or select

the Grabber – Grab command from the menu. Figure 25 shows the live image while PF 3D

Suite is in acquisition mode. Please consider that in case the camera is configured in trigger

mode a live image will only be visible if the conveyor belt is moving.

Photonfocus AG 24

Page 26: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

Figure 25: PF 3D Suite – Acquisition mode

The visualization of the laser profile can be activated or deactivated using the View - Peak

positions menu or the corresponding toolbar button.

Photonfocus AG 25

Page 27: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

5.6 Visualization

After the 3D acquisition, two output modes are available, the Range Map and the Surface).

Figure 26 displays the range map of a scanned object, Figure 27 shows the surface view.

Figure 26: PF 3D Suite – Range map view

Figure 27: PF 3D Suite – Surface view

Photonfocus AG 26

Page 28: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

6 3D SDK Library

6.1 SDK Description

The 3D Lib SDK is a C++ software library. The short name for the library is “PF3DLib”, so all

the functions and type names in the library start with this name.

The 3D SDK library consists of various layers. The frame grabber library represents the base

layer and depends on the type of frame grabber used. The PF3DLib and the PFLib (the

standard library for Photonfocus cameras) are built on top of the frame grabber library and

communicate with it. This architecture provides independence with respect to the frame

grabber and allows for user development of additional frame grabber libraries.

Figure 28: Overview of the SDK layers in the PF 3D Suite

For more information about the SDK library refer to the Photonfocus 3D SDK documentation

(see file “/Photonfocus/PF3DSuite/SDK/doc/pf3dlib/index.html”).

6.2 Frame Grabber Library

In order to use a frame grabber currently not supported by Photonfocus, an additional frame

grabber library is required.

Additional frame grabbers will be added continuously to the frame grabber compatibility

list.

Please contact Photonfocus AG, if you want to know about the latest supported frame grabber

list or if you are interested in developing an additional frame grabber interface.

Photonfocus AG 27

Page 29: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

Photonfocus AG 28

6.3

6.4

PFLib

For more information about the PFLib refer to the Photonfocus 3D SDK documentation (see file

“/Photonfocus/PF3DSuite/SDK/doc/pflib/index.html”).

PF3DLib

Table 1 lists the classes, structs, unions and interfaces with brief descriptions:

pf3dlib::Area An area over a frame

pf3dlib::Frame Manager class for 2D pictures in memory

pf3dlib::FrameGrabber Interface to pf3dlib Frame Grabber Drivers

pf3dlib::GrabNotStarted Tried to wait() a frame without starting to grab

pf3dlib::GrabStopped The frame grabber has been frozen while waiting for the next frame

pf3dlib::InvalidArea The area specified is invalid

pf3dlib::InvalidFile The file to load the frame from is invalid

pf3dlib::InvalidPlane The plane is outside the allowed range

pf3dlib::InvalidProfileLength The length of the profile to be added to a range map is invalid

pf3dlib::Matrix3D A 3D transformation matrix (rotation and translation)

pf3dlib::PhfPeakFinder Extracts the 3D information from frames of Photonfocus 3D cameras

pf3dlib::PhfPeakFinder::Port The port number to use to get the configuration

pf3dlib::Point3D A point in 3D space

pf3dlib::Profile Position of a laser line detected in a frame

pf3dlib::RangeMap 3D representation based on profile accumulation

pf3dlib::RangeMap::CalibrationConfig Acquisition system configuration for the calibration

pf3dlib::Timeout The grabber timed out while waiting for the next frame

Table 1: PF3DLib summary

For more information about the PF3DLib refer to the Photonfocus 3D SDK documentation (see

file “/Photonfocus/PF3DSuite/SDK/doc/pf3dlib/index.html”).

Page 30: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

7 Example

7.1 3D-Quickstart

#include <iostream> #include <fstream> #include <direct.h> #include <pf3dlib/Frame.h> #include <pf3dlibpp/FrameGrabber.hpp> #include <pf3dlibpp/RangeMap.hpp> #include <pf3dlibpp/Profile.hpp> #include <pf3dlibpp/PeakFinder.hpp> #include "pfconfig.hpp" using namespace std; using namespace pf3dlib; using namespace pfconfig; namespace { char gsFullAppPath[MAX_PATH]; const char* FG_DRIVER = "C:\\Program Files\\Photonfocus\\PF3DSuite\\drivers\\sisome4framegrabber.fgd"; const char* CAM_CONFIG = "3D01_1032x1024_A.mcf"; // 8 bit Data, Dual Tap, Port A, Full ROI const int MAXPROFILES = 400; const int TIMEOUT = 1000; const int FWIDTH1 = 120; const int FHEIGHT1 = 440; } ///////////////////////////////////////////////////////////////////// // // This example is a quick start application to get familar with the // 3D camera MV-D1024E-3D01 and the SDK based on the "pf3dlib" library. // // Description: The main functionality of the example is to configure // the camera with a set of properties. The property list is available // in the documentation of the PFRemote. The communication and the // property setup is implemented in the class ConfigCam.

Photonfocus AG 29

Page 31: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

// The functionality of capture is mainly to capture some frames from // the framegrabber Siso me4 and add the 3D profiles to a rangemap. // Finally the rangemap and the raw peak data will be saved into a file. // int config(CPFConfig* pfConfig) { // Setup the camera configuration // Additional 3D properties // Property:PeakDetector.Threshold // Peak detector gray-level threshold (pre-filter threshold) int iThreshold=800; if(pfConfig->SetCameraPropertyI("PeakDetector.Threshold", iThreshold) < 0) throw std::runtime_error ("Set camera property failed: PeakDetector.Threshold"); // Property: PeakDetector.Mode // Parameter: 0: "Img2D" (2D only) // 1: "Img2D3D" (2D+3D) // 2: "Img3D" (3D only) if(pfConfig->SetCameraPropertyI("PeakDetector.Mode", 1) < 0) throw std::runtime_error ("Set camera property failed: PeakDetector.Mode"); // Property: Trigger.TriggerResolution // Parameter: Trigger resolution value - only take every n-th trigger (n=trigger resolution+1) // TriggerResolution=0 means: take every trigger (default behaviour) if(pfConfig->SetCameraPropertyI("Trigger.TriggerResolution", 1) < 0) throw std::runtime_error ("Set camera property failed: PeakDetector.Mode"); // Property: ExposureTime // Parameter: Exposure time of the camera in millisecond. Maximum value is 419ms. float f=(float)10.0; if(pfConfig->SetCameraPropertyF("ExposureTime", f) < 0) throw std::runtime_error ("Set camera property failed: ExposureTime"); // Property: Trigger.Source // Parameter: 0 : Free_Running (Trigger is on Free Running Mode) // 1 : Interface_Trigger (Interface Trigger is the trigger source) // 2 : IO_Trigger (I/O Trigger is the trigger source) if(pfConfig->SetCameraPropertyF("Trigger.Source", 0) < 0) throw std::runtime_error ("Set camera property failed: Trigger.Source"); // Property: Window.W

Photonfocus AG 30

Page 32: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

// Parameter: Width of region of interest (12..1024) if(pfConfig->SetCameraPropertyI("Window.W", FWIDTH1) < 0) throw std::runtime_error ("Set camera property failed: Window.W"); // Property: Window.H // Parameter: Height of region of interest (1..1024) if(pfConfig->SetCameraPropertyI("Window.H", FHEIGHT1) < 0) throw std::runtime_error ("Set camera property failed: Window.H"); // Feel free to add some more properties... return 0; // No error } int capture(CPFConfig* pfConfig, PeakFinder::Port pfPort) { std::vector<unsigned int> width[MAXPROFILES]; std::vector<unsigned int> quality[MAXPROFILES]; // Load Framegrabber driver and camera file FrameGrabber fg1(FG_DRIVER, CAM_CONFIG); PeakFinder pf1(pfPort); // The PeakFinder reads its parameter directly from the camera RangeMap rm1; int iProfilecount; // Configure the frame grabber ROI // Add 8 pixels for the additional 3D Data in width fg1.setSize(FWIDTH1+8, FHEIGHT1); // Start grabbing fg1.grab(); cout << "Grabbing..." << endl; try { iProfilecount=0; // Add profiles to the rangemap until MAXPROFILES reached or a timeout occurs while(iProfilecount++ < MAXPROFILES) { fg1.wait(TIMEOUT); //pf3dlib::Frame frame(fg1.frame()); size_t plane=0;

Photonfocus AG 31

Page 33: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

// Get profile (peak), width and quality data pf3dlib::Profile profile = pf1(fg1.frame(), plane, width[iProfilecount-1], quality[iProfilecount-1]); // Get Only profile (peak) data //pf3dlib::Profile profile = pf1(frame); // Add the profile to a rangemap for further use rm1.addProfile(profile); // Save the frames in .bmp file format into a subfolder #Data (make sure the folder has been created manualy) //sprintf_s(sFramePathAndFile, MAX_PATH, "%s\\#Data\\frame_%d.bmp", gsFullAppPath, profilecount); // Uncomment in case you wants to use this function. // Please consider this could slow down your performance in grabbing frames. //frame.saveToFile(sFramePathAndFile); cout << "."; } } catch (...) { } cout << endl; // Stop grabbing fg1.freeze(); // Save profiles to a rangemap file //Rangemap files are saved in the Framegrabber driver directory by default string strPathRange(gsFullAppPath); strPathRange.append("\\rangemap.arm"); iProfilecount = rm1.countProfiles(); cout << "Profiles in Rangemap rm1: " << iProfilecount << endl; if (iProfilecount > 0){ cout << "Saving Rangemap and peak data to a file:" << endl; rm1.saveToFile(strPathRange); // Save all the peaks from the profile string strPathPeak(gsFullAppPath); string strPathInfo(gsFullAppPath);

Photonfocus AG 32

Page 34: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

strPathInfo.append("\\info.txt"); strPathPeak.append("\\peak.txt"); ofstream info_file(strPathInfo.c_str()); ofstream peak_file(strPathPeak.c_str()); for(int i=0; i < iProfilecount; i++){ // Get the profile from the range map pf3dlib::Profile profile = rm1[i]; cout << "."; for(size_t r=0; r < profile.length(); r++){ //float f = profile[r]; //cout << "Profile(" << i << ") Peak : Quality : Width (" << r << ") - " << profile[r]; //cout << " : " << quality[i][r] << " : " << width[i][r] << endl; // Save peak, quality and width data for each profile in a file peak_file

info_file info_file

<< profile[r] << " ";

<< "Profile(" << i << ") Peak : Quality : Width (" << r << ") - "; << profile[r] << ", " << quality[i][r] << ", " << width[i][r] << endl;

} peak_file << endl; info_file << endl; } cout << "." << endl; } return 0; } int main(int argc, char **argv) { CPFConfig* pfConfig; PeakFinder::Port pfPort(0); // Set the application path and define several paths to store data _getcwd(gsFullAppPath, MAX_PATH); // Open camera port and configure some properties try {

Photonfocus AG 33

Page 35: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

pfConfig = new CPFConfig(); // Get port information std::vector<cam_port_info> camPortInfoList; //cam_port_info PortInfo; camPortInfoList = pfConfig->GetPortInfo(); // Display camera port information and let the user choose a port number. vector<cam_port_info>::const_iterator cii; for(cii=camPortInfoList.begin(); cii!=camPortInfoList.end(); cii++) { cout << "Port nb: " << cii->iPort << " Manufactor: " << cii->sManu << ", " << cii->sName; cout << " Ver.: " << cii->iVersion << " Type: " << cii->iType << endl; } unsigned char ch=' '; // Numbers between 0 and total numbers of port are allowed while(ch < 48 || ch > (camPortInfoList.size() + 47)){ cout << "Please select a valid port number:" << endl; ch = getc(stdin); } pfPort.index = ch-48; printf("Opening camera on port %d ...\n", ch-48); int iError = pfConfig->OpenPort(ch-48); if(iError != 0){ string sError("Open camera port failed: "); sError += pfConfig->GetCamErrorMsg(); throw std::runtime_error(sError); } } catch(runtime_error &e) { cerr << "Uups... Problem configuring the camera. Press any key to exit the application. " << endl << e.what(); fflush(stdin); char ch = getc(stdin); if(pfConfig) // clean up memory delete pfConfig; return -1;

Photonfocus AG 34

Page 36: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

Photonfocus AG 35

} // Capture some frames try { capture(pfConfig, pfPort); cout << "Acquisition finished. Press any key to exit the application." << endl; fflush(stdin); char ch = getc(stdin); return 0; } catch (...) { cerr << "Uups... Problem acquiring from the frame grabber. Press any key to exit the application." << endl; fflush(stdin); char ch = getc(stdin); return -1; } }

Page 37: APPLICATION NOTE...AN028 3D System Setup, 08/2008 V1.0 3.2.2 Hardware Diagnosis After you have completed the microEnable IV frame grabber installation setup wizard and after your computer

AN028 3D System Setup, 08/2008 V1.0

8 Contact

Photonfocus AG Bahnhofplatz 10 CH-8853 Lachen Switzerland www.photonfocus.com Support Sales Phone: +41 55 451 01 37 Phone: +41 55 451 07 45 Fax: +41 55 451 00 01 Fax: +41 55 451 00 01 [email protected] [email protected]

9 Revision History

REV Description of the modification Date

1.0 First Release 06.10.2008

Table 2: Document revisions

Photonfocus AG 36