# Path: sunds/datasets/nerf_synthetic/builder_utils.py
# SCENE_NAMES = [
#     'chair',
#     'drums',
#     'ficus',
#     'hotdog',
#     'lego',
#     'materials',
#     'mic',
#     'ship',
# ]
# VERSION = tfds.core.Version('1.0.0')
# RELEASE_NOTES = {
#     '1.0.0': 'Initial version',
# }
# CONFIGS = [
#     tfds.core.BuilderConfig(name=scene_name) for scene_name in SCENE_NAMES
# ]
# DATASET_INFO_KWARGS = dict(
#     description="""Nerf synthetic dataset.""",
#     homepage='https://github.com/bmild/nerf',
#     citation="""
#     @inproceedings{mildenhall2020nerf,
#       title={NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis},
#       author={Mildenhall, Ben and Srinivasan, Pratul P and Tancik, Matthew and Barron, Jonathan T and Ramamoorthi, Ravi and Ng, Ren},
#       booktitle={European Conference on Computer Vision},
#       pages={405--421},
#       year={2020},
#       organization={Springer}
#     }
#     """,
# )
# DL_URL = 'https://drive.google.com/uc?id=18JxhpWD-4ZmuFKLzKlAw-w5PpzZxXOcG&export=download'
# IMG_SHAPE = (800, 800)
# CAMERA_NAME = 'default_camera'
# def camera_intrinsics(scene_data: Json) -> sunds.specs_utils.CameraIntrinsics:
# def frame(
#     *,
#     scene_name: Optional[str] = None,
#     frame_name: str,  # pylint: disable=redefined-outer-name
#     frame_data: Json,
#     intrinsics: sunds.specs_utils.CameraIntrinsics,
#     color_image: Optional[np.ndarray] = None,
# ) -> sunds.specs_utils.Frame:
# def frame_name(scene_name: str, split_name: str, frame_id: int) -> str:


import json
import numpy as np
import sunds
import tensorflow_datasets as tfds
from typing import Any, Dict
from etils import epath
from PIL import Image
from sunds.datasets.nerf_synthetic import builder_utils
                ),
        })

    return tfds.core.DatasetInfo(
        builder=self,
        features=tfds.features.FeaturesDict(features),
        **builder_utils.DATASET_INFO_KWARGS,
    )

  def _split_generators(
      self,
      dl_manager: tfds.download.DownloadManager,
  ) -> Dict[str, Any]:
    scene_dir = dl_manager.download_and_extract(builder_utils.DL_URL)
    scene_dir = scene_dir / 'nerf_synthetic' / self.builder_config.name

    return {
        'train':
            self._generate_examples(split_name='train', scene_dir=scene_dir),  # pytype: disable=wrong-arg-types  # gen-stub-imports
        'test':
            self._generate_examples(split_name='test', scene_dir=scene_dir),  # pytype: disable=wrong-arg-types  # gen-stub-imports
        'validation':
            self._generate_examples(split_name='val', scene_dir=scene_dir),  # pytype: disable=wrong-arg-types  # gen-stub-imports
    }

  def _generate_examples(self, scene_dir: epath.Path, split_name: str):
    scene_name = scene_dir.name
    scene_path = scene_dir / f'transforms_{split_name}.json'
    scene_data = json.loads(scene_path.read_text())


# Path: sunds/datasets/nerf_synthetic/builder_utils.py
# SCENE_NAMES = [
#     'chair',
#     'drums',
#     'ficus',
#     'hotdog',
#     'lego',
#     'materials',
#     'mic',
#     'ship',
# ]
# VERSION = tfds.core.Version('1.0.0')
# RELEASE_NOTES = {
#     '1.0.0': 'Initial version',
# }
# CONFIGS = [
#     tfds.core.BuilderConfig(name=scene_name) for scene_name in SCENE_NAMES
# ]
# DATASET_INFO_KWARGS = dict(
#     description="""Nerf synthetic dataset.""",
#     homepage='https://github.com/bmild/nerf',
#     citation="""
#     @inproceedings{mildenhall2020nerf,
#       title={NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis},
#       author={Mildenhall, Ben and Srinivasan, Pratul P and Tancik, Matthew and Barron, Jonathan T and Ramamoorthi, Ravi and Ng, Ren},
#       booktitle={European Conference on Computer Vision},
#       pages={405--421},
#       year={2020},
#       organization={Springer}
#     }
#     """,
# )
# DL_URL = 'https://drive.google.com/uc?id=18JxhpWD-4ZmuFKLzKlAw-w5PpzZxXOcG&export=download'
# IMG_SHAPE = (800, 800)
# CAMERA_NAME = 'default_camera'
# def camera_intrinsics(scene_data: Json) -> sunds.specs_utils.CameraIntrinsics:
# def frame(
#     *,
#     scene_name: Optional[str] = None,
#     frame_name: str,  # pylint: disable=redefined-outer-name
#     frame_data: Json,
#     intrinsics: sunds.specs_utils.CameraIntrinsics,
#     color_image: Optional[np.ndarray] = None,
# ) -> sunds.specs_utils.Frame:
# def frame_name(scene_name: str, split_name: str, frame_id: int) -> str:


# Path: sunds/datasets/nerf_synthetic/frames_builder.py
import json
import numpy as np
import sunds
import tensorflow_datasets as tfds
from typing import Any, Dict
from etils import epath
from PIL import Image
from sunds.datasets.nerf_synthetic import builder_utils

                ),
        })

    return tfds.core.DatasetInfo(
        builder=self,
        features=tfds.features.FeaturesDict(features),
        **builder_utils.DATASET_INFO_KWARGS,
    )

  def _split_generators(
      self,
      dl_manager: tfds.download.DownloadManager,
  ) -> Dict[str, Any]:
    scene_dir = dl_manager.download_and_extract(builder_utils.DL_URL)
    scene_dir = scene_dir / 'nerf_synthetic' / self.builder_config.name

    return {
        'train':
            self._generate_examples(split_name='train', scene_dir=scene_dir),  # pytype: disable=wrong-arg-types  # gen-stub-imports
        'test':
            self._generate_examples(split_name='test', scene_dir=scene_dir),  # pytype: disable=wrong-arg-types  # gen-stub-imports
        'validation':
            self._generate_examples(split_name='val', scene_dir=scene_dir),  # pytype: disable=wrong-arg-types  # gen-stub-imports
    }

  def _generate_examples(self, scene_dir: epath.Path, split_name: str):
    scene_name = scene_dir.name
    scene_path = scene_dir / f'transforms_{split_name}.json'
    scene_data = json.loads(scene_path.read_text())


    intrinsics = builder_utils.camera_intrinsics(scene_data)