zsylvester / segmenteverygrain

A SAM-based model for instance segmentation of images of grains

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NameError: name 'dist' is not defined

SR-Roweb opened this issue · comments

Hi zsylvester, wanted to say thank you for the great package!

Came across an issue I am struggling to fix when using the Segment_every_grain notebook. The following error pops up using the code here:
n_of_units = 10 # centimeters in this case units_per_pixel = n_of_units/dist

`---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [36], in <cell line: 2>()
1 n_of_units = 10 # centimeters in this case
----> 2 units_per_pixel = n_of_units/dist

NameError: name 'dist' is not defined`

I was wondering what is the best way to fix this?

Hi @SR-Roweb - good point, this is a bug that shows that I still don't understand how global variables behave :) .

The idea with that part of the notebook is that you click twice on the scale bar in the image (if any) to get the length of the scale bar in pixels. Then you can use this to convert the grain lengths in pixels to whatever measurement units you want to use.

I have updated the notebook now, hopefully it explains what I am trying to do.