MCPcopy Index your code
hub / github.com/apple/ml-pointersect / compare_rgbd_images

Function compare_rgbd_images

pointersect/inference/infer.py:1423–1683  ·  view source on GitHub ↗

Compare a list of rgbd_images by creating gif containing each of the rgbd_images Note we assume the camera used to capture the rgbd images are the same. Args: rgbd_images: list of rgbd_image to compare. names: name of the rgbd images. If given, n

(
        rgbd_images: T.List[RGBDImage],
        names: T.Optional[T.List[str]] = None,
        ref_rgbd_image: T.Optional[RGBDImage] = None,
        idx_ref: int = -1,
        ref_name: str = 'ground truth',
        ncols: int = -1,
        font_size: int = 24,
        font_color: T.Union[float, T.List[float], None] = None,  # [0,1]
        font_name: str = "DejaVuSans",
        background_color: T.Union[float, T.List[float]] = 1,  # [0,1]
        pad_height_px: int = 30,
        align_width: str = 'center',
        align_height: str = 'center',
        output_dir: str = None,
        overwrite: bool = False,
        save_png: bool = True,
        save_pt: bool = True,
        save_gif: bool = True,
        gif_fps: int = 10,
)

Source from the content-addressed store, hash-verified

1421
1422
1423def compare_rgbd_images(
1424 rgbd_images: T.List[RGBDImage],
1425 names: T.Optional[T.List[str]] = None,
1426 ref_rgbd_image: T.Optional[RGBDImage] = None,
1427 idx_ref: int = -1,
1428 ref_name: str = 'ground truth',
1429 ncols: int = -1,
1430 font_size: int = 24,
1431 font_color: T.Union[float, T.List[float], None] = None, # [0,1]
1432 font_name: str = "DejaVuSans",
1433 background_color: T.Union[float, T.List[float]] = 1, # [0,1]
1434 pad_height_px: int = 30,
1435 align_width: str = 'center',
1436 align_height: str = 'center',
1437 output_dir: str = None,
1438 overwrite: bool = False,
1439 save_png: bool = True,
1440 save_pt: bool = True,
1441 save_gif: bool = True,
1442 gif_fps: int = 10,
1443) -> RGBDImage:
1444 """
1445 Compare a list of rgbd_images by creating gif containing each of the rgbd_images
1446 Note we assume the camera used to capture the rgbd images are the same.
1447
1448 Args:
1449 rgbd_images:
1450 list of rgbd_image to compare.
1451 names:
1452 name of the rgbd images. If given, name will be print on top of the images
1453 ref_rgbd_image:
1454 reference rgbd image to compute the error against (if given)
1455 nrows:
1456 number of rows in the gif
1457 idx_ref:
1458 linear idx of the ref in the gif
1459
1460 Returns:
1461
1462 Procedure:
1463 - before adding the name to the image, compute the error to the reference
1464 - create tmp rgb, depth, normal_w, hit_map if not None. If one content is None, skip the image
1465 """
1466
1467 if idx_ref < 0:
1468 idx_ref = len(rgbd_images)
1469
1470 # insert ref image into rgbd_image
1471 if ref_rgbd_image is not None:
1472 rgbd_images = [rgbd for rgbd in rgbd_images] # create a new list
1473 rgbd_images.insert(idx_ref, ref_rgbd_image)
1474 names = [n for n in names] # create a new list
1475 names.insert(idx_ref, ref_name)
1476
1477 # find the first non-None image
1478 img = None
1479 for i in range(len(rgbd_images)):
1480 if rgbd_images[i].rgb is not None:

Callers

nothing calls this directly

Calls 6

saveMethod · 0.95
RGBDImageClass · 0.90
insertMethod · 0.80
masked_fillMethod · 0.80
cloneMethod · 0.45
detachMethod · 0.45

Tested by

no test coverage detected