MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / intersection_with

Method intersection_with

deeplabcut/core/inferenceutils.py:170–185  ·  view source on GitHub ↗
(self, other)

Source from the content-addressed store, hash-verified

168 return len(self._links)
169
170 def intersection_with(self, other):
171 x11, y11, x21, y21 = self.extent
172 x12, y12, x22, y22 = other.extent
173 x1 = max(x11, x12)
174 y1 = max(y11, y12)
175 x2 = min(x21, x22)
176 y2 = min(y21, y22)
177 if x2 < x1 or y2 < y1:
178 return 0
179 ll = np.array([x1, y1])
180 ur = np.array([x2, y2])
181 xy1 = self.xy[~np.isnan(self.xy).any(axis=1)]
182 xy2 = other.xy[~np.isnan(other.xy).any(axis=1)]
183 in1 = np.all((xy1 >= ll) & (xy1 <= ur), axis=1).sum()
184 in2 = np.all((xy2 >= ll) & (xy2 <= ur), axis=1).sum()
185 return min(in1 / len(self), in2 / len(other))
186
187 def add_joint(self, joint):
188 if joint.label in self._visible or joint.label is None:

Callers 2

test_assemblyFunction · 0.95
_assembleMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_assemblyFunction · 0.76