A ball routine takes you into the Halcon world

Source: Internet
Author: User
* This routine is from the built-in Halcon routine. Open Halcon-> Ctrl + e open the routine-enter ball added by xiejl in the search box.
* Ball. hdev: Inspection of Ball Bonding * dev_update_window ('off') dev_close_window () dev_open_window (0, 0,728,512, 'black', windowid) read_image (bond, 'Die/die_03 ') dev_display (bond) set_display_font (windowid, 14, 'mono', 'true', 'false') disp_continue_message (windowid, 'black', 'true') Stop () threshold (bond, bright, 100,255) shape_trans (bright, die, 'rectangle2') dev_set_color ('green') dev_set_line_width (3) dev_set_draw ('margin ') dev_display (die) disp_continue_message (windowid, 'black', 'true') Stop () performance_domain (bond, die, diegrey) threshold (diegrey, wires, 0, 50) fill_up_shape (wires, wiresfilled, 'area ', 1,100) dev_display (bond) dev_set_draw ('fill') dev_set_color ('red') dev_display (wiresfilled) disp_continue_message (windowid, 'black', 'true ') stop () opening_circle (wiresfilled, bils, 15.5) dev_set_color ('green') dev_display (bils) disp_continue_message (windowid, 'black', 'true') Stop () connection (bils, singlebils) select_shape (singlebils, intermediatebils, 'circularity ', 'and', 0.85, 1.0) sort_region (intermediatebils, finalbils, 'First _ point', 'true', 'column ') dev_display (bond) dev_set_colored (12) dev_display (finalbils) disp_continue_message (windowid, 'black', 'true') Stop () smallest_circle (finalbils, row, column, radius) numbils: = | radius | diameter: = 2 * radiusmeandiameter: = sum (diameter)/numballsmimdiameter: = min (diameter) dev_display (bond) disp_circle (windowid, row, column, radius) dev_set_color ('white') for I: = 1 to numballby 1 If (fmod (I, 2) = 1) disp_message (windowid, 'd: '+ diameter [I-1], 'image', row [I-1]-2.7 * radius [I-1], max ([column [I-1]-60, 0]), 'white', 'false ') else disp_message (windowid, 'd: '+ diameter [I-1], 'image', row [I-1] + 1.2 * radius [I-1], max ([column [I-1]-60, 0]), 'white', 'false') endifendfor * dump_window (windowid, 'tiff _ RGB ','. /ball ') dev_set_color ('green') dev_update_window ('on') disp_continue_message (windowid, 'black', 'true') Stop () dev_close_window ()

 

We can see that the processing of the image is code other than red, with few words.

Let's take a look at the code in the red part:

Dev_update_window: This is what we say in the help document-this operator determines whether all graph objects returned by one of the other operators are displayed on the active graph window ('on' is the default parameter, indicates that the update is enabled, and 'off' indicates that the update is disabled. All updates are manually enabled ). The selection of parameters does not affect the execution of the output object in a single step. After the execution, the graphic output object can still be displayed in the active graphic window. The parameter selection should be set to 'off'. We should manually call the operator only when the selected graphic object should be displayed in the graphic window: the dev_display operator displays this object (including image, xld, region, and other graphic objects ). Do you understand? Haha

Dev_close_window: this is a simple internal function in Halcon. It is used to close the graphic display window. Of course, we can open the graphic window through the menu bar-> window-of hdevelop to open multiple graphic windows.

Dev_open_window: this is nothing to say, that is, re-open the closed graph window above.

Dev_display: If we close window update by calling the dev_update_window ('off') statement, we must manually call dev_display () to display objects (such as imag, region, (xld ).

Stop: this should be the simplest statement in Halcon. It is equivalent to system ("pause") in C, so that the program is paused, in this case, we can observe the Variable Window (display graphical variables and control variables), debug programs, and so on.

Dev_set_color: before talking about the meaning of this sentence, we can use the hdevelop menu bar-> visualization-> color to achieve the same effect as this sentence, which may help you understand the meaning of dev_set_color, in fact, it is to set the color of the image (image, region, xld, etc.) in the graphic display window. This internal operation is complementary to the dev_set_colored mentioned below. Debugging is very useful.

Dev_set_colored: Same as above, we can achieve the same effect as this sentence through the number of colors in the menu bar-Visual-color of hdevelop. When we debug the program, after processing through the connection operator, obtain the connection domain of the region and divide the region into different region blocks, this function allows us to adjust and observe region colors.

Dev_set_line_width: Same as above, you can set the width of the line through the menu bar-> visual-> of hdevelop for debugging, for example, when observing xld.

Dev_continue_message: displays the continue message in the graphic window.

 

 

  Halcon has so many internal operations. Let's talk about operators and external functions later by xiejl

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.