regionprops3 measures the geometric properties of image objects in 3D space, including 'MajorAxis', 'MajorAxisLength', 'Centroid', 'AllAxes', and 'Eccentricity'.
Came up with a simple fix for you problem @Ganesh, at least if you're trying to find the centroid as in my case. I inserted "if isempty(pixs) == 0" and put all of the code following that inside of this if statement
it doesnot compute area,diameter
Nice work! Like it a lot. But still figuring evertything out.
Maybe a very basic question but: what happens here exactly? What formula is this based on?
distMat = sum(pixs.*repmat(eVectors(:,idx(1))',size(pixs,1),1),2);
output(ii).FirstAxisLength = range(distMat1);
@Ganesh, have you checked if your image data contains any NaN or Inf ? Use this to check : any(isnan(img(:))|isinf(img(:))). If the result comes back as one, you'll have to fix that in the image.
Can someone help me with this error, please?
"Error using eig
Input to EIG must not contain NaN or Inf.
Error in regionprops3 (line 55)
[eVectors, eValues] = eig(covmat);"
My input for regionprops3 is a 3-D binary image. I removed objects with single pixel, because that was mentioned as a problem. It still gave me the error.
Serdar Yeralan, can you describe the difficulties in more details ? Did you get any error?
I am having difficulties with the function "struct2array" it calls. Any help would be greatly appreciated
btw, could you please fix the function for the situations when the object consists of a single pixel.
L = zeros([5,5,5],'uint8');
L(3,3,3) = 1;
result = regionprops3(L, 'Eccentricity');
result = regionprops3(L, 'AllAxes');
Great function, thank you for sharing!
linked to github
Correct minor mistake in the function
Correct a mistake in the previous version and add a few more outputs.