is there any alternative way ?

1 visualización (últimos 30 días)
Niki
Niki el 18 de Feb. de 2014
Respondida: Sean de Wolski el 18 de Feb. de 2014
I want to remove those part of my data which are higher than 0.75 and those that lower than 0.30 I am using the following way, do you have any other idea?
[X Y Z] = size(H_cube);
avg_spec = zeros(X,Y);
specular_mask = zeros(X,Y);
data_mask = zeros(X,Y);
counter = 1;
for i=1:X
for j=1:Y
avg_spec(i,j) = mean(H_cube(i,j,:));
for k=1:Z
if(H_cube(i,j,k)>0.75 || avg_spec(i,j) >0.30)
specular_mask(i,j) = 1;
end
if(H_cube(i,j,k)>0.40)
data_mask(i,j) = 1;
end
end
end
end

Respuestas (1)

Sean de Wolski
Sean de Wolski el 18 de Feb. de 2014
Do the whole avg_spec calculation at once:
avg_spec = mean(H_cube,3); % mean along third dimension
Use logical indexing to create data_mask and specular_mask
specular_mask = bsxfun(@or,H_cube>0.75, avg_spec>0.30); % apply or with avg_spec to every page of H_cube
data_mask = H_cube > 0.40; % logical indexing directly

Categorías

Más información sobre Motion Planning en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by