请选择 进入手机版 | 继续访问电脑版

Hello Mat

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 397|回复: 0

特征集calculate_feature_set

[复制链接]

754

主题

893

帖子

2万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
29864
发表于 2019-7-22 22:36:37 | 显示全部楼层 |阅读模式
参考例子:C:\Users\Public\Documents\MVTec\HALCON-12.0\examples\hdevelop\Applications\Object-Recognition-2D\classify_pills_auto_select_features.hdev
  1. * *********************************************************
  2. * Feature procedure
  3. * Contains the names, properties and calculation of
  4. * all supproted features.
  5. * It consists of similar blocks for each feature.
  6. *
  7. * If you like to add your own features, please use
  8. * the external procedure get_custom_features.hdvp
  9. * in the HALCON procedures/templates directory.
  10. * *********************************************************
  11. *
  12. * Insert location of your custom procedure here
  13. *
  14. get_system ('empty_region_result', EmptyRegionResult)
  15. set_system ('empty_region_result', 'true')
  16. AccumulatedResults := []
  17. CustomResults := []
  18. count_obj (Region, NumRegions)
  19. get_image_size (Image, ImageWidth, ImageHeight)
  20. *
  21. for I := 0 to |Namelist| - 1 by 1
  22.     CurrentName := Namelist[I]
  23.     *
  24.     get_custom_features (Region, Image, CurrentName, Mode, CustomResults)
  25.     AccumulatedResults := [AccumulatedResults,CustomResults]
  26.     *
  27.     *
  28.     * ************************************
  29.     * HALCON REGION FEATURES
  30.     * ************************************
  31.     *
  32.     * ************************************
  33.     * BASIC
  34.     * ************************************
  35.     * ** area ***
  36.     Name := 'area'
  37.     Groups := ['region','rot_invar']
  38.     * ****************
  39.     if (Name == CurrentName)
  40.         * ** Calculate feature ***
  41.         area_center (Region, Feature, _, _)
  42.         * *************************
  43.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  44.         AccumulatedResults := ExtendedResults
  45.     endif
  46.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  47.     AccumulatedResults := ExtendedResults
  48.     * ************************************
  49.     *
  50.     * ************************************
  51.     * ** width ***
  52.     Name := 'width'
  53.     Groups := 'region'
  54.     * *************
  55.     if (Name == CurrentName)
  56.         * ** Calculate feature ***
  57.         smallest_rectangle1 (Region, Row1, Column1, Row2, Column2)
  58.         Feature := Column2 - Column1 + 1
  59.         * *************************
  60.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  61.         AccumulatedResults := ExtendedResults
  62.     endif
  63.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  64.     AccumulatedResults := ExtendedResults
  65.     * ************************************
  66.     *
  67.     * ************************************
  68.     * ** height ***
  69.     Name := 'height'
  70.     Groups := 'region'
  71.     * *************
  72.     if (Name == CurrentName)
  73.         * ** Calculate feature ***
  74.         smallest_rectangle1 (Region, Row1, Column1, Row2, Column2)
  75.         Feature := Row2 - Row1 + 1
  76.         * *************************
  77.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  78.         AccumulatedResults := ExtendedResults
  79.     endif
  80.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  81.     AccumulatedResults := ExtendedResults
  82.     * ************************************
  83.     *
  84.     * ************************************
  85.     * ** ra ***
  86.     Name := 'ra'
  87.     Groups := ['region','rot_invar']
  88.     * *************
  89.     if (Name == CurrentName)
  90.         * ** Calculate feature ***
  91.         elliptic_axis (Region, Ra, Rb, Phi)
  92.         Feature := Ra
  93.         * *************************
  94.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  95.         AccumulatedResults := ExtendedResults
  96.     endif
  97.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  98.     AccumulatedResults := ExtendedResults
  99.     * ************************************
  100.     *
  101.     * ************************************
  102.     * ** rb ***
  103.     Name := 'rb'
  104.     Groups := ['region','rot_invar']
  105.     * *************
  106.     if (Name == CurrentName)
  107.         * ** Calculate feature ***
  108.         elliptic_axis (Region, Ra, Rb, Phi)
  109.         Feature := Rb
  110.         * *************************
  111.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  112.         AccumulatedResults := ExtendedResults
  113.     endif
  114.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  115.     AccumulatedResults := ExtendedResults
  116.     * ************************************
  117.     *
  118.     * ************************************
  119.     * ** phi ***
  120.     Name := 'phi'
  121.     Groups := ['region','scale_invar']
  122.     * *************
  123.     if (Name == CurrentName)
  124.         * ** Calculate feature ***
  125.         elliptic_axis (Region, Ra, Rb, Phi)
  126.         Feature := Phi
  127.         * *************************
  128.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  129.         AccumulatedResults := ExtendedResults
  130.     endif
  131.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  132.     AccumulatedResults := ExtendedResults
  133.     * ************************************
  134.     *
  135.     * ************************************
  136.     * ** roundness ***
  137.     Name := 'roundness'
  138.     Groups := ['region','rot_invar','scale_invar']
  139.     * *************
  140.     if (Name == CurrentName)
  141.         * ** Calculate feature ***
  142.         roundness (Region, Distance, Sigma, Roundness, Sides)
  143.         Feature := Roundness
  144.         * *************************
  145.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  146.         AccumulatedResults := ExtendedResults
  147.     endif
  148.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  149.     AccumulatedResults := ExtendedResults
  150.     * ************************************
  151.     *
  152.     * ************************************
  153.     * ** num_sides ***
  154.     Name := 'num_sides'
  155.     Groups := ['region','rot_invar','scale_invar']
  156.     * *************
  157.     if (Name == CurrentName)
  158.         * ** Calculate feature ***
  159.         roundness (Region, Distance, Sigma, Roundness, Sides)
  160.         Feature := Sides
  161.         * *************************
  162.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  163.         AccumulatedResults := ExtendedResults
  164.     endif
  165.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  166.     AccumulatedResults := ExtendedResults
  167.     * ************************************
  168.     *
  169.     * ************************************
  170.     * ** num_connected ***
  171.     Name := 'num_connected'
  172.     Groups := ['region','rot_invar','scale_invar']
  173.     * *************
  174.     if (Name == CurrentName)
  175.         * ** Calculate feature ***
  176.         connect_and_holes (Region, NumConnected, NumHoles)
  177.         Feature := NumConnected
  178.         * *************************
  179.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  180.         AccumulatedResults := ExtendedResults
  181.     endif
  182.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  183.     AccumulatedResults := ExtendedResults
  184.     * ************************************
  185.     *
  186.     * ************************************
  187.     * ** num_holes ***
  188.     Name := 'num_holes'
  189.     Groups := ['region','rot_invar','scale_invar']
  190.     * *************
  191.     if (Name == CurrentName)
  192.         * ** Calculate feature ***
  193.         connect_and_holes (Region, NumConnected, NumHoles)
  194.         Feature := NumHoles
  195.         * *************************
  196.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  197.         AccumulatedResults := ExtendedResults
  198.     endif
  199.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  200.     AccumulatedResults := ExtendedResults
  201.     * ************************************
  202.     *
  203.     * ************************************
  204.     * ** area_holes ***
  205.     Name := 'area_holes'
  206.     Groups := ['region','rot_invar']
  207.     * *************
  208.     if (Name == CurrentName)
  209.         * ** Calculate feature ***
  210.         area_holes (Region, Feature)
  211.         * *************************
  212.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  213.         AccumulatedResults := ExtendedResults
  214.     endif
  215.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  216.     AccumulatedResults := ExtendedResults
  217.     * ************************************
  218.     *
  219.     * ************************************
  220.     * ** max_diameter ***
  221.     Name := 'max_diameter'
  222.     Groups := ['region','rot_invar']
  223.     * *************
  224.     if (Name == CurrentName)
  225.         * ** Calculate feature ***
  226.         diameter_region (Region, Row1, Column1, Row2, Column2, Diameter)
  227.         Feature := Diameter
  228.         * *************************
  229.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  230.         AccumulatedResults := ExtendedResults
  231.     endif
  232.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  233.     AccumulatedResults := ExtendedResults
  234.     * ************************************
  235.     *
  236.     * ************************************
  237.     * ** orientation ***
  238.     Name := 'orientation'
  239.     Groups := ['region','scale_invar']
  240.     * *************
  241.     if (Name == CurrentName)
  242.         * ** Calculate feature ***
  243.         orientation_region (Region, Feature)
  244.         * *************************
  245.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  246.         AccumulatedResults := ExtendedResults
  247.     endif
  248.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  249.     AccumulatedResults := ExtendedResults
  250.     * ************************************
  251.     *
  252.     * ************************************
  253.     * SHAPE
  254.     * ************************************
  255.     *
  256.     * ************************************
  257.     * ** outer_radius ***
  258.     Name := 'outer_radius'
  259.     Groups := ['region','rot_invar']
  260.     * *************
  261.     if (Name == CurrentName)
  262.         * ** Calculate feature ***
  263.         smallest_circle (Region, Row, Column, Feature)
  264.         * *************************
  265.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  266.         AccumulatedResults := ExtendedResults
  267.     endif
  268.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  269.     AccumulatedResults := ExtendedResults
  270.     * ************************************
  271.     *
  272.     * ************************************
  273.     * ** inner_radius ***
  274.     Name := 'inner_radius'
  275.     Groups := ['region','rot_invar']
  276.     * *************
  277.     if (Name == CurrentName)
  278.         * ** Calculate feature ***
  279.         inner_circle (Region, Row, Column, Feature)
  280.         * *************************
  281.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  282.         AccumulatedResults := ExtendedResults
  283.     endif
  284.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  285.     AccumulatedResults := ExtendedResults
  286.     * ************************************
  287.     *
  288.     * ************************************
  289.     * ** inner_width ***
  290.     Name := 'inner_width'
  291.     Groups := 'region'
  292.     * *************
  293.     if (Name == CurrentName)
  294.         * ** Calculate feature ***
  295.         inner_rectangle1 (Region, Row1, Column1, Row2, Column2)
  296.         Feature := Column2 - Column1 + 1
  297.         * *************************
  298.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  299.         AccumulatedResults := ExtendedResults
  300.     endif
  301.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  302.     AccumulatedResults := ExtendedResults
  303.     * ************************************
  304.     *
  305.     * ************************************
  306.     * ** inner_height ***
  307.     Name := 'inner_height'
  308.     Groups := 'region'
  309.     * *************
  310.     if (Name == CurrentName)
  311.         * ** Calculate feature ***
  312.         inner_rectangle1 (Region, Row1, Column1, Row2, Column2)
  313.         Feature := Row2 - Row1 + 1
  314.         * *************************
  315.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  316.         AccumulatedResults := ExtendedResults
  317.     endif
  318.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  319.     AccumulatedResults := ExtendedResults
  320.     *
  321.     * ************************************
  322.     *
  323.     * ************************************
  324.     * ** circularity ***
  325.     Name := 'circularity'
  326.     Groups := ['region','rot_invar','scale_invar']
  327.     * *************
  328.     if (Name == CurrentName)
  329.         * ** Calculate feature ***
  330.         circularity (Region, Feature)
  331.         * *************************
  332.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  333.         AccumulatedResults := ExtendedResults
  334.     endif
  335.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  336.     AccumulatedResults := ExtendedResults
  337.     *
  338.     * ************************************
  339.     *
  340.     * ************************************
  341.     * ** compactness ***
  342.     Name := 'compactness'
  343.     Groups := ['region','rot_invar','scale_invar']
  344.     * *************
  345.     if (Name == CurrentName)
  346.         * ** Calculate feature ***
  347.         compactness (Region, Feature)
  348.         * *************************
  349.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  350.         AccumulatedResults := ExtendedResults
  351.     endif
  352.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  353.     AccumulatedResults := ExtendedResults
  354.     *
  355.     * ************************************
  356.     *
  357.     * ************************************
  358.     * ** convexity ***
  359.     Name := 'convexity'
  360.     Groups := ['region','rot_invar','scale_invar']
  361.     * *************
  362.     if (Name == CurrentName)
  363.         * ** Calculate feature ***
  364.         convexity (Region, Feature)
  365.         * *************************
  366.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  367.         AccumulatedResults := ExtendedResults
  368.     endif
  369.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  370.     AccumulatedResults := ExtendedResults
  371.     *
  372.     * ************************************
  373.     *
  374.     * ************************************
  375.     * ** rectangularity ***
  376.     Name := 'rectangularity'
  377.     Groups := ['region','rot_invar','scale_invar']
  378.     * *************
  379.     if (Name == CurrentName)
  380.         * ** Calculate feature ***
  381.         rectangularity (Region, Feature)
  382.         * *************************
  383.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  384.         AccumulatedResults := ExtendedResults
  385.     endif
  386.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  387.     AccumulatedResults := ExtendedResults
  388.     *
  389.     * ************************************
  390.     *
  391.     * ************************************
  392.     * ** anisometry ***
  393.     Name := 'anisometry'
  394.     Groups := ['region','rot_invar','scale_invar']
  395.     * *************
  396.     if (Name == CurrentName)
  397.         * ** Calculate feature ***
  398.         eccentricity (Region, Anisometry, Bulkiness, StructureFactor)
  399.         Feature := Anisometry
  400.         * *************************
  401.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  402.         AccumulatedResults := ExtendedResults
  403.     endif
  404.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  405.     AccumulatedResults := ExtendedResults
  406.     *
  407.     * ************************************
  408.     *
  409.     * ************************************
  410.     * ** bulkiness ***
  411.     Name := 'bulkiness'
  412.     Groups := ['region','rot_invar','scale_invar']
  413.     * *************
  414.     if (Name == CurrentName)
  415.         * ** Calculate feature ***
  416.         eccentricity (Region, Anisometry, Bulkiness, StructureFactor)
  417.         Feature := Bulkiness
  418.         * *************************
  419.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  420.         AccumulatedResults := ExtendedResults
  421.     endif
  422.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  423.     AccumulatedResults := ExtendedResults
  424.     *
  425.     * ************************************
  426.     *
  427.     * ************************************
  428.     * ** struct_factor ***
  429.     Name := 'struct_factor'
  430.     Groups := ['region','rot_invar','scale_invar']
  431.     * *************
  432.     if (Name == CurrentName)
  433.         * ** Calculate feature ***
  434.         eccentricity (Region, Anisometry, Bulkiness, StructureFactor)
  435.         Feature := StructureFactor
  436.         * *************************
  437.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  438.         AccumulatedResults := ExtendedResults
  439.     endif
  440.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  441.     AccumulatedResults := ExtendedResults
  442.     *
  443.     * ************************************
  444.     *
  445.     * ************************************
  446.     * ** dist_mean ***
  447.     Name := 'dist_mean'
  448.     Groups := ['region','rot_invar']
  449.     * *************
  450.     if (Name == CurrentName)
  451.         * ** Calculate feature ***
  452.         roundness (Region, Distance, Sigma, Roundness, Sides)
  453.         Feature := Distance
  454.         * *************************
  455.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  456.         AccumulatedResults := ExtendedResults
  457.     endif
  458.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  459.     AccumulatedResults := ExtendedResults
  460.     *
  461.     * ************************************
  462.     *
  463.     * ************************************
  464.     * ** dist_deviation ***
  465.     Name := 'dist_deviation'
  466.     Groups := ['region','rot_invar']
  467.     * *************
  468.     if (Name == CurrentName)
  469.         * ** Calculate feature ***
  470.         roundness (Region, Distance, Sigma, Roundness, Sides)
  471.         Feature := Sigma
  472.         * *************************
  473.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  474.         AccumulatedResults := ExtendedResults
  475.     endif
  476.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  477.     AccumulatedResults := ExtendedResults
  478.     *
  479.     * ************************************
  480.     *
  481.     * ************************************
  482.     * ** euler_number ***
  483.     Name := 'euler_number'
  484.     Groups := ['region','rot_invar','scale_invar']
  485.     * *************
  486.     if (Name == CurrentName)
  487.         * ** Calculate feature ***
  488.         euler_number (Region, Feature)
  489.         * *************************
  490.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  491.         AccumulatedResults := ExtendedResults
  492.     endif
  493.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  494.     AccumulatedResults := ExtendedResults
  495.     *
  496.     * ************************************
  497.     *
  498.     * ************************************
  499.     * ** rect2_phi ***
  500.     Name := 'rect2_phi'
  501.     Groups := ['region','scale_invar']
  502.     * *************
  503.     if (Name == CurrentName)
  504.         * ** Calculate feature ***
  505.         smallest_rectangle2 (Region, Row, Column, Phi, Length1, Length2)
  506.         Feature := Phi
  507.         * *************************
  508.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  509.         AccumulatedResults := ExtendedResults
  510.     endif
  511.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  512.     AccumulatedResults := ExtendedResults
  513.     *
  514.     * ************************************
  515.     *
  516.     * ************************************
  517.     * ** rect2_len1 ***
  518.     Name := 'rect2_len1'
  519.     Groups := ['region','rot_invar']
  520.     * *************
  521.     if (Name == CurrentName)
  522.         * ** Calculate feature ***
  523.         smallest_rectangle2 (Region, Row, Column, Phi, Length1, Length2)
  524.         Feature := Length1
  525.         * *************************
  526.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  527.         AccumulatedResults := ExtendedResults
  528.     endif
  529.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  530.     AccumulatedResults := ExtendedResults
  531.     *
  532.     * ************************************
  533.     *
  534.     * ************************************
  535.     * ** rect2_len2 ***
  536.     Name := 'rect2_len2'
  537.     Groups := ['region','rot_invar']
  538.     * *************
  539.     if (Name == CurrentName)
  540.         * ** Calculate feature ***
  541.         smallest_rectangle2 (Region, Row, Column, Phi, Length1, Length2)
  542.         Feature := Length2
  543.         * *************************
  544.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  545.         AccumulatedResults := ExtendedResults
  546.     endif
  547.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  548.     AccumulatedResults := ExtendedResults
  549.     *
  550.     * ************************************
  551.     *
  552.     * ************************************
  553.     * ** contlength ***
  554.     Name := 'contlength'
  555.     Groups := ['region','rot_invar']
  556.     * *************
  557.     if (Name == CurrentName)
  558.         * ** Calculate feature ***
  559.         contlength (Region, ContLength)
  560.         Feature := ContLength
  561.         * *************************
  562.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  563.         AccumulatedResults := ExtendedResults
  564.     endif
  565.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  566.     AccumulatedResults := ExtendedResults
  567.     *
  568.     * ************************************
  569.     * REGION FEATURES
  570.     * ************************************
  571.     * MISC
  572.     * ************************************
  573.     * ** porosity ***
  574.     Name := 'porosity'
  575.     Groups := ['region','rot_invar','scale_invar']
  576.     * *************
  577.     if (Name == CurrentName)
  578.         * ** Calculate feature ***
  579.         area_holes (Region, AreaHoles)
  580.         area_center (Region, Area, Row, Column)
  581.         if (Area == 0)
  582.             Feature := 0.0
  583.         else
  584.             Feature := real(AreaHoles) / (Area + AreaHoles)
  585.         endif
  586.         * *************************
  587.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  588.         AccumulatedResults := ExtendedResults
  589.     endif
  590.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  591.     AccumulatedResults := ExtendedResults
  592.     *
  593.     * ************************************
  594.     * HALCON GRAY VALUE FEATURES
  595.     * ************************************
  596.     * BASIC
  597.     * ************************************
  598.     *
  599.     * ** gray_area ***
  600.     Name := 'gray_area'
  601.     Groups := ['gray','rot_invar']
  602.     * ****************
  603.     if (Name == CurrentName)
  604.         * ** Calculate feature ***
  605.         area_center_gray (Region, Image, Area, Row, Column)
  606.         Feature := Area
  607.         * *************************
  608.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  609.         AccumulatedResults := ExtendedResults
  610.     endif
  611.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  612.     AccumulatedResults := ExtendedResults
  613.     * ************************************
  614.     *
  615.     * ************************************
  616.     * ** gray_ra ***
  617.     Name := 'gray_ra'
  618.     Groups := ['gray','rot_invar']
  619.     * ****************
  620.     if (Name == CurrentName)
  621.         * ** Calculate feature ***
  622.         elliptic_axis_gray (Region, Image, Ra, Rb, Phi)
  623.         Feature := Ra
  624.         * *************************
  625.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  626.         AccumulatedResults := ExtendedResults
  627.     endif
  628.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  629.     AccumulatedResults := ExtendedResults
  630.     * ************************************
  631.     *
  632.     * ************************************
  633.     * ** gray_rb ***
  634.     Name := 'gray_rb'
  635.     Groups := ['gray','rot_invar']
  636.     * ****************
  637.     if (Name == CurrentName)
  638.         * ** Calculate feature ***
  639.         elliptic_axis_gray (Region, Image, Ra, Rb, Phi)
  640.         Feature := Rb
  641.         * *************************
  642.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  643.         AccumulatedResults := ExtendedResults
  644.     endif
  645.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  646.     AccumulatedResults := ExtendedResults
  647.     * ************************************
  648.     *
  649.     * ************************************
  650.     * ** gray_phi ***
  651.     Name := 'gray_phi'
  652.     Groups := ['gray','scale_invar']
  653.     * ****************
  654.     if (Name == CurrentName)
  655.         * ** Calculate feature ***
  656.         elliptic_axis_gray (Region, Image, Ra, Rb, Phi)
  657.         Feature := Phi
  658.         * *************************
  659.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  660.         AccumulatedResults := ExtendedResults
  661.     endif
  662.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  663.     AccumulatedResults := ExtendedResults
  664.     * ************************************
  665.     *
  666.     * ************************************
  667.     * ** gray_min ***
  668.     Name := 'gray_min'
  669.     Groups := ['gray','rot_invar','scale_invar']
  670.     * ****************
  671.     if (Name == CurrentName)
  672.         * ** Calculate feature ***
  673.         min_max_gray (Region, Image, 0, Min, Max, Range)
  674.         Feature := Min
  675.         * *************************
  676.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  677.         AccumulatedResults := ExtendedResults
  678.     endif
  679.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  680.     AccumulatedResults := ExtendedResults
  681.     * ************************************
  682.     *
  683.     * ************************************
  684.     * ** gray_max ***
  685.     Name := 'gray_max'
  686.     Groups := ['gray','rot_invar','scale_invar']
  687.     * ****************
  688.     if (Name == CurrentName)
  689.         * ** Calculate feature ***
  690.         min_max_gray (Region, Image, 0, Min, Max, Range)
  691.         Feature := Max
  692.         * *************************
  693.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  694.         AccumulatedResults := ExtendedResults
  695.     endif
  696.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  697.     AccumulatedResults := ExtendedResults
  698.     * ************************************
  699.     *
  700.     * ************************************
  701.     * ** gray_range ***
  702.     Name := 'gray_range'
  703.     Groups := ['gray','rot_invar','scale_invar']
  704.     * ****************
  705.     if (Name == CurrentName)
  706.         * ** Calculate feature ***
  707.         min_max_gray (Region, Image, 0, Min, Max, Range)
  708.         Feature := Range
  709.         * *************************
  710.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  711.         AccumulatedResults := ExtendedResults
  712.     endif
  713.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  714.     AccumulatedResults := ExtendedResults
  715.     * ************************************
  716.     *
  717.     * ************************************
  718.     * TEXTURE
  719.     * ************************************
  720.     *
  721.     * ************************************
  722.     * ** gray_mean ***
  723.     Name := 'gray_mean'
  724.     Groups := ['gray','texture','rot_invar','scale_invar']
  725.     * ****************
  726.     if (Name == CurrentName)
  727.         * ** Calculate feature ***
  728.         intensity (Region, Image, Mean, Deviation)
  729.         Feature := Mean
  730.         * *************************
  731.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  732.         AccumulatedResults := ExtendedResults
  733.     endif
  734.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  735.     AccumulatedResults := ExtendedResults
  736.     * ************************************
  737.     *
  738.     * ************************************
  739.     * ** gray_deviation ***
  740.     Name := 'gray_deviation'
  741.     Groups := ['gray','texture','rot_invar','scale_invar']
  742.     * ****************
  743.     if (Name == CurrentName)
  744.         * ** Calculate feature ***
  745.         intensity (Region, Image, Mean, Deviation)
  746.         Feature := Deviation
  747.         * *************************
  748.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  749.         AccumulatedResults := ExtendedResults
  750.     endif
  751.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  752.     AccumulatedResults := ExtendedResults
  753.     * ************************************
  754.     *
  755.     * ************************************
  756.     * ** gray_plane_deviation ***
  757.     Name := 'gray_plane_deviation'
  758.     Groups := ['gray','texture','rot_invar','scale_invar']
  759.     * ****************
  760.     if (Name == CurrentName)
  761.         * ** Calculate feature ***
  762.         plane_deviation (Region, Image, Feature)
  763.         * *************************
  764.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  765.         AccumulatedResults := ExtendedResults
  766.     endif
  767.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  768.     AccumulatedResults := ExtendedResults
  769.     * ************************************
  770.     *
  771.     * ************************************
  772.     * ** gray_anisotropy ***
  773.     Name := 'gray_anisotropy'
  774.     Groups := ['gray','texture','rot_invar','scale_invar']
  775.     * ****************
  776.     if (Name == CurrentName)
  777.         * ** Calculate feature ***
  778.         entropy_gray (Region, Image, Entropy, Anisotropy)
  779.         Feature := Anisotropy
  780.         * *************************
  781.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  782.         AccumulatedResults := ExtendedResults
  783.     endif
  784.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  785.     AccumulatedResults := ExtendedResults
  786.     * ************************************
  787.     *
  788.     * ************************************
  789.     * ** gray_entropy ***
  790.     Name := 'gray_entropy'
  791.     Groups := ['gray','texture','rot_invar','scale_invar']
  792.     * ****************
  793.     if (Name == CurrentName)
  794.         * ** Calculate feature ***
  795.         entropy_gray (Region, Image, Entropy, Anisotropy)
  796.         Feature := Entropy
  797.         * *************************
  798.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  799.         AccumulatedResults := ExtendedResults
  800.     endif
  801.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  802.     AccumulatedResults := ExtendedResults
  803.     * ************************************
  804.     *
  805.     * ************************************
  806.     * ** gray_hor_proj ***
  807.     Name := 'gray_hor_proj'
  808.     Groups := ['gray','texture','scale_invar']
  809.     * ****************
  810.     if (Name == CurrentName)
  811.         * ** Calculate feature ***
  812.         Size := 20
  813.         calc_feature_gray_proj (Region, Image, 'hor', Size, Feature)
  814.         * *************************
  815.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  816.         AccumulatedResults := ExtendedResults
  817.     endif
  818.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  819.     AccumulatedResults := ExtendedResults
  820.     * ************************************
  821.     *
  822.     * ************************************
  823.     * ** gray_vert_proj ***
  824.     Name := 'gray_vert_proj'
  825.     Groups := ['gray','texture','scale_invar']
  826.     * ****************
  827.     if (Name == CurrentName)
  828.         * ** Calculate feature ***
  829.         Size := 20
  830.         calc_feature_gray_proj (Region, Image, 'vert', Size, Feature)
  831.         * *************************
  832.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  833.         AccumulatedResults := ExtendedResults
  834.     endif
  835.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  836.     AccumulatedResults := ExtendedResults
  837.     * ************************************
  838.     *
  839.     * ************************************
  840.     * ** gray_hor_proj_histo ***
  841.     Name := 'gray_hor_proj_histo'
  842.     Groups := ['gray','texture','scale_invar']
  843.     * ****************
  844.     if (Name == CurrentName)
  845.         * ** Calculate feature ***
  846.         Size := 20
  847.         calc_feature_gray_proj (Region, Image, 'hor_histo', Size, Feature)
  848.         * *************************
  849.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  850.         AccumulatedResults := ExtendedResults
  851.     endif
  852.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  853.     AccumulatedResults := ExtendedResults
  854.     * ************************************
  855.     *
  856.     * ************************************
  857.     * ** gray_vert_proj_histo ***
  858.     Name := 'gray_vert_proj_histo'
  859.     Groups := ['gray','texture','scale_invar']
  860.     * ****************
  861.     if (Name == CurrentName)
  862.         * ** Calculate feature ***
  863.         Size := 20
  864.         calc_feature_gray_proj (Region, Image, 'vert_histo', Size, Feature)
  865.         * *************************
  866.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  867.         AccumulatedResults := ExtendedResults
  868.     endif
  869.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  870.     AccumulatedResults := ExtendedResults
  871.     * ************************************
  872.     *
  873.     * ************************************
  874.     * ** grad_dir_histo ***
  875.     Name := 'grad_dir_histo'
  876.     Groups := ['gray','texture']
  877.     * ****************
  878.     if (Name == CurrentName)
  879.         * ** Calculate feature ***
  880.         NumBins := 20
  881.         calc_feature_grad_dir_histo (Region, Image, NumBins, Feature)
  882.         * *************************
  883.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  884.         AccumulatedResults := ExtendedResults
  885.     endif
  886.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  887.     AccumulatedResults := ExtendedResults
  888.     * ************************************
  889.     *
  890.     * ************************************
  891.     * ** edge_density ***
  892.     Name := 'edge_density'
  893.     Groups := ['gray','texture','rot_invar','scale_invar']
  894.     * ****************
  895.     if (Name == CurrentName)
  896.         * ** Calculate feature ***
  897.         calc_feature_edge_density (Region, Image, Feature)
  898.         * *************************
  899.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  900.         AccumulatedResults := ExtendedResults
  901.     endif
  902.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  903.     AccumulatedResults := ExtendedResults
  904.     *
  905.     * ************************************
  906.     *
  907.     * ************************************
  908.     * ** edge_density_histogram ***
  909.     Name := 'edge_density_histogram'
  910.     Groups := ['gray','texture','rot_invar','scale_invar']
  911.     * ****************
  912.     if (Name == CurrentName)
  913.         * ** Calculate feature ***
  914.         NumBins := 4
  915.         calc_feature_edge_density_histogram (Region, Image, NumBins, Feature)
  916.         * *************************
  917.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  918.         AccumulatedResults := ExtendedResults
  919.     endif
  920.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  921.     AccumulatedResults := ExtendedResults
  922.     *
  923.     * ************************************
  924.     *
  925.     * ************************************
  926.     * ** edge_density_pyramid ***
  927.     NameRegExp := 'edge_density_pyramid_([234])'
  928.     Names := 'edge_density_pyramid_' + [2:4]
  929.     Groups := ['gray','texture','rot_invar','scale_invar']
  930.     * ****************
  931.     if (CurrentName =~ NameRegExp)
  932.         * ** Calculate feature ***
  933.         NumPyramids := number(regexp_match(CurrentName,NameRegExp))
  934.         calc_feature_pyramid (Region, Image, 'edge_density', NumPyramids, Feature)
  935.         * *************************
  936.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  937.         AccumulatedResults := ExtendedResults
  938.     endif
  939.     append_names_or_groups_pyramid (Mode, Groups, CurrentName, Names, NameRegExp, AccumulatedResults, ExtendedResults)
  940.     AccumulatedResults := ExtendedResults
  941.     *
  942.     * ************************************
  943.     *
  944.     * ************************************
  945.     * ** edge_density_histogram_pyramid ***
  946.     NameRegExp := 'edge_density_histogram_pyramid_([234])'
  947.     Names := 'edge_density_histogram_pyramid_' + [2:4]
  948.     Groups := ['gray','texture','rot_invar','scale_invar']
  949.     * ****************
  950.     if (CurrentName =~ NameRegExp)
  951.         * ** Calculate feature ***
  952.         NumPyramids := number(regexp_match(CurrentName,NameRegExp))
  953.         calc_feature_pyramid (Region, Image, 'edge_density_histogram', NumPyramids, Feature)
  954.         * *************************
  955.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  956.         AccumulatedResults := ExtendedResults
  957.     endif
  958.     append_names_or_groups_pyramid (Mode, Groups, CurrentName, Names, NameRegExp, AccumulatedResults, ExtendedResults)
  959.     AccumulatedResults := ExtendedResults
  960.     *
  961.     * ************************************
  962.     *
  963.     * ************************************
  964.     * ** cooc ***
  965.     Name := 'cooc'
  966.     Groups := ['gray','texture']
  967.     * ****************
  968.     if (Name == CurrentName)
  969.         * ** Calculate feature ***
  970.         Feature := []
  971.         cooc_feature_image (Region, Image, 6, 0, Energy, Correlation, Homogeneity, Contrast)
  972.         if (NumRegions > 0)
  973.             Index := [0:4:4 * NumRegions - 1]
  974.             Feature[Index] := Energy
  975.             Feature[1 + Index] := Correlation
  976.             Feature[2 + Index] := Homogeneity
  977.             Feature[3 + Index] := Contrast
  978.         endif
  979.         * *************************
  980.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  981.         AccumulatedResults := ExtendedResults
  982.     endif
  983.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  984.     AccumulatedResults := ExtendedResults
  985.     * ************************************
  986.     *
  987.     * ************************************
  988.     * ** cooc_pyramid ***
  989.     NameRegExp := 'cooc_pyramid_([234])'
  990.     Names := 'cooc_pyramid_' + [2:4]
  991.     Groups := ['gray','texture']
  992.     * ****************
  993.     if (CurrentName =~ NameRegExp)
  994.         * ** Calculate feature ***
  995.         NumPyramids := number(regexp_match(CurrentName,NameRegExp))
  996.         calc_feature_pyramid (Region, Image, 'cooc', NumPyramids, Feature)
  997.         * *************************
  998.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  999.         AccumulatedResults := ExtendedResults
  1000.     endif
  1001.     append_names_or_groups_pyramid (Mode, Groups, CurrentName, Names, NameRegExp, AccumulatedResults, ExtendedResults)
  1002.     AccumulatedResults := ExtendedResults
  1003.     *
  1004.     * ************************************
  1005.     *
  1006.     * ************************************
  1007.     * POLAR TRANSFORM FEATURES
  1008.     * ************************************
  1009.     *
  1010.     * ************************************
  1011.     * ** polar_gray_proj ***
  1012.     Name := 'polar_gray_proj'
  1013.     Groups := ['gray','rot_invar','scale_invar']
  1014.     * *************
  1015.     if (Name == CurrentName)
  1016.         * ** Calculate feature ***
  1017.         Width := 100
  1018.         Height := 40
  1019.         calc_feature_polar_gray_proj (Region, Image, 'hor_gray', Width, Height, Feature)
  1020.         * *************************
  1021.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  1022.         AccumulatedResults := ExtendedResults
  1023.     endif
  1024.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  1025.     AccumulatedResults := ExtendedResults
  1026.     * ************************************
  1027.     *
  1028.     * ************************************
  1029.     * ** polar_grad_proj ***
  1030.     Name := 'polar_grad_proj'
  1031.     Groups := ['gray','rot_invar','scale_invar']
  1032.     * *************
  1033.     if (Name == CurrentName)
  1034.         * ** Calculate feature ***
  1035.         Width := 100
  1036.         Height := 40
  1037.         calc_feature_polar_gray_proj (Region, Image, 'hor_sobel_amp', Width, Height, Feature)
  1038.         * *************************
  1039.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  1040.         AccumulatedResults := ExtendedResults
  1041.     endif
  1042.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  1043.     AccumulatedResults := ExtendedResults
  1044.     * ************************************
  1045.     *
  1046.     * ************************************
  1047.     * ** polar_grad_x_proj ***
  1048.     Name := 'polar_grad_x_proj'
  1049.     Groups := ['gray','rot_invar','scale_invar']
  1050.     * *************
  1051.     if (Name == CurrentName)
  1052.         * ** Calculate feature ***
  1053.         Width := 100
  1054.         Height := 40
  1055.         calc_feature_polar_gray_proj (Region, Image, 'hor_sobel_x', Width, Height, Feature)
  1056.         * *************************
  1057.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  1058.         AccumulatedResults := ExtendedResults
  1059.     endif
  1060.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  1061.     AccumulatedResults := ExtendedResults
  1062.     * ************************************
  1063.     *
  1064.     * ************************************
  1065.     * ** polar_grad_y_proj ***
  1066.     Name := 'polar_grad_y_proj'
  1067.     Groups := ['gray','rot_invar','scale_invar']
  1068.     * *************
  1069.     if (Name == CurrentName)
  1070.         * ** Calculate feature ***
  1071.         Width := 100
  1072.         Height := 40
  1073.         calc_feature_polar_gray_proj (Region, Image, 'hor_sobel_y', Width, Height, Feature)
  1074.         * *************************
  1075.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  1076.         AccumulatedResults := ExtendedResults
  1077.     endif
  1078.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  1079.     AccumulatedResults := ExtendedResults
  1080.     * ************************************
  1081.     *
  1082.     * ************************************
  1083.     * ** polar_gray_proj_histo ***
  1084.     Name := 'polar_gray_proj_histo'
  1085.     Groups := ['gray','rot_invar','scale_invar']
  1086.     * *************
  1087.     if (Name == CurrentName)
  1088.         * ** Calculate feature ***
  1089.         Width := 100
  1090.         Height := 40
  1091.         calc_feature_polar_gray_proj (Region, Image, 'vert_gray', Width, Height, Projection)
  1092.         NumBins := 20
  1093.         Feature := []
  1094.         for Index := 1 to NumRegions by 1
  1095.             Start := (Index - 1) * Width
  1096.             tuple_histo_range (Projection[Start:Start + Width - 1], 0, 255, NumBins, Histo, BinSize)
  1097.             Feature := [Feature,Histo]
  1098.         endfor
  1099.         * *************************
  1100.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  1101.         AccumulatedResults := ExtendedResults
  1102.     endif
  1103.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  1104.     AccumulatedResults := ExtendedResults
  1105.     * ************************************
  1106.     *
  1107.     * ************************************
  1108.     * COLOR FEATURES
  1109.     * ************************************
  1110.     *
  1111.     * ************************************
  1112.     * ** cielab_mean ***
  1113.     Name := 'cielab_mean'
  1114.     Groups := 'color'
  1115.     * *************
  1116.     if (Name == CurrentName)
  1117.         * ** Calculate feature ***
  1118.         calc_feature_color_intensity (Region, Image, 'cielab', 'mean', Feature)
  1119.         * *************************
  1120.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  1121.         AccumulatedResults := ExtendedResults
  1122.     endif
  1123.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  1124.     AccumulatedResults := ExtendedResults
  1125.     * ************************************
  1126.     *
  1127.     * ************************************
  1128.     * ** cielab_dev ***
  1129.     Name := 'cielab_dev'
  1130.     Groups := 'color'
  1131.     * *************
  1132.     if (Name == CurrentName)
  1133.         * ** Calculate feature ***
  1134.         calc_feature_color_intensity (Region, Image, 'cielab', 'deviation', Feature)
  1135.         * *************************
  1136.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  1137.         AccumulatedResults := ExtendedResults
  1138.     endif
  1139.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  1140.     AccumulatedResults := ExtendedResults
  1141.     * ************************************
  1142.     *
  1143.     * ************************************
  1144.     * ** hls_mean ***
  1145.     Name := 'hls_mean'
  1146.     Groups := 'color'
  1147.     * *************
  1148.     if (Name == CurrentName)
  1149.         * ** Calculate feature ***
  1150.         calc_feature_color_intensity (Region, Image, 'hls', 'mean', Feature)
  1151.         * *************************
  1152.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  1153.         AccumulatedResults := ExtendedResults
  1154.     endif
  1155.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  1156.     AccumulatedResults := ExtendedResults
  1157.     * ************************************
  1158.     *
  1159.     * ************************************
  1160.     * ** hls_dev ***
  1161.     Name := 'hls_dev'
  1162.     Groups := 'color'
  1163.     * *************
  1164.     if (Name == CurrentName)
  1165.         * ** Calculate feature ***
  1166.         calc_feature_color_intensity (Region, Image, 'hls', 'deviation', Feature)
  1167.         * *************************
  1168.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  1169.         AccumulatedResults := ExtendedResults
  1170.     endif
  1171.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  1172.     AccumulatedResults := ExtendedResults
  1173.     * ************************************
  1174.     *
  1175.     * ************************************
  1176.     * ** rgb_mean ***
  1177.     Name := 'rgb_mean'
  1178.     Groups := 'color'
  1179.     * *************
  1180.     if (Name == CurrentName)
  1181.         * ** Calculate feature ***
  1182.         calc_feature_color_intensity (Region, Image, 'rgb', 'mean', Feature)
  1183.         * *************************
  1184.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  1185.         AccumulatedResults := ExtendedResults
  1186.     endif
  1187.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  1188.     AccumulatedResults := ExtendedResults
  1189.     * ************************************
  1190.     *
  1191.     * ************************************
  1192.     * ** rgb_dev ***
  1193.     Name := 'rgb_dev'
  1194.     Groups := 'color'
  1195.     * *************
  1196.     if (Name == CurrentName)
  1197.         * ** Calculate feature ***
  1198.         calc_feature_color_intensity (Region, Image, 'rgb', 'deviation', Feature)
  1199.         * *************************
  1200.         append_length_or_values (Mode, Feature, AccumulatedResults, ExtendedResults)
  1201.         AccumulatedResults := ExtendedResults
  1202.     endif
  1203.     append_names_or_groups (Mode, Name, Groups, CurrentName, AccumulatedResults, ExtendedResults)
  1204.     AccumulatedResults := ExtendedResults
  1205. endfor
  1206. Output := AccumulatedResults
  1207. set_system ('empty_region_result', EmptyRegionResult)
  1208. return ()
复制代码









算法QQ  3283892722
群智能算法链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


Python|Opencv|MATLAB|Halcom.cn  

GMT+8, 2019-10-19 17:59 , Processed in 0.134421 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表