0

I have this image:

enter image description here

and would need to get the region of the crate. like this:

enter image description here

I have not been able to get a clean selection so far. I tried thresholding the image, tried after adding some mult_image, add_image, but no luck.

Any help on detecting the outlines/region of the crate is greatly appreciated.

NOTE: the crates can be different hights, even higher than this. in that case the imgage itself is higher too. BUT this implies that the bright areas left and right of the crates might not be entirely visible.

Thank you

EDIT:

This is the original image

enter image description here

sharkyenergy
  • 3,842
  • 10
  • 46
  • 97

1 Answers1

0

This is a quick and dirty solution. Thresholding seems to be working OK, but first erode the region and than dilate it:

read_image (Image, 'D:/OneDrive - Subpixel d.o.o/Other/Stackoverflow/3/4e7Za.png')
rgb1_to_gray (Image, GrayImage)
equ_histo_image (GrayImage, ImageEquHisto)
threshold (ImageEquHisto, Regions, 145, 227)
fill_up (Regions, RegionFillUp)

erosion_circle (RegionFillUp, RegionErosion, 30.5)
dilation_circle (RegionErosion, RegionDilation, 30.5)

It seems that the color camera would solve your problem much better, since the crate does have other color. Is this an option?

enter image description here

Vladimir Perković
  • 1,351
  • 3
  • 12
  • 30
  • Sorry for the late reply. it actually IS a color camera, and it is a black crate, on black background, on a blue belt. the image I posted is a prefiltered image that shows MUCH better that the origianl one. – sharkyenergy Jun 27 '22 at 11:34
  • Have you tried using another colorspace e.g. HSV or LAB? https://subpixel.hr/robust-color-detection/ – Vladimir Perković Jun 27 '22 at 12:38
  • Yes, the above image is the saturation channel of the HSL version of the image.. I was wondering if there is a way to get a more precise result. – sharkyenergy Jun 27 '22 at 12:45
  • LAB usually works a bit better. – Vladimir Perković Jun 27 '22 at 15:21
  • tired with lab, but unfortunately without luck. in case you want to have fun and give it a go I just added the original color image to the first post.... :D – sharkyenergy Jun 28 '22 at 11:14