HALCON is the comprehensive standard software library with an integrated development environment (IDE) for machine vision from MVTec.
HALCON provides an extensive library of more than 1300 operators with outstanding performance for blob analysis, morphology, pattern matching, measuring, 3D object recognition, and binocular stereo vision, to name just a few. Easy programming in C, C++, C#, Visual Basic .NET, and Delphi
ipkg-cl install halcon_8.0.1_arm.ipk
ipkg-cl install hfgfesto_7.1-3.1.5-festo0_arm.ipk
ipkg-cl install x11_X11R7-3.1.5-festo0_arm.ipk
HALCONROOT
and LD_LIBRARY_PATH
according to /ffx/halcon/.profile_halcon
orexport HALCONROOT=/ffx/halcon export LD_LIBRARY_PATH=/ffx/halcon/lib/arm-eneo-linux2.6:$LD_LIBRARY_PATH export DISPLAY=192.168.1.7:0.0
You can also add the following lines to your startupscript /ffx/rcS
export HALCONROOT=/ffx/halcon export LD_LIBRARY_PATH=/ffx/halcon/lib/arm-eneo-linux2.6:$LD_LIBRARY_PATH ldconfig
ATTENTION: Maybe you have to adapt /ffx/etc/ld.so.config (→ see Installing plain libraries) for the halcon lib file (also /ffx/halcon/.profile_halcon)
Download the full version for your PC at Halcon release download link and install it.
Remember you need a full halcon release license if you want to develop your image processing algorithm using the integrated halcon IDE.
dev_close_window dev_update_window dev_update_pc set_window_attr open_window disp_obj clear_window ...
if x11_X11R7-3.1.5-festo0_arm.ipk is NOT installed at camera
The headerfiles for the libraries (→ see SBOx-C preparation) can be found at
the PC with an installed HALCON application inside the subdirectory include
(i.e. c:\Program Files\MVTec\HALCON\include
)
Examples for the HALCON library usage are found inside the *.tar.gz
archive (i.e. halcon-8.0.1-eneo-sc.tar.gz
) of the downloaded Embedded Halcon library.
The default example3.cpp for the camera can also be found → here
You will find a detailled setup-procedure under X.
file = /halcon/revisions-7.1/source/interfaces/C++/HCPP.cxx procedure = set_system line = 432 error# = 2041 message = HALCON error #2041: Invalid host in operator set_system thread = 16384
Solution: Check if your license file at /ffx/halcon/license/license.dat is valid and the id inside matches the unique id!!
Solution:
df -h
move the whole *.ipk
file to /ffxusr/
instead of /ffx/
or /tmp/
otherwise you can also try to mount a directory from your PC and install the package without moving it on the camera at all
The HALCON function count_seconds
returns unreliable results for image processing time calculation.
HTuple Start, End, ElapsedTime; ... count_seconds(&Start); ... // some time consuming image processing ... count_seconds(&End); ElapsedTime = End-Start;
Solution: You have to add
set_system("clock_mode","elapsed_time");
to your source code for correct elapsed time calculation inside HALCON.
Anyway there still remains a jitter of ± 20 ms (1 ms = 10^-3 s).
So for exact time calulation use the function gettimeofday
as shown below:
#include <sys/time.h> // struct timeval, gettimeofday() /** Calculate the time difference from (End - Start). * \param pStart starting time value received from function gettimeofday * \param pEnd end time value received from function gettimeofday * \return time difference in usec (10e-6) */ long lTimeDiff(struct timeval *pStart, struct timeval *pEnd) { return((pEnd->tv_sec - pStart->tv_sec)*1000000 + (pEnd->tv_usec - pStart->tv_usec)); } /** Calculate the time difference from start to now. * \param pStart starting time value received from function gettimeofday * \return time difference in usec (10e-6) */ long lTimeDiffNow(struct timeval *pStart) { struct timeval Now; gettimeofday(&Now,0); return((Now.tv_sec - pStart->tv_sec)*1000000 + (Now.tv_usec - pStart->tv_usec)); } /** Calculate the time difference from (End - Start). * \param pStart starting time value received from function gettimeofday * \param pEnd end time value received from function gettimeofday * \return time difference in structure struct timeval */ struct timeval tTimeDiff(struct timeval *pStart, struct timeval *pEnd) { struct timeval Result; Result.tv_sec = pEnd->tv_sec - pStart->tv_sec; Result.tv_usec = pEnd->tv_usec - pStart->tv_usec; if(Result.tv_usec < 0) { Result.tv_usec += 1000000; Result.tv_sec--; } return(Result); } /** Calculate the time difference from start to now. * \param pStart starting time value received from function gettimeofday * \return time difference in structure struct timeval */ struct timeval tTimeDiffNow(struct timeval *pStart) { struct timeval Now; gettimeofday(&Now,0); Now.tv_sec -= pStart->tv_sec; Now.tv_usec -= pStart->tv_usec; if(Now.tv_usec < 0) { Now.tv_usec += 1000000; Now.tv_sec--; } return(Now); } struct timeval Start, End: long ElapsedTime; // elapsed image processing time in usec (10e-6) ... gettimeofday(&Start, 0); ... // some time consuming image processing ... gettimeofday(&End, 0); ElapsedTime = lTimeDiff(&Start, &End);
HALCON's cpp-export from hdevelop does NOT support commented lines with code.
If uncommenting source code lines there has to be done some additional work.