Python-Unity Images documentation!¶
client.py¶
-
class
client.client_communicator_to_unity(use_unity_build=True, log_level=20, port_range=[49990, 50050])¶ -
__init__(use_unity_build=True, log_level=20, port_range=[49990, 50050])¶ Creates a socket and a logger for the console and saves a log file at:
log/python_client.log. Starts Unity ifuse_unity_build == Trueand waits until Unity is fully started to then call the functionconnect_to_server().Parameters: - use_unity_build (bool, optional) –
defaults to
True,If this is set true the Unity build will start. Otherwise you should already set the Unity editor to play.,
- log_level (int, optional) –
defaults to
logging.INFO,This variable sets the logging level of the console handler for the class which means how much information is displayed to your console. For debugging set it to: logging.DEBUG
Raises: IOError – Raises IOError if Unity build can not be found.
- use_unity_build (bool, optional) –
-
connect_to_server()¶ Establish tcp socket connection to Unity server.
Load client tcp config from
data/python/client_tcp_config.json.Try to connect to the Unity server.
If connection is established save the tcp config to
data/python/client_tcp_config.json.
-
exit()¶ Close tcp connection and send end request to Unity which quits the build application.
-
receive_data_as_bytes()¶ Receive image data from Unity trough socket. Ends by timeout, returns bytearray
Returns: From Unity recived bytearray. Return type: bytearray
-
receive_image()¶ Receive corresponding image.
Parameters: json_string (string) – This stringhas to be comprehensible for Unity which are strings returned bywrite_json_crane()Returns: Image corresponding to the input string. Return type: PngImageFile-array
-
send_to_unity(json_string, exit=False)¶ Send data to Unity server.
Parameters: - json_string (string) – This string will be sent to Unity. Has to be readable by Unity.
- exit (bool, optional) –
defaults to
False,If this is True the Unity build will close.
-
write_json_crane(request_pose=False, total_cuboids=3, same_scale=True, scale=2.0, same_theta=True, theta=40.0, phi=0.0, total_branches=None, same_material=True, metallic=0.5, smoothness=0.5, r=1.0, g=1.0, b=1.0, a=1.0, CameraRes_width=256, CameraRes_height=256, Camera_FieldofView=60.0, CameraRadius=12.0, CameraTheta=90.0, CameraPhi=0.0, CameraVerticalOffset=0.0, Camera_solid_background=True, DirectionalLightTheta=30.0, DirectionalLightIntensity=0.8, totalPointLights=1, same_PointLightsColor=True, PointLightsColor_r=1.0, PointLightsColor_g=1.0, PointLightsColor_b=1.0, PointLightsColor_a=1.0, PointLightsRadius=[7.0], PointLightsTheta=[20.0], PointLightsPhi=[0.0], PointLightsIntensity=[1.0], PointLightsRange=[10.0], totalSpotLights=1, same_SpotLightsColor=True, SpotLightsColor_r=1.0, SpotLightsColor_g=1.0, SpotLightsColor_b=1.0, SpotLightsColor_a=1.0, SpotLightsRadius=[10.0], SpotLightsTheta=[0.0], SpotLightsPhi=[0.0], SpotLightsIntensity=[1.0], SpotLightsRange=[10.0], SpotAngle=[30.0])¶ Returns string according to input parameter which can be interpreted by the Unity server. Should be used in function
receive_image()to create an image.Parameters: - "request_pose" (bool, optional) – This flag indicates if a groundtruth of the pose in form of an image has to be created.
- total_cuboids (int, optional) – The total amount of cubiods which will be “stacked” along one branch. Has to be bigger than zero, defaults to 3
- same_scale (bool, optional) – If the vertical scale of the cuboids should all be the same, defaults to True
- scale ('float' or 'list', optional) – The cuboids size vary only along the vertical dimension others are set to one. It is either a float if
same_scale == Trueor a list of floats with the lenght oftotal_cuboids, defaults to 2.0 - same_theta (bool, optional) – If the angle between two stacked cuboids should be the same for every cuboid, defaults to True
- theta (float, optional) – The angle between two stacked cuboids in degrees. If it is zero the cuboids will be vertically allinged. If
same_theta == Trueit has to be a float, else it has to be list of float with the length oftotal_cuboids - 1, defaults to 40.0 - phi (float, optional) – The rotation in degrees around the origin on the vertical axis for all cuboids i.e. the whole crane, defaults to 0.0
- total_branches (None or list, optional) – If this is
Nonethere will be a Crane with one arm without any branches. If it is notNoneit has to be alistof integers with the length oftotal_cubiods-1. The integers define how many branches are created at the cubiod corresponding to the index of the element in the list, defaults to None - same_material (bool, optional) – If all cuboids should have the same material properties, defaults to True
- metallic (float or list, optional) – The metallic property of the material of a cuboid should be in the range of zero and one. For more details have a look at the unity documentation. If
same_material == Trueit has to be a float, else it has to be a list of floats with the length oftotal_cuboids, defaults to 0.5 - smoothness (float, optional) – The smoothness property of the material of a cuboid should be in the range of zero and one.
If
same_material == Trueit has to be a float, else it has to be a list of floats with the length oftotal_cuboids, defaults to 0.5 - r (float or list, optional) – The red color property of the material of a cuboid should be in the range of zero and one.
If
same_material == Trueit has to be a float, else it has to be a list of floats with the length oftotal_cuboids, defaults to 1.0 - g (float or list, optional) – The green color property of the material of a cuboid should be in the range of zero and one.
If
same_material == Trueit has to be a float, else it has to be a list of floats with the length oftotal_cuboids, defaults to 1.0 - b (float or list, optional) – The blue color property of the material of a cuboid should be in the range of zero and one.
If
same_material == Trueit has to be a float, else it has to be a list of floats with the length oftotal_cuboids, defaults to 1.0 - a (float or list, optional) – The alpha channel/transparency of the material of a cuboid should be in the range of zero and one with zero beeing fully transparent. For more details have a look at the unity documentation.
If
same_material == Trueit has to be a float, else it has to be a list of floats with the length oftotal_cuboids, defaults to 1.0 - CameraRes_width (int, optional) – The width resolution of the receiving Image, defaults to 256
- CameraRes_height (int, optional) – The height resolution of the receiving Image, defaults to 256
- Camera_FieldofView (float, optional) – The field of view of the camera in degrees, defaults to 60.0
- CameraRadius (float, optional) – Position of the camera in spherical coordinates. The camera always faces the origin of the spherical coordinates, defaults to 12.0
- CameraTheta (float, optional) – In degree the position of the camera in spherical coordinates. The camera always faces the origin of the spherical coordinates, defaults to 90.0
- CameraPhi (float, optional) – In degree the position of the camera in spherical coordinates. The camera always faces the origin of the spherical coordinates, defaults to 0.0
- CameraVerticalOffset (float, optional) – This parameter offstets the origin of the spherical coordinate system only for the camera in the vertical i.e y-axis direction. The camera always faces the origin of its spherical coordinates, defaults to 0.0
- DirectionalLightTheta (float, optional) – The angle in degrees of the directional light i.e. the sun. For more details have a look at the unity documentation. If zero it is at the zenith i.e. directly above the origin, at 90 degrees the light comes from the horizon, defaults to 30.0
- DirectionalLightIntensity (float, optional) – The intesity of the light should be between zero and one but can be set higher, defaults to 0.8
- totalPointLights (int, optional) – The total amount of Pointlights in the scene. For more details about Pointlights have a look at the unity documentation, defaults to 1
- same_PointLightsColor (bool, optional) – If all Pointlights should have the same color, defaults to True
- PointLightsColor_r (float or list, optional) – The red color property of the light should be in the range of zero and one. If
same_PointLightsColor == Trueit has to be a float, else it has to be a list of floats with the length oftotalPointLights, defaults to 1.0 - PointLightsColor_g (float or list, optional) – The green color property of the light should be in the range of zero and one. If
same_PointLightsColor == Trueit has to be a float, else it has to be a list of floats with the length oftotalPointLights, defaults to 1.0 - PointLightsColor_b (float or list, optional) – The blue color property of the light should be in the range of zero and one. If
same_PointLightsColor == Trueit has to be a float, else it has to be a list of floats with the length oftotalPointLights, defaults to 1.0 - PointLightsColor_a (float or list, optional) – The alpha channel/ transparency of the color of the light should be in the range of zero and one. If
same_PointLightsColor == Trueit has to be a float, else it has to be a list of floats with the length oftotalPointLights, defaults to 1.0 - PointLightsRadius (list, optional) – The positions of all Pointlights in spherical coordinates. Has to be a list of floats with the length of
totalPointLights, defaults to [7.0] - PointLightsTheta (list, optional) – The positions of all Pointlights in spherical coordinates. Has to be a list of floats with the length of
totalPointLights, defaults to [20.0] - PointLightsPhi (list, optional) – The positions of all Pointlights in spherical coordinates. Has to be a list of floats with the length of
totalPointLights, defaults to [0.0] - PointLightsIntensity (list, optional) – The intensities of all Pointlights should be in the range of zero and one. Has to be a list of floats with the length of
totalPointLights, defaults to [1.0] - PointLightsRange (list, optional) – The range of the emitted light from the Pointlights. Should be adjusted depending on the position of the lights to “reach” the cuboids. Has to be a list of floats with the length of
totalPointLights, defaults to [10.0] - totalSpotLights (int, optional) – The total amount of Spotlights in the scene. For more details about Spotlights have a look at the unity documentation, defaults to 1
- same_SpotLightsColor (bool, optional) – If all Spotlights should have the same color, defaults to True
- SpotLightsColor_r (float or list, optional) – The red color property of the light should be in the range of zero and one. If
same_SpotLightsColor == Trueit has to be a float, else it has to be a list of floats with the length oftotalSpotLights, defaults to 1.0 - SpotLightsColor_g (float or list, optional) – The green color property of the light should be in the range of zero and one. If
same_SpotLightsColor == Trueit has to be a float, else it has to be a list of floats with the length oftotalSpotLights, defaults to 1.0 - SpotLightsColor_b (float or list, optional) – The blue color property of the light should be in the range of zero and one. If
same_SpotLightsColor == Trueit has to be a float, else it has to be a list of floats with the length oftotalSpotLights, defaults to 1.0 - SpotLightsColor_a (float or list, optional) – The alpha channel/ transparency of the color of the light should be in the range of zero and one. If
same_SpotLightsColor == Trueit has to be a float, else it has to be a list of floats with the length oftotalSpotLights, defaults to 1.0 - SpotLightsRadius (list, optional) – The positions of all Spotlights in spherical coordinates. Spotlights always face the origin. Has to be a list of floats with the length of
totalSpotLights, defaults to [10.0] - SpotLightsTheta (list, optional) – The positions of all Spotlights in spherical coordinates. Spotlights always face the origin. Has to be a list of floats with the length of
totalSpotLights, defaults to [0.0] - SpotLightsPhi (list, optional) – The positions of all Spotlights in spherical coordinates. Spotlights always face the origin. Has to be a list of floats with the length of
totalSpotLights, defaults to [0.0] - SpotLightsIntensity (list, optional) – The intensities of all Spotlights should be in the range of zero and one. Has to be a list of floats with the length of
totalSpotLights, defaults to [1.0], defaults to [1.0] - SpotLightsRange (list, optional) – The range of the emitted light from the Spotlights. Should be adjusted depending on the position of the lights to “reach” the cuboids. Has to be a list of floats with the length of
totalSpotLights, defaults to [10.0] - SpotAngle (list, optional) – In degree this describes the angle created by the cone of the Spotlight. Has to be a list of floats with the length of
totalSpotLights, defaults to [30.0]
Returns: Returns a string with all given parameters for unity to interpret. Can be used in function
receive_image()to create an image.Return type: string
-
dataset.py¶
-
class
dataset.dataset_cuboids(dataset_name=None, unique_data_folder=True, debug_log=False, use_unity_build=True, dataset_directory=None, absolute_path=False, port_range=[49990, 50050])¶ -
__init__(dataset_name=None, unique_data_folder=True, debug_log=False, use_unity_build=True, dataset_directory=None, absolute_path=False, port_range=[49990, 50050])¶ Sets up logging, the config, necessary paths and a client instance form
client_communicator_to_unity.Parameters: - dataset_name (string or None, optional) – If this is not default the created images and parameters are saved into a folder nested in
data/dataset/containing the dataset_name, defaults to None - unique_data_folder (bool, optional) – If
Truethe name of the folder for your dataset will start with a time stamp. IfFalsethe name of the folder will only contain the name of the dataset and can be used across many instances of this class, defaults to True - use_unity_build (bool, optional) – If this is set to true image generation will work automatically with the Unity build. Otherwise you have to manually set the Unity editor to play, defaults to True
- debug_log (bool, optional) – If there should be more information displayed in the console for debugging, defaults to False
- dataset_name (string or None, optional) – If this is not default the created images and parameters are saved into a folder nested in
-
change_app1_art2(para1, para2)¶ Combines the appearence and the articulation of two different parameters.
Parameters: - para1 (dictionary) – Loaded or created parameters as from
create_random_parameters(). - para2 (dictionary) – Loaded or created parameters as from
create_random_parameters().
Returns: Parameters which combine the appearence of para1 and articulation of para2.
Return type: dictionary
- para1 (dictionary) – Loaded or created parameters as from
-
change_apperence_camera_phi(parameters, start_value, end_value, numb_of_changes)¶ Create many parameters in a list with the only difference in the Camera Phi value between
start_valueand theend_value.Parameters: - parameters (dictionary) – Loaded or created parameters as from
create_random_parameters(). - start_value (float) – The value of phi of the camera in the first parameters in degree.
- end_value (float) – The value of phi of the camera in the last parameters in degree.
- numb_of_changes (int) – How many parameters are going to be added to the returned list.
Returns: List with the length:
numb_of_changesof parameters in wich Camera position Phi is linearly extrapolated between thestart_valueand theend_value.Return type: list
- parameters (dictionary) – Loaded or created parameters as from
-
change_apperence_camera_phi_relative(parameters, delta_phi=20)¶ Input parameters and get parameters with the Camera position Phi shifted by
delta_phi.Parameters: - parameters (dictionary) – Loaded or created parameters as from
create_random_parameters(). - delta_phi (float, optional) – The amount of the added angle to Phi in degrees, defaults to 20
Returns: Parameters with Camera position Phi shifted by
delta_phi.Return type: dictionary
- parameters (dictionary) – Loaded or created parameters as from
-
change_apperence_camera_theta(parameters, start_value, end_value, numb_of_changes)¶ Create many parameters in a list with the only difference in the Camera theta value between
start_valueand theend_value.Parameters: - parameters (dictionary) – Loaded or created parameters as from
create_random_parameters(). - start_value (float) – The value of theta of the camera in the first parameters in degree.
- end_value (float) – The value of theta of the camera in the last parameters in degree.
- numb_of_changes (int) – How many parameters are going to be added to the returned list.
Returns: List with the length:
numb_of_changesof parameters in wich Camera position theta is linearly extrapolated between thestart_valueand theend_value.Return type: dictionary
- parameters (dictionary) – Loaded or created parameters as from
-
change_apperence_camera_theta_relative(parameters, delta_theta=20)¶ Input parameters and get parameters with the Camera position theta shifted by
delta_theta.Parameters: - parameters (dictionary) – Loaded or created parameters as from
create_random_parameters(). - delta_theta (float, optional) – The amount of the added angle to Theta in degrees, defaults to 20
Returns: Parameters with Camera position Theta shifted by
delta_theta.Return type: dictionary
- parameters (dictionary) – Loaded or created parameters as from
-
change_articulation_theta(parameters, start_value, end_value, numb_of_changes, theta_pos=None)¶ Get a list of the input parameters with a changed crane articulation at the cuboid
theta_posbetweenstart_valueandend_value. Iftheta_posis default then all theta of the crane are changing.Parameters: - parameters (dictionary) – Loaded or created parameters as from
create_random_parameters(). - start_value (float) – The theta angel in degrees for the first parameters in the list.
- end_value (float) – The theta angel in degrees for the last parameters in the list.
- numb_of_changes (int) – How many parameters are going to be added to the returned list.
- theta_pos (int, optional) – Defines at which cuboid theta is going to change. Has to be smaller than
parameters["total_cuboids"]if not, set toparameters["total_cuboids"]-1. If it is default: None all thetas are changing, defaults to None
Returns: A list with
numb_of_changesparameters with changed theta fromstart_valuetoend_valueat the cubiodtheta_pos.Return type: list
- parameters (dictionary) – Loaded or created parameters as from
-
create_json_string_from_parameters(dictionary)¶ Inputs the parameters/dictionary into the function
write_json_crane().Parameters: dictionary (dictionary) – A dictionary similar to one from create_random_parameters()with all input parameters for the functionwrite_json_crane().Returns: A string depending on your input parameters wich can be interpreted afterwards by the Unity script. Return type: string
-
create_random_parameters()¶ Creates random input parameters depending on your config which defines the interval for the generated parameters, the camera parameters are not set randomly
Parameters: - CameraRes_width (int, optional) – Image resolution width, defaults to 520
- CameraRes_height (int, optional) – Image resolution height, defaults to 520
Returns: A dictionary to use as input for function
create_json_string_from_parameters().Return type: dictionary
-
exit()¶ Closes TCP connection. Send end request to Unity and with that quit the application.
-
get_example(save_image=False, save_para=None, return_dict=True, index=None)¶ Create an example of the dataset.
Parameters: - save_para (bool or None, optional) – If the parameters should be saved at
data/parameters, if set toNonethey will not be created if a seed is available in the config, defaults to None - save_image (bool, optional) – If the image should be saved at
data/images, defaults to False - index (None or int, optional) – Shoukd be default. If specified the the new data will overwrite the old data at the given index if available, defaults to None
Returns: A dictionary with all relevant data in the keys “index”, “parameter” and “image”.
Return type: dictionary
- save_para (bool or None, optional) – If the parameters should be saved at
-
increment_index()¶ Load, increment and return the new external saved index.
Raises: FileNotFoundError – If the file data/python/index.txtis not found.Returns: An integer which represents the next index. Return type: int
-
load_config(index_config=0, file_name=None)¶ This enables you to load an old config to replicate a dataset.
Parameters: - index_config (int, optional) – This will give you the latest config if set to zero, if set to one it will set the the second latest config and so on, defaults to
0 - file_name (string or None, optional) – This specifies the file name. If this is not default the specified file will be loaded, defaults to
None
- index_config (int, optional) – This will give you the latest config if set to zero, if set to one it will set the the second latest config and so on, defaults to
-
load_parameters(index=[-1], amount=1)¶ Load and return a given amount of parameters as dictionaries in a list. If index is not specified the index will be chosen randomly.
Parameters: - index (list, optional) – If index is default it will be generated randomly else it has to be a list of integers the length of
amount, defaults to [-1] - amount (int, optional) – The amount of dictionaries in the returned list, defaults to 1
Returns: A list of parameters as dictionaries is returned except the amount is one or default the dictionary itself will be returned.
Return type: list or dictionary
- index (list, optional) – If index is default it will be generated randomly else it has to be a list of integers the length of
-
parameters_to_finished_data(parameters, save_image=True, save_para=None, return_dict=True)¶ Input parameters and get an corresponding image.
Parameters: - parameters (dictionary) – Parameters to use for
create_json_string_from_parameters(). - save_para (bool or None, optional) – If the parameters should be saved at
data/parameters, ifNonethey will not be created if a seed is available in the config, defaults to None - save_image (bool, optional) – If the image should be saved at
data/images, defaults to True
Returns: A dictionary with all relevant data in keys as “index”,”parameters” and “image”.
Return type: dictionary
- parameters (dictionary) – Parameters to use for
-
plot_images(dicts, images_per_row=4, save_fig=True, show_index=True)¶ Plot and show all images contained in the list dicts of dictionaries and label them with their corresponding index.
Parameters: - dicts (list) – Has to be a list with dictionaries in which there is the key “image” and if wanted “index” as returned from
parameters_to_finished_data() - images_per_row (int, optional) – How many images are plotted in one row, defaults to 4
- save_fig (bool, optional) – If the created plot of all images should be saved to
data/figures, defaults to True - show_index (bool, optional) – If the corresponding index of every image is shown in the plot, defaults to True
- dicts (list) – Has to be a list with dictionaries in which there is the key “image” and if wanted “index” as returned from
-
printProgressBar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='█', printEnd='\r')¶ Call in a loop to create terminal progress bar @params:
iteration - Required : current iteration (Int) total - Required : total iterations (Int) prefix - Optional : prefix string (Str) suffix - Optional : suffix string (Str) decimals - Optional : positive number of decimals in percent complete (Int) length - Optional : character length of bar (Int) fill - Optional : bar fill character (Str) printEnd - Optional : end character (e.g. ““, ” “) (Str)
-
read_index()¶ Load and return the old external saved index.
Raises: FileNotFoundError – If the file data/python/index.txtis not found.Returns: An integer which represents the last used index. Return type: int
-
reset_index(set_index=-1)¶ Reset the external saved index to
set_indexto save storage and overwrite old parameters and images.Parameters: set_index (int, optional) – The index to which it will be set, defaults to 0
-
save(dictionary, save_image=False, save_para=None)¶ Save parameter data or/and an image of a dictionary in the
data/parametersfolder or thedata/imagesfolder. The saved parameters can be loaded withload_parameters()and then manipulated to create an altered image.Parameters: - dictionary (dictionary) – A dictionary with keys as “index”, “parameters” and if needed “image”. For example a returned dictionary from
parameters_to_finished_data(). - save_para (bool, optional) – If the parameters should be saved to
data/parameterslabeled with the index if available, ifNoneand there is no seed save in the config, defaults toNone - save_image (bool, optional) – If the image should be saved to
data/imageslabeled with the index if available, defaults toFalse
- dictionary (dictionary) – A dictionary with keys as “index”, “parameters” and if needed “image”. For example a returned dictionary from
-
set_config(save_config=True, request_pose=False, request_three=False, same_scale=None, scale=[0.5, 4], total_cuboids=[2, 5], phi=[0, 360], specify_branches=False, branches=[1, 3], same_theta=None, theta=None, same_material=None, specify_material=False, r=[0, 1], g=[0, 1], b=[0, 1], a=1, metallic=[0, 1], smoothness=[0, 1], CameraRes_width=1024, CameraRes_height=1024, Camera_FieldofView=90, CameraRadius=None, CameraTheta=[60, 100], CameraPhi=[0, 360], CameraVerticalOffset=None, Camera_solid_background=False, totalPointLights=[5, 12], PointLightsRadius=[5, 20], PointLightsPhi=[0, 360], PointLightsTheta=[0, 90], PointLightsIntensity=[7, 17], PointLightsRange=[5, 25], same_PointLightsColor=None, PointLightsColor_r=[0, 1], PointLightsColor_g=[0, 1], PointLightsColor_b=[0, 1], PointLightsColor_a=[0.5, 1], totalSpotLights=[3, 7], SpotLightsRadius=[5, 20], SpotLightsPhi=[0, 360], SpotLightsTheta=[0, 90], SpotLightsIntensity=[5, 15], SpotLightsRange=[5, 25], SpotAngle=[5, 120], same_SpotLightsColor=None, SpotLightsColor_r=[0, 1], SpotLightsColor_g=[0, 1], SpotLightsColor_b=[0, 1], SpotLightsColor_a=[0.5, 1], DirectionalLightTheta=[0, 90], DirectionalLightIntensity=[1.0, 5.0], specify_scale=False, specify_theta=False)¶ Sets a config for this class instace which determines the interval for all random parameters created in the function
create_random_parameters(). The meaning of all the parameters are explained in this function:write_json_crane(). Here are only those parameters mentioned which deviate from thestandard_parameter. You can also specify and set parameters which should not be generated randomly.Parameters: - "save_config" (bool, optional) – This flag indicates if the config should be saved. It should be kept at the default:
True. - "request_pose" (bool, optional) – This flag indicates if a groundtruth of the pose in form of an image has to be created.
- "standard_parameter" – Has to be a list with two floats. The first element describes the lower boundary and second element describes the upper boundary for the function
create_random_parameters()in which the variable is set randomly, defaults is a predefined list - same_scale (None or bool, optional) – If
Nonethe boolean will be set randomly increate_random_parameters(). Otherwise it will be set to the given boolean, defaults to None - specify_branches (bool, optional) – Mainly leave it at the default: False, but if you wish to set the parameter
branchesnot randomly you can set it toTrueand specify them. - branches (None or list, optional) – If
Nonethere will be no branches which means one main branch. Else has to be a list with two integers. The amount of branches created increate_random_parameters()at every cuboid will be chosen from a normal distribution where the second element of this list is interpreted als three sigma deviation, there is also a thrid option to set this parameter to a fixed value: you can usespecyfy_branches = Trueand input a list with your desired values with a length oftotal_cuboids - 1, defaults to [1,3] - same_theta (None or bool, optional) – If
Nonethe boolean will be set randomly increate_random_parameters(). Otherwise it will be set to the given boolean, defaults to None - theta (None, list, float or int, optional) – If
Nonethe values for theta is set randomly between zero and360/total_cuboids. Otherwise it has to be a list of length 2. If you want fixed values you can input a float or an int ifsame_theta = True, if you want fixed values withsame_theta = Falseyou have to setspecify_theta = True, defaults to None - same_material (None or bool, optional) – If
Nonethe boolean will be set randomly increate_random_parameters(). Otherwise it will be set to the given boolean, defaults to None - CameraRes_width (int, optional) – The width Resolution of your image, default to 1024
- CameraRes_height (int, optional) – The height Resolution of your image, default to 1024
- Camera_FieldofView (float or int, optional) – The Fiel of View of the camera, default to 80
- CameraRadius (float, int, None or list, optional) – If a
floatorintis entered then the value increate_random_parameters()will not be random, instead set to the given value. If it is a list it has to be a list of length two. If it is set to `None`it will be calculated to fit the enire crane in the picture, defaults to 10.0 - CameraTheta (float, int or list, optional) – If
floatorintthen the value increate_random_parameters()will not be random, instead set to the given value. If it is a list it has to be a list of length two, defaults to [30,100] - CameraPhi (float, int or list, optional) – If input is
floatorintthen the value increate_random_parameters()will not be random, instead set to the given value. If it is a list it has to be a list of length two, defaults to [0,360] - CameraVerticalOffset (None, float, int or list, optional) – If
Noneit is set to zero. If input isfloatorintthen the value increate_random_parameters()will not be random, instead set to the givenfloat. If it is a list it has to be a list of length two, defaults to None - totalPointLights (None or list, optional) – If
Nonethere will be no Pointlights created increate_random_parameters(). Else it has to be a list of integers with the length two, defaults to [5,12] - same_PointLightsColor (None or bool, optional) – If
Nonethe boolean will be chosen randomly, else the given boolean is used, defaults to None - totalSpotLights (None or list, optional) – If
Nonethere will be no Spotlights created increate_random_parameters(). Else it has to be a list of integers with the length two, defaults to None - same_SpotLightsColor (None or bool, optional) – If
Nonethe boolean will be chosen randomly, else the given boolean is used, defaults to None - DirectionalLightTheta (None, float, int or list, optional) – If
NonetheDirectionalLightIntensitywill be set to zero, elif has to be a list of floats with the length two, for a fixed value enter afloatorint, defaults to [0,90] - DirectionalLightIntensity (None, float, int or list, optional) – If
NonetheDirectionalLightIntensitywill be set to zero, elif has to be a list of floats with the length two, for a fixed value enter afloatorint, defaults to [0.1,1.8] - specify_scale (bool, optional) – If this is set
Trueyou can enter the fixed values forscaleeven ifsame_scale = False, defaults to False - specify_theta (bool, optional) – If this is set
Trueyou can enter the fixed values forthetaeven ifsame_theta = False, defaults to False
- "save_config" (bool, optional) – This flag indicates if the config should be saved. It should be kept at the default:
-
three_parameters_to_finished_data(parameter_list, save_image=True, save_para=None, return_dict=True)¶ Input parameters and get an corresponding image.
Parameters: - parameters (dictionary) – Parameters to use for
create_json_string_from_parameters(). - save_para (bool or None, optional) – If the parameters should be saved at
data/parameters, ifNonethey will not be created if a seed is available in the config, defaults to None - save_image (bool, optional) – If the image should be saved at
data/images, defaults to True
Returns: A dictionary with all relevant data in keys as “index”,”parameters” and “image”.
Return type: dictionary
- parameters (dictionary) – Parameters to use for
-