Skip to content

Commit

Permalink
fix in the upsampler when it does not terminate
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgehrig18 committed Feb 22, 2023
1 parent b795a4d commit fc58757
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions upsampling/utils/upsampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def _upsample_adaptive(self, I0, I1, t0, t1, num_bisections=-1):
flow_mag_1_0_max = ((F_1_0 ** 2).sum(-1) ** .5).max()
num_bisections = int(np.ceil(np.log(max([flow_mag_0_1_max, flow_mag_1_0_max]))/np.log(2)))

if num_bisections == 0:
return [image[0]], [(t0 + t1) / 2]

left_images, left_timestamps = self._upsample_adaptive(I0, image, t0, (t0+t1)/2, num_bisections=num_bisections-1)
right_images, right_timestamps = self._upsample_adaptive(image, I1, (t0+t1)/2, t1, num_bisections=num_bisections-1)
timestamps = left_timestamps + [(t0+t1)/2] + right_timestamps
Expand Down

0 comments on commit fc58757

Please sign in to comment.