Skip to content

Commit

Permalink
deepsource issues
Browse files Browse the repository at this point in the history
  • Loading branch information
HaleySchuhl committed Mar 7, 2024
1 parent 4c6d5ae commit bd1a4c9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions plantcv/annotate/get_centroids.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Get centroids. region props method (WILL Merge into PCV.annotate, opening PR this week)
# Get centroids from mask objects

from skimage.measure import label, regionprops


def get_centroids(bin_img):
"""Get the coordinates (row,column) of the centroid of each connected region in a binary image.
Expand All @@ -18,12 +19,10 @@ def get_centroids(bin_img):
labeled_img = label(bin_img)
# measure regions
obj_measures = regionprops(labeled_img)

coords = []
for obj in obj_measures:
# Convert coord values to int
coord = tuple(map(int, obj.centroid))
coords.append(coord)


return coords

0 comments on commit bd1a4c9

Please sign in to comment.