This Image Sampler script is designed to extract 3 non-overlapping random samples from a given image. The user defines the size of the three samples, and if the image is large enough to fit three non-overlapping samples, the images are displayed.
When executed, the script will:
-
Read and display the input image.
-
Based on the dimensions of the image, verify that the samples can be arranged over the input image, without sample overlap.
-
The samples are placed on the image in a valid configuration, as determined by step 2.
-
A mask is created, by removing the coordinates where samples are placed, including a buffer around the samples and the edge of the image.
-
An image is "lifted", and the mask is used to determine a random valid coordinate where the image can be placed.
-
Step 5 is repeated for the remaining image samples.
-
The samples are now displayed, and the sample coordinates are saved.
The file named Version 2 contains a more complete version of the original script.