A simple way to solve this problem is to first crop, binarize and clean the image of noise, followed by finding the centroids and major/minor axes values using the command ‘regionprops’ and finally using the 'imcrop' function to get to your desired output.
To achieve the first step,
im = imread('figCrop.png');
im = rgb2gray(im);
im1 = imcrop(im,[223 118, 1333, 1273]);
im2 = imbinarize(im1);
im3 = imfill(im2, 'holes');
J = medfilt2(im3,[15 15]);
Secondly, use the MATLAB command ‘regionprops’ to extract the centroid values and minor/major axes lengths.
s = regionprops(J,'centroid');
centroids = cat(1,s.Centroid);
stats = regionprops('table',J,'Centroid',...
This will result in a table ‘stats’ that holds all the centroid and axes length information. Note that there are a few additional unnecessary values since the image could not be cleaned completely. These values must be neglected.
Now, leverage this information in ‘stats’ to feed the data to ‘imcrop’command to get the desired outputs. You may automate this process by writing a code that iteratively moves through all the centroids and crop images according to minor/major axes values.