<?xml version="1.0" encoding="UTF-8"?>
<hdevelop file_version="1.1" halcon_version="13.0">
<procedure name="exhaustive_find_best_rectangle1_fixed_scale_parallel">
<interface>
<io>
<par name="RegionSeg" base_type="iconic" dimension="0"/>
</io>
<ic>
<par name="Rows" base_type="ctrl" dimension="0"/>
<par name="Columns" base_type="ctrl" dimension="0"/>
<par name="InitWidth" base_type="ctrl" dimension="0"/>
<par name="InitHeight" base_type="ctrl" dimension="0"/>
<par name="initial_box_coordinate" base_type="ctrl" dimension="0"/>
<par name="best_overlap" base_type="ctrl" dimension="0"/>
</ic>
<oc>
<par name="best_box_coordinate" base_type="ctrl" dimension="0"/>
<par name="best_overlapOut" 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>* Divide the search Rows and Columns amoung NumThreads and</c>
<c>* process individually</c>
<l>NumThreads := 4</l>
<c></c>
<l>best_box_coordinate := []</l>
<l>best_overlapOut := best_overlap</l>
<l>NumPoints := |Rows|</l>
<l>if (NumPoints&gt;NumThreads)</l>
<l>    Step := NumPoints/ NumThreads</l>
<l>    RowIdx := [[0:NumThreads-1]*Step,NumPoints-1]</l>
<l>    for Index := 0 to NumThreads-1 by 1</l>
<l>        ParRows := Rows[RowIdx[Index]:RowIdx[Index+1]-1]</l>
<l>        ParColumns := Columns[RowIdx[Index]:RowIdx[Index+1]-1]</l>
<l>        par_start&lt;ThreadIDs.at(Index)&gt; : exhaustive_best_rectangle1_fixed_scale (RegionSeg, ParRows, ParColumns, InitWidth, InitHeight, \
                               initial_box_coordinate, best_overlap, BestOverlap.at(Index), BestBoxCoordinate.at(Index))</l>
<l>    endfor</l>
<c>    * Collect the threads</c>
<l>    Threads := []</l>
<l>    for Index := 0 to NumThreads-1 by 1</l>
<l>        Threads := [Threads,ThreadIDs.at(Index)]</l>
<l>    endfor</l>
<l>    par_join (Threads)</l>
<c>    </c>
<c>    * get the best box:</c>
<l>    best_overlap_out := []</l>
<l>    for Index := 0 to NumThreads-1 by 1</l>
<l>        best_overlap_out := [best_overlap_out,BestOverlap.at(Index)]</l>
<l>    endfor</l>
<l>    MaxIdx := find(best_overlap_out,max(best_overlap_out))</l>
<l>    best_box_coordinate := BestBoxCoordinate.at(MaxIdx[0])</l>
<l>    best_overlapOut := BestOverlap.at(MaxIdx[0])</l>
<l>else</l>
<l>    exhaustive_best_rectangle1_fixed_scale (RegionSeg, Rows, Columns, InitWidth, InitHeight, \
                               initial_box_coordinate, best_overlap, best_overlapOut, best_box_coordinate)</l>
<l>endif</l>
<l>return ()</l>
</body>
<docu id="exhaustive_find_best_rectangle1_fixed_scale_parallel">
<parameters>
<parameter id="Columns"/>
<parameter id="InitHeight"/>
<parameter id="InitWidth"/>
<parameter id="RegionSeg"/>
<parameter id="Rows"/>
<parameter id="best_box_coordinate"/>
<parameter id="best_overlap"/>
<parameter id="best_overlapOut"/>
<parameter id="initial_box_coordinate"/>
</parameters>
</docu>
</procedure>
</hdevelop>
