www.pudn.com > Watermark.rar > jpeg压缩试验.m, change:2009-06-25,size:552b


 
bjay=imread(bjay_addr,'bmp'); 
%把RGB图片转换为灰度图片 
map=rgb2gray(bjay); 
bjay=double(map)/255; 
%把灰度图转换为二值图片 
%阈值为0.6 
bjay=im2bw(bjay,0.6); 
s=bjay; 
 
bjay=imread(bjay_addr,'bmp'); 
js=bjay; 
 
bjay=imread(bjay_addr,'bmp'); 
bjs=bjay; 
i=1; 
data=bjs; 
for q=0:10:100 
    imwrite(data,'jpeg压缩.jpg','jpg','quality',q); 
   jpeg_temp=imread('jpeg压缩.jpg'); 
   for i1=1:48 
       for j1=1:48     
   if jpeg_temp(i1,j1)>0 
        jpeg_temp(i1,j1)=1; 
   end 
       end 
   end 
    yy1(i)=nc(s,jpeg_temp); 
    i=i+1; 
end