how to calculate voxel image volume ?

13 visualizaciones (últimos 30 días)
Moussa DIEDHIOU
Moussa DIEDHIOU el 31 de Ag. de 2022
Movida: Image Analyst el 1 de Sept. de 2022
Hi,
I am nex in matlab coding.
I am using voxel image function to drow voxels on a point cloud.
the code is runing and it gives a good plot. But the problem is that i do not know how to estimate the volume of my voxelized object ?
anyone can help ?
I already use volume function or [C,V] like alphashape or convexhull, but it doesn't work.
Thank's
  2 comentarios
Walter Roberson
Walter Roberson el 31 de Ag. de 2022
is it https://www.mathworks.com/help/vision/ref/pcmapndt.html that you are using?
Moussa DIEDHIOU
Moussa DIEDHIOU el 31 de Ag. de 2022
Hi,
the code is :
ptclouds = load('exemple.xyz');
Pts = ptclouds(:,1:3);
vs = [0.5, 0.5, 0.5]; % voxel size
vxl = voxel_image(Pts, vs);
Thank's

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 31 de Ag. de 2022
Try regionprops3 or just sum the binarized image to count the voxels.
  3 comentarios
Walter Roberson
Walter Roberson el 31 de Ag. de 2022
Image Analyst is not available through email.
Moussa DIEDHIOU
Moussa DIEDHIOU el 31 de Ag. de 2022
yes. Thank you for your help

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 31 de Ag. de 2022
discretize() each coordinate axis separately, getting an index number for each point. Use accumarray() with the combined indices, and count 1. Afterwards the volume is nnz() of the count times the volume of each voxel.
  3 comentarios
Walter Roberson
Walter Roberson el 31 de Ag. de 2022
N = 500;
data = randn(N,3) .* [20 10 15];
ptc = pointCloud(data);
%pcshow does not work in MATLAB Answers
xyz = ptc.Location;
scatter3(xyz(:,1), xyz(:,2), xyz(:,3)); %instead of pcshow for Answers
minxyz = floor(min(xyz,[],1));
maxxyz = ceil(max(xyz,[],1));
dx = .5; dy = .25; dz = .5;
xidx = 1 + floor((xyz(:,1) - minxyz(1))/dx);
yidx = 1 + floor((xyz(:,2) - minxyz(2))/dy);
zidx = 1 + floor((xyz(:,3) - minxyz(3))/dz);
counts = accumarray([xidx, yidx, zidx], 1);
volume = nnz(counts) .* (dx .* dy .* dz)
volume = 31.2500
volshow(counts, 'BackgroundColor', [0.8 0.8 0.8]);
Moussa DIEDHIOU
Moussa DIEDHIOU el 1 de Sept. de 2022
Movida: Image Analyst el 1 de Sept. de 2022
It works ! Thank you so so much for your help Roberson.

Iniciar sesión para comentar.

Categorías

Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by