File size: 1,508 Bytes
60acf32 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import numpy as np
########################################################################################################################
# Make the data using all the code in Shape_Generation_Functions.py
def make_boxes(image_size, densities, shapes):
"""
:param image_size: [int] - the pixel height and width of the generated arrays
:param densities: [list] - of the values of each of the active pixels in each shape
:param shapes: [list] - of the various shapes desired for the dataset
:return: [list[tuple]] - [Array, Density, Thickness, Shape]
"""
matrix = []
for function in shapes: # Adds different types of shapes
# Adds different density values
for i in range(len(densities)):
# Loops through the possible thickness values
for j in range(image_size): # Adds additional Pixels
thickness = j
Array = (function(thickness, densities[i], image_size))
# Checks if there are any 0's left in the array to append
if (np.where((Array == float(0)))[0] > 0).any():
the_tuple = (Array, str(function.__name__), densities[i], thickness)
matrix.append(the_tuple)
# Prevents solids shapes from being appended to the array
else:
break
return matrix
########################################################################################################################
|