Multiple Sphere Fits to 3D matrix
4 views (last 30 days)
Show older comments
I need to be able to do multiple sphere fits to a 3D matrix. The 3D matrix is created from a series of 2D images. This 3D matrix is supposed to represent a sort of mesh-like material, and I want to fit spheres to estimate pore size. The code that I am using is the Sphere Fit (Least squared) by Alan Jennings, but I think this only fits one sphere to the data. How would I go about fitting spheres everywhere there might be a 'pore'?
I have attached the current code that I have below. Essentially, I am taking a series of 2D images, resizing them, so they can be made into a 3D matrix.
% pre-allocate (or pre-size) a matrix to store all 1001 2D images
numImages = 1001;
allImages = uint8(zeros(maxnumrow,maxnumcol,numImages));
for k = 1 : numImages
% OPTION 2: Create an image filename, and read it in to a variable called imageData.
jpgFileName = strcat('image', num2str(k), '.jpg');
if isfile(jpgFileName)
imageData = imread(jpgFileName);
%resize all images to same size
imresize(imageData,[maxnumrow maxnumcol], 'bilinear');
% load the data from file
dataStruct = load(imageData);
% save the data to the 3D array
allImages(:,:,k) = dataStruct.(char(fields(dataStruct)));
else
fprintf('File %s does not exist.\n', jpgFileName);
end
end
sphereFit(allImages)
Thank you.
0 Comments
Answers (0)
See Also
Categories
Find more on Point Cloud Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!