<?xml version="1.0" encoding="UTF-8"?>
<hdevelop file_version="1.1" halcon_version="13.0">
<procedure name="gen_theoretical_trackers">
<interface>
<io>
<par name="RegionSeg" base_type="iconic" dimension="0"/>
</io>
<ic>
<par name="InitExhaustiveScale" base_type="ctrl" dimension="0"/>
<par name="initial_box_coordinate" base_type="ctrl" dimension="0"/>
</ic>
<oc>
<par name="overlap_no_scale" base_type="ctrl" dimension="0"/>
<par name="overlap_no_rotiation" base_type="ctrl" dimension="0"/>
<par name="overlap_rect2" base_type="ctrl" dimension="0"/>
<par name="box_coordinate_no_scale" base_type="ctrl" dimension="0"/>
<par name="box_coordinate_no_rotation" base_type="ctrl" dimension="0"/>
<par name="box_coordinate_rect2" base_type="ctrl" dimension="0"/>
<par name="initial_box_coordinate_out" base_type="ctrl" dimension="0"/>
</oc>
</interface>
<body>
<c> * Copyright (c) MVTec Software GmbH.  All rights reserved.</c>
<c> *</c>
<c> * All use of this software is subject to the terms of the revised BSD</c>
<c> * license.  You should have received a copy of this license along</c>
<c> * with this source code in a file named "license.txt."</c>
<c></c>
<c>* This procedure generates three theoretical tracker given a certain segmentation</c>
<c>* It is possible to pass an initial value for b to speed up the computation and</c>
<c>* set the scale for the scale variant tracker</c>
<c></c>
<c>* Border treatment: do not clip regions!</c>
<l>get_system ('clip_region',ClipRegion)</l>
<l>set_system ('clip_region','false')</l>
<c></c>
<c>* The vot2016 dataset sometimes has empty segmentations...</c>
<l>area_center (RegionSeg, Area, _, _)</l>
<c></c>
<l>if (Area)</l>
<l>    OptimizationDisplay := false</l>
<c>    **************</c>
<c>    * NO SCALE</c>
<c>    **************</c>
<l>    if (InitExhaustiveScale)</l>
<c>        * In the first frame we fix the scale for the exhaustive search.</c>
<c>        * Either with the best rectangle1 or with the smallest rectangle1</c>
<c>        * Best rectangle1:</c>
<l>        Rotation := false</l>
<l>        Scale := true</l>
<l>        OptimizationMethod := 'gradient_descent'</l>
<l>        estimate_best_rectangle_overlap (RegionSeg, Rectangle, Rotation, Scale, \
                                         OptimizationMethod, [], initial_box_coordinates,\
                                         overlap_no_scale, box_coordinate_no_scale)</l>
<l>        initial_box_coordinate_out := box_coordinate_no_scale</l>
<c>        * Smallest rectangle1:</c>
<l>*         smallest_rectangle1 (RegionSeg, Row1, Column1, Row2, Column2)</l>
<l>*         convert_rectangle1_to_rectangle2_params (Row1, Column1, Row2, Column2,\
                                                 Row, Column, Phi, Length1, Length2)</l>
<l>*         initial_box_coordinate := [Row, Column, Length1, Length2, 0.0]</l>
<l>    else</l>
<c>        * We exhaustively search for the best scale variant tracker</c>
<l>        Rotation := false</l>
<l>        Scale := false</l>
<l>        OptimizationMethod := 'exhaustive'</l>
<l>        estimate_best_rectangle_overlap (RegionSeg, Rectangle, Rotation, Scale, \
                                         OptimizationMethod, initial_box_coordinate, \
                                         initial_box_coordinates, overlap_no_scale,\
                                         box_coordinate_no_scale)</l>
<l>    endif</l>
<c>    </c>
<c>    **************</c>
<c>    * NO ROTATION</c>
<c>    **************</c>
<l>    Rotation := false</l>
<l>    Scale := true</l>
<l>    OptimizationMethod := ['gradient_descent']</l>
<l>    estimate_best_rectangle_overlap (RegionSeg, Rectangle, Rotation, Scale, \
                                     OptimizationMethod, [box_coordinate_no_scale], initial_box_coordinates, \
                                     overlap_no_rotiation, box_coordinate_no_rotation)</l>
<c></c>
<c>    **************</c>
<c>    * RECTANGLE 2</c>
<c>    **************</c>
<l>    Rotation := true</l>
<l>    Scale := true</l>
<l>    OptimizationMethod := ['gradient_descent']</l>
<l>    estimate_best_rectangle_overlap (RegionSeg, Rectangle, Rotation, Scale, \
                                     OptimizationMethod, [box_coordinate_no_rotation], initial_box_coordinates, \
                                     overlap_rect2, box_coordinate_rect2)</l>
<l>else</l>
<c>    * Fix for the frames with no valid segmentation...</c>
<l>    overlap_no_scale := 0.0</l>
<l>    overlap_no_rotiation := 0.0</l>
<l>    overlap_rect2 := 0.0</l>
<l>endif</l>
<c></c>
<l>set_system ('clip_region', ClipRegion)</l>
<l>return ()</l>
</body>
<docu id="gen_theoretical_trackers">
<parameters>
<parameter id="InitExhaustiveScale"/>
<parameter id="RegionSeg"/>
<parameter id="box_coordinate_no_rotation"/>
<parameter id="box_coordinate_no_scale"/>
<parameter id="box_coordinate_rect2"/>
<parameter id="initial_box_coordinate"/>
<parameter id="initial_box_coordinate_out"/>
<parameter id="overlap_no_rotiation"/>
<parameter id="overlap_no_scale"/>
<parameter id="overlap_rect2"/>
</parameters>
</docu>
</procedure>
</hdevelop>
