MCPcopy
hub / github.com/junyanz/iGAN / CropPatch

Method CropPatch

ui/ui_warp.py:21–28  ·  view source on GitHub ↗
(self, pnt, width)

Source from the content-addressed store, hash-verified

19 self.im = None
20
21 def CropPatch(self, pnt, width):
22 [x_c,y_c] = pnt
23 w = width / 2.0
24 x1 = int(np.clip(x_c - w, 0, self.img_size - 1))
25 y1 = int(np.clip(y_c - w, 0, self.img_size - 1))
26 x2 = int(np.clip(x_c + w, 0, self.img_size - 1))
27 y2 = int(np.clip(y_c + w, 0, self.img_size - 1))
28 return [x1,y1,x2,y2]
29
30 def AddPoint(self, pos, im):
31 x_c = int(np.round(pos.x()/self.scale))

Callers 1

updateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected