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

Method update

ui/ui_warp.py:52–77  ·  view source on GitHub ↗
(self, pos)

Source from the content-addressed store, hash-verified

50 return None
51
52 def update(self, pos):
53 self.img = np.zeros((self.img_size, self.img_size, self.nc), np.uint8)
54 self.mask = np.zeros((self.img_size, self.img_size, 1), np.uint8)
55
56 print('uiWarp: update %d' % self.activeId)
57 if self.activeId >= 0:
58 x_c = int(np.round(pos.x()/self.scale))
59 y_c= int(np.round(pos.y()/self.scale))
60 pnt = (x_c, y_c)
61 self.points2[self.activeId] = pnt
62
63 count = 0
64 for pnt1, pnt2 in zip(self.points1, self.points2):
65 w = int(max(1, self.width / self.scale))
66 [x1,y1,x2,y2] = self.CropPatch(pnt1, w)
67 [x1n, y1n, x2n, y2n] = self.CropPatch(pnt2, w)
68 im = self.ims[count]
69 if self.nc == 3:
70 patch = im[y1:y2,x1:x2,:].copy()
71 self.img[y1n:y2n,x1n:x2n,:] = patch
72 self.mask[y1n:y2n,x1n:x2n,:] = 255
73 else:
74 patch = im[y1:y2, x1:x2, [0]].copy()
75 self.img[y1n:y2n, x1n:x2n] = patch
76 self.mask[y1n:y2n, x1n:x2n] = 255
77 count += 1
78
79
80 def get_constraints(self):

Callers 15

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 1

CropPatchMethod · 0.95

Tested by

no test coverage detected