资源描述:
《通信原理实验程序课堂基础》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
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(va
2、rargin{:});%FEVALswitchyardendcatchdisp(lasterr);endend%--------------------------------------------------------------------functionvarargout=pushbutton1_Callback(h,eventdata,handles,varargin)img=imread('lena.bmp');img=im2double(img);img2=blkproc(img,
3、[1616],'walsh(x)');fileid=fopen('img.dat','w');fileid2=fopen('data.dat','w');filedata=[0];filescaledata=[0];subplot(findobj('tag','axes1'));imshow(img);axisoff;title('原图');lut=[88888888444444448844444444222222844444444422222284442222222200008442000000
4、00000084420000000000008442000000000000844200000000000044420000000000004442000000000000422200000000000042220000000000004220000000000000422000000000000042200000000000004220000000000000];fori=1:16,forj=1:16,iflut(i,j)~=0,[subdata,subscale]=quantizing(img
5、2,lut(i,j),i,j);
filedata=[filedata,subdata];filescaledata=[filescaledata,subscale];endendendfiledata=filedata(2:length(filedata));filescaledata=filescaledata(2:length(filescaledata));fwrite(fileid,filedata,'ubit1');fwrite(fileid2,filescaledata,'doubl
6、e');fclose(fileid);set(findobj('tag','text2'),'string',256/50);%--------------------------------------------------------------------functionvarargout=pushbutton2_Callback(h,eventdata,handles,varargin)img=im2double(imread('lena.bmp'));fileid=fopen('img
7、.dat','r');fileid2=fopen('data.dat','r');filescaledata=fread(fileid2,'double');filedata=fread(fileid,'ubit1');filedata=filedata';filescaledata=filescaledata';filedata=double(filedata);img3=zeros(512);offset1=0;offset2=0;m=0;lut=[8888888844444444884444
8、444422222284444444442222228444222222220000844200000000000084420000000000008442000000000000844200000000000044420000000000004442000000000000422200000000000042220000000000004220000000000000422000000000000042200000000000004220000000000000];fori=1: