MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / __call__

Method __call__

ldm/modules/midas/midas/transforms.py:162–194  ·  view source on GitHub ↗
(self, sample)

Source from the content-addressed store, hash-verified

160 return (new_width, new_height)
161
162 def __call__(self, sample):
163 width, height = self.get_size(
164 sample["image"].shape[1], sample["image"].shape[0]
165 )
166
167 # resize sample
168 sample["image"] = cv2.resize(
169 sample["image"],
170 (width, height),
171 interpolation=self.__image_interpolation_method,
172 )
173
174 if self.__resize_target:
175 if "disparity" in sample:
176 sample["disparity"] = cv2.resize(
177 sample["disparity"],
178 (width, height),
179 interpolation=cv2.INTER_NEAREST,
180 )
181
182 if "depth" in sample:
183 sample["depth"] = cv2.resize(
184 sample["depth"], (width, height), interpolation=cv2.INTER_NEAREST
185 )
186
187 sample["mask"] = cv2.resize(
188 sample["mask"].astype(np.float32),
189 (width, height),
190 interpolation=cv2.INTER_NEAREST,
191 )
192 sample["mask"] = sample["mask"].astype(bool)
193
194 return sample
195
196
197class NormalizeImage(object):

Callers

nothing calls this directly

Calls 1

get_sizeMethod · 0.95

Tested by

no test coverage detected