File Exchange

image thumbnail

Surface Reconstruction using Implicit B-Splines

version 1.6.1.0 (16.5 MB) by Mohammad Rouhani
Using Implicit B-Splines for Surface Reconstruction out of 3D point clouds.

21 Downloads

Updated 27 Mar 2019

View Version History

View License

Using Implicit B-Splines for Surface Reconstruction out of 3D point clouds.

Please cite the following paper, in case of using the code:

Rouhani M. and Sappa A.D., Implicit B-spline fitting using the 3L algorithm, IEEE Conference on on Image Processing (ICIP'11), 2011.

Cite As

Mohammad Rouhani (2021). Surface Reconstruction using Implicit B-Splines (https://www.mathworks.com/matlabcentral/fileexchange/44654-surface-reconstruction-using-implicit-b-splines), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (17)

Enrique Alonso

here function [f index Buvw] =BSpline3D(P,x,y,z)

M=size(P,1); N=size(P,2); O=size(P,3);
stepX=1/(M-3); stepY=1/(N-3); stepZ=1/(O-3);

i=floor(x/stepX)+1;
j=floor(y/stepY)+1;
k=floor(z/stepZ)+1;
u=x/stepX-i+1;
v=y/stepY-j+1;
w=z/stepZ-k+1;

%index=[i j];
f=0; h=0;

B=[-1 3 -3 1; 3 -6 3 0; -3 0 3 0; 1 4 1 0]/6;
bu=[u.^3, u.^2,u ,1]*B;
bv=[v^3 v^2 v 1]*B;
bw=[w^3 w^2 w 1]*B;
when i try to use the duck example and use it the data in .mat

bu=[u.^3, u.^2,u ,1]*B;

I did:
x=model(:,1)
y=model(:,2)
z=model(:,3)

and then when i was going to use

BSpline3D(P,x,y,z)
bu=[u.^3, u.^2,u ,1]*B;

>> bu=[u.^3, u.^2,u ,1]*B;
Error using horzcat
Dimensions of arrays being concatenated are not consistent.

What should I do, put bu=[u.^3, u.^2,u ,[ 1;1;1;1..... ]] or bu=[u.^3, u.^2,u ,[ 1;0;0;0..... ]]?

and this should be [u^3, u^2,u ,1] or this [u.^3, u.^2,u ,1]?

I find a lot of errors.... when i am only going to input a cloud points in 3D as input....

Yijun ZHOU

The indices of the triangular mesh start from 0. Unknown error cause topology changing for just a sphere input. Pretty slow for only 600 points.
Another "fast" version has unknown inputs.

Emanuele Plebani

Face indices for some reason are required to start from zero (Matlab's default is 1), variables in BSpline3D are not set causing avoidable errors for some inputs and the reconstructed surface does not respect the original topology (open when the original was closed).

SAM Ali

Thank you very much sir for your fantastic work. I am PhD student. Actually, I want to save your surface as IGES so that I can work on it in Catia. Please help in this regard.

GeoMath

xing liu

Zuzana

I solved the usage for your own data set. Here is the code I am using:

%(x,y,z) is my point-cloud
N = 1000; %for large set of data -> use every N-th point
tri = delaunay(x(1:N:end),y(1:N:end));
tri = tri-1; %needed for this code

%normalization
MinX = min(x)-0.1*abs(min(x));
MaxX = max(x)+0.1*abs(min(x));
MinY = min(y)-0.1*abs(min(y));
MaxY = max(y)+0.1*abs(min(y));
MinZ = min(z)-0.1*abs(min(z));
MaxZ = max(z)+0.1*abs(min(z));
xn = x; yn = y; zn = z;
xn = (xn-MinX)/((MaxX-MinX));
yn = (yn-MinY)/((MaxY-MinY));
zn = (zn-MinZ)/((MaxZ-MinZ));

L=10;
P=IBSL3_3DTRI(.01,20,L,[xn(1:N:end),yn(1:N:end),zn(1:N:end)], tri);
IBSLevelSurf(P,[.5 .6 .8],0.03);

Zuzana

I have my own 3D data set. How do I transform it into needed input?

leep

great

Florian Bendl

Result looks nice. But where is the code to get from 3d points to the needed input?

ilkhch

ilkhch

I have the same question as Thomas regarding how the triangulation is obtained

Xiaolu Wang

Mohammad Rouhani

Tags

Mohammad Rouhani

One may try the code with the public data sets provided by aim@shape:
http://shapes.aimatshape.net/viewmodels.php

Thomas-Glyn Cox

The error I am receiving is this: ??? Subscripted assignment dimension mismatch.

Error in ==> NewOffset at 38
tri_normal(i,:)=cross(P(2,:)-P(1,:),P(3,:)-P(2,:));

Error in ==> IBSL3_3DTRI at 32
[s,t]=NewOffset(r,pnt, tri); hold on;

My data set is constructed of a 5778x3 matrix and I used delaunay triangulation to make a 33514x4 matrix. I don't understand where you are getting an n x 3 triangulation matrix.

My data is normalized to the unit cube as well, so I am curious to know how more of the functions work.

Thanks again!

Thomas-Glyn Cox

I read your paper and am very interested in using this code, however I am a little confused on using and obtaining the inputs for the functions. It doesn't specify what method you used for triangulation, etc. Is there any additional documentation or tutorials on how to use the functions?

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!