Halcon is a very good image processing software (German things, do very powerful, the integration of many algorithms inside, you can do this for a lifetime), but the good, Cognex, keyence is also very cool, but the Japanese thing is generally too closed, the cock silk can not afford, also used, It's hard to use it. DIY (we study halcon because he is just a PC platform image processing library, whether you use C # or C++,qt,java can develop their own programs, with the camera to do the project, not by the various hardware and software restrictions).
Http://www.mvtec.com/products/halcon
?
Talk about Halcon, you have to talk about OpenCV, in C # also has a corresponding class library called EMGUCV, many people download, install, and then there is no then. Compared to HALCON,OPENCV is very difficult (personal feeling is only suitable for research use, although he is open source, free), if you want to quickly test the project, or to use the business of mature things (you compare the top and bottom of the two sites, obviously Eng feel a product, One is a semi-finished product of scientific research)
Http://www.emgu.com/wiki/index.php/Main_Page
?
Installation process is not introduced, you can see my attachment provided (also can own Baidu, may have updated version), after the installation is complete, open the software, and then you can directly open an Image Capture window, navigate to a folder with pictures
?
Click Insert Code to see the automatically generated code in the program editor
?
Halcon is very powerful, we remember a few basic shortcuts (you can test the constant press F6, see the effect of continuous execution of Read_image, double-click the Read_image will automatically navigate to the operator window, you can modify the parameters of this function)
F2: Program Reset
F5: Program Run
F6: Single Step operation
?
We have finished capturing the picture of the static folder, now try to directly capture the video device, switch to the Image acquisition interface, click Detect (automatically displayed as DirectShow), and then switch to the Connection page, click Connect-Capture
?
Real-time images can be captured in real-time, switching to code generation to get the same code that plays the video (F5 can run continuously to get the image of the camera)
?
Because of the limited time, we directly study the focus of this section, feature matching (that is, looking for things), open the window of the routine, enter the keyword in it, such as match, will automatically display all relevant examples, directly open this Best_match_rot_mg_clip1.hdev
?
Careful study of this program, although there are dozens of lines, but in fact, the code is like a script language, very easy to understand, usually directly first F5 look at the overall effect of the operation, you can find that he is the picture of all the paper clips found (so-called to find the characteristics of the center point, display XY coordinates and rotation angle, Draw a green arrow to indicate that it was found)
?
Let's take a look at his execution flow (F2 first Reset, then F6 to the position shown), notice that the Create_template_rot method literally means creating a template (you want to find all the images in the image, you need to set a datum template), At this point, you can see that the TemplateID of the variable window in the lower-left corner has been generated, and the xy and rotation angles of the elements found later are question marks (the question mark indicates that there is no value)
?
And then navigate to this BEST_MATH_ROT_MG function, double-click can see his input and output (although is a command, but the following parameters have included the input and output), can be easily understood as a template is created in the front, as long as the template can be taken to the specified image area to find results, Found results returned including x,y,angle,error four parameters
?
It is not easy to see the direct F5, here one step F6 can see the change of the result parameter when each paper clip is found (this example other parts of the code includes the processing of the image, like Threshold,connection,reduce_domain, We don't care about him for the time being, as long as the basic understanding of Halcon image processing complete process can be)
?
If you want to go into it, you can look at his next example, if the area of the paperclip is set to another location (if the person who specializes in image processing definitely needs to master these skills, because each individual project is not the same image, you need to understand what the different images are best suited for the most efficient combination of methods. The most accurate match, each time the demand is not the same, perhaps this time is grasping the middle of the paper clip, the next is the head, and then the next only find the most matching front three)
?
How do we customize features? Be sure to customize the draw rectangle instead of the rectangular window we set ourselves. Halcon provides us with two methods of drawing rectangles, draw_rectangle1 and draw_rectangle2, we can directly enter part of the code in the Operator window, and then let him automatically complete, after the completion of attention to the parameters of the pair (whether or not with direction, Just the input parameters are different, the last corresponding Gen_rectangle1 and gen_rectangle2 can be the specific parameters to get and then generate rectangle this thing, the next steps are the same)
?
Test the method of drawing a rectangle without a direction (the left mouse button to drag a red box, right-end drawing, whether you press F6 single step or F5 continuous, the execution to this step must be finished before the execution, then this image can be rotated regardless of how to find the template we set the XY and direction)
?
Test the rectangle with the direction (also the left mouse button box, the mouse on the Blue Cross set the origin, and then put to the red width and height can set the size of the rectangle, put on the green Arrow can set the initial direction, the other operation as above)
?
?
For more instructional videos and downloads, please pay attention to the following information:
My Youku Space:
Http://i.youku.com/acetaohai123
?
My online forum:
http://csrobot.gz01.bdysite.com/
?
Problem Exchange:
qq:910358960
Email:[email protected]
?
?
?
?
C # application video Tutorial 3.2 Halcon software test