Skip to content

Commit

Permalink
fix bug in transform tbn of sampled frames
Browse files Browse the repository at this point in the history
  • Loading branch information
yihua7 committed Aug 6, 2023
1 parent 98ca434 commit 14e2bcd
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions patch_matching_and_quilting.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,27 +299,22 @@ def initFirstPatch(self):
def prepareExamplePatches(self):
print('Preparing example patches ...')
result = self.patches
stbn = self.sample_tbn
stbn = self.sample_tbn.reshape([-1, 3, 3])

self.total_patches_count = result.shape[0]
if self.mirror_hor:
hor_result = result[:, ::-1, :, :]
result = np.concatenate((result, hor_result))
hor_stbn = np.copy(stbn)
hor_stbn[..., 0, :] *= -1
hor_stbn[..., 0] *= -1
stbn = np.concatenate([stbn, hor_stbn], axis=0)
if self.mirror_vert:
vert_result = result[:, :, ::-1, :]
result = np.concatenate((result, vert_result))
hor_vtbn = np.copy(stbn)
hor_vtbn[..., 1, :] *= -1
hor_vtbn[..., 1] *= -1
stbn = np.concatenate([stbn, hor_vtbn], axis=0)
if self.rotate:
rot_result1 = np.rot90(result, 2)
rot_result2 = np.rot90(rot_result1, 2)
rot_result3 = np.rot90(rot_result2, 2)
result = np.concatenate((result, rot_result1, rot_result2, rot_result3))
return result, stbn
return result, stbn.reshape([-1, 9])

def initCanvas(self):

Expand Down

0 comments on commit 14e2bcd

Please sign in to comment.