Segmentate package object with a tape in the middle that has similar color as background


I am facing an issue while segmenting packages moving on a (dark gray-almost black) conveyor belt. This packages have a standard size of 30x20cm or 20x20cm as an example. The problem comes when these packages have a tape from side to side that closes the box, but the color of the tape and the conveyor are quite similar and it generates a problem while segmenting the whole package, so I detect 2 objects.

Here’s an example of the use case:

I tried so many things, but I am not expert in image processing, I am learning, so but I would like to know if there’s any image process technique/algorithm in OpenCV that can help me out with this use case.

Thanks in advance! :slight_smile:

morphology operation. dilate or close.

and maybe select that background tighter. it’s probably distinguishable from the amazon tape. show us a real picture of the conveyor belt. what you show us there is edited.

Thanks! That’s what I’ve tried, morph close in rect and cross, because package can be placed i different angle positions. I was thinking also in having the corner points of the package and segmentate the polygon inside those points.
Here I attach a real picture:

that picture looks underexposed. I would recommend stronger light. (synchronized) strobe light is sensible if you set your camera for short exposure times to minimize motion blur.

with Otsu thresholding, followed by k dilation, 2k erosion, k dilation (k iterations), this cleans up sufficiently… but the parameters may depend on the picture. it’s not gonna get much cleaner than this.


1 Like