I found a solution.
First, we take the segmentation matrix
segMap = labels_map(seg)
Then, from this matrix, we can retrieve the coordinates of all the pixels in a given segment. Then we can store the X and Y coordinates in two separate variables to finally determine a box around a segment (the black crosses on the image below):
coordinates = findall(x -> x == 1, segMap)
x = Vector()
y = Vector()
for c in coordinates
push!(x, c[2])
push!(y, c[1])
end
xStart = x[1]
xEnd = last(x)
sort!(y)
yStart = y[1]
yEnd = last(y)
Hope this makes sens!
Best