转载:https://blog.csdn.net/deram_boy/article/details/27652367
HALCON源自学术界,它有别于市面一般的商用软件包。事实上,这是一套image processing library,由一千多个各自独立的函数,以及底层的数据管理核心构成。其中包含了各类滤波,色彩以及几何,数学转换,型态学计算分析,校正,分类辨识,形状搜寻等等基本的几何以及影像计算功能,由于这些功能大多并非针对特定工作设计的,因此只要用得到图像处理的地方,就可以用HALCON强大的计算 分析能力来完成工作。应用范围几乎没有限制,涵盖医学,遥感探测,监控,到工业上的各类自动化检测。
HALCON支持Windows,Linux和Mac OS X操作环境,它保证了投资的有效性。整个函数库可以用C,C++,C#,Visual basic和Delphi等多种普通编程语言访问。HALCON为大量的图像获取设备提供接口,保证了硬件的独立性。它为百余种工业相机和图像采集卡提供接口,包括GenlCam,GigE和IIDC 1394。
HALCON功能:
1.技术革新
HALCON 11可以实现真正意义上的目标识别。基于样本的识别方法可以区分出数量巨大的目标对象。使用这种技术可以实现仅依靠颜色或纹理等特征即可识别经过训练的目标,从而无需再采用一维码或二维码等用于目标识别的特殊印记。
2.强大的三维视觉处理
HALCON 11提供的一个极为突出的新技术是三维表面比较,即将一个三维物体的表面形状测量结果与预期形状进行比较。HALCON提供的所有三维技术,如多目立体视觉或sheet of light,都可用于表面重构;同时也支持直接通过现成的三维硬件扫描仪进行三维重构。此外,针对表面检测中的特殊应用对光度立体视觉方法进行了改善。不仅如此,HALCON现在还支持许多三维目标处理的方法,如点云的计算和三角测量、形状和体积等特征计算、通过切面进行点云分割等。
3.高速机器视觉体验
自动算子并行处理 (AOP) 技术是HALCON的一个独特性能。HALCON 11中支持使用GPU处理进行机器视觉算法的算子超过75个,比其他任何软件开发包提供的数量都多。除此之外,基于聚焦变化的深度图像获取 (depth from focus)、快速傅立叶变换 (FFT) 和HALCON的局部变形匹配都有显著的加速。HALCON 11会带给用户更高速的机器视觉体验。
4.其他新功能
1)Aztec码识别;
|
2)Micro QR码识别;
|
3)为分类自动选择特征;
|
4)使用HDevelop性能评测工具进行高效的编码分析;
|
5)支持Mac OS X 10.7操作系统;
|
6)重新修订HALCON/C++接口;
|
7)三维数据快速可视化;
|
8)远心镜头立体视觉;
|
9)改善摄像机标定技术;
|
10)HDevelop OCR助手,包含训练文件浏览器;
|
11)用于一维码和二维码识别的GS1术语学;
|
12)串行化HALCON/.NET及HALCON/C++;
|
13)易用的测量工具;
|
14)支持JPEG XR及其他。
|
|
第一步:安装前准备

第二步:


第三步:破解

