def __init__(self, objects, output_file='dataset.json'): """ Constructor. :param objects: an iterable of objects. Of those, only objects having hide_render set to False will be included to include in the dataset. :param output_file: the name of the output file (relative to the output directory). """ super().__init__() self._objects = [utils.get_object(o) for o in objects] self._output_file = output_file self._data = [] self._output_path = None
def __init__(self, light, power_range=None, color_range=None): """ Creates a new handler. :param light: light obj or its name. :param power_range: a tuple (strength_min, strength_max). :param color_range: a tuple ((r_min, g_min, b_min), (r_max, g_max, b_max)). """ super().__init__() self._light = utils.get_object(light) self._power_range = power_range self._color_range = color_range
def __init__(self, objects, location_range=None, rotation_euler_range=None, scale_range=None, bounds=None, intersection_3d=True, intersection_2d=True, max_corners_outside_image=None, make_map2d=False, random_attempt_count=100, break_on_first_failed=False): """ :param objects: an iterable of objects. :param location_range: a tuple ((x_min, y_min, z_min), (x_max, y_max, z_max)). :param rotation_euler_range: a tuple ((a1_min, a2_min, a3_min), (a1_max, a2_max, a3_max)). :param scale_range: a tuple ((sx_min, sy_min, sy_min), (sy_max, sy_max, sz_max)). :param bounds: a bounding box the objects must fit into: ((minx, miny, minz), (maxx, maxy, maxz)). :param intersection_3d: if False, the 3d objects will not intersect. :param intersection_2d: if False, the rendered objects will not intersect. :param max_corners_outside_image: maximal number of object corners outside the image. :param make_map2d: make a 2d array with pixels filled with object indexes. :param random_attempt_count: a number of attempts to place the objects. :param break_on_first_failed: if True, stops on the first objects that cannot be placed. """ super().__init__() self._location_range = np.array(location_range) self._rotation_euler_range = rotation_euler_range self._scale_range = scale_range self._objects = [utils.get_object(o) for o in objects] self._bounds = bounds self._intersection_2d = intersection_2d self._intersection_3d = intersection_3d self._max_corners_outside_image = max_corners_outside_image self._make_map2d = make_map2d self._map2d = None self._random_attempt_count = random_attempt_count self._break_on_first_failed = break_on_first_failed image_pose_camera, self._image_size = utils.get_camera_intrinsics() image_pose_camera = t3.Transform3(image_pose_camera) self._camera_pose_image = image_pose_camera.inv() self._image_corners = np.array( [[0, 0], [self._image_size[0], 0], [0, self._image_size[1]], [self._image_size[0], self._image_size[1]]]) - 0.5
def __init__(self, obj, location_range=None, rotation_euler_range=None, scale_range=None): """ Creates a new handler. :param obj: the object or its name. :param location_range: a tuple ((x_min, y_min, z_min), (x_max, y_max, z_max)). :param rotation_euler_range: a tuple ((a1_min, a2_min, a3_min), (a1_max, a2_max, a3_max)). :param scale_range: a tuple ((sx_min, sy_min, sy_min), (sy_max, sy_max, sz_max)). """ super().__init__() self._object = utils.get_object(obj) self._location_range = location_range self._rotation_euler_range = rotation_euler_range self._scale_range = scale_range
def __init__(self, obj, materials=[], texture_location_range=None, texture_rotation_range=None, texture_scale_range=None, color_range=None): """ Constructs a new SetTexturedSurfaceHandler. :param materials a list of material names. """ super().__init__() self._materials = [bpy.data.materials.get(mn) for mn in materials] self._object = utils.get_object(obj) self._texture_location_range = texture_location_range self._texture_rotation_range = texture_rotation_range self._texture_scale_range = texture_scale_range self._color_range = color_range