I am trying to iterate all rectangle regions in the image below and check which ones overlap with other regions. The overlapping regions need to be merged with eachother. I think my problem lies with iconic array initialisation and I had a look at a similar question over here but that one is about iconic variables not region array. This is what I tried:
* generated_rects is filled with 81 mostly overlapping rectangles
resultRegions := []
count_obj (generated_rects, nrOfRects)
for i := 0 to nrOfRects-1 by 1
* get center
region_features (generated_rects, 'row', r)
region_features (generated_rects, 'column', c)
if (resultRegions == [])
* copy region
continue
endif
* if there are result regions to check for overlap
count_obj (resultRegions, resultRegions_count) // error on: resultRegions
for j := 0 to resultRegions_count -1 by 1
select_obj (resultRegions, selectedRegion, j) // error on: resultRegions
* get_region_index (resultRegions, r, c, Index) // error on: resultRegions
* test_region_point (resultRegions, r, c, IsInside) // error on: resultRegions
endfor
endfor
Without information which of them are overlapping:
union1 (generated_rects, RegionUnion)
connection (RegionUnion, ConnectedRegions)