Effacer les filtres
Effacer les filtres

image stretching and squeezing code not working for big matrices

1 vue (au cours des 30 derniers jours)
myetceteramail myetceteramail
This is an image scrambling code that stretches the x and y coordinate by a factor of 2 and squeezes the z coordinate by 4. But this doesn't seem to be doing the job. Initial image image3d(x,y,z) pixel will map to NEWI(i,j,k) uniquely. But this code is not giving unique results for matrix greater than 8 x 8.
QUARTILE=n/4 %n=64
MID=n/2
UQUARTILE=3*(n/4)
% NEWI=zeros(n,n,n);
for i= 1:n
for j= 1:n
for k=1:n
if ( QUARTILE<k ) && (k<=MID ) || ( UQUARTILE<k)
x= mod(2*(i-1),n)+1+1;
else
x=mod(2*(i-1),n)+1;
end
if k>MID
y= mod(2*(j-1),n)+1+1;
else
y=mod(2*(j-1),n)+1;
end
if i<=MID && j<=MID
z=ceil(k/4);
elseif i>MID && j<=MID
z=ceil(k/4)+QUARTILE;
elseif i<=MID && j>MID
z=ceil(k/4)+MID;
elseif i>MID && j>MID
z=ceil(k/4)+UQUARTILE;
end
NEWI(i,j,k)=image3d(x,y,z);
end
end
end

Réponses (0)

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by