Skip to content
Snippets Groups Projects
Commit 3461bda1 authored by Jay Paul Morgan's avatar Jay Paul Morgan
Browse files

Improve the detection of limb points

parent d72b63b7
No related branches found
No related tags found
No related merge requests found
......@@ -50,30 +50,33 @@ class CircleFitter(torch.nn.Module):
def find_anchors(smap: sunpy.map.GenericMap) -> torch.Tensor:
x,y = smap.shape
xs = np.linspace(x//4, x-x//4, 69, dtype=int)
ys = np.linspace(y//4, y-y//4, 69, dtype=int)
inter = 3
xs = np.linspace(x//inter, x-x//inter, 69, dtype=int)
ys = np.linspace(y//inter, y-y//inter, 69, dtype=int)
k = np.array([-1, 0, +1]).reshape(1, 3)
dy = cv2.filter2D(filters.gaussian(smap, 7), -1, k.reshape(-1, 1))
dx = cv2.filter2D(filters.gaussian(smap, 7), -1, k)
points = []
for xi in xs:
# bottom profile
point = np.argmin(dy[y-(y//4):, xi])
points.append((xi, y-y//4+point))
for yi in ys:
# right profile
point = np.argmin(dx[yi, x-x//4:])
points.append((x-x//4+point, yi))
# bottom profile
point = np.argmin(dy[x-x//inter:, yi])
points.append((yi, x-x//inter+point))
for xi in xs:
# top profile
point = np.argmax(dy[:y//4, xi])
points.append((xi, point))
# right profile
point = np.argmin(dx[xi, y-y//inter:])
points.append((y-y//inter+point, xi))
for yi in ys:
# top profile
point = np.argmax(dy[:x//inter, yi])
points.append((yi, point))
for xi in xs:
# left profile
point = np.argmax(dx[yi,:y//3])
points.append((point, yi))
point = np.argmax(dx[xi,:y//inter])
points.append((point, xi))
return torch.Tensor(points)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment