MCPcopy Create free account
hub / github.com/apple/ml-sharp / get_screen_resolution_px_from_input

Function get_screen_resolution_px_from_input

src/sharp/utils/camera.py:353–365  ·  view source on GitHub ↗

Get resolution for metadata dictionary.

(width: int, height: int)

Source from the content-addressed store, hash-verified

351
352
353def get_screen_resolution_px_from_input(width: int, height: int) -> tuple[int, int]:
354 """Get resolution for metadata dictionary."""
355 resolution_px = (width, height)
356 # halve the dimensions for super large image
357 if resolution_px[1] > 3000:
358 resolution_px = (resolution_px[0] // 2, resolution_px[1] // 2)
359 # for mp4 compatibility, enforce dimensions to even number,
360 # otherwise could not be played in browser
361 if resolution_px[0] % 2 != 0:
362 resolution_px = (resolution_px[0] + 1, resolution_px[1])
363 if resolution_px[1] % 2 != 0:
364 resolution_px = (resolution_px[0], resolution_px[1] + 1)
365 return resolution_px
366
367
368def _compute_depth_quantiles(

Callers 1

create_camera_modelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected