0

I have a image with a random shape. What I need to do is to get the outermost 5 pixels of the image as a region. How can this be done in halcon?

what I did so far is this:

        threshold (ImageL, FullRegion, 0,255)
        erosion_circle(FullRegion, FullRegionErosion,5)
        complement(FullRegionErosion, Region2)
        intersection(FullRegion, Region2, Border)
       

It works, but I dont like it.. it seems like a hack to me..

sharkyenergy
  • 3,842
  • 10
  • 46
  • 97

1 Answers1

0

Image domain and get_image_size can be used for a less "hacky" solution:

get_image_size (Image, Width, Height)
get_domain (Image, Domain)
gen_rectangle1 (Rectangle, 5, 5, Height-6, Width-6)
difference (Domain, Rectangle, RegionDifference)
Vladimir Perković
  • 1,351
  • 3
  • 12
  • 30
  • thankyou, but this works only for rectangualar images. my images are not rectangular as they are cutouts of other images.. – sharkyenergy Jun 30 '22 at 05:27