I feel like this is probably a basic question, but I need to create a database of ellipses with random dimensions for a project. I'm doing the following code right now in Google Colab:
import numpy as np
import cv2
from matplotlib import pyplot as plt
import pandas as pd
from PIL import Image
from skimage import color
for i in range(2):
img = np.full((64,64,3), 255, dtype=np.uint8)
center_x = np.random.randint(30,45)
center_y = np.random.randint(30,45)
major_axis = np.random.randint(1,9)
minor_axis= np.random.randint(1,9)
angle = 0
B = 0
G = 0
R = 0
ellipseCoords = [img, (center_x,center_y), (major_axis, minor_axis), angle, 0, 360, (B,G,R), -1]
a = cv2.ellipse(img, (center_x, center_y), (major_axis, minor_axis), angle, 0, 360, (B, G, R), -1)
plt.imshow(a)
a.shape
The above code creates and graphs two ellipses as intended. I'm going to end up needing about 64-100 for the final thing, so individually saving the images seems very time-consuming. Worse comes to worse, I'll do that, but I would prefer using a computerized way.
Is this possible to do? I can't seem to find anything that helps...
Thanks!