Tutorial - VC-Z HALCON Image Acquisition Interface  1.0

How to run the Vision Application inside the Camera

How to run the Vision Application inside the Camera

1. Introduction

In this chapter we will see how to run exactly the same script inside the VC-Z camera.

2. Files transfer - FTP connection

The VC-Z camera has already a FTP server. We need a FTP client on the HOST. In this example we use WinSCP.

In this tutorial, we assume that the VC-Z camera has this IP address:

192.168.3.15

We can connect our FTP client to the camera with the root password: 'root'.

We have to copy these files in a folder on the camera:

  • the HDevelop file 'tutorial_1_02.hdev'
  • the images test, for example 'Image3.bmp'
  • the teapot CAD file 'teapot.ply'
FTP_tuto2.png

3. Script execution - SSH connection

Connect to the SSH server of the device as 'root':

SshConnection.png

The password is 'root'.

VC Lib Q library (HALCON embedded runtime) is installed inside the camera in these folders by default:

Paths Descriptions
/opt/halcon/ The HALCONROOT env variable is here. The folder contains the license and the folders for the images and the examples.
/usr/lib/ Every .so library files
/usr/bin/ The tool to launch the HDevelop script files called 'hrun' and the benchmark tool called 'hbench'.

You can launch the HDevelop script files by calling the tool 'hrun':

/usr/bin/hrun

When we are in the folder of the .hdev file, we can launch it by this command:

/usr/bin/hrun ./tutorial_1_02.hdev

Have a look at the help message of the 'hrun' program to discover every available features:

hrun_help.png

4. Image visualisation

If you connect to the camera in SSH via a Cygwin terminal xterm and if you install also the X Server like it is described in the VC Lib Q tutorial paragraph 2.5, you will see a window opened by the camera on your HOST to see the result like in HDevelop:

AppImageResultWithoutProcedures.png

5. Procedures issue

If you look at the previous image, you can see there are no XYZ axes displayed. The reason is that it is done by the procedure 'disp_3d_coord_system' defined by MVTec and installed in the folder 'procedures' in the path $HALCON_ROOT. Unfortunately this folder is not installed on embedded device. But we can run 'hrun' with '-p' parameter to add a procedure path in order to find every procedures used by our .hdev program

To work around this issue, you can copy-paste this folder from the HOST:

C:\Program Files\MVTec\HALCON-12.0\procedures

to the folder of the .hdev file into the camera.

Now we can run one more time with this command in order to see the XYZ coordinate system:

/usr/bin/hrun -p ./procedures ./tutorial_1_02.hdev

The result looks better:

AppImageResult.png

6. Differences from HDevelop

  • We can see the 'Dist' result is the same like in HDevelop but in rare cases, numeric results should be a little bit different due to a different round number. We can observe the same behaviour on a PC between a 32bits and a 64bits application.
  • The speed of the processing will not be the same. We saw an execution time of 80ms in the HOST in HDevelop in the previous page and the execution time is 120 ms in the camera on the same image.
  • The memory available is limited. You can check the memory ressources by a 'top' command in another SSH terminal.
  • To display images like in HDevelop, you have to specify the 'part' of the window with 'set_part' in the display part of your script. In HDevelop the images are fit in the window size by default but it is not the case in HDevEngine.
  • Currently there is no way to set a breakpoint inside the script of the camera. But you can debug the script in the camera by these ways:
    • Iconic variables (Image, Region and XLD) could be shown in a window like HDevelop via a X Server
    • Tuple variables could be shown in the SSH terminal via this command:
      set_framegrabber_param(AcqHandle, 'debug', [tuple1, tuple2])

Next section: Image sensor acquisition, Triggering and Sending results