Need Help (explaning) Bilater Mesh Smoothing / Denoising

2 次查看(过去 30 天)
*Im trying to understand the Bilateral Mesh Denoising*
I have to carry on on MATLAB
I have checked out Many Toolkits developed by Matlab , I found one that good Enough
I can get the vertex and faces by the function
name = 'elephant-50kv';
options.name = name; % useful for displaying
[vertex,faces] = read_mesh(name);
This returns me the Vertex and faces also the following function provides me the Normals
[normal,normalf] = compute_normal(vertex,faces);
normal are the normal and normalf are the normals to faces
The algorithm im trying to implement is available at http://www.cs.tau.ac.il/~dcor/online_papers/papers/shachar03.pdf
The paper states the Algorithm
DenoisePoint(Vertex v, Normal n)
{qi} = neighborhood(v)
K = |{qi}|
sum = 0
normalizer = 0
for i := 1 to K
t = ||vqi||
h =<n,vqi>
wc = exp(t^2/(2σc^2))
ws = exp(h^2/(2σs^2))
sum += (wc ·ws)·h
normalizer += wc ·ws
end
return Vertex vˆ = v+n·(sum/normalizer)
Tired to do the above mentioned algo
But im not able to implement the algorithm
What is Sigma_c(σc)and Sigma_s(σs here , also cant understand h =<n,v−qi>
I wrote this code but not good enough
------------------------------------------------------------------------ clear clc
path(path, 'toolbox/');
path(path, 'off/');
clear options;
% load the mesh
name = 'elephant-50kv';
options.name = name; % useful for displaying
[vertex,faces] = read_mesh(name);
% display the mesh
clf;
plot_mesh(vertex, faces);
shading interp;
% Computing The normals for the given vertecies and faces
% compute normal per vertex and per face
[normal,normalf] = compute_normal(vertex,faces);
% Reading the number of vertices
[ dummy total_vertex]=size(vertex); % sixe vertices and Normalas are the same
% Now applying Bilateral filtering to the mesh
%Here we require a Vertex and its Neighbour , Going for all vertices for
%all removal
new_vertex_set=vertex;
for vertex_num=1:total_vertex
neighbours=[];
sum_a=[0 0 0]';
normalizer=[0 0 0]';
%finding the neighbours
input_vertex=vertex(:,vertex_num);
input_normal=normal(:,vertex_num);
sigma_c=0.4;
sigma_s=0.4;
% subracting from all vertices to see the neighbouring distance
difference=repmat(input_vertex,1,total_vertex)-vertex;
distance=abs(sum(difference)); % sum col wise in this version 2013
neighbours=find(distance < 2*sigma_c);
[dummy num_neighbours]=size(neighbours);
q_i=vertex(:,neighbours);
t=abs(repmat(input_vertex,1,num_neighbours)-q_i);
h=(repmat(input_vertex,1,num_neighbours)-q_i);
Wc=exp((-t.^2)./2*sigma_c^2);
Ws=exp(((-h.^2))./2*sigma_s^2);
sum_a=sum(((Wc.*Ws).*h)').';
normalizer=sum((Wc.*Ws)').';
new_vertex=(input_vertex+input_normal).*(sum_a./normalizer);
new_vertex_set(:,vertex_num)=new_vertex;
end % loop end for vertices
plot_mesh(new_vertex_set, faces);
shading interp;

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by