Closed gustavmpettersson closed 1 year ago
Any further details or desirements around this? I've just had to label centroids myself for development purposes and found it relatively easy - I'd be happy to whip together a PR if my method suits. That method looks like:
from PIL import Image, ImageDraw
img1=Image.open('stars_i_dont_know.jpg')
import sys
from tetra3 import *
centroids1 = get_centroids_from_image(img1)
def ellipsecoords(radius, centroidyx):
leftUpPoint = (centroidyx[1]-radius, centroidyx[0]-radius)
rightDownPoint = (centroidyx[1]+radius, centroidyx[0]+radius)
twoPointList = [leftUpPoint, rightDownPoint]
return twoPointList
draw=ImageDraw.Draw(img1)
for centroid in centroids1:
draw.ellipse(ellipsecoords(6, centroid), outline=(255,0,0,255))
This of course leaves you with a differen't kind of "image" than the list of arrays get_centroids_from_image
returns, but presumably that's fine, or it's OK to just massage the result into an int32 array instead of an RGB PIL image.
Let me know if this is of interest and I can try inlining it with Tetra3.
Hi @alexw-im ,
This has finally been implemented, you now get back final_centroids
which has green circles for all accepted centroids and red circles for all rejected centroids.
Hey, that's awesome! Thanks!
Edit: Maybe I just missed it, but looking through the documentation around that, it looks like you've been busy drawing circles for all sorts of other stuff too!
When using
get_centroids_from_image
with the optionreturn_images=True
, a dictionary with images representing each step of the algorithm are returned. What each one does is not defined, but most are obvious enough.Unhelpfully, the final set of centroids is not shown in any image, and the image named 'label_statistics' is just a copy of the thresholded image.
Actions needed: