Search code examples
pythonimage-processingbounding-boxscikit-image

Strings in bounding box coordinates


I have used the regionsprops function on a labelled image to obtain bounding box coordinates and sizes. when I access a bounding box coordinate, I get a tuple with the string "L" in it. I cannot understand why there would be a string inside a tuple for coordinates and sizes.

Printing the bounding box coordinates returns (0L, 393L, 29L, 463L), whereas it would make life much easier if it returned (0, 393, 29, 463) instead.

I am not able to draw a bounding box since the tuple is not considered a numerical tuple TypeError: points is not a numerical tuple. How can I use this tuple to draw a bounding box on an image.

properties = skimage.measure.regionprops(labelled_image)
boundingbox = properties[0].bbox

print boundingbox # returns (0L, 393L, 29L, 463L)

Solution

  • The suffix L or l indicates a long integer.
    long was merged with int in Python 3.

    If you are on Python 2.x, these numbers shouldn't cause any problems and can be treated like integers.