Info
This question is closed. Reopen it to edit or answer.
error in executing loop
2 views (last 30 days)
Show older comments
I have a code for compression below,but my image is not compressed instead the size is more than the original folder
pathname ='F:\mri\'
dirlist = dir( [pathname '*.jpg'] );
pickind='jpg';
for m = 1:length(dirlist)
map = pink(90);
I = imread([pathname, dirlist(m).name]);
[R1 C1]=size(I)
x=size(I)
for i=2:2:x(1)
for j=3:2:x(2)
H1(i,j)=I(i,j);
end
end
H1;
for i=2:2:x(1)
for j=2:2:x(2)
H2(i,j)=I(i,j);
end
end
H2;
size(H1)
size(H2)
[R12 C12]=size(H1);
[R13 C13]=size(H2);
R12
C12
R13
C13
Z1=C1-C12
if R1-R12~=0
a=zeros((R1-R12),C1)
H1=[H1;a];
else if Z1>0
b=zeros(R1,Z1)
L= size(b)
H17=[H1 b];
end
end
size(H17)
if R1-R13~=0
a=zeros((R1-R13),C1)
H2=[H2;a];
else if C1-C13~=0
b=zeros(R1,(C1-C13))
H2=[H2 b];
end
end
size(H2)
H=H17-H2;
pickind='jpg'
singvals=20 ;
a=H;
dvalue=double(a);
[u,s,v] = svds(dvalue, singvals);
if isa(a,'uint8')
im = uint8(u * s * transpose(v));
elseif isa(a,'uint16')
im = uint16(u * s * transpose(v));
%end
elseif isa(a,'double')
im = (u * s * transpose(v));
else im = (u * s * transpose(v));
end
strtemp=strcat('F:\ehs\',int2str(m),'.',pickind);
imwrite(im,strtemp);%title('ebcot low pass frames ');
end
The size of mri folder is 170kb(15 images)
but in folder ehs the size is 193kb,(15 images),please tell ehy my image is not compressed
0 Comments
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!