双击激活工具
然后
ok啦!!!
启动界面如下:
和VC6.0结合
第一步:将程序导出并保存为:.cpp文件
如下代码:
- <pre name="code" class="cpp">///
- // File generated by HDevelop for HALCON/C++ Version 10.0
- ///
- #include "HalconCpp.h"
- using namespace Halcon;
- // Default exception handler
- void CPPExpDefaultExceptionHandler(const Halcon::HException& except)
- {
- throw except;
- }
- // Procedure declarations
- // External procedures
- // Chapter: Graphics / Text
- // Short Description: This procedure displays 'Click 'Run' to continue' in the lower right corner of the screen.
- void disp_continue_message (Halcon::HTuple WindowHandle, Halcon::HTuple Color, Halcon::HTuple Box);
- // Chapter: Graphics / Text
- // Short Description: This procedure writes a text message.
- void disp_message (Halcon::HTuple WindowHandle, Halcon::HTuple String, Halcon::HTuple CoordSystem,
- Halcon::HTuple Row, Halcon::HTuple Column, Halcon::HTuple Color, Halcon::HTuple Box);
- // Chapter: Graphics / Text
- // Short Description: Set font independent of OS
- void set_display_font (Halcon::HTuple WindowHandle, Halcon::HTuple Size, Halcon::HTuple Font,
- Halcon::HTuple Bold, Halcon::HTuple Slant);
- // Procedures
- // External procedures
- // Chapter: Graphics / Text
- // Short Description: This procedure displays 'Click 'Run' to continue' in the lower right corner of the screen.
- void disp_continue_message (Halcon::HTuple WindowHandle, Halcon::HTuple Color, Halcon::HTuple Box)
- {
- using namespace Halcon;
- // Local control variables
- HTuple ContinueMessage, Row, Column, Width, Height;
- HTuple Ascent, Descent, TextWidth, TextHeight;
- //This procedure displays 'Press Run (F5) to continue' in the
- //lower right corner of the screen.
- //It uses the procedure disp_message.
- //
- //Input parameters:
- //WindowHandle: The window, where the text shall be displayed
- //Color: defines the text color.
- // If set to '' or 'auto', the currently set color is used.
- //Box: If set to 'true', the text is displayed in a box.
- //
- ContinueMessage = "Press Run (F5) to continue";
- get_window_extents(WindowHandle, &Row, &Column, &Width, &Height);
- get_string_extents(WindowHandle, (" "+ContinueMessage)+" ", &Ascent, &Descent,
- &TextWidth, &TextHeight);
- disp_message(WindowHandle, ContinueMessage, "window", (Height-TextHeight)-12, (Width-TextWidth)-12,
- Color, Box);
- return;
- }
- // Chapter: Graphics / Text
- // Short Description: This procedure writes a text message.
- void disp_message (Halcon::HTuple WindowHandle, Halcon::HTuple String, Halcon::HTuple CoordSystem,
- Halcon::HTuple Row, Halcon::HTuple Column, Halcon::HTuple Color, Halcon::HTuple Box)
- {
- using namespace Halcon;
- // Local control variables
- HTuple Red, Green, Blue, Row1Part, Column1Part;
- HTuple Row2Part, Column2Part, RowWin, ColumnWin, WidthWin;
- HTuple HeightWin, MaxAscent, MaxDescent, MaxWidth, MaxHeight;
- HTuple R1, C1, FactorRow, FactorColumn, Width, Index, Ascent;
- HTuple Descent, W, H, FrameHeight, FrameWidth, R2, C2;
- HTuple DrawMode, Exception, CurrentColor;
- // Install default exception handler
- HException::InstallHHandler(&CPPExpDefaultExceptionHandler);
- //This procedure displays text in a graphics window.
- //
- //Input parameters:
- //WindowHandle: The WindowHandle of the graphics window, where
- // the message should be displayed
- //String: A tuple of strings containing the text message to be displayed
- //CoordSystem: If set to 'window', the text position is given
- // with respect to the window coordinate system.
- // If set to 'image', image coordinates are used.
- // (This may be useful in zoomed images.)
- //Row: The row coordinate of the desired text position
- // If set to -1, a default value of 12 is used.
- //Column: The column coordinate of the desired text position
- // If set to -1, a default value of 12 is used.
- //Color: defines the color of the text as string.
- // If set to [], '' or 'auto' the currently set color is used.
- // If a tuple of strings is passed, the colors are used cyclically
- // for each new textline.
- //Box: If set to 'true', the text is written within a white box.
- //
- //prepare window
- get_rgb(WindowHandle, &Red, &Green, &Blue);
- get_part(WindowHandle, &Row1Part, &Column1Part, &Row2Part, &Column2Part);
- get_window_extents(WindowHandle, &RowWin, &ColumnWin, &WidthWin, &HeightWin);
- set_part(WindowHandle, 0, 0, HeightWin-1, WidthWin-1);
- //
- //default settings
- if (0 != (Row==-1))
- {
- Row = 12;
- }
- if (0 != (Column==-1))
- {
- Column = 12;
- }
- if (0 != (Color==HTuple()))
- {
- Color = "";
- }
- //
- String = ((""+String)+"").Split("\n");
- //
- //Estimate extentions of text depending on font size.
- get_font_extents(WindowHandle, &MaxAscent, &MaxDescent, &MaxWidth, &MaxHeight);
- if (0 != (CoordSystem==HTuple("window")))
- {
- R1 = Row;
- C1 = Column;
- }
- else
- {
- //transform image to window coordinates
- FactorRow = (1.0*HeightWin)/((Row2Part-Row1Part)+1);
- FactorColumn = (1.0*WidthWin)/((Column2Part-Column1Part)+1);
- R1 = ((Row-Row1Part)+0.5)*FactorRow;
- C1 = ((Column-Column1Part)+0.5)*FactorColumn;
- }
- //
- //display text box depending on text size
- if (0 != (Box==HTuple("true")))
- {
- //calculate box extents
- String = (" "+String)+" ";
- Width = HTuple();
- for (Index=0; Index<=(String.Num())-1; Index+=1)
- {
- get_string_extents(WindowHandle, HTuple(String[Index]), &Ascent, &Descent,
- &W, &H);
- Width.Append(W);
- }
- FrameHeight = MaxHeight*(String.Num());
- FrameWidth = (HTuple(0).Concat(Width)).Max();
- R2 = R1+FrameHeight;
- C2 = C1+FrameWidth;
- //display rectangles
- get_draw(WindowHandle, &DrawMode);
- set_draw(WindowHandle, "fill");
- set_color(WindowHandle, "light gray");
- disp_rectangle1(WindowHandle, R1+3, C1+3, R2+3, C2+3);
- set_color(WindowHandle, "white");
- disp_rectangle1(WindowHandle, R1, C1, R2, C2);
- set_draw(WindowHandle, DrawMode);
- }
- else if (0 != (Box!=HTuple("false")))
- {
- Exception = "Wrong value of control parameter Box";
- throw HException(Exception);
- }
- //Write text.
- for (Index=0; Index<=(String.Num())-1; Index+=1)
- {
- CurrentColor = Color[Index%(Color.Num())];
- if (0 != (HTuple(CurrentColor!=HTuple("")).And(CurrentColor!=HTuple("auto"))))
- {
- set_color(WindowHandle, CurrentColor);
- }
- else
- {
- set_rgb(WindowHandle, Red, Green, Blue);
- }
- Row = R1+(MaxHeight*Index);
- set_tposition(WindowHandle, Row, C1);
- write_string(WindowHandle, HTuple(String[Index]));
- }
- //reset changed window settings
- set_rgb(WindowHandle, Red, Green, Blue);
- set_part(WindowHandle, Row1Part, Column1Part, Row2Part, Column2Part);
- return;
- }
- // Chapter: Graphics / Text
- // Short Description: Set font independent of OS
- void set_display_font (Halcon::HTuple WindowHandle, Halcon::HTuple Size, Halcon::HTuple Font,
- Halcon::HTuple Bold, Halcon::HTuple Slant)
- {
- using namespace Halcon;
- // Local control variables
- HTuple OS, Exception, AllowedFontSizes, Distances;
- HTuple Indices;
- // Install default exception handler
- HException::InstallHHandler(&CPPExpDefaultExceptionHandler);
- //This procedure sets the text font of the current window with
- //the specified attributes.
- //It is assumed that following fonts are installed on the system:
- //Windows: Courier New, Arial Times New Roman
- //Linux: courier, helvetica, times
- //Because fonts are displayed smaller on Linux than on Windows,
- //a scaling factor of 1.25 is used the get comparable results.
- //For Linux, only a limited number of font sizes is supported,
- //to get comparable results, it is recommended to use one of the
- //following sizes: 9, 11, 14, 16, 20, 27
- //(which will be mapped internally on Linux systems to 11, 14, 17, 20, 25, 34)
- //
- //input parameters:
- //WindowHandle: The graphics window for which the font will be set
- //Size: The font size. If Size=-1, the default of 16 is used.
- //Bold: If set to 'true', a bold font is used
- //Slant: If set to 'true', a slanted font is used
- //
- get_system("operating_system", &OS);
- if (0 != (HTuple(Size==HTuple()).Or(Size==-1)))
- {
- Size = 16;
- }
- if (0 != ((OS.Substring(0,2))==HTuple("Win")))
- {
- //set font on Windows systems
- if (0 != (HTuple(HTuple(Font==HTuple("mono")).Or(Font==HTuple("Courier"))).Or(Font==HTuple("courier"))))
- {
- Font = "Courier New";
- }
- else if (0 != (Font==HTuple("sans")))
- {
- Font = "Arial";
- }
- else if (0 != (Font==HTuple("serif")))
- {
- Font = "Times New Roman";
- }
- if (0 != (Bold==HTuple("true")))
- {
- Bold = 1;
- }
- else if (0 != (Bold==HTuple("false")))
- {
- Bold = 0;
- }
- else
- {
- Exception = "Wrong value of control parameter Bold";
- throw HException(Exception);
- }
- if (0 != (Slant==HTuple("true")))
- {
- Slant = 1;
- }
- else if (0 != (Slant==HTuple("false")))
- {
- Slant = 0;
- }
- else
- {
- Exception = "Wrong value of control parameter Slant";
- throw HException(Exception);
- }
- try
- {
- set_font(WindowHandle, ((((((("-"+Font)+"-")+Size)+"-*-")+Slant)+"-*-*-")+Bold)+"-");
- }
- // catch (Exception)
- catch (HException &HDevExpDefaultException)
- {
- HDevExpDefaultException.ToHTuple(&Exception);
- throw HException(Exception);
- }
- }
- else
- {
- //set font for UNIX systems
- Size = Size*1.25;
- AllowedFontSizes.Reset();
- AllowedFontSizes[0] = 11;
- AllowedFontSizes[1] = 14;
- AllowedFontSizes[2] = 17;
- AllowedFontSizes[3] = 20;
- AllowedFontSizes[4] = 25;
- AllowedFontSizes[5] = 34;
- if (0 != ((AllowedFontSizes.Find(Size))==-1))
- {
- Distances = (AllowedFontSizes-Size).Abs();
- tuple_sort_index(Distances, &Indices);
- Size = AllowedFontSizes[HTuple(Indices[0])];
- }
- if (0 != (HTuple(Font==HTuple("mono")).Or(Font==HTuple("Courier"))))
- {
- Font = "courier";
- }
- else if (0 != (Font==HTuple("sans")))
- {
- Font = "helvetica";
- }
- else if (0 != (Font==HTuple("serif")))
- {
- Font = "times";
- }
- if (0 != (Bold==HTuple("true")))
- {
- Bold = "bold";
- }
- else if (0 != (Bold==HTuple("false")))
- {
- Bold = "medium";
- }
- else
- {
- Exception = "Wrong value of control parameter Bold";
- throw HException(Exception);
- }
- if (0 != (Slant==HTuple("true")))
- {
- if (0 != (Font==HTuple("times")))
- {
- Slant = "i";
- }
- else
- {
- Slant = "o";
- }
- }
- else if (0 != (Slant==HTuple("false")))
- {
- Slant = "r";
- }
- else
- {
- Exception = "Wrong value of control parameter Slant";
- throw HException(Exception);
- }
- try
- {
- set_font(WindowHandle, ((((((("-adobe-"+Font)+"-")+Bold)+"-")+Slant)+"-normal-*-")+Size)+"-*-*-*-*-*-*-*");
- }
- // catch (Exception)
- catch (HException &HDevExpDefaultException)
- {
- HDevExpDefaultException.ToHTuple(&Exception);
- throw HException(Exception);
- }
- }
- return;
- }
- #ifndef NO_EXPORT_MAIN
- // Main procedure
- void action()
- {
- using namespace Halcon;
- // Local iconic variables
- Hobject Clip, Dark, Single, Selected;
- // Local control variables
- HTuple Width, Height, WindowID, Phi, Area, Row;
- HTuple Column, Length, i;
- //clip.hdev: Orientation of clips
- //
- // dev_update_window(...); only in hdevelop
- read_image(&Clip, "clip");
- get_image_size(Clip, &Width, &Height);
- if (HDevWindowStack::IsOpen())
- close_window(HDevWindowStack::Pop());
- set_window_attr("background_color","black");
- open_window(0,0,Width/2,Height/2,0,"","",&WindowID);
- HDevWindowStack::Push(WindowID);
- if (HDevWindowStack::IsOpen())
- disp_obj(Clip, HDevWindowStack::GetActive());
- set_display_font(WindowID, 14, "mono", "true", "false");
- disp_continue_message(WindowID, "black", "true");
- // stop(); only in hdevelop
- bin_threshold(Clip, &Dark);
- connection(Dark, &Single);
- select_shape(Single, &Selected, "area", "and", 5000, 10000);
- if (HDevWindowStack::IsOpen())
- set_draw(HDevWindowStack::GetActive(),"fill");
- if (HDevWindowStack::IsOpen())
- set_colored(HDevWindowStack::GetActive(),12);
- if (HDevWindowStack::IsOpen())
- disp_obj(Selected, HDevWindowStack::GetActive());
- disp_continue_message(WindowID, "black", "true");
- // stop(); only in hdevelop
- if (HDevWindowStack::IsOpen())
- disp_obj(Clip, HDevWindowStack::GetActive());
- if (HDevWindowStack::IsOpen())
- set_color(HDevWindowStack::GetActive(),"green");
- if (HDevWindowStack::IsOpen())
- disp_obj(Selected, HDevWindowStack::GetActive());
- orientation_region(Selected, &Phi);
- area_center(Selected, &Area, &Row, &Column);
- if (HDevWindowStack::IsOpen())
- set_line_width(HDevWindowStack::GetActive(),3);
- if (HDevWindowStack::IsOpen())
- set_draw(HDevWindowStack::GetActive(),"margin");
- Length = 80;
- for (i=0; i<=(Phi.Num())-1; i+=1)
- {
- if (HDevWindowStack::IsOpen())
- set_color(HDevWindowStack::GetActive(),"blue");
- disp_arrow(WindowID, HTuple(Row[i]), HTuple(Column[i]), HTuple(Row[i])-(Length*(HTuple(Phi[i]).Sin())),
- HTuple(Column[i])+(Length*(HTuple(Phi[i]).Cos())), 4);
- disp_message(WindowID, ((HTuple(Phi[i]).Deg()).ToString("3.1f"))+" deg", "image",
- HTuple(Row[i]), HTuple(Column[i])-100, "black", "false");
- }
- // dev_update_window(...); only in hdevelop
- }
- #ifndef NO_EXPORT_APP_MAIN
- int main(int argc, char *argv[])
- {
- using namespace Halcon;
- // Default settings used in HDevelop (can be omitted)
- set_system("do_low_error","false");
- action();
- return 0;
- }
- #endif
- #endif
第二步:打开VC6.0建立项目
然后配置链接如下: