资源描述:
《通信原理实验程序new》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、三.主程序:functionvarargout=yasuo(varargin)ifnargin==0%fig=openfig(mfilename,'reuse');handles=guihandles(fig);guidata(fig,handles);ifnargout>0varargout{1}=fig;endelseifischar(varargin{1})tryif(nargout)[varargout{1:nargout}]=feval(varargin{:});elsefeval(varargin{:});
2、%FEVALswitchyardendcatchdisp(lasterr);endend%--------------------------------------------------------------------functionvarargout=pushbutton1_Callback(h,eventdata,handles,varargin)img=imread('lena.bmp');img=im2double(img);img2=blkproc(img,[1616],'walsh(x)');fil
3、eid=fopen('img.dat','w');fileid2=fopen('data.dat','w');filedata=[0];filescaledata=[0];subplot(findobj('tag','axes1'));imshow(img);axisoff;title('原图');lut=[88888888444444448844444444222222844444444422222284442222222200008442000000000000844200000000000084420000000
4、00000844200000000000044420000000000004442000000000000422200000000000042220000000000004220000000000000422000000000000042200000000000004220000000000000];fori=1:16,forj=1:16,iflut(i,j)~=0,[subdata,subscale]=quantizing(img2,lut(i,j),i,j);filedata=[filedata,subdata];
5、filescaledata=[filescaledata,subscale];endendendfiledata=filedata(2:length(filedata));filescaledata=filescaledata(2:length(filescaledata));fwrite(fileid,filedata,'ubit1');fwrite(fileid2,filescaledata,'double');fclose(fileid);set(findobj('tag','text2'),'string',2
6、56/50);%--------------------------------------------------------------------functionvarargout=pushbutton2_Callback(h,eventdata,handles,varargin)img=im2double(imread('lena.bmp'));fileid=fopen('img.dat','r');fileid2=fopen('data.dat','r');filescaledata=fread(fileid
7、2,'double');filedata=fread(fileid,'ubit1');filedata=filedata';filescaledata=filescaledata';filedata=double(filedata);img3=zeros(512);offset1=0;offset2=0;m=0;lut=[8888888844444444884444444422222284444444442222228444222222220000844200000000000084420000000000008442
8、000000000000844200000000000044420000000000004442000000000000422200000000000042220000000000004220000000000000422000000000000042200000000000004220000000000000];fori=1:1