MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / crop

Function crop

data/transforms.py:221–231  ·  view source on GitHub ↗
(image, crop_factors)

Source from the content-addressed store, hash-verified

219
220
221def crop(image, crop_factors):
222 target_h, target_w = crop_factors
223 img_w, img_h = image.size
224
225 if target_h > img_h or target_w > img_w:
226 raise ValueError("Crop size exceeds image dimensions")
227
228 x = random.randint(0, img_w - target_w)
229 y = random.randint(0, img_h - target_h)
230
231 return image.crop((x, y, x + target_w, y + target_h)), [[x, y], [x + target_w, y + target_h]]
232
233
234def motion_blur_opencv(image, kernel_size=15, angle=0):

Callers

nothing calls this directly

Calls 1

cropMethod · 0.80

Tested by

no test coverage detected