(self, plist)
| 129 | self.channel), dtype='uint8') |
| 130 | |
| 131 | def draw_patches(self, plist): |
| 132 | assert self.nr_row * self.nr_col >= len(plist), \ |
| 133 | "{}*{} < {}".format(self.nr_row, self.nr_col, len(plist)) |
| 134 | if self.channel == 3 and plist.shape[3] == 1: |
| 135 | plist = np.repeat(plist, 3, axis=3) |
| 136 | cur_row, cur_col = 0, 0 |
| 137 | if self.channel == 1: |
| 138 | self.canvas.fill(self.bgcolor) |
| 139 | else: |
| 140 | self.canvas[:, :, :] = self.bgcolor |
| 141 | for patch in plist: |
| 142 | r0 = cur_row * (self.ph + self.border) |
| 143 | c0 = cur_col * (self.pw + self.border) |
| 144 | self.canvas[r0:r0 + self.ph, c0:c0 + self.pw] = patch |
| 145 | cur_col += 1 |
| 146 | if cur_col == self.nr_col: |
| 147 | cur_col = 0 |
| 148 | cur_row += 1 |
| 149 | |
| 150 | def get_patchid_from_coord(self, x, y): |
| 151 | x = x // (self.pw + self.border) |
no test coverage detected