diff --git a/scripts/create_test_data.py b/scripts/create_test_data.py new file mode 100644 index 0000000000000000000000000000000000000000..1e196fe6e11282256ae0766f0bf09a17e7dd66d0 --- /dev/null +++ b/scripts/create_test_data.py @@ -0,0 +1,49 @@ +from PIL import Image, ImageDraw + + +def generate_test_image(width, height, file_path): + # Create an empty white image + image = Image.new(mode = "RGB", size = (width, height), color=(255,255,255)) + + # Save the image as a PNG file + image.save(file_path) + +# Example usage +width = 1000 # Specify the width of the image in pixels +height = 1000 # Specify the height of the image in pixels +file_path = 'testimage.png' # Specify the file path for saving the image + +# Generate and save the black and white image +generate_test_image(width, height, file_path) + + +"""This is used to generate the test data""" + +def generate_image_with_squares(width, height, square_diameter, square_locations, num_images): + # Create a white image with objects of specified size at specified x, y locations + for i in range(1, num_images + 1): + image = Image.new('RGB', (width, height), color=(255, 255, 255)) + + # Create a draw object + draw = ImageDraw.Draw(image) + + # Draw black squares + for location in square_locations: + x, y = location + square = (x, y, x + (square_size - 1), y + (square_size - 1)) + # square defines the bounding box + draw.rectangle(square, fill=(0, 0, 0)) + + file_name = f"../test_data/PyTest/test_s00{i}.png" + image.save(file_name, "PNG") + +# Example usage +width = 1500 # Specify the width of the image in pixels +height = 1000 # Specify the height of the image in pixels +square_diameter = 10 # Specify the size of the black squares in pixels +square_locations = [(500, 500), (500, 600), (500, 700), (1000, 500), (1000,600),(1000,700)] # Specify the x, y locations of the black squares +num_images = 5 + +# Generate the white image with black squares +image = generate_image_with_squares(width, height, square_diameter, square_locations,num_images) + diff --git a/test_data/PyTest/test_s001.png b/test_data/PyTest/test_s001.png new file mode 100644 index 0000000000000000000000000000000000000000..260f98b911f9071cb51e7d5a47bd263866afae6b Binary files /dev/null and b/test_data/PyTest/test_s001.png differ diff --git a/test_data/PyTest/test_s002.png b/test_data/PyTest/test_s002.png new file mode 100644 index 0000000000000000000000000000000000000000..260f98b911f9071cb51e7d5a47bd263866afae6b Binary files /dev/null and b/test_data/PyTest/test_s002.png differ diff --git a/test_data/PyTest/test_s003.png b/test_data/PyTest/test_s003.png new file mode 100644 index 0000000000000000000000000000000000000000..260f98b911f9071cb51e7d5a47bd263866afae6b Binary files /dev/null and b/test_data/PyTest/test_s003.png differ diff --git a/test_data/PyTest/test_s004.png b/test_data/PyTest/test_s004.png new file mode 100644 index 0000000000000000000000000000000000000000..260f98b911f9071cb51e7d5a47bd263866afae6b Binary files /dev/null and b/test_data/PyTest/test_s004.png differ diff --git a/test_data/PyTest/test_s005.png b/test_data/PyTest/test_s005.png new file mode 100644 index 0000000000000000000000000000000000000000..260f98b911f9071cb51e7d5a47bd263866afae6b Binary files /dev/null and b/test_data/PyTest/test_s005.png differ diff --git a/test_data/create_test_data.py b/test_data/create_test_data.py deleted file mode 100644 index f5f70f579499043da8db316fc4751385d9ab0a67..0000000000000000000000000000000000000000 --- a/test_data/create_test_data.py +++ /dev/null @@ -1,43 +0,0 @@ -from PIL import Image, ImageDraw - -def generate_test_image(width, height, file_path): - # Create an empty white image - image = Image.new(mode = "RGB", size = (width, height), color=(255,255,255)) - - # Save the image as a PNG file - image.save(file_path) - -# Example usage -width = 1000 # Specify the width of the image in pixels -height = 1000 # Specify the height of the image in pixels -file_path = 'testimage.png' # Specify the file path for saving the image - -# Generate and save the black and white image -generate_test_image(width, height, file_path) - -def generate_white_image_with_squares(width, height, square_size, square_locations): - # Create a white image with objects of specified size and x, y location - image = Image.new('RGB', (width, height), color=(255, 255, 255)) - - # Create a draw object - draw = ImageDraw.Draw(image) - - # Draw black squares - for location in square_locations: - x, y = location - square = (x, y, x + square_size, y + square_size) - draw.rectangle(square, fill=(0, 0, 0)) - - return image - -# Example usage -width = 1000 # Specify the width of the image in pixels -height = 1000 # Specify the height of the image in pixels -square_size = 50 # Specify the size of the black squares in pixels -square_locations = [(500, 500), (150, 150), (250, 250), (750, 750)] # Specify the x, y locations of the black squares - -# Generate the white image with black squares -image = generate_white_image_with_squares(width, height, square_size, square_locations) - -# Save the image -image.save('white_image_with_squares.png') \ No newline at end of file diff --git a/test_data/testimage.png b/test_data/testimage.png new file mode 100644 index 0000000000000000000000000000000000000000..77cdf70f52d8d4532d1a1563659b3e54959ebe14 Binary files /dev/null and b/test_data/testimage.png differ diff --git a/test_data/white_image_with_squares.png b/test_data/white_image_with_squares.png index f2caf78a8adb2896d8a8a125dadd167c65de4add..ff9fbdb168a9ec47ad27b731e1e5ec00bd116606 100644 Binary files a/test_data/white_image_with_squares.png and b/test_data/white_image_with_squares.png differ