Problem while measuring with regionprops for the first index in the interaction

12 views Asked by At

enter image description here

Hi, guys. So I'm trying to get measurements for each object/region in the above image. But, for the first region, I'm not achieving this result.

I'm using the following code:

for index in range(1, labels.max()):
    label_i = props[index].label
    contour = find_contours(labels == label_i, 0.5)[0]
    y, x = contour.T
    hoverinfo = ''
    for prop_name in properties:
        hoverinfo += f'<b>{prop_name}: {getattr(props[index], prop_name):.2f}</b><br>'
    fig.add_trace(go.Scatter(
        x=x, y=y, name=label_i,
        mode='lines', fill='toself', showlegend=False,
        hovertemplate=hoverinfo, hoveron='points+fills'))

The official documentation has had the same problem. [https://scikit-image.org/docs/stable/auto_examples/segmentation/plot_regionprops.html][2]

Is there any solution to this problem?

0

There are 0 answers