icaoberg/More random ellipsoids

Created Sat, 07 Aug 2021 20:45:14 +0000 Modified Sat, 07 Aug 2021 20:45:14 +0000

I thought about this during. Most of the ellipsoids I generate get synthesized outside of the image. Hence I have many blank images like this one

Montage

What can I do?

Not much. I clearly reached the moment where I need to sample and compute these stats using something like Python (or other) and then call ImageMagick from it. See convoluted script below

#!/bin/bash

set -x
for I in {1..100}
do
	X0=$((448 + $RANDOM % 576))
	Y0=$((448 + $RANDOM % 576))
	let "X_CIRCLE_EDGE=$X0+15"
	let "Y_CIRCLE_EDGE=$Y0+15"
	ANGLE=$((-45 + $RANDOM % 45))
	MIN_RADIUS=$((5 + $RANDOM % 50))
	X_ELLIPSOID_EDGE=$(($MIN_RADIUS + $RANDOM % 75 ))
	MIN_RADIUS=$((5 + $RANDOM % 75))
	Y_ELLIPSOID_EDGE=$(($MIN_RADIUS + $RANDOM % 75))
	FLIP_A_COIN=$(($(($RANDOM%10))%2))

	if [ $FLIP_A_COIN -eq 1 ];then
		convert -size 1024x1024 xc:black  \
        		    -draw "fill white rotate $ANGLE ellipse $X0,$Y0 $X_ELLIPSOID_EDGE,$Y_ELLIPSOID_EDGE 0,360 " \
					-draw "fill black rotate $ANGLE circle $X0,$Y0 $X_CIRCLE_EDGE,$Y_CIRCLE_EDGE" cell$I.png
	else
		convert -size 1024x1024 xc:black  \
        		    -draw "fill white rotate $ANGLE ellipse $X0,$Y0 $Y_ELLIPSOID_EDGE,$X_ELLIPSOID_EDGE 0,360 " \
					-draw "fill white rotate $ANGLE circle $X0,$Y0 $X_CIRCLE_EDGE,$Y_CIRCLE_EDGE" cell$I.png
	fi
done

montage -density 300 -tile 10x10 -geometry +5+5 -border 2 cell*.png montage10x10-translation-and-rotation6.png
convert montage10x10-translation-and-rotation6.png -scale 50% montage10x10-translation-and-rotation6.png
rm -f cell*png

and the pretty image it produces

Montage

$$ But why?

Gif

Honestly, at this point, it seems like to challenge to work this out on ImageMagick. I know… a dumb challenge.