We have to modifiy our script to fit the real constraints of our application:
Let's start with the first topic.
There is a specific HALCON Image Acquisition Interface for the VC-Z camera. The file is called 'hAcqVC-Z.so'. You can check if it is present in /usr/lib/ folder in the camera:
We can see some other files:
HALCON Files | Descriptions |
---|---|
hAcqFile.so | HALCON Image Acquisition Interface for virtual acquisition of image files |
hAcqVC-Z.so | HALCON Image Acquisition Interface to grab image from the sensor directly with 'grab_image' |
libhalcon.so | This binary file contents every HALCON processing operators |
libhalconc.so | HALCON C Interface |
libhalconcpp.so | HALCON C++ Interface |
libhdevenginecpp.so | HDevelop Engine Interface for C++ application |
We can connect to the sensor by open_framegrabber() with the interface 'VC-Z' instead of the 'File' interface:
That is all! The images grabbed by 'grab_image_async()' will come from the sensor.
A complete documentation of the 'VC-Z' Image Acquisition Interface is available here.
We can enable the hardware trigger by this simple line:
Now when there is no hardware trigger, a timeout could happens. We have to manage this behaviour around the 'grab_image_async()' call.
No image is taken until a rising edge happens on TrgIn.
In HALCON we can handle TCP or UDP or serial communication. Have a look a the HALCON reference documentation on this topic. In our example we propose to establish a TCP socket connection between the camera and a small terminal on the HOST PC called 'TeraTerm' as a TCP client.
So we have to modify our script in order to manage a TCP communication. At first, we create a TCP server in order to accept a client connection:
And then we are waiting for an incoming connection from a client:
We are waiting for a client connection 3 times during the timeout of 5 sec, so we have 15 sec to establish the connection with a client otherwise the 'Socket' variable will be empty and no result will be sent after the processing step:
Have a look at the complete source code at the end of this page. We can launch the script in the camera:
And we have 15 seconds to connect a TCP client to receive results. For example we use 'TeraTerm' client with this settings:
When the connection succeeds, a result is sent to the TCP client at each rising edge on the TrigIn line:
That's all! Our first real application is done, congratulations!
There are some other scripts to illustrate the VC-Z HALCON acquisition interface:
You can get the complete source code here.
Next section: Additional tips: Strobe, Flipping image and color processing.